1 23 package com.sun.enterprise.tools.verifier.tests.appclient.elements; 24 25 import com.sun.enterprise.tools.verifier.tests.appclient.AppClientTest; 26 import com.sun.enterprise.tools.verifier.tests.appclient.AppClientCheck; 27 import java.util.*; 28 import com.sun.enterprise.deployment.*; 29 import com.sun.enterprise.tools.verifier.*; 30 import com.sun.enterprise.tools.verifier.tests.*; 31 32 37 public class AppClientEjbRefTypeElement extends AppClientTest implements AppClientCheck { 38 39 40 49 public Result check(ApplicationClientDescriptor descriptor) { 50 51 Result result = getInitializedResult(); 52 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 53 54 boolean failed = false; 55 56 if (!descriptor.getEjbReferenceDescriptors().isEmpty()) { 60 for (Iterator itr = descriptor.getEjbReferenceDescriptors().iterator(); 61 itr.hasNext();) { 62 EjbReferenceDescriptor nextEjbReference = (EjbReferenceDescriptor) itr.next(); 63 String ejbRefTypeStr = nextEjbReference.getType(); if (!((ejbRefTypeStr.equals(EjbSessionDescriptor.TYPE)) || 65 (ejbRefTypeStr.equals(EjbEntityDescriptor.TYPE)))) { 66 result.addErrorDetails(smh.getLocalString 67 ("tests.componentNameConstructor", 68 "For [ {0} ]", 69 new Object [] {compName.toString()})); 70 result.failed(smh.getLocalString 71 (getClass().getName() + ".failed", 72 "Error: ejb-ref-type [ {0} ] within \n application client [ {1} ] is not valid. \n Must be [ {2} ] or [ {3} ]", 73 new Object [] {ejbRefTypeStr,descriptor.getName(),EjbEntityDescriptor.TYPE,EjbSessionDescriptor.TYPE})); 74 failed = true; 75 } 76 } 77 } else { 78 result.addNaDetails(smh.getLocalString 79 ("tests.componentNameConstructor", 80 "For [ {0} ]", 81 new Object [] {compName.toString()})); 82 result.notApplicable(smh.getLocalString 83 (getClass().getName() + ".notApplicable", 84 "There are no ejb references to other beans within this application client [ {0} ]", 85 new Object [] {descriptor.getName()})); 86 return result; 87 } 88 89 if (failed) 90 { 91 result.setStatus(Result.FAILED); 92 } else { 93 result.addGoodDetails(smh.getLocalString 94 ("tests.componentNameConstructor", 95 "For [ {0} ]", 96 new Object [] {compName.toString()})); 97 result.passed 98 (smh.getLocalString 99 (getClass().getName() + ".passed", 100 "All ejb-ref-type elements are valid. They are all [ {0} ] or [ {1} ] within this application client [ {2} ]", 101 new Object [] {EjbEntityDescriptor.TYPE,EjbSessionDescriptor.TYPE,descriptor.getName()})); 102 } 103 return result; 104 } 105 } 106 | Popular Tags |