[jbossws-commits] JBossWS SVN: r15902 - in stack/cxf/trunk: etc and 3 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Thu Mar 8 11:28:48 EST 2012
Author: alessio.soldano at jboss.com
Date: 2012-03-08 11:28:47 -0500 (Thu, 08 Mar 2012)
New Revision: 15902
Added:
stack/cxf/trunk/etc/
stack/cxf/trunk/etc/application-roles.properties
stack/cxf/trunk/etc/application-users.properties
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/JMSHTTPEndpointDeploymentTestCase.java
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3454] Adding test user properties, cleaning up testcases, adding hornetq dependencies (test scope)
Added: stack/cxf/trunk/etc/application-roles.properties
===================================================================
--- stack/cxf/trunk/etc/application-roles.properties (rev 0)
+++ stack/cxf/trunk/etc/application-roles.properties 2012-03-08 16:28:47 UTC (rev 15902)
@@ -0,0 +1 @@
+kermit=guest
Added: stack/cxf/trunk/etc/application-users.properties
===================================================================
--- stack/cxf/trunk/etc/application-users.properties (rev 0)
+++ stack/cxf/trunk/etc/application-users.properties 2012-03-08 16:28:47 UTC (rev 15902)
@@ -0,0 +1 @@
+kermit=0491092837b7e5aef6f270a3b85f8336
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java 2012-03-08 16:24:43 UTC (rev 15901)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java 2012-03-08 16:28:47 UTC (rev 15902)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * 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.
*
@@ -49,6 +49,7 @@
import org.jboss.ws.common.DOMUtils;
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
/**
* Test case for deploying an archive with a JMS (SOAP-over-JMS 1.0) endpoint only
@@ -80,7 +81,11 @@
Service service = Service.create(wsdlUrl, serviceName);
HelloWorld proxy = (HelloWorld) service.getPort(new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldImplPort"), HelloWorld.class);
setupProxy(proxy);
- assertEquals("Hi", proxy.echo("Hi"));
+ try {
+ assertEquals("Hi", proxy.echo("Hi"));
+ } catch (Exception e) {
+ rethrowAndHandleAuthWarning(e);
+ }
}
public void testMessagingClient() throws Exception
@@ -106,14 +111,19 @@
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "remote://" + getServerHost() + ":4447");
- env.put(Context.SECURITY_PRINCIPAL, "guest");
- env.put(Context.SECURITY_CREDENTIALS, "pass");
- InitialContext context = new InitialContext(env);
+ env.put(Context.SECURITY_PRINCIPAL, JBossWSTestHelper.getTestUsername());
+ env.put(Context.SECURITY_CREDENTIALS, JBossWSTestHelper.getTestPassword());
+ InitialContext context = null;
+ try {
+ context = new InitialContext(env);
+ } catch (Exception e) {
+ rethrowAndHandleAuthWarning(e);
+ }
QueueConnectionFactory connectionFactory = (QueueConnectionFactory)context.lookup("jms/RemoteConnectionFactory");
Queue reqQueue = (Queue)context.lookup("jms/queue/test");
Queue resQueue = (Queue)context.lookup("jms/queue/test");
- QueueConnection con = connectionFactory.createQueueConnection("guest", "pass");
+ QueueConnection con = connectionFactory.createQueueConnection(JBossWSTestHelper.getTestUsername(), JBossWSTestHelper.getTestPassword());
QueueSession session = con.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueReceiver receiver = session.createReceiver(resQueue);
ResponseListener responseListener = new ResponseListener();
@@ -168,14 +178,21 @@
}
private void setupProxy(HelloWorld proxy) {
- final String user = "guest";
- final String pwd = "pass";
JMSConduit conduit = (JMSConduit)ClientProxy.getClient(proxy).getConduit();
JNDIConfiguration jndiConfig = conduit.getJmsConfig().getJndiConfig();
- jndiConfig.setConnectionUserName(user);
- jndiConfig.setConnectionPassword(pwd);
+ jndiConfig.setConnectionUserName(JBossWSTestHelper.getTestUsername());
+ jndiConfig.setConnectionPassword(JBossWSTestHelper.getTestPassword());
Properties props = conduit.getJmsConfig().getJndiTemplate().getEnvironment();
- props.put(Context.SECURITY_PRINCIPAL, user);
- props.put(Context.SECURITY_CREDENTIALS, pwd);
+ props.put(Context.SECURITY_PRINCIPAL, JBossWSTestHelper.getTestUsername());
+ props.put(Context.SECURITY_CREDENTIALS, JBossWSTestHelper.getTestPassword());
}
+
+ private static void rethrowAndHandleAuthWarning(Exception e) throws Exception {
+ final String msg = "Authentication failed";
+ if (e.getMessage().contains(msg) || e.getCause().getMessage().contains(msg)) {
+ System.out.println("This test requires an user with 'guest' role to be available on the application server; " +
+ "please ensure that then specify user and password using -Dtest.username=\"foo\" -Dtest.password=\"bar\".");
+ }
+ throw e;
+ }
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/JMSHTTPEndpointDeploymentTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/JMSHTTPEndpointDeploymentTestCase.java 2012-03-08 16:24:43 UTC (rev 15901)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/JMSHTTPEndpointDeploymentTestCase.java 2012-03-08 16:28:47 UTC (rev 15902)
@@ -38,6 +38,7 @@
import org.jboss.test.ws.jaxws.cxf.jms.HelloWorld;
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
/**
* Test case for deploying an archive with a JMS (SOAP-over-JMS 1.0) and a HTTP endpoints
@@ -67,7 +68,15 @@
Service service = Service.create(wsdlUrl, serviceName);
HelloWorld proxy = (HelloWorld) service.getPort(new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldImplPort"), HelloWorld.class);
setupProxy(proxy);
- assertEquals("Hi", proxy.echo("Hi"));
+ try {
+ assertEquals("Hi", proxy.echo("Hi"));
+ } catch (Exception e) {
+ if (e.getMessage().contains("Authentication failed")) {
+ System.out.println("This test requires an user with 'guest' role to be available on the application server; " +
+ "please ensure that then specify user and password using -Dtest.username=\"foo\" -Dtest.password=\"bar\".");
+ }
+ throw e;
+ }
}
public void testHTTPEndpointClientSide() throws Exception
@@ -81,14 +90,12 @@
}
private void setupProxy(HelloWorld proxy) {
- final String user = "guest";
- final String pwd = "pass";
JMSConduit conduit = (JMSConduit)ClientProxy.getClient(proxy).getConduit();
JNDIConfiguration jndiConfig = conduit.getJmsConfig().getJndiConfig();
- jndiConfig.setConnectionUserName(user);
- jndiConfig.setConnectionPassword(pwd);
+ jndiConfig.setConnectionUserName(JBossWSTestHelper.getTestUsername());
+ jndiConfig.setConnectionPassword(JBossWSTestHelper.getTestPassword());
Properties props = conduit.getJmsConfig().getJndiTemplate().getEnvironment();
- props.put(Context.SECURITY_PRINCIPAL, user);
- props.put(Context.SECURITY_CREDENTIALS, pwd);
+ props.put(Context.SECURITY_PRINCIPAL, JBossWSTestHelper.getTestUsername());
+ props.put(Context.SECURITY_CREDENTIALS, JBossWSTestHelper.getTestPassword());
}
}
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2012-03-08 16:24:43 UTC (rev 15901)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2012-03-08 16:28:47 UTC (rev 15902)
@@ -330,6 +330,14 @@
<value>${test.resources.directory}</value>
</property>
<property>
+ <name>test.username</name>
+ <value>${test.username}</value>
+ </property>
+ <property>
+ <name>test.password</name>
+ <value>${test.password}</value>
+ </property>
+ <property>
<name>wsdl.publish.location</name>
<value>${wsdl.publish.location}</value>
</property>
@@ -1254,6 +1262,18 @@
<version>3.2.2.GA</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-jms</artifactId>
+ <version>2.2.11.Final</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-core</artifactId>
+ <version>2.2.11.Final</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
More information about the jbossws-commits
mailing list