1 23 package com.sun.enterprise.tools.verifier.tests.ejb; 24 25 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 26 import java.util.*; 27 import com.sun.enterprise.deployment.*; 28 import com.sun.enterprise.security.acl.*; 29 import com.sun.enterprise.tools.verifier.*; 30 import com.sun.enterprise.tools.verifier.tests.*; 31 32 35 public class RoleNameNMTOKEN extends EjbTest implements EjbCheck { 36 37 38 39 46 public Result check(EjbDescriptor descriptor) { 47 48 Result result = getInitializedResult(); 49 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 50 51 if (!descriptor.getPermissionedRoles().isEmpty()) { 52 for (Iterator itr = descriptor.getPermissionedRoles().iterator(); 53 itr.hasNext();) { 54 55 Role nextRole = (Role) itr.next(); 56 if (NameToken.isNMTOKEN(nextRole.getName())) { 57 result.addGoodDetails(smh.getLocalString 58 ("tests.componentNameConstructor", 59 "For [ {0} ]", 60 new Object [] {compName.toString()})); 61 result.addGoodDetails 62 (smh.getLocalString 63 (getClass().getName() + ".passed", 64 "Role name [ {0} ] conforms to the lexical rules of NMTOKEN within bean [ {1} ]", 65 new Object [] {nextRole.getName(), descriptor.getName()})); 66 if (result.getStatus()!= Result.FAILED) 67 result.setStatus(Result.PASSED); 68 } else { 69 result.addErrorDetails(smh.getLocalString 70 ("tests.componentNameConstructor", 71 "For [ {0} ]", 72 new Object [] {compName.toString()})); 73 result.failed 74 (smh.getLocalString 75 (getClass().getName() + ".failed", 76 "Role name [ {0} ] does not conform to the lexical rules of NMTOKEN within bean [ {1} ]", 77 new Object [] {nextRole.getName(), descriptor.getName()})); 78 } 79 } 80 } else { 81 result.addNaDetails(smh.getLocalString 82 ("tests.componentNameConstructor", 83 "For [ {0} ]", 84 new Object [] {compName.toString()})); 85 result.notApplicable(smh.getLocalString 86 (getClass().getName() + ".notApplicable", 87 "No permissioned roles defined for this bean [ {0} ]", 88 new Object [] {descriptor.getName()})); 89 } 90 return result; 91 } 92 } 93 | Popular Tags |