Result result = getInitializedResult();
ComponentNameConstructor compName = new ComponentNameConstructor(descriptor);
SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject();
String ejbName = null;
if(descriptor.getEjbBundleDescriptor().getTestsDone().contains(getClass().getName()))
{
result.setStatus(Result.NOT_RUN);
result.addGoodDetails(smh.getLocalString("enterpriseBeans.allReadyRun",
"NOT RUN [AS-EJB enterprise-beans] name test is a JAR Level Test. This test has already been run once"));
return result;
}
descriptor.getEjbBundleDescriptor().setTestsDone(getClass().getName());
if(ejbJar!=null)
{
EnterpriseBeans entBean = ejbJar.getEnterpriseBeans();
String entBeanName = entBean.getName();
if(entBeanName == null)
{
result.setStatus(Result.NOT_APPLICABLE);
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"{0} Does not define any enterprise bean name",
new Object[] {ejbName}));
return result;
}
if(entBeanName!=null && entBeanName.length()==0)
{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.warning(smh.getLocalString
(getClass().getName() + ".warning",
"WARNING [AS-EJB enterprise-beans] : name should not be empty."));
return result;
}
else
{
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"PASSED [AS-EJB enterprise-beans] : name is {0}",
new Object[] {entBeanName}));
return result;
}
}
else
{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".notRun",
"NOT RUN [AS-EJB] : Could not create an SunEjbJar object"));
return result;
}