Author: alessio.soldano(a)jboss.com
Date: 2011-06-06 12:25:26 -0400 (Mon, 06 Jun 2011)
New Revision: 14478
Modified:
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/DeployerJBoss6.java
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
Log:
[JBWS-3257] Adding security domain related methods to test deploy facilities
Modified: shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/DeployerJBoss6.java
===================================================================
--- shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/DeployerJBoss6.java 2011-06-06
16:24:06 UTC (rev 14477)
+++ shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/DeployerJBoss6.java 2011-06-06
16:25:26 UTC (rev 14478)
@@ -19,6 +19,7 @@
package org.jboss.wsf.test;
import java.net.URL;
+import java.util.Map;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
@@ -59,4 +60,16 @@
{"java.net.URL"});
}
+ @Override
+ public void addSecurityDomain(String name, Map<String, String>
authenticationOptions) throws Exception
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeSecurityDomain(String name) throws Exception
+ {
+ throw new UnsupportedOperationException();
+ }
+
}
Modified: shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
---
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2011-06-06
16:24:06 UTC (rev 14477)
+++
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2011-06-06
16:25:26 UTC (rev 14478)
@@ -29,6 +29,7 @@
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Hashtable;
+import java.util.Map;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
@@ -315,4 +316,14 @@
return testResourcesDir;
}
+
+ public static void addSecurityDomain(String name, Map<String,String>
authenticationOptions) throws Exception
+ {
+ DEPLOYER.addSecurityDomain(name, authenticationOptions);
+ }
+
+ public static void removeSecurityDomain(String name) throws Exception
+ {
+ DEPLOYER.removeSecurityDomain(name);
+ }
}
Modified: shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
===================================================================
---
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java 2011-06-06
16:24:06 UTC (rev 14477)
+++
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java 2011-06-06
16:25:26 UTC (rev 14478)
@@ -26,7 +26,9 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import javax.management.MBeanServerConnection;
@@ -49,9 +51,9 @@
// provide logging
private static Logger log = Logger.getLogger(JBossWSTestSetup.class);
- private JBossWSTestHelper delegate = new JBossWSTestHelper();
private String[] archives = new String[0];
private ClassLoader originalClassLoader;
+ private Map<String, Map<String, String>> securityDomains = new
HashMap<String, Map<String,String>>();
public JBossWSTestSetup(Class<?> testClass, String archiveList)
{
@@ -72,22 +74,22 @@
public File getArchiveFile(String archive)
{
- return delegate.getArchiveFile(archive);
+ return JBossWSTestHelper.getArchiveFile(archive);
}
public URL getArchiveURL(String archive) throws MalformedURLException
{
- return delegate.getArchiveFile(archive).toURI().toURL();
+ return JBossWSTestHelper.getArchiveFile(archive).toURI().toURL();
}
public File getResourceFile(String resource)
{
- return delegate.getResourceFile(resource);
+ return JBossWSTestHelper.getResourceFile(resource);
}
public URL getResourceURL(String resource) throws MalformedURLException
{
- return delegate.getResourceFile(resource).toURI().toURL();
+ return JBossWSTestHelper.getResourceFile(resource).toURI().toURL();
}
private void getArchiveArray(String archiveList)
@@ -105,8 +107,16 @@
protected void setUp() throws Exception
{
// verify integration target
- String integrationTarget = delegate.getIntegrationTarget();
+ String integrationTarget = JBossWSTestHelper.getIntegrationTarget();
log.debug("Integration target: " + integrationTarget);
+
+ if (!securityDomains.isEmpty())
+ {
+ for (String key : securityDomains.keySet())
+ {
+ JBossWSTestHelper.addSecurityDomain(key, securityDomains.get(key));
+ }
+ }
List<URL> clientJars = new ArrayList<URL>();
for (int i = 0; i < archives.length; i++)
@@ -114,12 +124,12 @@
String archive = archives[i];
try
{
- delegate.deploy(archive);
+ JBossWSTestHelper.deploy(archive);
}
catch (Exception ex)
{
ex.printStackTrace();
- delegate.undeploy(archive);
+ JBossWSTestHelper.undeploy(archive);
}
if (archive.endsWith("-client.jar"))
@@ -151,12 +161,20 @@
for (int i = 0; i < archives.length; i++)
{
String archive = archives[archives.length - i - 1];
- delegate.undeploy(archive);
+ JBossWSTestHelper.undeploy(archive);
}
}
finally
{
Thread.currentThread().setContextClassLoader(originalClassLoader);
+
+ if (!securityDomains.isEmpty())
+ {
+ for (String key : securityDomains.keySet())
+ {
+ JBossWSTestHelper.removeSecurityDomain(key);
+ }
+ }
}
}
@@ -169,4 +187,9 @@
{
return JBossWSTestHelper.getServer();
}
+
+ public void addSecurityDomainRequirement(String securityDomainName, Map<String,
String> authenticationOptions)
+ {
+ securityDomains.put(securityDomainName, authenticationOptions);
+ }
}
Show replies by date