Methods Summary |
---|
protected java.lang.String | getEarName()
return "clusteredentity-embeddedid-test";
|
protected org.jboss.ejb3.test.clusteredentity.embeddedid.EmbeddedIdTest | getUserTest(java.lang.String nodeJNDIAddress)
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");
log.info("===== Naming properties for " + nodeJNDIAddress + ": ");
log.info(prop1);
log.info("Create InitialContext for " + nodeJNDIAddress);
InitialContext ctx1 = new InitialContext(prop1);
log.info("Lookup sfsb from " + nodeJNDIAddress);
return (EmbeddedIdTest) ctx1.lookup(getEarName() + "/EmbeddedIdTestBean/remote");
|
private void | queryByInstrument(org.jboss.ejb3.test.clusteredentity.embeddedid.EmbeddedIdTest sfsb, java.lang.String instrument, boolean useNamedRegion)
List<MusicianPK> pks = sfsb.getMusiciansForInstrument(instrument, useNamedRegion);
assertNotNull("Got pks", pks);
assertEquals("Got one pk", 1, pks.size());
assertEquals("Got correct pks", EmbeddedIdTest.DEFAULT_PK, pks.get(0));
|
protected void | setUp()
super.setUp();
sfsb0 = getUserTest(System.getProperty("jbosstest.cluster.node0"));
sfsb1 = getUserTest(System.getProperty("jbosstest.cluster.node1"));
sfsb0.cleanup();
sfsb1.cleanup();
|
protected void | sleep(long millis)
try
{
Thread.sleep(millis);
}
catch (InterruptedException e)
{
log.warn("Interrupted while sleeping", e);
}
|
public static junit.framework.Test | suite()
TestSuite suite = new TestSuite();
Test t1 = getDeploySetup(EmbeddedIdClassloaderTestCase.class,
"clusteredentity-embeddedid-test.ear");
suite.addTest(t1);
// Create an initializer for the test suite
DBSetup wrapper = new DBSetup(suite);
return wrapper;
|
protected void | tearDown()
if (sfsb0 != null)
{
try
{
sfsb0.remove();
}
catch (Exception e) {}
}
if (sfsb1 != null)
{
try
{
sfsb1.remove();
}
catch (Exception e) {}
}
sfsb0 = sfsb1 = null;
|
public void | testQuery()
try
{
sfsb0.createMusician(EmbeddedIdTest.DEFAULT_PK, "zither");
queryByInstrument(sfsb0, "zither", false);
queryByInstrument(sfsb0, "zither", true);
// pause to let queries replicate async
sleep(SLEEP_TIME);
queryByInstrument(sfsb1, "zither", false);
queryByInstrument(sfsb1, "zither", true);
}
finally
{
// cleanup the db so we can run this test multiple times w/o restarting the cluster
sfsb0.cleanup();
}
|