[jbossws-commits] JBossWS SVN: r8317 - framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Oct 2 06:22:40 EDT 2008


Author: alessio.soldano at jboss.com
Date: 2008-10-02 06:22:40 -0400 (Thu, 02 Oct 2008)
New Revision: 8317

Modified:
   framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBareTestCase.java
   framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPWrappedTestCase.java
Log:
[JBWS-2165] Using Woodstox on client side when in Metro integration


Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBareTestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBareTestCase.java	2008-10-01 06:32:55 UTC (rev 8316)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBareTestCase.java	2008-10-02 10:22:40 UTC (rev 8317)
@@ -49,6 +49,15 @@
 {
 
    public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-samples-xop-doclit/bare";
+   
+   private String xmlInputFactoryValue;
+   private String xmlOutputFactoryValue;
+   private String xmlEventFactoryValue;
+   
+   private static final String XML_INPUT_FACTORY = "javax.xml.stream.XMLInputFactory";
+   private static final String XML_OUTPUT_FACTORY = "javax.xml.stream.XMLOutputFactory";
+   private static final String XML_EVENT_FACTORY = "javax.xml.stream.XMLEventFactory";
+   private static final String NOT_SET = "NOT_SET";
 
    public static Test suite()
    {
@@ -57,6 +66,18 @@
 
    protected void setUp() throws Exception
    {
+      if (isIntegrationMetro())
+      {
+         //use Woodstox as a workaround for JBWS-2165 on AS 5
+         xmlInputFactoryValue = System.getProperty(XML_INPUT_FACTORY, NOT_SET);
+         xmlOutputFactoryValue = System.getProperty(XML_OUTPUT_FACTORY, NOT_SET);
+         xmlEventFactoryValue = System.getProperty(XML_EVENT_FACTORY, NOT_SET);
+         
+         System.setProperty(XML_INPUT_FACTORY, "com.ctc.wstx.stax.WstxInputFactory");
+         System.setProperty(XML_OUTPUT_FACTORY, "com.ctc.wstx.stax.WstxOutputFactory");
+         System.setProperty(XML_EVENT_FACTORY, "com.ctc.wstx.stax.WstxEventFactory");
+      }
+      
       QName serviceName = new QName("http://doclit.xop.samples.jaxws.ws.test.jboss.org/", "MTOMService");
       URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
 
@@ -64,6 +85,40 @@
       port = service.getPort(MTOMEndpoint.class);
       binding = (SOAPBinding)((BindingProvider)port).getBinding();
    }
+   
+   protected void tearDown() throws Exception
+   {
+      if (isIntegrationMetro())
+      {
+         //restore StAX implementation factories
+         if (NOT_SET.equals(xmlInputFactoryValue))
+         {
+            System.clearProperty(XML_INPUT_FACTORY);
+         }
+         else
+         {
+            System.setProperty(XML_INPUT_FACTORY, xmlInputFactoryValue);
+         }
+         
+         if (NOT_SET.equals(xmlOutputFactoryValue))
+         {
+            System.clearProperty(XML_OUTPUT_FACTORY);
+         }
+         else
+         {
+            System.setProperty(XML_OUTPUT_FACTORY, xmlOutputFactoryValue);
+         }
+         
+         if (NOT_SET.equals(xmlEventFactoryValue))
+         {
+            System.clearProperty(XML_EVENT_FACTORY);
+         }
+         else
+         {
+            System.setProperty(XML_EVENT_FACTORY, xmlEventFactoryValue);
+         }
+      }
+   }
 
    /**
     * Consumption of XOP packages (not inlined) should resolve the correct java type.

Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPWrappedTestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPWrappedTestCase.java	2008-10-01 06:32:55 UTC (rev 8316)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPWrappedTestCase.java	2008-10-02 10:22:40 UTC (rev 8317)
@@ -49,6 +49,16 @@
    public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-samples-xop-doclit/wrapped";
 
    private WrappedEndpoint port;
+   
+   private String xmlInputFactoryValue;
+   private String xmlOutputFactoryValue;
+   private String xmlEventFactoryValue;
+   
+   private static final String XML_INPUT_FACTORY = "javax.xml.stream.XMLInputFactory";
+   private static final String XML_OUTPUT_FACTORY = "javax.xml.stream.XMLOutputFactory";
+   private static final String XML_EVENT_FACTORY = "javax.xml.stream.XMLEventFactory";
+   private static final String NOT_SET = "NOT_SET";
+   
 
    public static Test suite()
    {
@@ -57,7 +67,18 @@
 
    protected void setUp() throws Exception
    {
-
+      if (isIntegrationMetro())
+      {
+         //use Woodstox as a workaround for JBWS-2165 on AS 5
+         xmlInputFactoryValue = System.getProperty(XML_INPUT_FACTORY, NOT_SET);
+         xmlOutputFactoryValue = System.getProperty(XML_OUTPUT_FACTORY, NOT_SET);
+         xmlEventFactoryValue = System.getProperty(XML_EVENT_FACTORY, NOT_SET);
+         
+         System.setProperty(XML_INPUT_FACTORY, "com.ctc.wstx.stax.WstxInputFactory");
+         System.setProperty(XML_OUTPUT_FACTORY, "com.ctc.wstx.stax.WstxOutputFactory");
+         System.setProperty(XML_EVENT_FACTORY, "com.ctc.wstx.stax.WstxEventFactory");
+      }
+      
       QName serviceName = new QName("http://doclit.xop.samples.jaxws.ws.test.jboss.org/", "WrappedService");
       URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
 
@@ -68,6 +89,40 @@
       binding.setMTOMEnabled(true);
 
    }
+   
+   protected void tearDown() throws Exception
+   {
+      if (isIntegrationMetro())
+      {
+         //restore StAX implementation factories
+         if (NOT_SET.equals(xmlInputFactoryValue))
+         {
+            System.clearProperty(XML_INPUT_FACTORY);
+         }
+         else
+         {
+            System.setProperty(XML_INPUT_FACTORY, xmlInputFactoryValue);
+         }
+         
+         if (NOT_SET.equals(xmlOutputFactoryValue))
+         {
+            System.clearProperty(XML_OUTPUT_FACTORY);
+         }
+         else
+         {
+            System.setProperty(XML_OUTPUT_FACTORY, xmlOutputFactoryValue);
+         }
+         
+         if (NOT_SET.equals(xmlEventFactoryValue))
+         {
+            System.clearProperty(XML_EVENT_FACTORY);
+         }
+         else
+         {
+            System.setProperty(XML_EVENT_FACTORY, xmlEventFactoryValue);
+         }
+      }
+   }
 
    public void testParameterAnnotation() throws Exception
    {




More information about the jbossws-commits mailing list