"org.jnp.interfaces.NamingContextFactory");
env.setProperty(Context.PROVIDER_URL, urls[0]);
Context ctx = new InitialContext(env);
getLog().debug("Got InitialContext with " + urls[0]);
HAServiceRemote remote = (HAServiceRemote) ctx.lookup(jndiName);
getLog().debug("Found " + jndiName);
assertEquals("Hello", remote.hello());
String nodeA = remote.getClusterNode();
assertNotNull("Got clusterNode", nodeA);
getLog().debug("nodeA OK");
// Invoke again to check it works with load balancing
assertFalse("Requests load balanced", nodeA.equals(remote.getClusterNode()));
getLog().debug("nodeA load balanced OK");
// Undeploy from one node
reconfigureCluster();
// Test for JBAS-5164
try
{
ctx.lookup(jndiName);
fail("Known issue JBAS-5164. Proxy not removed from JNDI on undeployed node");
}
catch (NamingException good) {}
// Check it still works
try
{
assertEquals("Hello", remote.hello());
getLog().debug("OK after reconfigure");
}
catch (ServiceUnavailableException sue)
{
fail("Known issue JBAS-3194: " + sue.getMessage());