You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ve...@apache.org on 2010/03/02 21:36:10 UTC
svn commit: r918173 - in /cxf/sandbox/veithen/cxf-spring-security:
cxf-systests-spring-security/
cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/
cxf-systests-spring-security/src/test/resources/META-INF/
cxf-systests-spring-s...
Author: veithen
Date: Tue Mar 2 20:36:09 2010
New Revision: 918173
URL: http://svn.apache.org/viewvc?rev=918173&view=rev
Log:
Transformed jax-ws-jms-sample into a systest.
Added:
cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/CalculatorImpl.java
- copied, changed from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/java/test/calculator/impl/CalculatorImpl.java
cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/JMSCustomHeadersTest.java (with props)
cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/META-INF/
- copied from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/resources/META-INF/
cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_jms_custom_headers/
cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_jms_custom_headers/applicationContext.xml
- copied, changed from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/resources/applicationContext.xml
Removed:
cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/
Modified:
cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml
cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml
Modified: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml?rev=918173&r1=918172&r2=918173&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml (original)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml Tue Mar 2 20:36:09 2010
@@ -63,7 +63,7 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
+ <!-- scope>test</scope -->
</dependency>
<!-- Required by in-memory user details service -->
<dependency>
@@ -73,6 +73,26 @@
<scope>test</scope>
</dependency>
+ <!-- Dependencies for JMS -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-jms</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.3.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ <version>3.6</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -104,4 +124,31 @@
</snapshots>
</repository>
</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <!-- TODO: we should use the CXF plugin here -->
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.12</version>
+ <executions>
+ <execution>
+ <goals>
+ <!-- TODO: we actually should generate the code for the test
+ phase, not the compile phase -->
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wsdlDirectory>src/test/resources/META-INF/wsdl</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>calculator.wsdl</wsdlFile>
+ </wsdlFiles>
+ <wsdlLocation>META-INF/wsdl/calculator.wsdl</wsdlLocation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Copied: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/CalculatorImpl.java (from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/java/test/calculator/impl/CalculatorImpl.java)
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/CalculatorImpl.java?p2=cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/CalculatorImpl.java&p1=cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/java/test/calculator/impl/CalculatorImpl.java&r1=918166&r2=918173&rev=918173&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/java/test/calculator/impl/CalculatorImpl.java (original)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/CalculatorImpl.java Tue Mar 2 20:36:09 2010
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package test.calculator.impl;
+package org.apache.cxf.systest.security;
import test.calculator.Calculator;
Added: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/JMSCustomHeadersTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/JMSCustomHeadersTest.java?rev=918173&view=auto
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/JMSCustomHeadersTest.java (added)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/JMSCustomHeadersTest.java Tue Mar 2 20:36:09 2010
@@ -0,0 +1,96 @@
+/**
+ * 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.systest.security;
+
+import java.util.List;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.transport.jms.JMSConstants;
+import org.apache.cxf.transport.jms.JMSMessageHeadersType;
+import org.apache.cxf.transport.jms.JMSPropertyType;
+import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import test.calculator.Calculator;
+
+public class JMSCustomHeadersTest extends Assert {
+ private static ClassPathXmlApplicationContext appContext;
+ private static String address;
+
+ @BeforeClass
+ public static void beforeClass() {
+ appContext = new ClassPathXmlApplicationContext("security_jms_custom_headers/applicationContext.xml");
+ address = ((EndpointImpl)appContext.getBean("endpoint")).getAddress();
+ }
+
+ private Calculator createClient(String user, String password) {
+ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+ factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
+ factory.setServiceClass(Calculator.class);
+ factory.setAddress(address);
+ Calculator client = (Calculator)factory.create();
+ if (user != null || password != null) {
+ JMSMessageHeadersType headers = new JMSMessageHeadersType();
+ List<JMSPropertyType> properties = headers.getProperty();
+ if (user != null) {
+ JMSPropertyType property = new JMSPropertyType();
+ property.setName("user");
+ property.setValue(user);
+ properties.add(property);
+ }
+ if (password != null) {
+ JMSPropertyType property = new JMSPropertyType();
+ property.setName("password");
+ property.setValue(password);
+ properties.add(property);
+ }
+ ((BindingProvider)client).getRequestContext().put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS,
+ headers);
+ }
+ return client;
+ }
+
+ @Test
+ public void testAuthenticated() {
+ assertEquals(2, createClient("joe", "password").add(1, 1));
+ }
+
+ @Test
+ public void testUnauthenticated() {
+ try {
+ createClient(null, null).add(1, 1);
+ fail("Expected a SOAP fault");
+ } catch (SOAPFaultException fault) {
+ assertEquals("Client", fault.getFault().getFaultCodeAsQName().getLocalPart());
+ }
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ appContext.destroy();
+ }
+}
Propchange: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/JMSCustomHeadersTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_jms_custom_headers/applicationContext.xml (from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/resources/applicationContext.xml)
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_jms_custom_headers/applicationContext.xml?p2=cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_jms_custom_headers/applicationContext.xml&p1=cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/resources/applicationContext.xml&r1=918166&r2=918173&rev=918173&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/samples/jax-ws-jms-sample/src/main/resources/applicationContext.xml (original)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_jms_custom_headers/applicationContext.xml Tue Mar 2 20:36:09 2010
@@ -43,7 +43,7 @@
</security:authentication-provider>
<jaxws:endpoint id="endpoint"
- implementor="test.calculator.impl.CalculatorImpl"
+ implementor="org.apache.cxf.systest.security.CalculatorImpl"
address="jms:jndi:dynamicQueues/calculator?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&jndiConnectionFactoryName=ConnectionFactory&jndiURL=vm://broker1%3Fmarshal=false%26broker.persistent=false"
transportId="http://www.w3.org/2008/07/soap/bindings/JMS/">
<jaxws:inInterceptors>
Modified: cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml?rev=918173&r1=918172&r2=918173&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml (original)
+++ cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml Tue Mar 2 20:36:09 2010
@@ -16,7 +16,6 @@
<modules>
<module>jax-rs</module>
- <module>jax-ws-jms-sample</module>
<module>wss</module>
</modules>