1 7 8 package test.compliance.relation; 9 10 import javax.management.relation.RoleStatus; 11 12 import junit.framework.TestCase; 13 14 19 public class RoleStatusTestCase 20 extends TestCase 21 { 22 23 25 static int[] statii = new int[] 26 { 27 RoleStatus.LESS_THAN_MIN_ROLE_DEGREE, 28 RoleStatus.MORE_THAN_MAX_ROLE_DEGREE, 29 RoleStatus.NO_ROLE_WITH_NAME, 30 RoleStatus.REF_MBEAN_NOT_REGISTERED, 31 RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS, 32 RoleStatus.ROLE_NOT_READABLE, 33 RoleStatus.ROLE_NOT_WRITABLE 34 }; 35 36 static String[] statiiDesc = new String[] 37 { 38 "LESS_THAN_MIN_ROLE_DEGREE", 39 "MORE_THAN_MAX_ROLE_DEGREE", 40 "NO_ROLE_WITH_NAME", 41 "REF_MBEAN_NOT_REGISTERED", 42 "REF_MBEAN_OF_INCORRECT_CLASS", 43 "ROLE_NOT_READABLE", 44 "ROLE_NOT_WRITABLE" 45 }; 46 47 49 51 54 public RoleStatusTestCase(String s) 55 { 56 super(s); 57 } 58 59 61 64 public void testDifferent() 65 { 66 for (int i = 0; i < (statii.length - 1); i++) 67 { 68 for (int j = i + 1; j < statii.length; j++) 69 if (statii[i] == statii[j]) 70 fail("RoleStatus constants are not unique"); 71 } 72 } 73 74 77 public void testRoleStatus() 78 { 79 RoleStatus test = new RoleStatus(); 80 for (int i = 0; i < statii.length; i++) 81 { 82 if (RoleStatus.isRoleStatus(statii[i]) == false) 83 fail(statiiDesc + " is not a role status"); 84 } 85 } 86 } 87 | Popular Tags |