[jboss-cvs] JBossAS SVN: r61075 - in branches/Branch_4_0/testsuite/src/main/org/jboss/test: naming/test and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Mar 4 16:57:03 EST 2007
Author: bstansberry at jboss.com
Date: 2007-03-04 16:57:03 -0500 (Sun, 04 Mar 2007)
New Revision: 61075
Modified:
branches/Branch_4_0/testsuite/src/main/org/jboss/test/cluster/test/HAJndiTestCase.java
branches/Branch_4_0/testsuite/src/main/org/jboss/test/naming/test/SimpleUnitTestCase.java
branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/RetryInterceptorUnitTestCase.java
Log:
Limit autodiscovery packet TTL
Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/cluster/test/HAJndiTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/cluster/test/HAJndiTestCase.java 2007-03-04 21:46:16 UTC (rev 61074)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/cluster/test/HAJndiTestCase.java 2007-03-04 21:57:03 UTC (rev 61075)
@@ -338,6 +338,9 @@
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
+ // Don't let the discovery packet off the test server so we don't
+ // get spurious responses from other servers on the network
+ env.put("jnp.discoveryTTL", "1");
if (autoDisabled)
{
Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/naming/test/SimpleUnitTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/naming/test/SimpleUnitTestCase.java 2007-03-04 21:46:16 UTC (rev 61074)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/naming/test/SimpleUnitTestCase.java 2007-03-04 21:57:03 UTC (rev 61075)
@@ -32,7 +32,6 @@
import javax.naming.Name;
import javax.naming.NameClassPair;
-import java.net.InetAddress;
import java.util.Properties;
/** Simple unit tests for the jndi implementation. Note that there cannot
@@ -238,6 +237,9 @@
env.setProperty(Context.PROVIDER_URL, "jnp://" + serverHost + ":65535/");
env.setProperty("jnp.localAddress", serverHost);
env.setProperty("jnp.partitionName", "DefaultPartition");
+ // Don't let the discovery packet off the test server so we don't
+ // get spurious responses from other servers on the network
+ env.setProperty("jnp.discoveryTTL", "1");
if (DISCOVERY_GROUP != null && "".equals(DISCOVERY_GROUP) == false)
{
// Server is not listening for discovery on std multicast address
@@ -286,6 +288,9 @@
env.setProperty(Context.PROVIDER_URL, "jnp://" + serverHost + ":65535/");
env.setProperty("jnp.localAddress", serverHost);
env.setProperty("jnp.discoveryPort", "1102");
+ // Don't let the discovery packet off the test server so we don't
+ // get spurious responses from other servers on the network
+ env.setProperty("jnp.discoveryTTL", "1");
if (DISCOVERY_GROUP != null && "".equals(DISCOVERY_GROUP) == false)
{
// Server is not listening for discovery on std multicast address
Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/RetryInterceptorUnitTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/RetryInterceptorUnitTestCase.java 2007-03-04 21:46:16 UTC (rev 61074)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/testbeancluster/test/RetryInterceptorUnitTestCase.java 2007-03-04 21:57:03 UTC (rev 61075)
@@ -489,29 +489,29 @@
{
getLog().debug("+++ Enter testRetryWithJnpAndAutoDiscovery()");
+ // Create a jndi.properties in the temp dir with special configs
+ // to prevent autodiscovery spuriously discovering random servers
+ // on the network. When the RetryCaller runs, it will create a
+ // special classloader that will pick up this file
+ if (customJndiDir == null)
+ customJndiDir = new File(System.getProperty("java.io.tempdir"),
+ "retry-int-test");
+ if (!customJndiDir.exists())
+ customJndiDir.mkdir();
+ customJndiProperties = new File(customJndiDir, "jndi.properties");
+ FileOutputStream fos = new FileOutputStream(customJndiProperties);
+ OutputStreamWriter writer = new OutputStreamWriter(fos);
+ writer.write("jnp.discoveryTTL=1\n");
if (DISCOVERY_GROUP != null && "".equals(DISCOVERY_GROUP) == false)
{
// The server isn't listening on the std multicast address
- // for auto discovery, so we have to pretend there is a jndi.properties
- // telling the NamingContext what address to use
- if (customJndiDir == null)
- customJndiDir = new File(System.getProperty("java.io.tempdir"), "retry-int-test");
- if (!customJndiDir.exists())
- customJndiDir.mkdir();
- customJndiProperties = new File(customJndiDir, "jndi.properties");
- FileOutputStream fos = new FileOutputStream(customJndiProperties);
- OutputStreamWriter writer = new OutputStreamWriter(fos);
writer.write("jnp.discoveryGroup=" + DISCOVERY_GROUP);
- writer.close();
- getLog().debug("Created custom jndi.properties at " + customJndiProperties +
- " -- DISCOVERY_GROUP is " + DISCOVERY_GROUP);
}
- else
- {
- getLog().debug("Not creating custom jndi.properties -- " +
- "DISCOVERY_GROUP is " + DISCOVERY_GROUP);
- }
+ writer.close();
+ getLog().debug("Created custom jndi.properties at " + customJndiProperties +
+ " -- DISCOVERY_GROUP is " + DISCOVERY_GROUP);
+
Properties env = getNamingProperties("org.jnp.interfaces.NamingContextFactory", true);
InitialContext ctx = new InitialContext(env);
@@ -563,6 +563,9 @@
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, namingFactoryClass);
env.setProperty(Context.PROVIDER_URL, urls[0]);
+ // Don't let the discovery packet off the test server so we don't
+ // get spurious responses from other servers on the network
+ env.setProperty("jnp.discoveryTTL", "1");
if (!autoDiscovery)
{
More information about the jboss-cvs-commits
mailing list