You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2002/10/29 18:59:03 UTC

cvs commit: xml-axis/java/test/wsdd TestXSD.java PackageTests.java

dims        2002/10/29 09:59:03

  Modified:    java/test/wsdl/interop3 client_deploy.wsdd
               java/wsdd/examples/from_SOAP_v2 ejbtest.wsdd
               java/test/wsdd PackageTests.java
  Added:       java/test/wsdd TestXSD.java
  Log:
  Beginning of a test case that will eventually ensure that WSDD.xsd is up-to-date by recursing through all wsdd's and validating them.
  
  Revision  Changes    Path
  1.2       +1 -1      xml-axis/java/test/wsdl/interop3/client_deploy.wsdd
  
  Index: client_deploy.wsdd
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop3/client_deploy.wsdd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- client_deploy.wsdd	31 May 2002 20:28:21 -0000	1.1
  +++ client_deploy.wsdd	29 Oct 2002 17:59:03 -0000	1.2
  @@ -15,7 +15,7 @@
       <responseFlow>
         <handler type="log"/>
       </responseFlow>
  -  <globalConfiguration>
  +  </globalConfiguration>
   
   <!--
     <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/>
  
  
  
  1.4       +1 -1      xml-axis/java/wsdd/examples/from_SOAP_v2/ejbtest.wsdd
  
  Index: ejbtest.wsdd
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/wsdd/examples/from_SOAP_v2/ejbtest.wsdd,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ejbtest.wsdd	25 Apr 2001 22:48:39 -0000	1.3
  +++ ejbtest.wsdd	29 Oct 2002 17:59:03 -0000	1.4
  @@ -1,7 +1,7 @@
   <?xml version="1.0"?>
   <deployment 	name="EJBTest" 
   				xmlns="http://xml.apache.org/axis/wsdd/" 
  -				xlmns:java="http://xml.apache.org/axis/wsdd/providers/java/"
  +				xmlns:java="http://xml.apache.org/axis/wsdd/providers/java/"
   				xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" 
   				xsi:schemaLocation="http://xml.apache.org/axis/wsdd/ D:\Schemas\WSDD\WSDD.xsd">
   	<documentation>
  
  
  
  1.9       +1 -0      xml-axis/java/test/wsdd/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdd/PackageTests.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PackageTests.java	11 Feb 2002 14:34:28 -0000	1.8
  +++ PackageTests.java	29 Oct 2002 17:59:03 -0000	1.9
  @@ -24,6 +24,7 @@
           suite.addTestSuite(TestStructure.class);
           suite.addTestSuite(TestBadWSDD.class);
           suite.addTestSuite(TestAdminService.class);
  +        suite.addTestSuite(TestXSD.class);
   
           return suite;
       }
  
  
  
  1.1                  xml-axis/java/test/wsdd/TestXSD.java
  
  Index: TestXSD.java
  ===================================================================
  package test.wsdd;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  import org.w3c.dom.Document;
  
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import java.io.File;
  
  /**
   *  Make sure that WSDD.xsd is up-to-date
   */
  public class TestXSD extends TestCase {
  
      static final String JAXP_SCHEMA_LANGUAGE =
              "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
      static final String W3C_XML_SCHEMA =
              "http://www.w3.org/2001/XMLSchema";
      static final String JAXP_SCHEMA_SOURCE =
              "http://java.sun.com/xml/jaxp/properties/schemaSource";
  
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  
      public TestXSD(String name) {
          super(name);
      }
  
      public static Test suite() {
          return new TestSuite(TestXSD.class);
      }
  
      protected void setUp() throws Exception {
          String schemaSource = "wsdd/WSDD.xsd";
  
          // Set namespaceAware to true to get a DOM Level 2 tree with nodes
          // containing namesapce information.  This is necessary because the
          // default value from JAXP 1.0 was defined to be false.
          dbf.setNamespaceAware(true);
  
          dbf.setValidating(true);
          dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
          // Specify other factory configuration settings
          File f = new File(schemaSource);
          dbf.setAttribute(JAXP_SCHEMA_SOURCE, f.toURL().toExternalForm());
      }
  
      public static void main(String[] args) throws Exception {
          TestXSD tester = new TestXSD("TestXSD");
          tester.setUp();
          tester.testWSDD();
      }
  
      public void testWSDD() throws Exception {
          File f = new File(".");
          recurse(f);
      }
  
      private void recurse(File f) throws Exception {
          if (f.isDirectory()) {
              File[] files = f.listFiles();
              for (int i = 0; i < files.length; i++) {
                  recurse(files[i]);
              }
          } else if (f.getName().endsWith(".wsdd")) {
              checkValidity(f);
          }
      }
  
      private void checkValidity(File f) throws Exception {
          System.out.println("========== Checking " + f.getAbsolutePath() + "=================");
          DocumentBuilder db = dbf.newDocumentBuilder();
          Document doc = db.parse(f);
          assertTrue(doc != null);
      }
  }
  
  
  

Re: cvs commit: xml-axis/java/test/wsdd TestXSD.java PackageTests.java

Posted by Davanum Srinivas <di...@yahoo.com>.
Steve,

Can you please look at the errors generated when you run "test.wsdd.TestXSD" (command line from
xml-axis/java directory)? I think the WSDD.xsd needs a bit more work to be useful. 

Thanks,
dims

