[jboss-cvs] JBossAS SVN: r109611 - in branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test: cluster/ejb3/clusteredservice/unit and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 30 18:46:06 EST 2010
Author: rachmatowicz at jboss.com
Date: 2010-11-30 18:46:05 -0500 (Tue, 30 Nov 2010)
New Revision: 109611
Modified:
branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/BulkOperationsUnitTestCase.java
branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EmbeddedIdClassloaderTestCase.java
branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityClassloaderTestBase.java
branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryRedeployUnitTestCase.java
branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityUnitTestCase.java
branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredservice/unit/HttpUtils.java
branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web/HttpUtils.java
Log:
Fix up HttpUtils instances; fix up clusteredentity test cases (JBAS-8540)
Modified: branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/BulkOperationsUnitTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/BulkOperationsUnitTestCase.java 2010-11-30 23:44:42 UTC (rev 109610)
+++ branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/BulkOperationsUnitTestCase.java 2010-11-30 23:46:05 UTC (rev 109611)
@@ -49,12 +49,13 @@
public void testBulkOperations() throws Exception
{
System.out.println("*** testBulkOperations()");
- String node0 = System.getProperty("jbosstest.cluster.node0");
+
+ String[] namingURLs = getNamingURLs() ;
Properties prop0 = new Properties();
prop0.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
prop0.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- prop0.put("java.naming.provider.url", "jnp://" + node0 + ":1099");
+ prop0.put("java.naming.provider.url", namingURLs[0]);
System.out.println("===== Node0 properties: ");
System.out.println(prop0);
Modified: branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EmbeddedIdClassloaderTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EmbeddedIdClassloaderTestCase.java 2010-11-30 23:44:42 UTC (rev 109610)
+++ branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EmbeddedIdClassloaderTestCase.java 2010-11-30 23:46:05 UTC (rev 109611)
@@ -32,6 +32,7 @@
import org.jboss.test.cluster.clusteredentity.embeddedid.EmbeddedIdTest;
import org.jboss.test.cluster.clusteredentity.embeddedid.MusicianPK;
import org.jboss.test.cluster.testutil.DBSetup;
+import org.jboss.test.JBossTestUtil;
/**
* Simple test of replication of entities and related queries with @EmbeddedId
@@ -59,8 +60,10 @@
{
super.setUp();
- sfsb0 = getUserTest(System.getProperty("jbosstest.cluster.node0"));
- sfsb1 = getUserTest(System.getProperty("jbosstest.cluster.node1"));
+ String[] servers = getServers() ;
+
+ sfsb0 = getUserTest(servers[0]);
+ sfsb1 = getUserTest(servers[1]);
sfsb0.cleanup();
sfsb1.cleanup();
}
@@ -92,7 +95,7 @@
Properties prop1 = new Properties();
prop1.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
prop1.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- prop1.put("java.naming.provider.url", "jnp://" + nodeJNDIAddress + ":1099");
+ prop1.put("java.naming.provider.url", "jnp://" + JBossTestUtil.fixHostnameForURL(nodeJNDIAddress) + ":1099");
log.info("===== Naming properties for " + nodeJNDIAddress + ": ");
log.info(prop1);
Modified: branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityClassloaderTestBase.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityClassloaderTestBase.java 2010-11-30 23:44:42 UTC (rev 109610)
+++ branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityClassloaderTestBase.java 2010-11-30 23:46:05 UTC (rev 109611)
@@ -27,6 +27,7 @@
import org.jboss.test.cluster.clusteredentity.classloader.AccountHolderPK;
import org.jboss.test.cluster.clusteredentity.classloader.EntityQueryTest;
import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.JBossTestUtil;
/**
* Base class for tests involving clustered entities with a scoped classloader.
@@ -72,8 +73,10 @@
{
super.setUp();
- sfsb0 = getEntityQueryTest(System.getProperty("jbosstest.cluster.node0"));
- sfsb1 = getEntityQueryTest(System.getProperty("jbosstest.cluster.node1"));
+ String[] servers = getServers() ;
+
+ sfsb0 = getEntityQueryTest(servers[0]);
+ sfsb1 = getEntityQueryTest(servers[1]);
sfsb0.cleanup();
sfsb1.cleanup();
}
@@ -83,7 +86,8 @@
Properties prop = new Properties();
prop.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
prop.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- prop.put("java.naming.provider.url", "jnp://" + nodeJNDIAddress + ":1099");
+ // JBAS-8540
+ prop.put("java.naming.provider.url", "jnp://" + JBossTestUtil.fixHostnameForURL(nodeJNDIAddress) + ":1099");
log.info("===== Naming properties for " + nodeJNDIAddress + ": ");
log.info(prop);
Modified: branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryRedeployUnitTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryRedeployUnitTestCase.java 2010-11-30 23:44:42 UTC (rev 109610)
+++ branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityQueryRedeployUnitTestCase.java 2010-11-30 23:46:05 UTC (rev 109611)
@@ -72,7 +72,8 @@
sleep(2000);
// Get the SFSB again
- sfsb1 = getEntityQueryTest(System.getProperty("jbosstest.cluster.node1"));
+ String[] servers = getServers() ;
+ sfsb1 = getEntityQueryTest(servers[1]);
}
Modified: branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityUnitTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityUnitTestCase.java 2010-11-30 23:44:42 UTC (rev 109610)
+++ branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/defaultcfg/clusteredentity/test/EntityUnitTestCase.java 2010-11-30 23:46:05 UTC (rev 109611)
@@ -89,13 +89,12 @@
public void testAll() throws Exception
{
System.out.println("*** testServerFound()");
- String node0 = System.getProperty("jbosstest.cluster.node0");
- String node1 = System.getProperty("jbosstest.cluster.node1");
+ String[] namingURLs = getNamingURLs();
Properties prop0 = new Properties();
prop0.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
prop0.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- prop0.put("java.naming.provider.url", "jnp://" + node0 + ":1099");
+ prop0.put("java.naming.provider.url", namingURLs[0]);
System.out.println("===== Node0 properties: ");
System.out.println(prop0);
@@ -103,7 +102,7 @@
Properties prop1 = new Properties();
prop1.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
prop1.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- prop1.put("java.naming.provider.url", "jnp://" + node1 + ":1099");
+ prop1.put("java.naming.provider.url", namingURLs[1]);
System.out.println("===== Node1 properties: ");
System.out.println(prop1);
Modified: branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredservice/unit/HttpUtils.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredservice/unit/HttpUtils.java 2010-11-30 23:44:42 UTC (rev 109610)
+++ branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredservice/unit/HttpUtils.java 2010-11-30 23:46:05 UTC (rev 109611)
@@ -37,6 +37,7 @@
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.TraceMethod;
import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestUtil;
/** Utilities for client http requests
*
@@ -46,8 +47,8 @@
public class HttpUtils
{
private static Logger log = Logger.getLogger(HttpUtils.class);
- private static String baseURL = "http://jduke:theduke@localhost:" + Integer.getInteger("web.port", 8080) + "/";
- private static String baseURLNoAuth = "http://localhost:" + Integer.getInteger("web.port", 8080) + "/";
+ private static String baseURL = "http://jduke:theduke@" + getServerHostForURL() + ":" + Integer.getInteger("web.port", 8080) + "/";
+ private static String baseURLNoAuth = "http://" + getServerHostForURL() + ":" + Integer.getInteger("web.port", 8080) + "/";
public static final int GET = 1;
public static final int POST = 2;
@@ -57,13 +58,36 @@
public static final int DELETE = 6;
public static final int TRACE = 7;
+ // JBAS-8540
+ private static String getServerHost() {
+ String hostname = System.getProperty("jboss.bind.address", "localhost") ;
+ if (log.isDebugEnabled())
+ log.debug("getServerHost(): using hostname = " + hostname) ;
+ return hostname;
+ }
+
+ // JBAS-8540
+ private static String getServerHostForURL()
+ {
+ String hostname = getServerHost() ;
+
+ if (hostname == null)
+ return hostname;
+
+ String hostnameForURL = JBossTestUtil.fixHostnameForURL(hostname) ;
+ if (log.isDebugEnabled())
+ log.debug("getServerHostForURL(): using hostname for url = " + hostnameForURL) ;
+
+ return hostnameForURL;
+ }
+
public static String getBaseURL()
{
return baseURL;
}
public static String getBaseURL(String username, String password)
{
- String url = "http://"+username+":"+password+"@"+ System.getProperty("jboss.bind.address") + ":"
+ String url = "http://"+username+":"+password+"@"+ getServerHostForURL() + ":"
+ Integer.getInteger("web.port", 8080) + "/";
return url;
}
Modified: branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web/HttpUtils.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web/HttpUtils.java 2010-11-30 23:44:42 UTC (rev 109610)
+++ branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web/HttpUtils.java 2010-11-30 23:46:05 UTC (rev 109611)
@@ -36,6 +36,7 @@
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.TraceMethod;
import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestUtil;
/** Utilities for client http requests
*
@@ -58,23 +59,25 @@
// JBAS-8540
private static String getServerHost() {
- String hostName = System.getProperty("jbosstest.server.host", "localhost") ;
- System.out.println("HttpUtils: using hostname = " + hostName) ;
- return hostName;
+ String hostname = System.getProperty("jbosstest.server.host", "localhost") ;
+ if (log.isDebugEnabled())
+ log.debug("getServerHost(): using hostname = " + hostname) ;
+ return hostname;
}
+ // JBAS-8540
private static String getServerHostForURL()
{
- String hostName = getServerHost() ;
+ String hostname = getServerHost() ;
- if (hostName == null)
- return hostName;
+ if (hostname == null)
+ return hostname;
- // check for IPv6 literal
- if (hostName.indexOf(":") != -1)
- return "[" + hostName + "]" ;
- else
- return hostName ;
+ String hostnameForURL = JBossTestUtil.fixHostnameForURL(hostname) ;
+ if (log.isDebugEnabled())
+ log.debug("getServerHostForURL(): using hostname for url = " + hostnameForURL) ;
+
+ return hostnameForURL;
}
public static String getBaseURL()
More information about the jboss-cvs-commits
mailing list