axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-axis/java/test/RPCDispatch TestRPC.java
Date Wed, 26 Jun 2002 20:08:39 GMT
dims        2002/06/26 13:08:39

  Modified:    java/test/RPCDispatch TestRPC.java
  Log:
  Added test cases for testing comma-delimited, space-delimited, '*' in allowedMethods.
  
  Revision  Changes    Path
  1.41      +78 -1     xml-axis/java/test/RPCDispatch/TestRPC.java
  
  Index: TestRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestRPC.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- TestRPC.java	11 Jun 2002 14:54:02 -0000	1.40
  +++ TestRPC.java	26 Jun 2002 20:08:39 -0000	1.41
  @@ -117,6 +117,79 @@
       }
   
       /**
  +     * Test a simple method that reverses a string (but fails)
  +     */
  +    public void testReverseStringThatShouldFail() throws Exception {
  +        try {
  +            // Register the reverseString service
  +            SOAPService reverse = new SOAPService(new RPCProvider());
  +            reverse.setOption("className", "test.RPCDispatch.Service");
  +            reverse.setOption("allowedMethods", "reverseString2");
  +            provider.deployService(new QName(null,SOAPAction), reverse);
  +            ServiceDesc serviceDesc = reverse.getServiceDescription();
  +            serviceDesc.loadServiceDescByIntrospection(test.RPCDispatch.Service.class,
  +                                                       (TypeMapping)reverse.getTypeMappingRegistry().getDefaultTypeMapping());
  +            // invoke the service and verify the result
  +            rpc("reverseString", new Object[] {"abc"});
  +            throw new junit.framework.AssertionFailedError("Should not reach here");
  +        } catch (AxisFault af){
  +            //This test should cause an exception.
  +            return;
  +        }
  +    }
  +    
  +    /**
  +     * Test a simple method that reverses a string (with a comma delimiter
  +     */
  +    public void testReverseStringWithCommaDelimiter() throws Exception {
  +        // Register the reverseString service
  +        SOAPService reverse = new SOAPService(new RPCProvider());
  +        reverse.setOption("className", "test.RPCDispatch.Service");
  +        reverse.setOption("allowedMethods", "reverseString2,reverseString");
  +        provider.deployService(new QName(null,SOAPAction), reverse);
  +        ServiceDesc serviceDesc = reverse.getServiceDescription();
  +        serviceDesc.loadServiceDescByIntrospection(test.RPCDispatch.Service.class,
  +                                                   (TypeMapping)reverse.getTypeMappingRegistry().getDefaultTypeMapping());
  +
  +        // invoke the service and verify the result
  +        assertEquals("Did not reverse the string correctly.", "cba", rpc("reverseString",
new Object[] {"abc"}));
  +    }
  +
  +    /**
  +     * Test a simple method that reverses a string (with a space delimiter
  +     */
  +    public void testReverseStringWithSpaceDelimiter() throws Exception {
  +        // Register the reverseString service
  +        SOAPService reverse = new SOAPService(new RPCProvider());
  +        reverse.setOption("className", "test.RPCDispatch.Service");
  +        reverse.setOption("allowedMethods", "reverseString2 reverseString");
  +        provider.deployService(new QName(null,SOAPAction), reverse);
  +        ServiceDesc serviceDesc = reverse.getServiceDescription();
  +        serviceDesc.loadServiceDescByIntrospection(test.RPCDispatch.Service.class,
  +                                                   (TypeMapping)reverse.getTypeMappingRegistry().getDefaultTypeMapping());
  +
  +        // invoke the service and verify the result
  +        assertEquals("Did not reverse the string correctly.", "cba", rpc("reverseString",
new Object[] {"abc"}));
  +    }
  +
  +    /**
  +     * Test a simple method that reverses a string (with a '*'
  +     */
  +    public void testReverseStringWithStar() throws Exception {
  +        // Register the reverseString service
  +        SOAPService reverse = new SOAPService(new RPCProvider());
  +        reverse.setOption("className", "test.RPCDispatch.Service");
  +        reverse.setOption("allowedMethods", "*");
  +        provider.deployService(new QName(null,SOAPAction), reverse);
  +        ServiceDesc serviceDesc = reverse.getServiceDescription();
  +        serviceDesc.loadServiceDescByIntrospection(test.RPCDispatch.Service.class,
  +                                                   (TypeMapping)reverse.getTypeMappingRegistry().getDefaultTypeMapping());
  +
  +        // invoke the service and verify the result
  +        assertEquals("Did not reverse the string correctly.", "cba", rpc("reverseString",
new Object[] {"abc"}));
  +    }
  +    
  +    /**
        * Test a method that reverses a data structure
        */
       public void testReverseData() throws Exception {
  @@ -201,7 +274,11 @@
           TestRPC tester = new TestRPC("RPC test");
           tester.testReverseString();
           tester.testReverseData();
  -          tester.testSimpleFault();
  +        tester.testSimpleFault();
  +        tester.testReverseStringThatShouldFail();
  +        tester.testReverseStringWithCommaDelimiter();
  +        tester.testReverseStringWithSpaceDelimiter();
  +        tester.testReverseStringWithStar();
         } catch (Exception e) {
           e.printStackTrace();
         }
  
  
  

Mime
View raw message