{
Result result = getInitializedResult();
ComponentNameConstructor compName = new ComponentNameConstructor(descriptor);
SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject();
Ejb testCase = null;
if(ejbJar!=null)
{
testCase = super.getEjb(descriptor.getName(),ejbJar);
Cmp cmpBean = testCase.getCmp();
if(cmpBean != null)
{
//mapping-properties
String mappingProps = cmpBean.getMappingProperties();
if(mappingProps == null)
{
oneWarning = true;
result.warning(smh.getLocalString(getClass().getName()+".warning",
"WARNING [AS-EJB cmp] : mapping-properties Element is not defined"));
}
else
{
if(mappingProps.length()==0)
{
oneFailed = true;
result.failed(smh.getLocalString(getClass().getName()+".failed",
"FAILED [AS-EJB cmp] : mapping-properties field must contain a vaild non-empty value"));
}
else//4690436
{ File f = Verifier.getJarFile(((EjbBundleArchivist) descriptor.getEjbBundleDescriptor().getArchivist()).getEjbJarFile().getName());
JarFile jarFile = null;
ZipEntry deploymentEntry=null;
try {
jarFile = new JarFile(f);
if(jarFile!=null)
deploymentEntry = jarFile.getEntry(mappingProps);
}
catch(IOException e){}
finally{
try{ if(jarFile!=null) jarFile.close();}
catch(IOException e){}
}
if(deploymentEntry !=null){
result.passed(smh.getLocalString(getClass().getName()+".passed",
"PASSED [AS-EJB cmp] : mapping-properties file is {0}",
new Object[]{mappingProps}));
}
else{
//invalid entry
result.failed(smh.getLocalString(getClass().getName()+".failed",
"FAILED [AS-EJB cmp] : mapping-properties field must contain a vaild non-empty value"));
}
}
}
//is-one-one-cmp
String isOneOne = cmpBean.getIsOneOneCmp();
if(isOneOne == null)
{
oneWarning = true;
result.warning(smh.getLocalString(getClass().getName()+".warning1",
"WARNING [AS-EJB cmp] : is-one-one-cmp Element is not defined"));
}
else
{
if(isOneOne.length()==0)
{
oneFailed = true;
result.failed(smh.getLocalString(getClass().getName()+".failed1",
"FAILED [AS-EJB cmp] : is-one-one-cmp cannot be an empty string. It can be either true or false"));
}
else
{
if(!isOneOne.equals("true") && !isOneOne.equals("false"))
{
oneFailed = true;
result.failed(smh.getLocalString(getClass().getName()+".failed2",
"FAILED [AS-EJB cmp] : is-one-one-cmp cannot be {0}. It can either be true or false",
new Object[]{isOneOne}));
}
else
{
result.passed(smh.getLocalString(getClass().getName()+".passed1",
"PASSED [AS-EJB cmp] : is-one-one-cmp is {0}",
new Object[]{isOneOne}));
}
}
}
//one-one-finders
OneOneFinders finders = cmpBean.getOneOneFinders();
if(finders!=null)
{
testFinders(finders,result);
}
else
{
oneWarning = true;
result.warning(smh.getLocalString(getClass().getName()+".warning2",
"WARNING [AS-EJB cmp] : one-one-finders Element is not defined"));
}
if(oneFailed)
result.setStatus(Result.FAILED);
else if(oneWarning)
result.setStatus(Result.WARNING);
}
else
result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
"NOT APPLICABLE [AS-EJB cmp] : {0} is not a CMP Entity Bean.",
new Object[] {testCase.getEjbName()}));
}
else
{
result.failed(smh.getLocalString(getClass().getName()+".notRun",
"NOT RUN [AS-EJB cmp] Could not create SunEjbJar Object."));