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 ga...@apache.org on 2005/01/05 07:17:42 UTC

cvs commit: ws-axis/java/test/servicedesc BaseFault.java CustomFault.java PackageTests.java ServiceClass.java TestServiceDesc.java build.xml

gawor       2005/01/04 22:17:42

  Added:       java/test/servicedesc BaseFault.java CustomFault.java
                        PackageTests.java ServiceClass.java
                        TestServiceDesc.java build.xml
  Log:
  simple tests for cheching fault metadata
  
  Revision  Changes    Path
  1.1                  ws-axis/java/test/servicedesc/BaseFault.java
  
  Index: BaseFault.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package test.servicedesc;
  
  import org.apache.axis.AxisFault;
  
  public class BaseFault extends AxisFault  {
  
  }
  
  
  
  1.1                  ws-axis/java/test/servicedesc/CustomFault.java
  
  Index: CustomFault.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package test.servicedesc;
  
  public class CustomFault extends BaseFault {
  
  }
  
  
  
  1.1                  ws-axis/java/test/servicedesc/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package test.servicedesc;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  public class PackageTests extends TestCase {
      
      public PackageTests(String name) {
          super(name);
      }
      
      public static Test suite() throws Exception {
          TestSuite suite = new TestSuite();
          
          suite.addTestSuite(TestServiceDesc.class);
  
          return suite;
      }
  }
  
  
  
  1.1                  ws-axis/java/test/servicedesc/ServiceClass.java
  
  Index: ServiceClass.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package test.servicedesc;
  
  import java.rmi.RemoteException;
  
  public class ServiceClass {
  
      public void doIt1(String in) 
          throws RemoteException, BaseFault, CustomFault {
      }
  
      public void doIt2(String in) 
          throws RemoteException, CustomFault, BaseFault {
      }
      
  }
  
  
  
  1.1                  ws-axis/java/test/servicedesc/TestServiceDesc.java
  
  Index: TestServiceDesc.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package test.servicedesc;
  
  import java.util.List;
  
  import junit.framework.TestCase;
  
  import org.apache.axis.description.JavaServiceDesc;
  import org.apache.axis.description.OperationDesc;
  
  import javax.xml.namespace.QName;
  
  public class TestServiceDesc extends TestCase { 
      
      public TestServiceDesc(String name) {
          super(name);
      }
      
      public TestServiceDesc() {
          super("Test ServiceDesc Synch");
      }
   
      public void testFaultSynch() throws Exception {
          JavaServiceDesc desc = new JavaServiceDesc();
  
          desc.loadServiceDescByIntrospection(ServiceClass.class);
  
          List operations = desc.getOperations();
  
          assertTrue(operations != null);
          assertEquals("invalid number of registered operations",
                       2, operations.size());
          
          OperationDesc operation;
          List faults;
  
          operation = (OperationDesc)operations.get(0);
          assertEquals("doIt1", operation.getName());
  
          faults = operation.getFaults();
  
          assertTrue(faults != null);
          assertEquals("invalid number of registered faults", 
                       2, faults.size());
  
          operation = (OperationDesc)operations.get(1);
          assertEquals("doIt2", operation.getName());
  
          faults = operation.getFaults();
  
          assertTrue(faults != null);
          assertEquals("invalid number of registered faults", 
                       2, faults.size());
  
  
      }
  
  }
  
  
  
  1.1                  ws-axis/java/test/servicedesc/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0" ?>
  <!DOCTYPE project [
          <!ENTITY properties SYSTEM "file:../../xmls/properties.xml">
          <!ENTITY paths  SYSTEM "file:../../xmls/path_refs.xml">
          <!ENTITY taskdefs SYSTEM "file:../../xmls/taskdefs.xml">
          <!ENTITY taskdefs_post_compile SYSTEM "file:../../xmls/taskdefs_post_compile.xml">
          <!ENTITY targets SYSTEM "file:../../xmls/targets.xml">
  ]>
  
  <!-- ===================================================================
  <description>
     Test/Sample Component file for Axis
  
  Notes:
     This is a build file for use with the Jakarta Ant build tool.
  
  Prerequisites:
  
     jakarta-ant from http://jakarta.apache.org
  
  Build Instructions:
     To compile
          ant compile
     To execute
          ant run
  
  Author:
    Matt Seibert mseibert@us.ibm.com
  
  Copyright:
    Copyright (c) 2002-2003 Apache Software Foundation.
  </description>
  ==================================================================== -->
  
  <project default="compile">
  
          <property name="axis.home" location="../../" />
  	<property name="componentName" value="test/servicedesc"/>
  
          &properties;
          &paths;
          &taskdefs;
          &taskdefs_post_compile;
  	&targets;
  
  
  <target name="clean">
      <echo message="Removing ${build.dir}/classes/${componentName} and ${build.dir}/work/${componentName}" />
      <delete dir="${build.dir}/classes/${componentName}"/>
      <delete dir="${build.dir}/work/${componentName}"/>
  </target>
  
  <target name="copy" depends="setenv"/>
  
  <target name="compile" depends="copy">
    <echo message="Compiling test.${componentName}"/>
    <javac srcdir="${axis.home}" destdir="${build.dest}" debug="${debug}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}">
      <classpath>
          <path refid="classpath"/>
      </classpath>
      <include name="${componentName}/*.java"/>
    </javac>
  </target>
  
  <target name="run">
  	<antcall target="execute-Component-noServer" />
  </target>
  
  </project>