You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2017/08/17 20:37:55 UTC

cxf git commit: Fix/remove some @Ignored tests, speed up wsn-core tests

Repository: cxf
Updated Branches:
  refs/heads/master 0de14168b -> 9890add2c


Fix/remove some @Ignored tests, speed up wsn-core tests


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9890add2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9890add2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9890add2

Branch: refs/heads/master
Commit: 9890add2c3ed5682a97f117ec547fcf1130dc21f
Parents: 0de1416
Author: Daniel Kulp <dk...@apache.org>
Authored: Thu Aug 17 16:37:29 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Thu Aug 17 16:37:29 2017 -0400

----------------------------------------------------------------------
 .../cxf/jaxws/ConfiguredEndpointTest.java       |  43 +----
 .../apache/cxf/jaxws/EndpointReferenceTest.java |   2 -
 .../apache/cxf/jaxws/ws/PolicyFeatureTest.java  | 163 -------------------
 .../org/apache/cxf/wsn/jms/JmsSubscription.java |   2 +-
 .../java/org/apache/cxf/wsn/WsnBrokerTest.java  |  11 +-
 .../org/apache/cxf/test/AbstractCXFTest.java    |   3 +-
 .../cxf/tools/common/dom/DocumentTest.java      |  33 ----
 .../cxf/tools/wsdlto/jaxws/CodeGenBugTest.java  |  30 ++--
 8 files changed, 26 insertions(+), 261 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9890add2/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java
