You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2008/01/25 05:32:06 UTC

svn commit: r615104 - /incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java

Author: ningjiang
Date: Thu Jan 24 20:32:04 2008
New Revision: 615104

URL: http://svn.apache.org/viewvc?rev=615104&view=rev
Log:
CXF-1401 Fixed the MtomServerTest warning complain

Modified:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java?rev=615104&r1=615103&r2=615104&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java Thu Jan 24 20:32:04 2008
@@ -53,20 +53,20 @@
 import org.junit.Test;
 
 public class MtomServerTest extends AbstractCXFTest {
-   
-    
+
+
     private static final String HTTP_ID = "http://schemas.xmlsoap.org/wsdl/http/";
-    
+
     @BeforeClass
     public static void setKeepAliveProperty() {
         TestUtilities.setKeepAliveSystemProperty(false);
     }
-    
+
     @AfterClass
     public static void cleanKeepAliveProperty() {
         TestUtilities.recoverKeepAliveSystemProperty();
     }
-    
+
     @Test
     public void testMtomRequest() throws Exception {
         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
@@ -78,7 +78,7 @@
         props.put(Message.MTOM_ENABLED, "true");
         sf.setProperties(props);
         sf.create();
-        
+
         EndpointInfo ei = new EndpointInfo(null, HTTP_ID);
         ei.setAddress(address);
 
@@ -141,11 +141,9 @@
         sf.setProperties(props);
         Server server = sf.create();
         server.getEndpoint().getService().getDataBinding().setMtomThreshold(0);
-        
-        servStatic(getClass().getResource("mtom-policy.xml"), 
-                   "http://localhost:9036/policy.xsd");
-        
 
+        servStatic(getClass().getResource("mtom-policy.xml"),
+                   "http://localhost:9036/policy.xsd");
 
         EndpointInfo ei = new EndpointInfo(null, HTTP_ID);
         ei.setAddress(address);
@@ -156,7 +154,7 @@
 
         TestMessageObserver obs = new TestMessageObserver();
         conduit.setMessageObserver(obs);
-        
+
         Message m = new MessageImpl();
         String ct = "multipart/related; type=\"application/xop+xml\"; "
                     + "start=\"<so...@xfire.codehaus.org>\"; "
@@ -177,7 +175,7 @@
         os.flush();
         is.close();
         os.close();
-        
+
         byte[] res = obs.getResponseStream().toByteArray();
         MessageImpl resMsg = new MessageImpl();
         resMsg.setContent(InputStream.class, new ByteArrayInputStream(res));
@@ -197,17 +195,33 @@
         assertTrue("Wrong size: " + out.size()
                    + "\n" + out.toString(),
                    out.size() > 970 && out.size() < 1020);
+        unregisterServStatic("http://localhost:9036/policy.xsd");
+
+    }
+
+    private void unregisterServStatic(String add) throws Exception {
+        Bus bus = getBus();
+        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+        DestinationFactory df = dfm
+            .getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
+
+        EndpointInfo ei = new EndpointInfo();
+        ei.setAddress(add);
+
+        Destination d = df.getDestination(ei);
+        d.setMessageObserver(null);
+
     }
 
     @Override
     protected Bus createBus() throws BusException {
         return BusFactory.getDefaultBus();
     }
-    
+
     /**
      * Serve static file
      */
-    private void servStatic(final URL resource, 
+    private void servStatic(final URL resource,
                                    final String add) throws Exception {
         Bus bus = getBus();
         DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);