1 package org.jacorb.test.common; 2 3 23 24 import junit.framework.*; 25 26 32 public class TestAnnotations 33 { 34 private static JacORBVersionComparator jacorbVersionComparator = 35 new JacORBVersionComparator(); 36 37 private String clientSince = null; 38 private String serverSince = null; 39 40 public TestAnnotations (String clientSince, String serverSince) 41 { 42 this.clientSince = clientSince; 43 this.serverSince = serverSince; 44 } 45 46 public String getClientSince() 47 { 48 return clientSince; 49 } 50 51 public String getServerSince() 52 { 53 return serverSince; 54 } 55 56 public static TestAnnotations forTestCase (TestCase t) 57 { 58 TestAnnotationsParser p = TestAnnotationsParser.getInstance(t.getClass()); 59 String methodName = t.getName().replaceAll("\\(.+\\)", ""); 60 return p.getMethodAnnotations (methodName); 61 } 62 63 public static TestAnnotations forTestSuite (TestSuite t) 64 { 65 return TestAnnotationsParser.getInstance(t.getClass()) 66 .getClassAnnotations(); 67 } 68 69 public static TestAnnotations forClass (Class c) 70 { 71 return TestAnnotationsParser.getInstance(c) 72 .getClassAnnotations(); 73 } 74 75 79 public boolean isApplicableTo (String clientVersion, String serverVersion) 80 { 81 int clientCompare = jacorbVersionComparator.compare (clientVersion, 82 clientSince); 83 int serverCompare = jacorbVersionComparator.compare (serverVersion, 84 serverSince); 85 return clientCompare >= 0 && serverCompare >= 0; 86 } 87 88 } 89 | Popular Tags |