index 5675864..42a3b55 100644
--- a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java
+++ b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java
@@ -47,7 +47,6 @@ import org.apache.hello_world_soap_http.GreeterImpl;
 import org.apache.hello_world_soap_http.SOAPService;
 import org.junit.After;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class ConfiguredEndpointTest extends Assert {
@@ -130,20 +129,6 @@ public class ConfiguredEndpointTest extends Assert {
     }
 
     @Test
-    @Ignore
-    public void testCXFConfiguredClientEndpoint() {
-        CXFBusFactory cf = new CXFBusFactory();
-        factory = cf;
-        BusFactory.setDefaultBus(null);
-        Map<String, Object> properties = new HashMap<>();
-        properties.put(Configurer.USER_CFG_FILE_PROPERTY_NAME,
-            "org/apache/cxf/jaxws/configured-endpoints.xml");
-        BusFactory.setDefaultBus(cf.createBus(null, properties));
-        System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, CXFBusFactory.class.getName());
-        doTestConfiguredClientEndpoint();
-    }
-
-    @Test
     public void testSpringConfiguredClientEndpoint() {
         SpringBusFactory sf = new SpringBusFactory();
         factory = sf;
@@ -161,42 +146,23 @@ public class ConfiguredEndpointTest extends Assert {
         JaxWsClientProxy eih = (JaxWsClientProxy)Proxy.getInvocationHandler(greeter);
         Client client = eih.getClient();
         JaxWsEndpointImpl endpoint = (JaxWsEndpointImpl)client.getEndpoint();
-//      The service shouldn't pick up the <jaxws:endpoint>...
-//        assertEquals("Unexpected bean name", PORT_NAME.toString() + ".endpoint", endpoint.getBeanName());
-//        // assertTrue("Unexpected value for property validating", endpoint.getValidating());
-//        List<Interceptor> interceptors = endpoint.getInInterceptors();
-//        assertEquals("Unexpected number of interceptors.", 1, interceptors.size());
-//        assertEquals("Unexpected interceptor id.", "endpoint-in",
-//                     findTestInterceptor(interceptors).getId());
-//        interceptors = endpoint.getOutInterceptors();
-//        assertEquals("Unexpected number of interceptors.", 1, interceptors.size());
-//        assertEquals("Unexpected interceptor id.", "endpoint-out",
-//                     findTestInterceptor(interceptors).getId());
-//        interceptors = endpoint.getInFaultInterceptors();
-//        assertEquals("Unexpected number of interceptors.", 1, interceptors.size());
-//        assertEquals("Unexpected interceptor id.", "endpoint-in-fault",
-//                     findTestInterceptor(interceptors).getId());
-//        interceptors = endpoint.getOutFaultInterceptors();
-//        assertEquals("Unexpected number of interceptors.", 1, interceptors.size());
-//        assertEquals("Unexpected interceptor id.", "endpoint-out-fault",
-//                     findTestInterceptor(interceptors).getId());
 
         org.apache.cxf.service.ServiceImpl svc = (org.apache.cxf.service.ServiceImpl)endpoint.getService();
         assertEquals("Unexpected bean name.", SERVICE_NAME.toString(), svc.getBeanName());
         List<Interceptor<? extends Message>> interceptors = svc.getInInterceptors();
-        assertEquals("Unexpected number of interceptors.", 1, interceptors.size());
+        assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
         assertEquals("Unexpected interceptor id.", "service-in",
                      findTestInterceptor(interceptors).getId());
         interceptors = svc.getOutInterceptors();
-        assertEquals("Unexpected number of interceptors.", 1, interceptors.size());
+        assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
         assertEquals("Unexpected interceptor id.", "service-out",
                      findTestInterceptor(interceptors).getId());
         interceptors = svc.getInFaultInterceptors();
-        assertEquals("Unexpected number of interceptors.", 1, interceptors.size());
+        assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
         assertEquals("Unexpected interceptor id.", "service-in-fault",
                      findTestInterceptor(interceptors).getId());
         interceptors = svc.getOutFaultInterceptors();
-        assertEquals("Unexpected number of interceptors.", 1, interceptors.size());
+        assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
         assertEquals("Unexpected interceptor id.", "service-out-fault",
                      findTestInterceptor(interceptors).getId());
     }
@@ -254,7 +220,6 @@ public class ConfiguredEndpointTest extends Assert {
     }
 
     @Test
-    @Ignore
     public void xtestCXFConfiguredServerEndpoint() {
         CXFBusFactory cf = new CXFBusFactory();
         factory = cf;

http://git-wip-us.apache.org/repos/asf/cxf/blob/9890add2/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java
index 6d37462..cf197b1 100644
--- a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java
+++ b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java
@@ -43,7 +43,6 @@ import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.GreeterImpl;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class EndpointReferenceTest extends AbstractJaxWsTest {
@@ -185,7 +184,6 @@ public class EndpointReferenceTest extends AbstractJaxWsTest {
     }
 
     @Test
-    @Ignore("Not implemented yet")
     public void testEndpointGetEndpointReferenceXMLBinding() throws Exception {
         org.apache.hello_world_xml_http.bare.Greeter greeter =
             new org.apache.hello_world_xml_http.bare.GreeterImpl();

http://git-wip-us.apache.org/repos/asf/cxf/blob/9890add2/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyFeatureTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyFeatureTest.java b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyFeatureTest.java
deleted file mode 100644
index 99a867f..0000000
--- a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyFeatureTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * 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.cxf.jaxws.ws;
-
-import java.util.List;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.CXFBusFactory;
-import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.configuration.Configurer;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.feature.Feature;
-import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.ws.policy.PolicyEngine;
-import org.apache.cxf.ws.policy.PolicyEngineImpl;
-import org.apache.cxf.ws.policy.WSPolicyFeature;
-import org.apache.hello_world_soap_http.GreeterImpl;
-import org.apache.neethi.Policy;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
-@Ignore
-public class PolicyFeatureTest extends Assert {
-    private Bus bus;
-    @After
-    public void tearDown() {
-        bus.shutdown(true);
-        BusFactory.setDefaultBus(null);
-    }
-
-    @Test
-    public void testServerFactory() {
-        bus = new CXFBusFactory().createBus();
-        PolicyEngineImpl pei = new PolicyEngineImpl();
-        bus.setExtension(pei, PolicyEngine.class);
-        pei.setBus(bus);
-
-        Policy p = new Policy();
-        p.setId("test");
-
-        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
-        sf.getFeatures().add(new WSPolicyFeature(p));
-        sf.setServiceBean(new GreeterImpl());
-        sf.setAddress("http://localhost/test");
-        sf.setStart(false);
-        sf.setBus(bus);
-        Server server = sf.create();
-
-        List<ServiceInfo> sis = server.getEndpoint().getService().getServiceInfos();
-        ServiceInfo info = sis.get(0);
-
-        Policy p2 = info.getExtensor(Policy.class);
-        assertEquals(p, p2);
-    }
-
-
-    @Test
-    public void testServerFactoryWith2007Xml() {
-        bus = new SpringBusFactory().createBus("/org/apache/cxf/jaxws/ws/server.xml");
-
-        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
-        sf.setServiceBean(new GreeterImpl());
-        sf.setAddress("http://localhost/test");
-
-        sf.setBus(bus);
-
-        Configurer c = bus.getExtension(Configurer.class);
-        c.configureBean("test", sf);
-        sf.setStart(false);
-
-        List<Feature> features = sf.getFeatures();
-        assertEquals(1, features.size());
-
-        Server server = sf.create();
-
-        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
-        assertNotNull(pe);
-
-        List<ServiceInfo> sis = server.getEndpoint().getService().getServiceInfos();
-        ServiceInfo info = sis.get(0);
-
-        Policy p2 = info.getExtensor(Policy.class);
-        assertNotNull(p2);
-    }
-
-    @Test
-    public void testServerFactoryWith2004Xml() {
-        bus =
-            new SpringBusFactory().createBus("/org/apache/cxf/jaxws/ws/server.xml");
-
-        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
-        sf.setServiceBean(new GreeterImpl());
-        sf.setAddress("http://localhost/test");
-        sf.setBus(bus);
-
-        Configurer c = bus.getExtension(Configurer.class);
-        c.configureBean("test2004", sf);
-
-        List<? extends Feature> features = sf.getFeatures();
-        assertEquals(1, features.size());
-        sf.setStart(false);
-
-        Server server = sf.create();
-
-        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
-        assertNotNull(pe);
-
-        List<ServiceInfo> sis = server.getEndpoint().getService().getServiceInfos();
-        ServiceInfo info = sis.get(0);
-
-        Policy p2 = info.getExtensor(Policy.class);
-        assertNotNull(p2);
-    }
-
-    @Test
-    public void testPolicyReference() {
-        bus =
-            new SpringBusFactory().createBus("/org/apache/cxf/jaxws/ws/server.xml");
-
-        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
-        sf.setServiceBean(new GreeterImpl());
-        sf.setAddress("http://localhost/test");
-        sf.setBus(bus);
-
-        Configurer c = bus.getExtension(Configurer.class);
-        c.configureBean("testExternal", sf);
-
-        List<Feature> features = sf.getFeatures();
-        assertEquals(1, features.size());
-        sf.setStart(false);
-        Server server = sf.create();
-
-        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
-        assertNotNull(pe);
-
-        List<ServiceInfo> sis = server.getEndpoint().getService().getServiceInfos();
-        ServiceInfo info = sis.get(0);
-
-        Policy p = info.getExtensor(Policy.class);
-        assertNotNull(p);
-        assertEquals("External", p.getId());
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/9890add2/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java
----------------------------------------------------------------------
diff --git a/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java b/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java
index a49aa5d..b1a55ab 100644
--- a/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java
+++ b/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java
@@ -283,7 +283,7 @@ public abstract class JmsSubscription extends AbstractSubscription implements Me
                     }
                 }
                 try {
-                    Thread.sleep(10000); // check if should terminate every 10 sec
+                    Thread.sleep(2000); // check if should terminate every 2 sec
                 } catch (InterruptedException e) {
                     LOGGER.log(Level.WARNING, "TerminationThread sleep interrupted", e);
                 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/9890add2/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java
----------------------------------------------------------------------
diff --git a/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java b/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java
index 6836d9c..f828aa1 100644
--- a/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java
+++ b/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java
@@ -152,15 +152,16 @@ public abstract class WsnBrokerTest extends Assert {
         TestConsumer callback = new TestConsumer();
         Consumer consumer = new Consumer(callback, "http://localhost:" + port2 + "/test/consumer");
 
-        //create subscription with InitialTerminationTime 20 sec, so that the
-        //subscription would be expired after 20 sec
-        Subscription subscription = notificationBroker.subscribe(consumer, "myTopic", null, false, "PT20S");
-        Thread.sleep(30000);
+        //create subscription with InitialTerminationTime 2 sec, so that the
+        //subscription would be expired after 2 sec
+        Subscription subscription = notificationBroker.subscribe(consumer, "myTopic", null, false, "PT02S");
+        Thread.sleep(5000);
         synchronized (callback.notifications) {
+            System.out.println("send notify");
             notificationBroker.notify("myTopic",
                                       new JAXBElement<String>(new QName("urn:test:org", "foo"),
                                           String.class, "bar"));
-            callback.notifications.wait(10000);
+            callback.notifications.wait(2000);
         }
         assertEquals(0, callback.notifications.size()); //the subscription is expired so can't get the notification
         subscription.renew("PT60S"); //renew another 60 sec to resend the notification

http://git-wip-us.apache.org/repos/asf/cxf/blob/9890add2/testutils/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
----------------------------------------------------------------------
diff --git a/testutils/src/main/java/org/apache/cxf/test/AbstractCXFTest.java b/testutils/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
index 2cf498c..787936a 100644
--- a/testutils/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
+++ b/testutils/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
@@ -47,8 +47,7 @@ import org.junit.Before;
  * A basic test case meant for helping users unit test their services.
  * @see TestUtilities
  */
-@org.junit.Ignore
-public class AbstractCXFTest extends Assert {
+public abstract class AbstractCXFTest extends Assert {
 
     protected TestUtilities testUtilities;
     protected Bus bus;

http://git-wip-us.apache.org/repos/asf/cxf/blob/9890add2/tools/common/src/test/java/org/apache/cxf/tools/common/dom/DocumentTest.java
----------------------------------------------------------------------
diff --git a/tools/common/src/test/java/org/apache/cxf/tools/common/dom/DocumentTest.java b/tools/common/src/test/java/org/apache/cxf/tools/common/dom/DocumentTest.java
deleted file mode 100644
index 9198db8..0000000
--- a/tools/common/src/test/java/org/apache/cxf/tools/common/dom/DocumentTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.cxf.tools.common.dom;
-
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DocumentTest extends Assert {
-
-    @Test
-    @Ignore
-    public void testDocument() {
-        // fail("There are no tests in xutil.dom, put some in!!");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/9890add2/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
index 6386eb1..1e78b75 100644
--- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
+++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
@@ -485,26 +485,24 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         assertFalse(orginal.exists());
     }
 
-    // @Ignore'd due to continually failing on Jenkins
     @Test
-    @org.junit.Ignore
     public void testHelloWorldExternalBindingFile() throws Exception {
         Server server = new Server(0);
-
-        ResourceHandler reshandler = new ResourceHandler();
-        reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
-        // this is the only handler we're supposed to need, so we don't need to
-        // 'add' it.
-        server.setHandler(reshandler);
-        server.start();
-        int port = ((NetworkConnector)server.getConnectors()[0]).getLocalPort();
-        env.put(ToolConstants.CFG_WSDLURL, "http://localhost:"
-            + port + "/hello_world.wsdl");
-        env.put(ToolConstants.CFG_BINDING, "http://localhost:"
-            + port + "/remote-hello_world_binding.xsd");
-        processor.setContext(env);
-        processor.execute();
         try {
+            ResourceHandler reshandler = new ResourceHandler();
+            reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
+            // this is the only handler we're supposed to need, so we don't need to
+            // 'add' it.
+            server.setHandler(reshandler);
+            server.start();
+            Thread.sleep(250); //give network connector a little time to spin up
+            int port = ((NetworkConnector)server.getConnectors()[0]).getLocalPort();
+            env.put(ToolConstants.CFG_WSDLURL, "http://localhost:"
+                + port + "/hello_world.wsdl");
+            env.put(ToolConstants.CFG_BINDING, "http://localhost:"
+                + port + "/remote-hello_world_binding.xsd");
+            processor.setContext(env);
+            processor.execute();
             reshandler.stop();
         } finally {
             server.stop();