Author: alessio.soldano(a)jboss.com
Date: 2008-05-14 09:55:19 -0400 (Wed, 14 May 2008)
New Revision: 7030
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/interop/nov2007/wsse/AbstractWSSEBase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/interop/wsse/AbstractWSSEBase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SimpleSignEncryptTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/wsse/UsernameTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2014/EncryptTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2014/SignTestCase.java
Log:
[JBWS-2176] Restoring wsse system properties to the original values once the test is over
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/interop/nov2007/wsse/AbstractWSSEBase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/interop/nov2007/wsse/AbstractWSSEBase.java 2008-05-14
13:49:12 UTC (rev 7029)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/interop/nov2007/wsse/AbstractWSSEBase.java 2008-05-14
13:55:19 UTC (rev 7030)
@@ -47,8 +47,13 @@
*/
public abstract class AbstractWSSEBase extends JBossWSTest
{
-
protected IPingService port;
+ private String keyStore;
+ private String trustStore;
+ private String keyStorePassword;
+ private String trustStorePassword;
+ private String keyStoreType;
+ private String trustStoreType;
protected void setUp() throws Exception
{
@@ -63,9 +68,28 @@
configureClient();
}
+ //Backup values
+ keyStore = System.getProperty("org.jboss.ws.wsse.keyStore");
+ keyStorePassword =
System.getProperty("org.jboss.ws.wsse.keyStorePassword");
+ keyStoreType = System.getProperty("org.jboss.ws.wsse.keyStoreType");
+ trustStore = System.getProperty("org.jboss.ws.wsse.trustStore");
+ trustStorePassword =
System.getProperty("org.jboss.ws.wsse.trustStorePassword");
+ trustStoreType = System.getProperty("org.jboss.ws.wsse.trustStoreType");
scenarioSetup(port);
}
+ protected void tearDown() throws Exception
+ {
+ //Restore environment
+ System.setProperty("org.jboss.ws.wsse.keyStore", keyStore);
+ System.setProperty("org.jboss.ws.wsse.trustStore", trustStore);
+ System.setProperty("org.jboss.ws.wsse.keyStorePassword",
keyStorePassword);
+ System.setProperty("org.jboss.ws.wsse.trustStorePassword",
trustStorePassword);
+ System.setProperty("org.jboss.ws.wsse.keyStoreType", keyStoreType);
+ System.setProperty("org.jboss.ws.wsse.trustStoreType", trustStoreType);
+ super.tearDown();
+ }
+
protected abstract void scenarioSetup(IPingService port);
protected abstract QName getScenarioPortQName();
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/interop/wsse/AbstractWSSEBase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/interop/wsse/AbstractWSSEBase.java 2008-05-14
13:49:12 UTC (rev 7029)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/interop/wsse/AbstractWSSEBase.java 2008-05-14
13:55:19 UTC (rev 7030)
@@ -42,6 +42,12 @@
public abstract class AbstractWSSEBase extends JBossWSTest
{
protected IPingService port;
+ private String keyStore;
+ private String trustStore;
+ private String keyStorePassword;
+ private String trustStorePassword;
+ private String keyStoreType;
+ private String trustStoreType;
protected void setUp() throws Exception
{
@@ -67,6 +73,14 @@
{
((StubExt)port).setConfigName("Standard WSSecurity Client");
+ //Backup values
+ keyStore = System.getProperty("org.jboss.ws.wsse.keyStore");
+ keyStorePassword =
System.getProperty("org.jboss.ws.wsse.keyStorePassword");
+ keyStoreType = System.getProperty("org.jboss.ws.wsse.keyStoreType");
+ trustStore = System.getProperty("org.jboss.ws.wsse.trustStore");
+ trustStorePassword =
System.getProperty("org.jboss.ws.wsse.trustStorePassword");
+ trustStoreType = System.getProperty("org.jboss.ws.wsse.trustStoreType");
+ //Set values
System.setProperty("org.jboss.ws.wsse.keyStore",
getResourceFile("interop/wsse/shared/META-INF/alice.jks").getPath());
System.setProperty("org.jboss.ws.wsse.trustStore",
getResourceFile("interop/wsse/shared/META-INF/wsse10.truststore").getPath());
System.setProperty("org.jboss.ws.wsse.keyStorePassword",
"password");
@@ -74,6 +88,18 @@
System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
System.setProperty("org.jboss.ws.wsse.trustStoreType", "jks");
}
+
+ protected void tearDown() throws Exception
+ {
+ //Restore environment
+ System.setProperty("org.jboss.ws.wsse.keyStore", keyStore);
+ System.setProperty("org.jboss.ws.wsse.trustStore", trustStore);
+ System.setProperty("org.jboss.ws.wsse.keyStorePassword",
keyStorePassword);
+ System.setProperty("org.jboss.ws.wsse.trustStorePassword",
trustStorePassword);
+ System.setProperty("org.jboss.ws.wsse.keyStoreType", keyStoreType);
+ System.setProperty("org.jboss.ws.wsse.trustStoreType", trustStoreType);
+ super.tearDown();
+ }
protected void configureClient()
{
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SimpleSignEncryptTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SimpleSignEncryptTestCase.java 2008-05-14
13:49:12 UTC (rev 7029)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SimpleSignEncryptTestCase.java 2008-05-14
13:55:19 UTC (rev 7030)
@@ -40,7 +40,13 @@
*/
public class SimpleSignEncryptTestCase extends JBossWSTest
{
-
+ private String keyStore;
+ private String trustStore;
+ private String keyStorePassword;
+ private String trustStorePassword;
+ private String keyStoreType;
+ private String trustStoreType;
+
/** Construct the test case with a given name
*/
@@ -63,6 +69,40 @@
public void testEndpointNoProperties() throws Exception
{
+ clearEnvironment();
+ try
+ {
+ InitialContext iniCtx = getInitialContext();
+ Service service =
(Service)iniCtx.lookup("java:comp/env/service/HelloService");
+ Hello hello = (Hello)service.getPort(Hello.class);
+
+ UserType in0 = new UserType("Kermit");
+
+ try
+ {
+ hello.echoUserType(in0);
+ fail("Expected exception not thrown");
+ }
+ catch (RemoteException e)
+ {
+ }
+ }
+ finally
+ {
+ restoreEnvironment();
+ }
+ }
+
+ private void clearEnvironment()
+ {
+ //Backup values
+ keyStore = System.getProperty("org.jboss.ws.wsse.keyStore");
+ keyStorePassword =
System.getProperty("org.jboss.ws.wsse.keyStorePassword");
+ keyStoreType = System.getProperty("org.jboss.ws.wsse.keyStoreType");
+ trustStore = System.getProperty("org.jboss.ws.wsse.trustStore");
+ trustStorePassword =
System.getProperty("org.jboss.ws.wsse.trustStorePassword");
+ trustStoreType = System.getProperty("org.jboss.ws.wsse.trustStoreType");
+ //Clear
Properties props = System.getProperties();
props.remove("org.jboss.ws.wsse.keyStore");
props.remove("org.jboss.ws.wsse.trustStore");
@@ -70,20 +110,15 @@
props.remove("org.jboss.ws.wsse.trustStorePassword");
props.remove("org.jboss.ws.wsse.keyStoreType");
props.remove("org.jboss.ws.wsse.trustStoreType");
+ }
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/HelloService");
- Hello hello = (Hello)service.getPort(Hello.class);
-
- UserType in0 = new UserType("Kermit");
-
- try
- {
- hello.echoUserType(in0);
- fail("Expected exception not thrown");
- }
- catch (RemoteException e)
- {
- }
+ private void restoreEnvironment()
+ {
+ System.setProperty("org.jboss.ws.wsse.keyStore", keyStore);
+ System.setProperty("org.jboss.ws.wsse.trustStore", trustStore);
+ System.setProperty("org.jboss.ws.wsse.keyStorePassword",
keyStorePassword);
+ System.setProperty("org.jboss.ws.wsse.trustStorePassword",
trustStorePassword);
+ System.setProperty("org.jboss.ws.wsse.keyStoreType", keyStoreType);
+ System.setProperty("org.jboss.ws.wsse.trustStoreType", trustStoreType);
}
}
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/wsse/UsernameTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/wsse/UsernameTestCase.java 2008-05-14
13:49:12 UTC (rev 7029)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/wsse/UsernameTestCase.java 2008-05-14
13:55:19 UTC (rev 7030)
@@ -42,6 +42,12 @@
public class UsernameTestCase extends JBossWSTest
{
private static JaxRpcTestService port;
+ private String keyStore;
+ private String trustStore;
+ private String keyStorePassword;
+ private String trustStorePassword;
+ private String keyStoreType;
+ private String trustStoreType;
public static Test suite()
{
@@ -59,6 +65,14 @@
port = (JaxRpcTestService)service.getPort(JaxRpcTestService.class);
}
+ //Backup values
+ keyStore = System.getProperty("org.jboss.ws.wsse.keyStore");
+ keyStorePassword =
System.getProperty("org.jboss.ws.wsse.keyStorePassword");
+ keyStoreType = System.getProperty("org.jboss.ws.wsse.keyStoreType");
+ trustStore = System.getProperty("org.jboss.ws.wsse.trustStore");
+ trustStorePassword =
System.getProperty("org.jboss.ws.wsse.trustStorePassword");
+ trustStoreType = System.getProperty("org.jboss.ws.wsse.trustStoreType");
+ //Clear environment
Properties props = System.getProperties();
props.remove("org.jboss.ws.wsse.keyStore");
props.remove("org.jboss.ws.wsse.trustStore");
@@ -67,6 +81,18 @@
props.remove("org.jboss.ws.wsse.keyStoreType");
props.remove("org.jboss.ws.wsse.trustStoreType");
}
+
+ protected void tearDown() throws Exception
+ {
+ //Restore environment
+ System.setProperty("org.jboss.ws.wsse.keyStore", keyStore);
+ System.setProperty("org.jboss.ws.wsse.trustStore", trustStore);
+ System.setProperty("org.jboss.ws.wsse.keyStorePassword",
keyStorePassword);
+ System.setProperty("org.jboss.ws.wsse.trustStorePassword",
trustStorePassword);
+ System.setProperty("org.jboss.ws.wsse.keyStoreType", keyStoreType);
+ System.setProperty("org.jboss.ws.wsse.trustStoreType", trustStoreType);
+ super.tearDown();
+ }
public void testEchoString() throws Exception
{
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2014/EncryptTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2014/EncryptTestCase.java 2008-05-14
13:49:12 UTC (rev 7029)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2014/EncryptTestCase.java 2008-05-14
13:55:19 UTC (rev 7030)
@@ -88,13 +88,6 @@
private TestEndpoint getPort() throws Exception
{
- System.setProperty("org.jboss.ws.wsse.keyStore",
getResourceFile("jaxws/jbws2014/wsse.keystore").getPath());
- System.setProperty("org.jboss.ws.wsse.trustStore",
getResourceFile("jaxws/jbws2014/wsse.truststore").getPath());
- System.setProperty("org.jboss.ws.wsse.keyStorePassword",
"jbossws");
- System.setProperty("org.jboss.ws.wsse.trustStorePassword",
"jbossws");
- System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
- System.setProperty("org.jboss.ws.wsse.trustStoreType", "jks");
-
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws2014?wsdl");
URL securityURL =
getResourceURL("jaxws/jbws2014/encrypt/META-INF/jboss-wsse-client.xml");
QName serviceName = new QName("http://org.jboss.ws/jbws2014",
"TestService");
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2014/SignTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2014/SignTestCase.java 2008-05-14
13:49:12 UTC (rev 7029)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2014/SignTestCase.java 2008-05-14
13:55:19 UTC (rev 7030)
@@ -84,12 +84,14 @@
private TestEndpoint getPort() throws Exception
{
+ /**
System.setProperty("org.jboss.ws.wsse.keyStore",
getResourceFile("jaxws/jbws2014/wsse.keystore").getPath());
System.setProperty("org.jboss.ws.wsse.trustStore",
getResourceFile("jaxws/jbws2014/wsse.truststore").getPath());
System.setProperty("org.jboss.ws.wsse.keyStorePassword",
"jbossws");
System.setProperty("org.jboss.ws.wsse.trustStorePassword",
"jbossws");
System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
System.setProperty("org.jboss.ws.wsse.trustStoreType", "jks");
+ **/
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws2014?wsdl");
URL securityURL =
getResourceURL("jaxws/jbws2014/sign/META-INF/jboss-wsse-client.xml");