Author: ffang
Date: Thu Jul 3 21:38:24 2008
New Revision: 673902
URL: http://svn.apache.org/viewvc?rev=673902&view=rev
Log:
[SM-1422]Jetty engine not stopped when CXF BC is undeployed
Added:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcHttpsConsumerTest.java
(with props)
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml
(with props)
Modified:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Modified:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL:
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=673902&r1=673901&r2=673902&view=diff
==============================================================================
---
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(original)
+++
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Thu Jul 3 21:38:24 2008
@@ -146,6 +146,9 @@
private int timeout = 10;
private boolean useJBIWrapper = true;
+
+
+ private EndpointInfo ei;
/**
* @return the wsdl
@@ -228,6 +231,10 @@
@Override
public void stop() throws Exception {
server.stop();
+ if (ei.getAddress().startsWith("https")) {
+ bus.shutdown(false);
+ bus = null;
+ }
super.stop();
}
@@ -253,7 +260,7 @@
Service cxfService = factory.create();
- EndpointInfo ei = cxfService.getServiceInfos().iterator().next()
+ ei = cxfService.getServiceInfos().iterator().next()
.getEndpoints().iterator().next();
for (ServiceInfo serviceInfo : cxfService.getServiceInfos()) {
if (serviceInfo.getName().equals(service)
@@ -345,7 +352,6 @@
chain = new JbiChainInitiationObserver(ep, getBus());
server = new ServerImpl(getBus(), ep, null, chain);
-
super.validate();
} catch (DeploymentException e) {
throw e;
Added:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcHttpsConsumerTest.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/security/CxfBcHttpsConsumerTest.java?rev=673902&view=auto
==============================================================================
---
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcHttpsConsumerTest.java
(added)
+++
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcHttpsConsumerTest.java
Thu Jul 3 21:38:24 2008
@@ -0,0 +1,95 @@
+/*
+ * 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.security;
+
+
+
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.servicemix.cxfbc.CxfBcComponent;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class CxfBcHttpsConsumerTest extends SpringTestSupport {
+
+ private static final java.net.URL WSDL_LOC;
+ static {
+ java.net.URL tmp = null;
+ try {
+ tmp = CxfBCSecurityTest.class.getClassLoader().getResource(
+ "org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl"
+ );
+ } catch (final Exception e) {
+ e.printStackTrace();
+ }
+ WSDL_LOC = tmp;
+ }
+
+ public void testHttps() throws Exception {
+
+ Bus bus = new SpringBusFactory().createBus(
+
"org/apache/servicemix/cxfbc/ws/security/provider/WibbleClient.xml");
+ BusFactory.setDefaultBus(bus);
+ LoggingInInterceptor in = new LoggingInInterceptor();
+ bus.getInInterceptors().add(in);
+ bus.getInFaultInterceptors().add(in);
+ LoggingOutInterceptor out = new LoggingOutInterceptor();
+ bus.getOutInterceptors().add(out);
+ bus.getOutFaultInterceptors().add(out);
+ final javax.xml.ws.Service svc = javax.xml.ws.Service.create(WSDL_LOC,
+ new javax.xml.namespace.QName(
+ "http://apache.org/hello_world_soap_http",
+ "SOAPServiceWSSecurity"));
+ svc.addPort(new javax.xml.namespace.QName(
+ "http://apache.org/hello_world_soap_http",
+ "TimestampSignEncrypt"), SOAPBinding.SOAP11HTTP_BINDING,
+ "https://localhost:9001/SoapContext/SoapPort");
+ final Greeter greeter = svc.getPort(new javax.xml.namespace.QName(
+ "http://apache.org/hello_world_soap_http",
+ "TimestampSignEncrypt"), Greeter.class);
+ String ret = greeter.sayHi();
+ assertEquals(ret, "Bonjour");
+ ret = greeter.greetMe("ffang");
+ assertEquals(ret, "Hello ffang");
+
+ //test redeploy
+ CxfBcComponent component = (CxfBcComponent)
jbi.getComponent("servicemix-cxfbc").getComponent();
+ component.getServiceUnitManager().stop("#default#");
+ component.getServiceUnitManager().shutDown("#default#");
+ Thread.sleep(10000);
+ component.getServiceUnitManager().init("#default#", null);
+ component.getServiceUnitManager().start("#default#");
+ ret = greeter.sayHi();
+ assertEquals(ret, "Bonjour");
+ ret = greeter.greetMe("ffang");
+ assertEquals(ret, "Hello ffang");
+ }
+
+ @Override
+ protected AbstractXmlApplicationContext createBeanFactory() {
+ return new ClassPathXmlApplicationContext(
+ "org/apache/servicemix/cxfbc/ws/security/xbean-https.xml");
+ }
+
+}
Propchange:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcHttpsConsumerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcHttpsConsumerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml
URL:
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml?rev=673902&view=auto
==============================================================================
---
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml
(added)
+++
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml
Thu Jul 3 21:38:24 2008
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
+ xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
+ xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
+ xmlns:greeter="http://apache.org/hello_world_soap_http">
+
+ <sm:container id="jbi" embedded="true">
+
+ <sm:endpoints>
+ <cxfse:endpoint>
+ <cxfse:pojo>
+ <bean class="org.apache.servicemix.cxfbc.ws.security.GreeterImpl" />
+ </cxfse:pojo>
+ <cxfse:inInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfse:inInterceptors>
+ <cxfse:outInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfse:outInterceptors>
+ <cxfse:inFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfse:inFaultInterceptors>
+ <cxfse:outFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfse:outFaultInterceptors>
+ </cxfse:endpoint>
+ <cxfbc:consumer
wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl"
+ targetEndpoint="TimestampSignEncrypt"
+ targetService="greeter:SOAPServiceWSSecurity"
+ targetInterface="greeter:Greeter"
+ locationURI="https://localhost:9001/SoapContext/SoapPort"
+
busCfg="org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml"
+ >
+ <cxfbc:inInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inInterceptors>
+ <cxfbc:outInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outInterceptors>
+ <cxfbc:inFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inFaultInterceptors>
+ <cxfbc:outFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outFaultInterceptors>
+ </cxfbc:consumer>
+ </sm:endpoints>
+
+ </sm:container>
+
+
+</beans>
Propchange:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml