servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r796613 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy: CxfBCPolicyTest.java JBIServer.java
Date Wed, 22 Jul 2009 04:33:56 GMT
Author: ffang
Date: Wed Jul 22 04:33:56 2009
New Revision: 796613

URL: http://svn.apache.org/viewvc?rev=796613&view=rev
Log:
[SMXCOMP-596]CxfBCPolicyTest intermittently failed on some box

Added:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/JBIServer.java
Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java?rev=796613&r1=796612&r2=796613&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java
Wed Jul 22 04:33:56 2009
@@ -16,11 +16,15 @@
  */
 package org.apache.servicemix.cxfbc.ws.policy;
 
+import java.io.IOException;
 import java.net.URL;
+import java.util.Map;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
 
+import junit.framework.TestCase;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
@@ -32,14 +36,57 @@
 import org.apache.cxf.greeter_control.PingMeFault;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
-import org.apache.servicemix.tck.SpringTestSupport;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.cxf.testutil.common.ServerLauncher;
+
 
-public class CxfBCPolicyTest extends SpringTestSupport {
+public class CxfBCPolicyTest extends TestCase {
 
     private static final Logger LOG = LogUtils.getL7dLogger(CxfBCPolicyTest.class);
+    private static boolean serversStarted;
+    private ServerLauncher sl;
+    
+    public void startJBIContainers() throws Exception {
+        if (serversStarted) {
+            return;
+        }
+        
+        assertTrue("JBIContainers did not launch correctly", 
+                launchServer(JBIServer.class, null, false));
+       
+        
+        serversStarted = true;
+    }
+    
+    protected void setUp() throws Exception {
+        startJBIContainers();
+    }
+    
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        try {
+            sl.stopServer();         
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            fail("failed to stop jbi container " + sl.getClass());
+        } 
+        serversStarted = false;
+    }
 
+    public boolean launchServer(Class<?> clz, Map<String, String> p, boolean
inProcess) {
+        boolean ok = false;
+        try { 
+            sl = new ServerLauncher(clz.getName(), p, null, inProcess);
+            ok = sl.launchServer();
+            assertTrue("server failed to launch", ok);
+            
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            fail("failed to launch server " + clz);
+        }
+        
+        return ok;
+    }
+    
     public void testUsingAddressing() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
         Bus bus = bf
@@ -88,12 +135,5 @@
         }
     }
 
-    @Override
-    protected AbstractXmlApplicationContext createBeanFactory() {
-        // load cxf se and bc from spring config file
-        return new ClassPathXmlApplicationContext(
-                "org/apache/servicemix/cxfbc/ws/policy/xbean.xml");
-
-    }
-
+    
 }

Added: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/JBIServer.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/JBIServer.java?rev=796613&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/JBIServer.java
(added)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/JBIServer.java
Wed Jul 22 04:33:56 2009
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.servicemix.cxfbc.ws.policy;
+
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.servicemix.jbi.container.SpringJBIContainer;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class JBIServer extends AbstractBusTestServerBase {
+    
+    protected AbstractXmlApplicationContext context;
+
+    protected SpringJBIContainer jbi;
+    
+    public static void main(String[] args) {
+        new JBIServer().start();
+    }
+    
+  
+    
+   
+    
+    protected AbstractXmlApplicationContext createBeanFactory() {
+        // load cxf se and bc from spring config file
+        return new ClassPathXmlApplicationContext(
+                "org/apache/servicemix/cxfbc/ws/policy/xbean.xml");
+
+    }
+
+    @Override
+    protected void run() {
+        context = createBeanFactory();
+        jbi = (SpringJBIContainer) context.getBean("jbi");
+        
+    }
+
+
+}



Mime
View raw message