use of com.sun.enterprise.tools.verifier.Result 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.Result 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.Result 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.Result 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;
}
use of com.sun.enterprise.tools.verifier.Result in project Payara by payara.
the class ASEjbMDBResourceAdapter method check.
/**
* @param descriptor the Enterprise Java Bean deployment descriptor
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
boolean oneFailed = false;
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
String value = null;
int count = 0;
try {
count = getCountNodeSet("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/mdb-resource-adapter");
if (count > 0) {
value = getXPathValue("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/mdb-resource-adapter/resource-adapter-mid");
if (value == null || value.length() == 0) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failed1", "FAILED [AS-EJB mdb-resource-adapter] : resource-adapter-mid cannot be empty.", new Object[] { descriptor.getName() }));
} else {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.passed(smh.getLocalString(getClass().getName() + ".passed1", "PASSED [AS-EJB mdb-resource-adapter] : resource-adapter-mid is {1}", new Object[] { descriptor.getName(), value }));
}
// activation-config
count = getCountNodeSet("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/mdb-resource-adapter/activation-config");
if (count > 0) {
count = getCountNodeSet("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/mdb-resource-adapter/activation-config/activation-config-property");
if (count > 0) {
for (int i = 1; i <= count; i++) {
value = getXPathValue("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/mdb-resource-adapter/activation-config/activation-config-property/activation-config-property-name");
if (value == null || value.length() == 0) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failed2", "FAILED [AS-EJB mdb-resource-adapter] : activation-config-property-name cannot be empty.", new Object[] { descriptor.getName() }));
} else {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.passed(smh.getLocalString(getClass().getName() + ".passed2", "PASSED [AS-EJB mdb-resource-adapter] : activation-config-property-name is {1}", new Object[] { descriptor.getName(), value }));
}
value = getXPathValue("sun-ejb-jar/enterprise-beans/ejb[ejb-name=\"" + descriptor.getName() + "\"]/mdb-resource-adapter/activation-config/activation-config-property/activation-config-property-value");
if (value == null || value.length() == 0) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failed3", "FAILED [AS-EJB mdb-resource-adapter] : activation-config-property-value cannot be empty.", new Object[] { descriptor.getName() }));
} else {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.passed(smh.getLocalString(getClass().getName() + ".passed3", "PASSED [AS-EJB mdb-resource-adapter] : activation-config-property-value is {1}", new Object[] { descriptor.getName(), value }));
}
}
} else {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failed4", "FAILED [AS-EJB mdb-resource-adapter] : activation-config-property is not defined", new Object[] { descriptor.getName() }));
}
}
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "NOT APPLICABLE [AS-EJB ejb] : mdb-resource-adapter is not defined."));
}
} catch (Exception ex) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".notRun", "NOT RUN [AS-EJB] : Could not create descriptor object"));
}
if (oneFailed)
result.setStatus(Result.FAILED);
return result;
}
Aggregations