1 23 package com.sun.enterprise.tools.verifier.tests.appclient; 24 25 import java.util.*; 26 import com.sun.enterprise.deployment.*; 27 import com.sun.enterprise.tools.verifier.*; 28 import com.sun.enterprise.tools.verifier.tests.*; 29 30 35 public class AppClientEjbRefNamePrefixed extends AppClientTest implements AppClientCheck { 36 37 38 47 public Result check(ApplicationClientDescriptor descriptor) { 48 Result result = getInitializedResult(); 49 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 50 51 boolean oneWarning = false; 52 if (!descriptor.getEjbReferenceDescriptors().isEmpty()) { 53 for (Iterator itr = descriptor.getEjbReferenceDescriptors().iterator(); 54 itr.hasNext();) { 55 EjbReferenceDescriptor nextEjbReference = (EjbReferenceDescriptor) itr.next(); 56 String ejbRefName = nextEjbReference.getName(); 57 58 if (ejbRefName.startsWith("ejb/")) { 59 result.addGoodDetails(smh.getLocalString 60 ("tests.componentNameConstructor", 61 "For [ {0} ]", 62 new Object [] {compName.toString()})); 63 result.addGoodDetails 64 (smh.getLocalString 65 (getClass().getName() + ".passed", 66 "[ {0} ] is prefixed with recommended string \"ejb/\" within application client [ {1} ]", 67 new Object [] {ejbRefName,descriptor.getName()})); 68 } else { 69 if (!oneWarning) { 70 oneWarning = true; 71 } 72 result.addWarningDetails(smh.getLocalString 73 ("tests.componentNameConstructor", 74 "For [ {0} ]", 75 new Object [] {compName.toString()})); 76 result.addWarningDetails 77 (smh.getLocalString 78 (getClass().getName() + ".warning", 79 "Warning: [ {0} ] is not prefixed with recommended string \"ejb/\" within application client [ {1} ]", 80 new Object [] {ejbRefName,descriptor.getName()})); 81 } 82 } 83 if (oneWarning) { 84 result.setStatus(Result.WARNING); 85 } else { 86 result.setStatus(Result.PASSED); 87 } 88 } else { 89 result.addNaDetails(smh.getLocalString 90 ("tests.componentNameConstructor", 91 "For [ {0} ]", 92 new Object [] {compName.toString()})); 93 result.notApplicable(smh.getLocalString 94 (getClass().getName() + ".notApplicable", 95 "There are no ejb references to other beans within this application client [ {0} ]", 96 new Object [] {descriptor.getName()})); 97 } 98 return result; 99 } 100 } 101 | Popular Tags |