Author: alessio.soldano(a)jboss.com
Date: 2012-04-03 09:02:57 -0400 (Tue, 03 Apr 2012)
New Revision: 16084
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/ClientSpringAppTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Endpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/EndpointImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Foo.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Helper.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/my-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/spring-dd.xml
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/pom.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
Log:
[JBWS-3478] Adding testcase for checking jbossws-cxf functionalities when Spring is
available in user app
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/pom.xml 2012-04-03 11:31:39 UTC (rev
16083)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/pom.xml 2012-04-03 13:02:57 UTC (rev
16084)
@@ -14,6 +14,12 @@
<relativePath>../pom.xml</relativePath>
</parent>
+ <properties>
+ <!-- This is used for test archives embedding Spring and is intentionally
different from the
+ version specified in the jbossws-cxf main pom.xml to test there're no
classloading clashes -->
+ <test.spring.version>3.0.3.RELEASE</test.spring.version>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.jboss.ws.cxf</groupId>
@@ -97,6 +103,49 @@
</execution>
</executions>
</plugin>
+ <plugin> <!-- This downloads and copies some Spring libs into
target/spring to be later picked up and included in some test jars -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-spring</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-asm</artifactId>
+ <version>${test.spring.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${test.spring.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${test.spring.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${test.spring.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-expression</artifactId>
+ <version>${test.spring.version}</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>target/spring</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</profile>
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2012-04-03
11:31:39 UTC (rev 16083)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2012-04-03
13:02:57 UTC (rev 16084)
@@ -225,6 +225,31 @@
</webinf>
</war>
+ <!-- jaxws-cxf-spring -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-cxf-spring.war"
needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/cxf/spring/Endpoint*.class"/>
+ </classes>
+ </war>
+ <war warfile="${tests.output.dir}/test-libs/jaxws-cxf-spring-client.war"
needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/cxf/spring/Helper*.class"/>
+ <include
name="org/jboss/test/ws/jaxws/cxf/spring/Endpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/cxf/spring/Foo.class"/>
+ <include name="org/jboss/wsf/test/TestServlet.class"/>
+ <include name="org/jboss/wsf/test/ClientHelper.class"/>
+ </classes>
+ <zipfileset
+ dir="${tests.output.dir}/test-resources/jaxws/cxf/spring/"
+ prefix="WEB-INF/classes/"/>
+ <zipfileset
+ dir="${tests.output.dir}/spring/"
+ prefix="WEB-INF/lib/"/>
+ <manifest>
+ <attribute name="Dependencies"
value="org.jboss.ws.cxf.jbossws-cxf-client services"/>
+ </manifest>
+ </war>
+
<!-- saaj-soap-connection -->
<war
warfile="${tests.output.dir}/test-libs/saaj-soap-connection.war"
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/ClientSpringAppTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/ClientSpringAppTestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/ClientSpringAppTestCase.java 2012-04-03
13:02:57 UTC (rev 16084)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.spring;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * An application embedding Spring jars acts as a client to an existing WS endpoint.
+ * This testcase verifies the spring availability in the app does not badly affect ws
functionalities.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 02-Apr-2012
+ */
+public final class ClientSpringAppTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSCXFTestSetup(ClientSpringAppTestCase.class,
"jaxws-cxf-spring-client.war, jaxws-cxf-spring.war");
+ }
+
+ public void testSpringAvailability() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testSpringAvailability",
Helper.class.getName()));
+ }
+
+ public void testJBossWSCXFBus() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testJBossWSCXFBus",
Helper.class.getName()));
+ }
+
+ public void testJBossWSCXFSpringBus() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testJBossWSCXFSpringBus",
Helper.class.getName()));
+ }
+
+ public void testJAXWSClient() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testJAXWSClient",
Helper.class.getName()));
+ }
+
+ public void testSpringFunctionalities() throws Exception
+ {
+ assertEquals("1",
runTestInContainer("testSpringFunctionalities", Helper.class.getName()));
+ }
+
+ private String runTestInContainer(String test, String helper) throws Exception
+ {
+ URL url = new URL("http://" + getServerHost() +
":8080/jaxws-cxf-spring-client?path=/jaxws-cxf-spring&method="
+ + test + "&helper=" + helper);
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ return br.readLine();
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Endpoint.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Endpoint.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Endpoint.java 2012-04-03
13:02:57 UTC (rev 16084)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.spring;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name = "Endpoint", targetNamespace =
"http://ws.jboss.org/spring")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Endpoint
+{
+ public String echo(final String message);
+
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/EndpointImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/EndpointImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/EndpointImpl.java 2012-04-03
13:02:57 UTC (rev 16084)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.spring;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.servlet.annotation.WebServlet;
+
+@WebService(name = "Endpoint", serviceName = "EndpointService",
targetNamespace = "http://org.jboss.ws/spring", endpointInterface =
"org.jboss.test.ws.jaxws.cxf.spring.Endpoint")
+@WebServlet(name = "WSServlet", urlPatterns = "/*")
+public class EndpointImpl implements Endpoint
+{
+ @WebMethod
+ public String echo(String input)
+ {
+ return input;
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Foo.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Foo.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Foo.java 2012-04-03
13:02:57 UTC (rev 16084)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.spring;
+
+public class Foo
+{
+
+ private String message;
+
+ public Foo()
+ {
+
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Helper.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Helper.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/spring/Helper.java 2012-04-03
13:02:57 UTC (rev 16084)
@@ -0,0 +1,242 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.spring;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.configuration.Configurer;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
+import org.jboss.wsf.stack.cxf.client.util.SpringUtils;
+import org.jboss.wsf.test.ClientHelper;
+
+/**
+ * Helper for performing various checks on Spring effects over the JBossWS-CXF
integration when available in user applications.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 02-Apr-2012
+ *
+ */
+public class Helper implements ClientHelper
+{
+ private String targetEndpoint;
+ private final boolean springInAS =
SpringUtils.isSpringAvailable(ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
+
+ @Override
+ public void setTargetEndpoint(String address)
+ {
+ targetEndpoint = address;
+ }
+
+ /**
+ * Verify the web app classloader 'sees' Spring (i.e. Spring jars are in the
web app)
+ *
+ * @return
+ */
+ public boolean testSpringAvailability()
+ {
+ return
SpringUtils.isSpringAvailable(Thread.currentThread().getContextClassLoader());
+ }
+
+ /**
+ * Verify the BusFactory.newInstance() still return the JBossWS-CXF version of
BusFactory
+ * (the web app has a dependency on jbossws-cxf-client) and that still create a plain
bus
+ * version, without being fooled by the Spring availability in the TCCL when Spring is
not
+ * installed in the AS.
+ *
+ * @return
+ */
+ public boolean testJBossWSCXFBus()
+ {
+ BusFactory factory = BusFactory.newInstance();
+ if (!(factory instanceof JBossWSBusFactory))
+ {
+ throw new RuntimeException("Expected JBossWSBusFactory");
+ }
+ Bus bus = null;
+ try
+ {
+ if (springInAS) {
+ bus = factory.createBus();
+ //the created bus should not be a SpringBus, as there's no spring
descriptor involved
+ return !isSpringBus(bus);
+ }
+ else
+ {
+ //set Configurer.USER_CFG_FILE_PROPERTY_NAME so that if the SpringBusFactory
is
+ //internally erroneously used, that won't fallback delegating to the non
Spring
+ //one, which would shade the issue
+ final String prop =
System.getProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME);
+ try
+ {
+ System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME,
"unexistentfile.xml");
+ bus = factory.createBus();
+ //the created bus should not be a SpringBus, as the classloader for CXF
has no visibility over the deployment spring jars
+ return !isSpringBus(bus);
+ }
+ finally
+ {
+ if (prop == null)
+ {
+ System.clearProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME);
+ }
+ else
+ {
+ System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME, prop);
+ }
+ }
+ }
+ }
+ finally
+ {
+ if (bus != null)
+ {
+ bus.shutdown(true);
+ }
+ }
+ }
+
+ /**
+ * Verify a Spring version of the Bus is created when actually required
+ * and Spring is installed on the AS (the creation process is expected
+ * to fail if Spring is not installed on the AS)
+ *
+ * @return
+ */
+ public boolean testJBossWSCXFSpringBus()
+ {
+ File f =
copy(Thread.currentThread().getContextClassLoader().getResourceAsStream("my-cxf.xml"));
+ BusFactory factory = BusFactory.newInstance();
+ if (!(factory instanceof JBossWSBusFactory))
+ {
+ throw new RuntimeException("Expected JBossWSBusFactory");
+ }
+ Bus bus = null;
+ try
+ {
+ bus = ((JBossWSBusFactory) factory).createBus(f.getAbsolutePath());
+ //check the created Bus is a SpringBus and we have Spring installed on AS (if
it's not installed, this *must* fail)
+ return springInAS && isSpringBus(bus);
+ }
+ catch (Throwable t)
+ {
+ if (!springInAS && (t instanceof NoClassDefFoundError) &&
t.getMessage().contains("org/springframework"))
+ {
+ //Spring is not installed on AS, so the SpringBus can't be created -
fine
+ return true;
+ }
+ else
+ {
+ throw new RuntimeException(t);
+ }
+ }
+ finally
+ {
+ if (bus != null)
+ {
+ bus.shutdown(true);
+ }
+ if (f != null) {
+ f.delete();
+ }
+ }
+ }
+
+ /**
+ * Verify a JAXWS client can be properly created and used to invoke a ws endpoint
+ *
+ * @return
+ * @throws Exception
+ */
+ public boolean testJAXWSClient() throws Exception
+ {
+ Bus bus = BusFactory.newInstance().createBus();
+ try
+ {
+ BusFactory.setThreadDefaultBus(bus);
+
+ URL wsdlURL = new URL(targetEndpoint + "?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/spring",
"EndpointService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint) service.getPort(Endpoint.class);
+ return "Hello".equals(port.echo("Hello"));
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ }
+
+ private static boolean isSpringBus(Bus bus) {
+ //avoid compile/runtime Spring dependency for the check only
+ return
"org.apache.cxf.bus.spring.SpringBus".equals(bus.getClass().getName());
+ }
+
+ private static File copy(InputStream inputStream)
+ {
+ try
+ {
+ File f = File.createTempFile("jbws-cxf-testsuite", ".xml");
+ OutputStream out = new FileOutputStream(f);
+ byte buf[] = new byte[1024];
+ int len;
+ while ((len = inputStream.read(buf)) > 0)
+ {
+ out.write(buf, 0, len);
+ }
+ out.close();
+ inputStream.close();
+ return f;
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean testSpringFunctionalities() throws Exception
+ {
+ //use reflection to avoid compile Spring dependency (this test is to be run within
the non-spring testsuite too,
+ //the Spring classes are coming from the jars included in the app on server side)
+ URL url =
Thread.currentThread().getContextClassLoader().getResource("spring-dd.xml");
+ Class<?> cpXmlAppCtxClass =
Class.forName("org.springframework.context.support.ClassPathXmlApplicationContext");
+ Constructor<?> cons = cpXmlAppCtxClass.getConstructor(String.class);
+ Object applicationContext = cons.newInstance(url.toString());
+ Class<?> appCtxClass = applicationContext.getClass();
+ Method m = appCtxClass.getMethod("getBean", String.class, Class.class);
+ Foo foo = (Foo)m.invoke(applicationContext, "foo", Foo.class);
+ return "Bar".equals(foo.getMessage());
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/my-cxf.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/my-cxf.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/my-cxf.xml 2012-04-03
13:02:57 UTC (rev 16084)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans
xmlns="http://www.springframework.org/schema/beans"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
+
xmlns:cxf="http://cxf.apache.org/core"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
+http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
+ <cxf:bus/>
+</beans>
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/spring-dd.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/spring-dd.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/spring/spring-dd.xml 2012-04-03
13:02:57 UTC (rev 16084)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans
xmlns="http://www.springframework.org/schema/beans"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
+ <bean id="foo"
class="org.jboss.test.ws.jaxws.cxf.spring.Foo">
+ <property name="message" value="Bar" />
+ </bean>
+</beans>