use of org.jboss.as.test.clustering.cluster.registry.bean.RegistryRetriever in project wildfly by wildfly.
the class RegistryTestCase method test.
@Test
public void test() throws Exception {
// TODO Elytron: Once support for legacy EJB properties has been added back, actually set the EJB properties
// that should be used for this test using CLIENT_PROPERTIES and ensure the EJB client context is reset
// to its original state at the end of the test
EJBClientContextSelector.setup(CLIENT_PROPERTIES);
try (EJBDirectory context = new RemoteEJBDirectory(MODULE_NAME)) {
RegistryRetriever bean = context.lookupStateless(RegistryRetrieverBean.class, RegistryRetriever.class);
Collection<String> names = bean.getNodes();
assertEquals(2, names.size());
assertTrue(names.toString(), names.contains(NODE_1));
assertTrue(names.toString(), names.contains(NODE_2));
undeploy(DEPLOYMENT_1);
names = bean.getNodes();
assertEquals(1, names.size());
assertTrue(names.contains(NODE_2));
deploy(DEPLOYMENT_1);
names = bean.getNodes();
assertEquals(2, names.size());
assertTrue(names.contains(NODE_1));
assertTrue(names.contains(NODE_2));
stop(CONTAINER_2);
names = bean.getNodes();
assertEquals(1, names.size());
assertTrue(names.contains(NODE_1));
start(CONTAINER_2);
names = bean.getNodes();
assertEquals(2, names.size());
assertTrue(names.contains(NODE_1));
assertTrue(names.contains(NODE_2));
}
}
use of org.jboss.as.test.clustering.cluster.registry.bean.RegistryRetriever in project wildfly by wildfly.
the class RegistryTestCase method test.
@Test
public void test() throws Exception {
JBossEJBProperties properties = JBossEJBProperties.fromClassPath(RegistryTestCase.class.getClassLoader(), CLIENT_PROPERTIES);
properties.runCallable(() -> {
try (EJBDirectory context = new RemoteEJBDirectory(MODULE_NAME)) {
RegistryRetriever bean = context.lookupStateless(RegistryRetrieverBean.class, RegistryRetriever.class);
Collection<String> names = bean.getNodes();
assertEquals(1, names.size());
assertTrue(names.toString(), names.contains(NODE_1));
}
return null;
});
}
Aggregations