You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/12/24 14:00:04 UTC
svn commit: r729306 - in
/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test:
java/org/apache/servicemix/cxfbc/ resources/org/apache/servicemix/cxfbc/
resources/org/apache/servicemix/cxfbc/ws/security/
Author: ffang
Date: Wed Dec 24 05:00:04 2008
New Revision: 729306
URL: http://svn.apache.org/viewvc?rev=729306&view=rev
Log:
[SM-1726]add wsdl-only configuration test
Added:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java (with props)
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml (with props)
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl (with props)
Added: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.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/CxfBcJmsTransactionWsdlConfigTest.java?rev=729306&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java (added)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java Wed Dec 24 05:00:04 2008
@@ -0,0 +1,209 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.ServerLauncher;
+import org.apache.hello_world_soap_http.BadRecordLitFault;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.HelloWorldService;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.apache.servicemix.jbi.container.SpringJBIContainer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class CxfBcJmsTransactionWsdlConfigTest extends SpringTestSupport {
+
+ protected static boolean serversStarted;
+ private ServerLauncher sl;
+ private ServerLauncher embeddedLauncher;
+ private ServerLauncher jmsLauncher;
+
+
+
+ public void startServers() throws Exception {
+ if (serversStarted) {
+ return;
+ }
+ Map<String, String> props = new HashMap<String, String>();
+ if (System.getProperty("activemq.store.dir") != null) {
+ props.put("activemq.store.dir", System.getProperty("activemq.store.dir"));
+ }
+ props.put("java.util.logging.config.file",
+ System.getProperty("java.util.logging.config.file"));
+
+ assertTrue("server did not launch correctly",
+ launchServer(EmbededJMSBrokerLauncher.class, props, false));
+ embeddedLauncher = sl;
+ assertTrue("server did not launch correctly",
+ launchServer(MyJMSServer.class, null, false));
+ jmsLauncher = sl;
+
+ serversStarted = true;
+ }
+
+ protected void setUp() throws Exception {
+ startServers();
+ //super.setUp();
+
+ }
+
+ public void setUpJBI(String beanFile) throws Exception {
+ if (context != null) {
+ context.refresh();
+ }
+ transformer = new SourceTransformer();
+ if (beanFile == null) {
+ context = createBeanFactory();
+ } else {
+ context = createBeanFactory(beanFile);
+ }
+
+ jbi = (SpringJBIContainer) context.getBean("jbi");
+ assertNotNull("JBI Container not found in spring!", jbi);
+ }
+
+ protected void tearDown() throws Exception {
+ try {
+ embeddedLauncher.stopServer();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("failed to stop server " + embeddedLauncher.getClass());
+ }
+ try {
+ jmsLauncher.stopServer();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("failed to stop server " + jmsLauncher.getClass());
+ }
+ serversStarted = false;
+ if (jbi != null) {
+ jbi.shutDown();
+ jbi.destroy();
+ jbi = null;
+ }
+ //to release the lock for txlog
+ Thread.sleep(3000);
+ }
+
+ 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 testJMSTransactionWsdlConfig() throws Exception {
+ setUpJBI("org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml");
+ jmsTestBase();
+ }
+
+ private void jmsTestBase() throws Exception, NoSuchCodeLitFault, BadRecordLitFault {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus testBus = bf.createBus("org/apache/servicemix/cxfbc/jms_test_timeout.xml");
+ BusFactory.setDefaultBus(testBus);
+
+ URL wsdl = getWSDLURL("org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl");
+
+ QName serviceName = getServiceName(new QName(
+ "http://apache.org/hello_world_soap_http", "HelloWorldService"));
+ QName portName = getPortName(new QName(
+ "http://apache.org/hello_world_soap_http", "HelloWorldPort"));
+
+ assertNotNull(wsdl);
+
+ HelloWorldService service = new HelloWorldService(wsdl, serviceName);
+ assertNotNull(service);
+
+ String response1 = new String("Hello ");
+ String response2 = new String("Bonjour");
+ try {
+ Greeter greeter = service.getPort(portName, Greeter.class);
+ String greeting = greeter.greetMe("transaction");
+ assertNotNull("no response received from service", greeting);
+ String exResponse = response1 + "transaction";
+ assertEquals(exResponse, greeting);
+
+ String reply = greeter.sayHi();
+ assertNotNull("no response received from service", reply);
+ assertEquals(response2, reply);
+ greeter.greetMeOneWay("test");
+ try {
+ greeter.testDocLitFault("BadRecordLitFault");
+ fail("Should have thrown BadRecoedLitFault");
+ } catch (BadRecordLitFault ex) {
+ assertNotNull(ex.getFaultInfo());
+ }
+
+ try {
+ greeter.testDocLitFault("NoSuchCodeLitFault");
+ fail("Should have thrown NoSuchCodeLitFault exception");
+ } catch (NoSuchCodeLitFault nslf) {
+ assertNotNull(nslf.getFaultInfo());
+ assertNotNull(nslf.getFaultInfo().getCode());
+ }
+
+ } catch (UndeclaredThrowableException ex) {
+ throw (Exception) ex.getCause();
+ }
+ }
+
+ @Override
+ protected AbstractXmlApplicationContext createBeanFactory() {
+ return new ClassPathXmlApplicationContext(
+ "org/apache/servicemix/cxfbc/jms_transport_transaction.xml");
+ }
+
+ protected AbstractXmlApplicationContext createBeanFactory(String beanFile) {
+ // load cxf se and bc from specified spring config file
+ return new ClassPathXmlApplicationContext(beanFile);
+ }
+
+ public QName getServiceName(QName q) {
+ return q;
+ }
+
+ public QName getPortName(QName q) {
+ return q;
+ }
+
+ public URL getWSDLURL(String s) throws Exception {
+ return CxfBcJmsTest.class.getClassLoader().getResource(s);
+ }
+
+}
Propchange: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.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/jms_transport_transaction_wsdl_config.xml?rev=729306&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml (added)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml Wed Dec 24 05:00:04 2008
@@ -0,0 +1,73 @@
+<?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:test="urn:test"
+ xmlns:greeter="http://apache.org/hello_world_soap_http"
+ >
+ <import resource="classpath:tx.xml" />
+ <sm:container id="jbi" embedded="true" transactionManager="#transactionManager">
+
+ <sm:endpoints>
+ <cxfbc:consumer wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl"
+ service="greeter:HelloWorldService"
+ endpoint="HelloWorldPort"
+ targetEndpoint="HelloWorldPortProxy"
+ targetService="greeter:HelloWorldService"
+ targetInterface="greeter:Greeter"
+ >
+ <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>
+ <cxfbc:provider wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl"
+ service="greeter:HelloWorldService"
+ endpoint="HelloWorldPortProxy"
+ interfaceName="greeter:Greetr"
+ busCfg="org/apache/servicemix/cxfbc/jms_test_timeout_provider.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:provider>
+
+ </sm:endpoints>
+ </sm:container>
+
+</beans>
Propchange: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl
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/hello_world_transaction.wsdl?rev=729306&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl (added)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl Wed Dec 24 05:00:04 2008
@@ -0,0 +1,65 @@
+<?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.
+-->
+<wsdl:definitions
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://apache.org/hello_world_soap_http"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:jms="http://cxf.apache.org/transports/jms"
+ targetNamespace="http://apache.org/hello_world_soap_http"
+ name="WSSecurity"
+ >
+
+ <wsdl:import
+ namespace="http://apache.org/hello_world_soap_http"
+ location="hello_world_base.wsdl"
+ />
+
+ <wsdl:service name="SOAPServiceWSSecurity">
+ <wsdl:port
+ name="TimestampSignEncrypt"
+ binding="tns:Greeter_SOAPBinding">
+ <soap:address location="http://localhost:9000/SOAPServiceWSSecurity/TimestampSignEncrypt"/>
+ </wsdl:port>
+ </wsdl:service>
+ <service name="HelloWorldService">
+ <port binding="tns:Greeter_SOAPBinding" name="HelloWorldPort">
+ <jms:address
+ jndiConnectionFactoryName="ConnectionFactory"
+ jndiDestinationName="dynamicQueues/test.jmstransport.text"> <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
+ <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
+ </jms:address>
+
+ <jms:server durableSubscriberName="CXF_subscriber" transactional="true"/>
+ </port>
+ <port binding="tns:Greeter_SOAPBinding" name="HelloWorldPortProxy">
+ <jms:address
+ jndiConnectionFactoryName="ConnectionFactory" jndiDestinationName="dynamicQueues/test.jmstransport.text.provider"> <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
+ <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
+ </jms:address>
+
+ <jms:server durableSubscriberName="CXF_subscriber"/>
+ </port>
+ </service>
+
+
+
+</wsdl:definitions>
+
Propchange: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl
------------------------------------------------------------------------------
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/hello_world_transaction.wsdl
------------------------------------------------------------------------------
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/hello_world_transaction.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml