1 23 28 29 package com.sun.enterprise.tools.verifier.connector; 30 31 import java.io.File ; 32 import java.io.FileInputStream ; 33 34 import com.sun.enterprise.deployment.ConnectorDescriptor; 35 import com.sun.enterprise.deployment.Descriptor; 36 import com.sun.enterprise.deployment.io.ConnectorDeploymentDescriptorFile; 37 import com.sun.enterprise.tools.verifier.CheckMgr; 38 import com.sun.enterprise.tools.verifier.FrameworkContext; 39 import com.sun.enterprise.tools.verifier.JarCheck; 40 import com.sun.enterprise.tools.verifier.Result; 41 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 42 import com.sun.enterprise.tools.verifier.tests.dd.ParseDD; 43 44 51 public class ConnectorCheckMgrImpl extends CheckMgr implements JarCheck { 52 53 57 private static final String testsListFileName = "TestNamesConnector.xml"; private static final String sunONETestsListFileName = getSunPrefix() 59 .concat(testsListFileName); 60 61 public ConnectorCheckMgrImpl(FrameworkContext frameworkContext) { 62 this.frameworkContext = frameworkContext; 63 } 64 65 public void check(Descriptor descriptor) throws Exception { 66 if (getSchemaVersion(descriptor).compareTo("1.5") < 0) { ConnectorDeploymentDescriptorFile ddf = new ConnectorDeploymentDescriptorFile(); 69 File file = new File (getAbstractArchiveUri(descriptor), 70 ddf.getDeploymentDescriptorPath()); 71 FileInputStream is = new FileInputStream (file); 72 try { 73 if (is != null) { 74 Result result = new ParseDD().validateConnectorDescriptor(is); 75 result.setComponentName(getArchiveUri(descriptor)); 76 setModuleName(result); 77 frameworkContext.getResultManager().add(result); 78 } 79 } finally { 80 try { 81 if(is!=null) 82 is.close(); 83 } catch(Exception e) {} 84 } 85 } 86 87 super.check(descriptor); 88 } 89 90 96 protected String getTestsListFileName() { 97 return testsListFileName; 98 } 99 100 106 protected String getSunONETestsListFileName() { 107 if ((System.getProperty("verifier.tests.sunconnector", "false")).equals( 108 "true")) return sunONETestsListFileName; 110 else 111 return null; 112 } 113 114 protected String getSchemaVersion(Descriptor descriptor) { 115 return ((ConnectorDescriptor) descriptor).getSpecVersion(); 116 } 117 118 protected void setModuleName(Result r) { 119 r.setModuleName(Result.CONNECTOR); 120 } 121 122 protected ComponentNameConstructor getComponentNameConstructor( 123 Descriptor descriptor) { 124 return new ComponentNameConstructor((ConnectorDescriptor)descriptor); 125 } 126 127 } 128 | Popular Tags |