--- dims@apache.org wrote:
> dims        2002/10/29 09:59:03
> 
>   Modified:    java/test/wsdl/interop3 client_deploy.wsdd
>                java/wsdd/examples/from_SOAP_v2 ejbtest.wsdd
>                java/test/wsdd PackageTests.java
>   Added:       java/test/wsdd TestXSD.java
>   Log:
>   Beginning of a test case that will eventually ensure that WSDD.xsd is up-to-date by recursing
> through all wsdd's and validating them.
>   
>   Revision  Changes    Path
>   1.2       +1 -1      xml-axis/java/test/wsdl/interop3/client_deploy.wsdd
>   
>   Index: client_deploy.wsdd
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/test/wsdl/interop3/client_deploy.wsdd,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- client_deploy.wsdd	31 May 2002 20:28:21 -0000	1.1
>   +++ client_deploy.wsdd	29 Oct 2002 17:59:03 -0000	1.2
>   @@ -15,7 +15,7 @@
>        <responseFlow>
>          <handler type="log"/>
>        </responseFlow>
>   -  <globalConfiguration>
>   +  </globalConfiguration>
>    
>    <!--
>      <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/>
>   
>   
>   
>   1.4       +1 -1      xml-axis/java/wsdd/examples/from_SOAP_v2/ejbtest.wsdd
>   
>   Index: ejbtest.wsdd
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/wsdd/examples/from_SOAP_v2/ejbtest.wsdd,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- ejbtest.wsdd	25 Apr 2001 22:48:39 -0000	1.3
>   +++ ejbtest.wsdd	29 Oct 2002 17:59:03 -0000	1.4
>   @@ -1,7 +1,7 @@
>    <?xml version="1.0"?>
>    <deployment 	name="EJBTest" 
>    				xmlns="http://xml.apache.org/axis/wsdd/" 
>   -				xlmns:java="http://xml.apache.org/axis/wsdd/providers/java/"
>   +				xmlns:java="http://xml.apache.org/axis/wsdd/providers/java/"
>    				xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" 
>    				xsi:schemaLocation="http://xml.apache.org/axis/wsdd/ D:\Schemas\WSDD\WSDD.xsd">
>    	<documentation>
>   
>   
>   
>   1.9       +1 -0      xml-axis/java/test/wsdd/PackageTests.java
>   
>   Index: PackageTests.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/test/wsdd/PackageTests.java,v
>   retrieving revision 1.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- PackageTests.java	11 Feb 2002 14:34:28 -0000	1.8
>   +++ PackageTests.java	29 Oct 2002 17:59:03 -0000	1.9
>   @@ -24,6 +24,7 @@
>            suite.addTestSuite(TestStructure.class);
>            suite.addTestSuite(TestBadWSDD.class);
>            suite.addTestSuite(TestAdminService.class);
>   +        suite.addTestSuite(TestXSD.class);
>    
>            return suite;
>        }
>   
>   
>   
>   1.1                  xml-axis/java/test/wsdd/TestXSD.java
>   
>   Index: TestXSD.java
>   ===================================================================
>   package test.wsdd;
>   
>   import junit.framework.Test;
>   import junit.framework.TestCase;
>   import junit.framework.TestSuite;
>   import org.w3c.dom.Document;
>   
>   import javax.xml.parsers.DocumentBuilder;
>   import javax.xml.parsers.DocumentBuilderFactory;
>   import java.io.File;
>   
>   /**
>    *  Make sure that WSDD.xsd is up-to-date
>    */
>   public class TestXSD extends TestCase {
>   
>       static final String JAXP_SCHEMA_LANGUAGE =
>               "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
>       static final String W3C_XML_SCHEMA =
>               "http://www.w3.org/2001/XMLSchema";
>       static final String JAXP_SCHEMA_SOURCE =
>               "http://java.sun.com/xml/jaxp/properties/schemaSource";
>   
>       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
>   
>       public TestXSD(String name) {
>           super(name);
>       }
>   
>       public static Test suite() {
>           return new TestSuite(TestXSD.class);
>       }
>   
>       protected void setUp() throws Exception {
>           String schemaSource = "wsdd/WSDD.xsd";
>   
>           // Set namespaceAware to true to get a DOM Level 2 tree with nodes
>           // containing namesapce information.  This is necessary because the
>           // default value from JAXP 1.0 was defined to be false.
>           dbf.setNamespaceAware(true);
>   
>           dbf.setValidating(true);
>           dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
>           // Specify other factory configuration settings
>           File f = new File(schemaSource);
>           dbf.setAttribute(JAXP_SCHEMA_SOURCE, f.toURL().toExternalForm());
>       }
>   
>       public static void main(String[] args) throws Exception {
>           TestXSD tester = new TestXSD("TestXSD");
>           tester.setUp();
>           tester.testWSDD();
>       }
>   
>       public void testWSDD() throws Exception {
>           File f = new File(".");
>           recurse(f);
>       }
>   
>       private void recurse(File f) throws Exception {
>           if (f.isDirectory()) {
>               File[] files = f.listFiles();
>               for (int i = 0; i < files.length; i++) {
>                   recurse(files[i]);
>               }
>           } else if (f.getName().endsWith(".wsdd")) {
>               checkValidity(f);
>           }
>       }
>   
>       private void checkValidity(File f) throws Exception {
>           System.out.println("========== Checking " + f.getAbsolutePath() +
> "=================");
>           DocumentBuilder db = dbf.newDocumentBuilder();
>           Document doc = db.parse(f);
>           assertTrue(doc != null);
>       }
>   }
>   
>   
>   


=====
Davanum Srinivas - http://xml.apache.org/~dims/

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/