1 23 package com.sun.enterprise.tools.verifier.tests.ejb.intf; 24 25 import com.sun.enterprise.deployment.EjbDescriptor; 26 import com.sun.enterprise.deployment.EjbEntityDescriptor; 27 import com.sun.enterprise.deployment.EjbSessionDescriptor; 28 import com.sun.enterprise.tools.verifier.Result; 29 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 30 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 31 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 32 33 import java.lang.reflect.Modifier ; 34 import java.util.Set ; 35 import java.util.logging.Level ; 36 37 41 abstract public class InterfacePublic extends EjbTest implements EjbCheck { 42 43 46 47 abstract protected Set <String > getInterfaceNames(EjbDescriptor descriptor); 48 49 57 public Result check(EjbDescriptor descriptor) { 58 Result result = getInitializedResult(); 59 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 60 61 if (!(descriptor instanceof EjbSessionDescriptor) && 62 !(descriptor instanceof EjbEntityDescriptor)) { 63 addNaDetails(result, compName); 64 result.notApplicable(smh.getLocalString 65 ("com.sun.enterprise.tools.verifier.tests.ejb.homeintf.HomeMethodTest.notApplicable1", 66 "Test apply only to session or entity beans.")); 67 return result; 68 } 69 String assertionClass = "com.sun.enterprise.tools.verifier.tests.ejb.intf.InterfacePublic"; 70 71 for (String intfName : getInterfaceNames(descriptor)) { 72 try { 73 ClassLoader jcl = getVerifierContext().getClassLoader(); 74 Class c = Class.forName(intfName, false, jcl); 75 76 if (!Modifier.isPublic(c.getModifiers())) { 78 addErrorDetails(result, compName); 79 result.failed(smh.getLocalString 80 (assertionClass + ".failed", 81 "Error: [ {0} ] is not defined as a public interface.", 82 new Object [] {intfName})); 83 } 84 } catch (ClassNotFoundException e) { 85 logger.log(Level.FINER,e.getMessage(),e); 87 } 88 } 89 90 if(result.getStatus() != Result.FAILED) { 91 addGoodDetails(result, compName); 92 result.passed(smh.getLocalString 93 (assertionClass + ".passed", 94 "Valid public interface(s).")); 95 } 96 return result; 97 } 98 } 99 | Popular Tags |