1 23 28 29 package com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2; 30 31 import java.lang.reflect.Method ; 32 import com.sun.enterprise.deployment.*; 33 import com.sun.enterprise.tools.verifier.Result; 34 import com.sun.enterprise.tools.verifier.tests.*; 35 36 41 abstract public class SelectMethodTest extends CMPTest { 42 43 protected abstract boolean runIndividualSelectTest(Method m, EjbCMPEntityDescriptor descriptor, Result result); 44 45 51 public Result check(EjbCMPEntityDescriptor descriptor) { 52 53 boolean allIsWell = true; 54 Result result = getInitializedResult(); 55 boolean found = false; 56 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 57 58 Class ejbClass = loadEjbClass(descriptor, result); 59 if (ejbClass!=null) { 60 Method [] methods = ejbClass.getDeclaredMethods(); 61 if (methods != null) { 62 for (int i=0;i<methods.length;i++) { 63 String methodName = methods[i].getName(); 64 if (methodName.startsWith("ejbSelect")) { 65 found = true; 66 if (!runIndividualSelectTest(methods[i], (EjbCMPEntityDescriptor) descriptor, result)) 67 allIsWell=false; 68 } 69 } 70 if (found == false) { 71 result.addNaDetails(smh.getLocalString 72 ("tests.componentNameConstructor", 73 "For [ {0} ]", 74 new Object [] {compName.toString()})); 75 result.notApplicable(smh.getLocalString 76 ("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.SelectMethodTest.nptApplicable", 77 "Not Applicable : No select methods found", 78 new Object [] {})); 79 } 80 if (result.getStatus() != Result.NOT_APPLICABLE) { 81 if (allIsWell) 82 result.setStatus(Result.PASSED); 83 else 84 result.setStatus(Result.FAILED); 85 } 86 } 87 } 88 return result; 89 } 90 } 91 | Popular Tags |