[jboss-cvs] JBossAS SVN: r61607 - trunk/testsuite/src/main/org/jboss/test/naming/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 22 14:50:25 EDT 2007
Author: anil.saldhana at jboss.com
Date: 2007-03-22 14:50:25 -0400 (Thu, 22 Mar 2007)
New Revision: 61607
Modified:
trunk/testsuite/src/main/org/jboss/test/naming/test/SecurityUnitTestCase.java
Log:
JBAS-4234:use getServerHost instead of hardcoded localhost
Modified: trunk/testsuite/src/main/org/jboss/test/naming/test/SecurityUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/naming/test/SecurityUnitTestCase.java 2007-03-22 18:26:06 UTC (rev 61606)
+++ trunk/testsuite/src/main/org/jboss/test/naming/test/SecurityUnitTestCase.java 2007-03-22 18:50:25 UTC (rev 61607)
@@ -49,6 +49,10 @@
*/
public class SecurityUnitTestCase extends JBossTestCase
{
+
+ private String JNDI_URL;
+ private String INVOKER_BASE;
+
public static Test suite() throws Exception
{
// JBAS-3606, the execution order of tests in this test case is important
@@ -64,6 +68,13 @@
return suite;
}
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ JNDI_URL = "jnp://" + getServerHost() + ":1099/";
+ INVOKER_BASE = "http://"+ getServerHost() + ":8080/invoker/";
+ }
/**
* Constructor for the SecurityUnitTestCase object
@@ -86,7 +97,7 @@
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
// Test the secured JNDI factory
- env.setProperty(Context.PROVIDER_URL, "http://localhost:8080/invoker/restricted/JNDIFactory");
+ env.setProperty(Context.PROVIDER_URL, INVOKER_BASE +"restricted/JNDIFactory");
getLog().debug("Creating InitialContext with env="+env);
// Try without a login to ensure the lookup fails
@@ -123,7 +134,7 @@
lc.login();
// Test the secured JNDI factory
- env.setProperty(Context.PROVIDER_URL, "http://localhost:8080/invoker/restricted/JNDIFactory");
+ env.setProperty(Context.PROVIDER_URL, INVOKER_BASE + "restricted/JNDIFactory");
getLog().debug("Creating InitialContext with env="+env);
InitialContext ctx = new InitialContext(env);
getLog().debug("Created InitialContext");
@@ -173,7 +184,7 @@
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
- env.setProperty(Context.PROVIDER_URL, "http://localhost:8080/invoker/ReadOnlyJNDIFactory");
+ env.setProperty(Context.PROVIDER_URL, INVOKER_BASE + "ReadOnlyJNDIFactory");
getLog().debug("Creating InitialContext with env="+env);
InitialContext ctx = new InitialContext(env);
Object data = ctx.lookup("readonly/data");
@@ -229,7 +240,7 @@
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.test.naming.test.BootstrapNamingContextFactory");
- env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
+ env.setProperty(Context.PROVIDER_URL, JNDI_URL);
env.setProperty("bootstrap-binding", "naming/Naming");
getLog().debug("Creating bootstrap InitialContext with env="+env);
InitialContext bootCtx = new InitialContext(env);
@@ -300,7 +311,7 @@
Properties env = new Properties();
// Try with a login that should succeed
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.LoginInitialContextFactory");
- env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099/");
+ env.setProperty(Context.PROVIDER_URL, JNDI_URL);
env.setProperty(Context.SECURITY_CREDENTIALS, "theduke");
env.setProperty(Context.SECURITY_PRINCIPAL, "jduke");
env.setProperty(Context.SECURITY_PROTOCOL, "testLoginInitialContext");
@@ -347,7 +358,7 @@
Properties env = new Properties();
// Try with a login that should succeed
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.LoginInitialContextFactory");
- env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099/");
+ env.setProperty(Context.PROVIDER_URL, JNDI_URL);
env.setProperty(Context.SECURITY_CREDENTIALS, "theduke");
env.setProperty(Context.SECURITY_PRINCIPAL, "jduke");
env.setProperty(Context.SECURITY_PROTOCOL, "testLoginInitialContext");
@@ -389,7 +400,7 @@
Properties env = new Properties();
// Try with a login that should succeed
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
- env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099/");
+ env.setProperty(Context.PROVIDER_URL, JNDI_URL);
env.setProperty(Context.SECURITY_CREDENTIALS, "theduke");
env.setProperty(Context.SECURITY_PRINCIPAL, "jduke");
More information about the jboss-cvs-commits
mailing list