1 23 package com.sun.enterprise.tools.verifier.tests.ejb.beanclass; 24 25 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 26 import com.sun.enterprise.deployment.EjbDescriptor; 27 import com.sun.enterprise.tools.verifier.*; 28 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 29 import java.util.logging.Level ; 30 31 import com.sun.enterprise.tools.verifier.tests.*; 32 33 37 38 public class EjbClassExist extends EjbTest implements EjbCheck { 39 40 48 public Result check(EjbDescriptor descriptor) { 49 50 Result result = getInitializedResult(); 51 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 52 53 try { 55 Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader()); 56 result.addGoodDetails(smh.getLocalString 57 ("tests.componentNameConstructor", 58 "For [ {0} ]", 59 new Object [] {compName.toString()})); 60 result.passed(smh.getLocalString 61 (getClass().getName() + ".passed", 62 "Bean class [ {0} ] exist and is loadable.", 63 new Object [] {descriptor.getEjbClassName()})); 64 65 } catch (NoClassDefFoundError e) { 66 logger.log(Level.FINE, "Can't find class " + e.getMessage()); 68 result.addErrorDetails(smh.getLocalString 69 ("tests.componentNameConstructor", 70 "For [ {0} ]", 71 new Object [] {compName.toString()})); 72 result.failed(smh.getLocalString 73 (getClass().getName() + ".failed", 74 "Error: Bean class [ {0} ] does not exist or is not loadable.", 75 new Object [] {descriptor.getEjbClassName()})); 76 } catch (ClassNotFoundException e) { 77 Verifier.debug(e); 78 result.addErrorDetails(smh.getLocalString 79 ("tests.componentNameConstructor", 80 "For [ {0} ]", 81 new Object [] {compName.toString()})); 82 result.failed(smh.getLocalString 83 (getClass().getName() + ".failed", 84 "Error: Bean class [ {0} ] does not exist or is not loadable.", 85 new Object [] {descriptor.getEjbClassName()})); 86 } catch (Exception e) { 87 result.addErrorDetails(smh.getLocalString 89 ("tests.componentNameConstructor", 90 "For [ {0} ]", 91 new Object [] {compName.toString()})); 92 result.failed(smh.getLocalString 93 (getClass().getName() + ".failed", 94 "Error: Bean class [ {0} ] does not exist or is not loadable.", 95 new Object [] {descriptor.getEjbClassName()})); 96 } 97 return result; 98 } 99 } 100 | Popular Tags |