use of com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor in project Payara by payara.
the class RemoteExceptionNotThrown method check.
public Result check(EjbMessageBeanDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
ClassLoader cl = getVerifierContext().getClassLoader();
try {
Method[] methods = descriptor.getMessageListenerInterfaceMethods(cl);
for (int i = 0; i < methods.length; i++) {
if (containsRemote(methods[i].getExceptionTypes())) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName() + ".failed", "Method [ {0} ] throws RemoteException", new Object[] { methods[i] }));
}
}
} catch (NoSuchMethodException e) {
Verifier.debug(e);
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName() + ".failed1", "[ {0} ]", new Object[] { e.getMessage() }));
}
if (result.getStatus() != Result.FAILED) {
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName() + ".passed", "Valid message listener method(s)."));
}
return result;
}
use of com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor in project Payara by payara.
the class ASEjbCommitOption method check.
/**
* @param descriptor
* @return
*/
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
boolean oneFailed = false;
try {
IASEjbExtraDescriptors iasEjbExtraDesc = descriptor.getIASEjbExtraDescriptors();
String commitOption = iasEjbExtraDesc.getCommitOption();
if (commitOption != null) {
if (commitOption.length() == 0) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName() + ".failed", "FAILED [AS-EJB ejb] : commit-option cannot be an empty String"));
} else {
if (// 4699329
!commitOption.equals("A") && !commitOption.equals("B") && !commitOption.equals("C")) {
addErrorDetails(result, compName);
result.failed(// 4699329
smh.getLocalString(// 4699329
getClass().getName() + ".failed1", "FAILED [AS-EJB ejb] : commit-option cannot be {0}. " + "It must be one of A, B and " + "C", new Object[] { commitOption }));
}
}
} else {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "NOT APPLICABLE [AS-EJB ejb] commit-option Element is not defined"));
}
} catch (Exception ex) {
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".notRun", "NOT RUN [AS-EJB] : Could not create an descriptor object"));
}
return result;
}
use of com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor in project Payara by payara.
the class ASEjbIORSecurityConfig method check.
/**
* The function that performs the test.
*
* @param descriptor EjbDescriptor object representing the bean.
*/
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
int count = 0;
try {
// Set ejbIORConfDescSet = descriptor.getIORConfigurationDescriptors();
count = getCountNodeSet("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/ior-security-config");
if (count > 0) {
for (int i = 0; i < count; i++) {
testTranConfig(i, descriptor, compName, result);
testAsContext(i, descriptor, compName, result);
testSasContext(i, descriptor, compName, result);
}
} else {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "NOT APPLICABLE [AS-EJB ior-security-config] : ior-security-config Element not defined"));
}
if (oneFailed)
result.setStatus(Result.FAILED);
} catch (Exception ex) {
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".notRun", "NOT RUN [AS-EJB] : Could not create a descriptor object"));
}
return result;
}
use of com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor in project Payara by payara.
the class ASEjbJMSDurableSubscriptionName method check.
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
boolean oneFailed = false;
try {
EjbMessageBeanDescriptor msgBeanDesc = (EjbMessageBeanDescriptor) descriptor;
String jmsDurableName = msgBeanDesc.getDurableSubscriptionName();
if (jmsDurableName != null) {
if (jmsDurableName.length() == 0) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName() + ".failed", "FAILED [AS-EJB ejb] : jms-durable-subscription-name cannot be an empty string value"));
} else {
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName() + ".passed", "PASSED [AS-EJB ejb] : jms-durable-subscription-name is {0}", new Object[] { jmsDurableName }));
}
} else {
if (descriptor instanceof EjbMessageBeanDescriptor) {
if (msgBeanDesc.hasTopicDest() && msgBeanDesc.hasDurableSubscription()) {
boolean failed = false;
int count = getCountNodeSet("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/mdb-resource-adapter");
if (count > 0) {
String value = getXPathValue("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/mdb-resource-adapter/resource-adapter-mid");
if (value == null || value.length() == 0) {
failed = true;
}
} else {
failed = true;
}
if (failed) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName() + ".failed1", "FAILED [AS-EJB ejb] : jms-durable-subscription-name should be defined for an MDB with" + " destination type Topic and Durable subscription type"));
}
} else {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "NOT APPLICABLE [AS-EJB ejb] : jms-durable-subscription-name element is not defined"));
}
} else {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "NOT APPLICABLE [AS-EJB ejb] : jms-durable-subscription-name element is not defined"));
}
}
} catch (Exception ex) {
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".notRun", "NOT RUN [AS-EJB] : Could not create a descriptor object"));
}
return result;
}
use of com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor in project Payara by payara.
the class ASEjbJMSMaxMessagesLoad method check.
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
try {
IASEjbExtraDescriptors iasEjbDescriptor = descriptor.getIASEjbExtraDescriptors();
int value = iasEjbDescriptor.getJmsMaxMessagesLoad();
Integer jmsMaxMsgs = new Integer(value);
if (jmsMaxMsgs != null) {
if (value < 1 || value > Integer.MAX_VALUE) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName() + ".failed", "FAILED [AS-EJB ejb] : {0} is not a valid value for jms-max-messages-load. It should be " + '\n' + "between 0 and MAX_INT", new Object[] { new Integer(value) }));
} else {
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName() + ".passed", "PASSED [AS-EJB ejb] : jms-max-messages-load is {0}", new Object[] { jmsMaxMsgs }));
}
} else {
if (descriptor instanceof EjbMessageBeanDescriptor) {
// <addition author="irfan@sun.com" [bug/rfe]-id="4724447" >
// Change in message output ms->jms //
addWarningDetails(result, compName);
result.warning(smh.getLocalString(getClass().getName() + ".warning", "WARNING [AS-EJB ejb] : jms-max-messages-load should be defined for MDBs"));
} else {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "NOT APPLICABLE [AS-EJB ejb] : jms-max-messages-load element is not defined"));
}
}
} catch (Exception ex) {
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".notRun", "NOT RUN [AS-EJB] : Could not create a descriptor object"));
}
return result;
}
Aggregations