1 23 package com.sun.enterprise.tools.verifier.appclient; 24 25 import java.io.File ; 26 import java.io.FileInputStream ; 27 import java.util.Iterator ; 28 import java.util.Set ; 29 30 import com.sun.enterprise.deployment.ApplicationClientDescriptor; 31 import com.sun.enterprise.deployment.Descriptor; 32 import com.sun.enterprise.deployment.RootDeploymentDescriptor; 33 import com.sun.enterprise.deployment.ServiceReferenceDescriptor; 34 import com.sun.enterprise.deployment.io.AppClientDeploymentDescriptorFile; 35 import com.sun.enterprise.tools.verifier.CheckMgr; 36 import com.sun.enterprise.tools.verifier.FrameworkContext; 37 import com.sun.enterprise.tools.verifier.JarCheck; 38 import com.sun.enterprise.tools.verifier.Result; 39 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 40 import com.sun.enterprise.tools.verifier.tests.dd.ParseDD; 41 import com.sun.enterprise.tools.verifier.wsclient.WebServiceClientCheckMgrImpl; 42 43 46 public class AppClientCheckMgrImpl extends CheckMgr implements JarCheck { 47 48 52 private static final String testsListFileName = "TestNamesAppClient.xml"; private static final String sunONETestsListFileName = getSunPrefix() 54 .concat(testsListFileName); 55 56 public AppClientCheckMgrImpl(FrameworkContext frameworkContext) { 57 this.frameworkContext = frameworkContext; 58 } 59 60 65 public void check(Descriptor descriptor) throws Exception { 66 checkPersistenceUnits(ApplicationClientDescriptor.class.cast(descriptor)); 68 checkWebServicesClient(descriptor); 70 71 if (frameworkContext.isPartition() && 72 !frameworkContext.isAppClient()) 73 return; 74 if (getSchemaVersion(descriptor).compareTo("1.4") < 0) { AppClientDeploymentDescriptorFile ddf = new AppClientDeploymentDescriptorFile(); 77 File file = new File (getAbstractArchiveUri(descriptor), 78 ddf.getDeploymentDescriptorPath()); 79 FileInputStream is = new FileInputStream (file); 80 try { 81 if (is != null) { 82 Result result = new ParseDD().validateAppClientDescriptor(is); 83 result.setComponentName(getArchiveUri(descriptor)); 84 setModuleName(result); 85 frameworkContext.getResultManager().add(result); 86 } 87 } finally { 88 try { 89 if(is!=null) 90 is.close(); 91 } catch(Exception e) {} 92 } 93 } 94 95 super.check(descriptor); 96 } 97 98 104 protected String getTestsListFileName() { 105 return testsListFileName; 106 } 107 108 114 protected String getSunONETestsListFileName() { 115 return sunONETestsListFileName; 116 } 117 118 protected String getSchemaVersion(Descriptor descriptor) { 119 return ((RootDeploymentDescriptor) descriptor).getSpecVersion(); 120 } 121 122 protected void setModuleName(Result r) { 123 r.setModuleName(Result.APPCLIENT); 124 } 125 126 protected void checkWebServicesClient(Descriptor descriptor) 127 throws Exception { 128 if (frameworkContext.isPartition() && 129 !frameworkContext.isWebServicesClient()) 130 return; 131 WebServiceClientCheckMgrImpl webServiceClientCheckMgr = 132 new WebServiceClientCheckMgrImpl(frameworkContext); 133 ApplicationClientDescriptor desc = (ApplicationClientDescriptor) descriptor; 134 if (desc.hasWebServiceClients()) { 135 Set serviceRefDescriptors = desc.getServiceReferenceDescriptors(); 136 Iterator it = serviceRefDescriptors.iterator(); 137 while (it.hasNext()) { 138 webServiceClientCheckMgr.setVerifierContext(context); 139 webServiceClientCheckMgr.check( 140 (ServiceReferenceDescriptor) it.next()); 141 } 142 } else webServiceClientCheckMgr.setVerifierContext(context); 144 } 145 146 protected ComponentNameConstructor getComponentNameConstructor( 147 Descriptor descriptor) { 148 return new ComponentNameConstructor((ApplicationClientDescriptor)descriptor); 149 } 150 151 } 152 | Popular Tags |