use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.
the class EjbCreateMethodExceptions method check.
/**
* Entity Bean's ejbCreate(...) methods exceptions test.
* Each entity Bean class may define zero or more ejbCreate(...) methods.
* The number and signatures of a entity Bean's create methods are specific
* to each EJB class. The method signatures must follow these rules:
*
* Compatibility Note: EJB 1.0 allowed the ejbCreate method to throw the
* java.rmi.RemoteException to indicate a non-application exception. This
* practice is deprecated in EJB 1.1---an EJB 1.1 compliant enterprise bean
* should throw the javax.ejb.EJBException or another RuntimeException to
* indicate non-application exceptions to the Container (see Section 12.2.2).
* Note: Treat as a warning to user in this instance.
*
* @param descriptor the Enterprise Java Bean deployment descriptor
*
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
boolean oneFailed = false;
int foundWarning = 0;
int foundAtLeastOne = 0;
try {
VerifierTestContext context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
Class c = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
boolean ejbCreateFound = false;
boolean throwsRemoteException = false;
// start do while loop here....
do {
Method[] methods = c.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
// reset flags from last time thru loop
ejbCreateFound = false;
throwsRemoteException = false;
// The method name must be ejbCreate.
if (methods[i].getName().startsWith("ejbCreate")) {
foundAtLeastOne++;
ejbCreateFound = true;
// Compatibility Note: EJB 1.0 allowed the ejbCreate method to throw
// the java.rmi.RemoteException to indicate a non-application
// exception. This practice is deprecated in EJB 1.1---an EJB 1.1
// compliant enterprise bean should throw the javax.ejb.EJBException
// or another RuntimeException to indicate non-application
// exceptions to the Container (see Section 12.2.2).
// Note: Treat as a warning to user in this instance.
Class[] exceptions = methods[i].getExceptionTypes();
for (int z = 0; z < exceptions.length; ++z) {
if (exceptions[z].getName().equals("java.rmi.RemoteException")) {
throwsRemoteException = true;
break;
}
}
// method
if (ejbCreateFound && (!throwsRemoteException)) {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] method [ {1} ]", new Object[] { descriptor.getEjbClassName(), methods[i].getName() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "[ {0} ] properly declares [ {1} ] method which does not throw java.rmi.RemoteException.", new Object[] { descriptor.getEjbClassName(), methods[i].getName() }));
} else if (ejbCreateFound && throwsRemoteException) {
result.addWarningDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addWarningDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] method [ {1} ]", new Object[] { descriptor.getEjbClassName(), methods[i].getName() }));
result.addWarningDetails(smh.getLocalString(getClass().getName() + ".warning", "Error: Compatibility Note:" + "\n An [ {0} ] method was found, but" + "\n EJB 1.0 allowed the ejbCreate method to throw the " + "\n java.rmi.RemoteException to indicate a non-application" + "\n exception. This practice is deprecated in EJB 1.1" + "\n ---an EJB 1.1 compliant enterprise bean should" + "\n throw the javax.ejb.EJBException or another " + "\n RuntimeException to indicate non-application exceptions" + "\n to the Container. ", new Object[] { methods[i].getName() }));
foundWarning++;
break;
}
}
}
if (foundWarning > 0)
break;
} while (((c = c.getSuperclass()) != null) && (foundAtLeastOne == 0));
if (foundAtLeastOne == 0) {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable1", "[ {0} ] does not declare any ejbCreate(...) methods.", new Object[] { descriptor.getEjbClassName() }));
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failedException", "Error: [ {0} ] class not found.", new Object[] { descriptor.getEjbClassName() }));
oneFailed = true;
}
if (oneFailed) {
result.setStatus(result.FAILED);
} else if (foundAtLeastOne == 0) {
result.setStatus(result.NOT_APPLICABLE);
} else if (foundWarning > 0) {
result.setStatus(result.WARNING);
} else {
result.setStatus(result.PASSED);
}
return result;
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "[ {0} ] expected {1} bean, but called with {2} bean.", new Object[] { getClass(), "Entity", "Session" }));
return result;
}
}
use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.
the class EjbCreateMethodName method commonToBothInterfaces.
private boolean commonToBothInterfaces(String component, EjbEntityDescriptor descriptor) {
boolean oneFailed = false;
boolean createExists = false;
try {
VerifierTestContext context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
Class c = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
Class home = Class.forName(component, false, getVerifierContext().getClassLoader());
Method[] homeMethods = home.getDeclaredMethods();
Vector<String> createMethodSuffix = new Vector<String>();
for (int i = 0; i < homeMethods.length; i++) {
// The method name must start with create.
if (homeMethods[i].getName().startsWith("create")) {
createMethodSuffix.addElement(homeMethods[i].getName().substring(6));
createExists = true;
}
}
// start do while loop here....
do {
boolean found = false;
Method[] methods = c.getDeclaredMethods();
for (int j = 0; j < methods.length; j++) {
// The method name must start with ejbCreate.
if (methods[j].getName().startsWith("ejbCreate")) {
String matchSuffix = methods[j].getName().substring(9);
for (int k = 0; k < createMethodSuffix.size(); k++) {
found = false;
if (matchSuffix.equals(createMethodSuffix.elementAt(k))) {
found = true;
foundAtLeastOne++;
// now display the appropriate results for this particular ejbCreate
// method
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] method [ {1} ]", new Object[] { descriptor.getEjbClassName(), methods[j].getName() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "[ {0} ] declares [ {1} ] method.", new Object[] { descriptor.getEjbClassName(), methods[j].getName() }));
break;
}
}
if (found == false) {
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failedException1", "Error: no create{0}() method found corresponding to ejbCreate{1}() method ", new Object[] { matchSuffix, matchSuffix }));
oneFailed = true;
break;
}
}
}
if (oneFailed == true)
break;
} while (((c = c.getSuperclass()) != null) && (foundAtLeastOne == 0));
if (createExists == false) {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable1", "[ {0} ] does not declare any ejbCreate(...) methods.", new Object[] { descriptor.getEjbClassName() }));
oneFailed = false;
}
if (foundAtLeastOne == 0 && createExists == true) {
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failedException1", "Error: no ejbCreate<Method> method for corresponding create<Method> method found!", new Object[] {}));
oneFailed = false;
}
return oneFailed;
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failedException", "Error: [ {0} ] class not found.", new Object[] { descriptor.getEjbClassName() }));
oneFailed = true;
return oneFailed;
}
}
use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.
the class EjbCreateMethodReturn method check.
/**
* Entity Bean's ejbCreate(...) methods return test.
* Each entity Bean class may define zero or more ejbCreate(...) methods.
* The number and signatures of a entity Bean's create methods are specific
* to each EJB class. The method signatures must follow these rules:
*
* The method name must be ejbCreate.
*
* The return type must be primary key type.
*
* @param descriptor the Enterprise Java Bean deployment descriptor
*
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
String persistence = ((EjbEntityDescriptor) descriptor).getPersistenceType();
if (EjbEntityDescriptor.BEAN_PERSISTENCE.equals(persistence)) {
boolean oneFailed = false;
boolean oneWarning = false;
int foundAtLeastOne = 0;
try {
VerifierTestContext context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
Class c = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
String primaryKeyType = ((EjbEntityDescriptor) descriptor).getPrimaryKeyClassName();
boolean ejbCreateFound = false;
boolean returnsPrimaryKeyType = false;
// start do while loop here....
do {
Method[] methods = c.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
// reset flags from last time thru loop
ejbCreateFound = false;
returnsPrimaryKeyType = false;
// The method name must be ejbCreate.
if (methods[i].getName().startsWith("ejbCreate")) {
foundAtLeastOne++;
ejbCreateFound = true;
// The return type must be primary key type.
Class rt = methods[i].getReturnType();
if (rt.getName().equals(primaryKeyType)) {
returnsPrimaryKeyType = true;
}
// method
if (ejbCreateFound && !returnsPrimaryKeyType) {
if (primaryKeyType.equals("java.lang.Object")) {
oneWarning = true;
result.addWarningDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addWarningDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] method [ {1} ]", new Object[] { descriptor.getEjbClassName(), methods[i].getName() }));
result.addWarningDetails(smh.getLocalString(getClass().getName() + ".warning", "Warning: An [ {0} ] method was found, but [ {1} ] method has [ {2} ] return type. Deployment descriptor primary key type [ {3} ]. Definition of the primary key type is deferred to deployment time ?", new Object[] { methods[i].getName(), methods[i].getName(), methods[i].getReturnType().getName(), primaryKeyType }));
} else {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] method [ {1} ]", new Object[] { descriptor.getEjbClassName(), methods[i].getName() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed", "Error: An [ {0} ] method was found, but [ {1} ] method has illegal return value. [ {2} ] methods must return primary key type [ {3} ].", new Object[] { methods[i].getName(), methods[i].getName(), methods[i].getName(), primaryKeyType }));
break;
}
}
}
}
if (oneFailed == true)
break;
} while (((c = c.getSuperclass()) != null) && (foundAtLeastOne == 0));
if (foundAtLeastOne == 0) {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable0", "[ {0} ] does not declare any ejbCreate(...) methods.", new Object[] { descriptor.getEjbClassName() }));
}
if (oneFailed == false && foundAtLeastOne > 0) {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ]", new Object[] { descriptor.getEjbClassName() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "[ {0} ] properly declares ejbCreate<method> method to return primary key type [ {1} ].", new Object[] { descriptor.getEjbClassName(), primaryKeyType }));
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failedException", "Error: [ {0} ] class not found.", new Object[] { descriptor.getEjbClassName() }));
oneFailed = true;
}
if (oneFailed) {
result.setStatus(result.FAILED);
} else if (foundAtLeastOne == 0) {
result.setStatus(result.NOT_APPLICABLE);
} else {
if (oneWarning) {
result.setStatus(result.WARNING);
} else {
result.setStatus(result.PASSED);
}
}
return result;
} else {
// if (CONTAINER_PERSISTENCE.equals(persistence)) {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable1", "Expected [ {0} ] managed persistence, but [ {1} ] bean has [ {2} ] managed persistence.", new Object[] { EjbEntityDescriptor.BEAN_PERSISTENCE, descriptor.getName(), persistence }));
return result;
}
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "[ {0} ] expected {1} bean, but called with {2} bean.", new Object[] { getClass(), "Entity", "Session" }));
return result;
}
}
use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.
the class EjbFindByPrimaryKeyException method check.
/**
* Define ejbFindByPrimaryKey method exception test.
*
* Every entity enterprise Bean class must define the ejbFindByPrimaryKey
* method.
*
* Compatibility Note: EJB 1.0 allowed the finder methods to throw the
* java.rmi.RemoteException to indicate a non-application exception. This
* practice is deprecated in EJB 1.1---an EJB 1.1 compliant enterprise
* bean should throw the javax.ejb.EJBException or another
* java.lang.RuntimeException to indicate non-application exceptions to
* the Container.
*
* @param descriptor the Enterprise Java Bean deployment descriptor
*
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
String persistentType = ((EjbEntityDescriptor) descriptor).getPersistenceType();
if (EjbEntityDescriptor.BEAN_PERSISTENCE.equals(persistentType)) {
boolean ejbFindByPrimaryKeyMethodFound = false;
boolean throwsRemoteException = false;
boolean oneFailed = false;
int foundWarning = 0;
try {
// retrieve the EJB Class Methods
VerifierTestContext context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
Class EJBClass = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
// start do while loop here....
do {
Method[] ejbFinderMethods = EJBClass.getDeclaredMethods();
for (int j = 0; j < ejbFinderMethods.length; ++j) {
if (ejbFinderMethods[j].getName().equals("ejbFindByPrimaryKey")) {
// Every entity enterprise Bean class must define the
// ejbFindByPrimaryKey method.
ejbFindByPrimaryKeyMethodFound = true;
// Compatibility Note: EJB 1.0 allowed the ejbFindByPrimaryKey to
// throw the java.rmi.RemoteException to indicate a non-application
// exception. This practice is deprecated in EJB 1.1---an EJB 1.1
// compliant enterprise bean should throw the javax.ejb.EJBException
// or another RuntimeException to indicate non-application
// exceptions to the Container (see Section 12.2.2).
// Note: Treat as a warning to user in this instance.
Class[] exceptions = ejbFinderMethods[j].getExceptionTypes();
for (int z = 0; z < exceptions.length; ++z) {
if (exceptions[z].getName().equals("java.rmi.RemoteException")) {
throwsRemoteException = true;
break;
}
}
if (ejbFindByPrimaryKeyMethodFound && (!throwsRemoteException)) {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] Finder Method [ {1} ]", new Object[] { EJBClass.getName(), ejbFinderMethods[j].getName() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "[ {0} ] declares [ {1} ] method, which properly does not throw java.rmi.RemoteException", new Object[] { EJBClass.getName(), ejbFinderMethods[j].getName() }));
} else if (ejbFindByPrimaryKeyMethodFound && throwsRemoteException) {
result.addWarningDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addWarningDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] Finder Method [ {1} ]", new Object[] { EJBClass.getName(), ejbFinderMethods[j].getName() }));
result.addWarningDetails(smh.getLocalString(getClass().getName() + ".warning", "Error: Compatibility Note:" + "\n An [ {0} ] method was found, but" + "\n EJB 1.0 allowed the ejbFindByPrimaryKey method to throw " + "\n the java.rmi.RemoteException to indicate a non-application" + "\n exception. This practice is deprecated in EJB 1.1" + "\n ---an EJB 1.1 compliant enterprise bean should" + "\n throw the javax.ejb.EJBException or another " + "\n RuntimeException to indicate non-application exceptions" + "\n to the Container. ", new Object[] { ejbFinderMethods[j].getName() }));
foundWarning++;
}
// found one, and there should only be one, break out
break;
}
}
} while (((EJBClass = EJBClass.getSuperclass()) != null) && (!ejbFindByPrimaryKeyMethodFound));
if (!ejbFindByPrimaryKeyMethodFound) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".debug3", "For EJB Class [ {0} ]", new Object[] { descriptor.getEjbClassName() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed", "Error: No ejbFindByPrimaryKey method was found in bean class."));
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failedException", "Error: EJB Class [ {0} ] does not exist or is not loadable.", new Object[] { descriptor.getEjbClassName() }));
oneFailed = true;
}
if (oneFailed) {
result.setStatus(result.FAILED);
} else if (foundWarning > 0) {
result.setStatus(result.WARNING);
} else {
result.setStatus(result.PASSED);
}
} else {
// (CONTAINER_PERSISTENCE.equals(persistentType))
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable2", "Expected persistence type [ {0} ], but bean [ {1} ] has persistence type [ {2} ]", new Object[] { EjbEntityDescriptor.BEAN_PERSISTENCE, descriptor.getName(), persistentType }));
}
return result;
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "[ {0} ] expected {1} bean, but called with {2} bean.", new Object[] { getClass(), "Entity", "Session" }));
return result;
}
}
use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.
the class EjbFindByPrimaryKeyFinal method check.
/**
* Define ejbFindByPrimaryKey method final test.
*
* Every entity enterprise Bean class must define the ejbFindByPrimaryKey
* method.
*
* The method must not be declared as final.
*
* @param descriptor the Enterprise Java Bean deployment descriptor
*
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
String persistentType = ((EjbEntityDescriptor) descriptor).getPersistenceType();
if (EjbEntityDescriptor.BEAN_PERSISTENCE.equals(persistentType)) {
boolean ejbFindByPrimaryKeyMethodFound = false;
boolean isFinal = false;
boolean oneFailed = false;
int findMethodModifiers = 0;
try {
// retrieve the EJB Class Methods
VerifierTestContext context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
Class EJBClass = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
// start do while loop here....
do {
Method[] ejbFinderMethods = EJBClass.getDeclaredMethods();
for (int j = 0; j < ejbFinderMethods.length; ++j) {
if (ejbFinderMethods[j].getName().equals("ejbFindByPrimaryKey")) {
// Every entity enterprise Bean class must define the
// ejbFindByPrimaryKey method.
ejbFindByPrimaryKeyMethodFound = true;
// The method must not be declared as final.
findMethodModifiers = ejbFinderMethods[j].getModifiers();
if (Modifier.isFinal(findMethodModifiers)) {
isFinal = true;
}
if (ejbFindByPrimaryKeyMethodFound && !isFinal) {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] Finder method [ {1} ]", new Object[] { EJBClass.getName(), ejbFinderMethods[j].getName() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "A non-final [ {0} ] method was found.", new Object[] { ejbFinderMethods[j].getName() }));
} else if (ejbFindByPrimaryKeyMethodFound && isFinal) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] Finder method [ {1} ]", new Object[] { EJBClass.getName(), ejbFinderMethods[j].getName() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed", "Error: A final [ {0} ] method was found, but [ {1} ] cannot be declared as final.", new Object[] { ejbFinderMethods[j].getName(), ejbFinderMethods[j].getName() }));
}
// found one, and there should only be one, break out
break;
}
}
} while (((EJBClass = EJBClass.getSuperclass()) != null) && (!ejbFindByPrimaryKeyMethodFound));
if (!ejbFindByPrimaryKeyMethodFound) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".debug3", "For EJB Class [ {0} ]", new Object[] { descriptor.getEjbClassName() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed1", "Error: No ejbFindByPrimaryKey method was found in bean class."));
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failedException", "Error: EJB Class [ {0} ] does not exist or is not loadable.", new Object[] { descriptor.getEjbClassName() }));
oneFailed = true;
}
if (oneFailed) {
result.setStatus(result.FAILED);
} else {
result.setStatus(result.PASSED);
}
} else {
// (CONTAINER_PERSISTENCE.equals(persistentType))
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable2", "Expected persistence type [ {0} ], but bean [ {1} ] has persistence type [ {2} ]", new Object[] { EjbEntityDescriptor.BEAN_PERSISTENCE, descriptor.getName(), persistentType }));
}
return result;
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "[ {0} ] expected {1} bean, but called with {2} bean.", new Object[] { getClass(), "Entity", "Session" }));
return result;
}
}
Aggregations