Search in sources :

Example 1 with ServiceProviderRetriever

use of org.jboss.as.test.clustering.cluster.provider.bean.ServiceProviderRetriever in project wildfly by wildfly.

the class ServiceProviderRegistrationTestCase 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 directory = new RemoteEJBDirectory(MODULE_NAME)) {
        ServiceProviderRetriever bean = directory.lookupStateless(ServiceProviderRetrieverBean.class, ServiceProviderRetriever.class);
        Collection<String> names = bean.getProviders();
        assertEquals(2, names.size());
        assertTrue(names.toString(), names.contains(NODE_1));
        assertTrue(names.toString(), names.contains(NODE_2));
        undeploy(DEPLOYMENT_1);
        names = bean.getProviders();
        assertEquals(1, names.size());
        assertTrue(names.contains(NODE_2));
        deploy(DEPLOYMENT_1);
        names = bean.getProviders();
        assertEquals(2, names.size());
        assertTrue(names.contains(NODE_1));
        assertTrue(names.contains(NODE_2));
        stop(CONTAINER_2);
        names = bean.getProviders();
        assertEquals(1, names.size());
        assertTrue(names.contains(NODE_1));
        start(CONTAINER_2);
        names = bean.getProviders();
        assertEquals(2, names.size());
        assertTrue(names.contains(NODE_1));
        assertTrue(names.contains(NODE_2));
    }
}
Also used : ServiceProviderRetriever(org.jboss.as.test.clustering.cluster.provider.bean.ServiceProviderRetriever) RemoteEJBDirectory(org.jboss.as.test.clustering.ejb.RemoteEJBDirectory) EJBDirectory(org.jboss.as.test.clustering.ejb.EJBDirectory) RemoteEJBDirectory(org.jboss.as.test.clustering.ejb.RemoteEJBDirectory) Test(org.junit.Test)

Example 2 with ServiceProviderRetriever

use of org.jboss.as.test.clustering.cluster.provider.bean.ServiceProviderRetriever in project wildfly by wildfly.

the class ServiceProviderRegistrationTestCase method test.

@Test
public void test() throws Exception {
    JBossEJBProperties properties = JBossEJBProperties.fromClassPath(ServiceProviderRegistrationTestCase.class.getClassLoader(), CLIENT_PROPERTIES);
    properties.runCallable(() -> {
        try (EJBDirectory directory = new RemoteEJBDirectory(MODULE_NAME)) {
            ServiceProviderRetriever bean = directory.lookupStateless(ServiceProviderRetrieverBean.class, ServiceProviderRetriever.class);
            Collection<String> names = bean.getProviders();
            assertEquals(1, names.size());
            assertTrue(names.toString(), names.contains(NODE_1));
        }
        return null;
    });
}
Also used : JBossEJBProperties(org.jboss.ejb.client.legacy.JBossEJBProperties) ServiceProviderRetriever(org.jboss.as.test.clustering.cluster.provider.bean.ServiceProviderRetriever) RemoteEJBDirectory(org.jboss.as.test.clustering.ejb.RemoteEJBDirectory) EJBDirectory(org.jboss.as.test.clustering.ejb.EJBDirectory) RemoteEJBDirectory(org.jboss.as.test.clustering.ejb.RemoteEJBDirectory) Test(org.junit.Test)

Aggregations

ServiceProviderRetriever (org.jboss.as.test.clustering.cluster.provider.bean.ServiceProviderRetriever)2 EJBDirectory (org.jboss.as.test.clustering.ejb.EJBDirectory)2 RemoteEJBDirectory (org.jboss.as.test.clustering.ejb.RemoteEJBDirectory)2 Test (org.junit.Test)2 JBossEJBProperties (org.jboss.ejb.client.legacy.JBossEJBProperties)1