1 23 package com.sun.enterprise.tools.verifier.tests.webservices; 24 25 import com.sun.enterprise.deployment.*; 26 import com.sun.enterprise.tools.verifier.*; 27 import java.util.*; 28 import com.sun.enterprise.tools.verifier.tests.*; 29 import java.lang.reflect.*; 30 31 34 35 53 54 public class ServiceImplBeanLinkCheck extends WSTest implements WSCheck { 55 56 public boolean resolveComponentLink(WebServiceEndpoint desc, Result result) { 57 boolean resolved = false; 58 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 59 60 if( desc.implementedByEjbComponent()) { 61 EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor)desc.getBundleDescriptor(); 62 if( ejbBundle.hasEjbByName(desc.getEjbLink())) { 63 EjbDescriptor ejb = ejbBundle.getEjbByName(desc.getEjbLink()); 64 if (ejb != null) { 65 resolved = true; 66 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 68 "For [ {0} ]", new Object [] {compName.toString()})); 69 result.passed(smh.getLocalString (getClass().getName() + ".passed", 70 "[{0}] link of service-impl-bean element resolved successfully.", 71 new Object [] {desc.getEjbLink()})); 72 73 } 74 else { 75 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 77 "For [ {0} ]", new Object [] {compName.toString()})); 78 result.failed(smh.getLocalString (getClass().getName() + ".failed", 79 "Could not resolve [{0}] link of service-impl-bean element.", 80 new Object [] {desc.getEjbLink()})); 81 82 } 83 } 84 } else if( desc.implementedByWebComponent()) { 85 WebBundleDescriptor webBundle = (WebBundleDescriptor)desc.getBundleDescriptor(); 86 WebComponentDescriptor webComponent = 87 (WebComponentDescriptor) webBundle. 88 getWebComponentByCanonicalName(desc.getWebComponentLink()); 89 if( webComponent != null && webComponent.isServlet()) { 90 resolved = true; 91 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 93 "For [ {0} ]", new Object [] {compName.toString()})); 94 result.passed(smh.getLocalString (getClass().getName() + ".passed", 95 "[{0}] link of service-impl-bean element resolved successfully.", 96 new Object [] {desc.getWebComponentLink()})); 97 } 98 else { 99 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 101 "For [ {0} ]", new Object [] {compName.toString()})); 102 result.failed(smh.getLocalString (getClass().getName() + ".failed", 103 "Could not resolve [{0}] link of service-impl-bean element.", 104 new Object [] {desc.getWebComponentLink()})); 105 } 106 } 107 return resolved; 108 } 109 110 114 public Result check (WebServiceEndpoint wsdescriptor) { 115 116 Result result = getInitializedResult(); 117 boolean pass = resolveComponentLink(wsdescriptor, result); 118 return result; 119 } 120 } 121 122 | Popular Tags |