axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/test/encoding TestBody.java PackageTests.java
Date Fri, 15 Jun 2001 00:20:02 GMT
rubys       01/06/14 17:20:02

  Modified:    java/test/encoding PackageTests.java
  Added:       java/test/encoding TestBody.java
  Log:
  Verify that the service can actually be set from the body during
  deserialization...I was concerned given that the RPC Dispatch test
  avoids deserialization...but it actually works...  PHEW!  ;-)
  
  Revision  Changes    Path
  1.7       +1 -0      xml-axis/java/test/encoding/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/PackageTests.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PackageTests.java	2001/06/08 00:12:00	1.6
  +++ PackageTests.java	2001/06/15 00:20:02	1.7
  @@ -26,6 +26,7 @@
           suite.addTestSuite(TestSer.class);
           suite.addTestSuite(TestString.class);
           suite.addTestSuite(TestHrefs.class);
  +        suite.addTestSuite(TestBody.class);
   
           return suite;
       }
  
  
  
  1.1                  xml-axis/java/test/encoding/TestBody.java
  
  Index: TestBody.java
  ===================================================================
  package test.encoding;
  
  import org.apache.axis.*;
  import org.apache.axis.encoding.*;
  import org.apache.axis.handlers.soap.*;
  import org.apache.axis.message.*;
  import org.apache.axis.registries.*;
  import org.apache.axis.server.AxisServer;
  import org.apache.axis.utils.QName;
  import org.xml.sax.InputSource;
  import java.io.*;
  import java.util.*;
  
  import junit.framework.TestCase;
  
  /** 
   * Verify that deserialization actually can cause the soap service
   * to be set...
   */
  public class TestBody extends TestCase {
  
      public TestBody(String name) {
          super(name);
      }
  
      private String namespace = "http://xml.apache.org/axis/TestBody";
  
      private String request = 
          "<?xml version=\"1.0\"?>\n" +
          "<soap:Envelope " +
            "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
            "xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">" +
            "<soap:Body>\n" +
              "<method xmlns=\"" + namespace + "\">\n" +
                "<arg>5</arg>" + 
              "</method>\n" +
            "</soap:Body>\n" +
          "</soap:Envelope>\n";
  
      public void testBodyNamespace() {
  
         // setup
         AxisEngine engine = new AxisServer();
         engine.init();
         HandlerRegistry hr = engine.getHandlerRegistry();
         HandlerRegistry sr = engine.getServiceRegistry();
         
         // register the service with the engine
         Handler RPCDispatcher = hr.find("RPCDispatcher");
         SOAPService target = new SOAPService(RPCDispatcher, "RPCDispatcher");
         sr.add(namespace, target);
  
         // create a message in context
         MessageContext msgContext = new MessageContext(engine);
         Message message = new Message(request);
         message.setMessageContext(msgContext);
  
         // ensure that the message is parsed
         SOAPEnvelope envelope = message.getAsSOAPEnvelope();
         RPCElement body = (RPCElement)envelope.getFirstBody();
  
         // verify the service is set
         assertEquals(namespace, msgContext.getTargetService());
         assertEquals(target, msgContext.getServiceHandler());
      }
  }
  
  
  

Mime
View raw message