Search in sources :

Example 1 with AppClientWrapper

use of org.jboss.as.test.integration.ee.appclient.util.AppClientWrapper in project wildfly by wildfly.

the class SimpleApplicationClientTestCase method descriptorBasedAppClientTest.

/**
     * Tests an app client with a deployment descriptor, that injects an env-entry and an EJB.
     *
     * @throws Exception
     */
@Test
public void descriptorBasedAppClientTest() throws Exception {
    final StatelessEJBLocator<AppClientSingletonRemote> locator = new StatelessEJBLocator(AppClientSingletonRemote.class, APP_NAME, MODULE_NAME, AppClientStateSingleton.class.getSimpleName(), "");
    final AppClientSingletonRemote remote = EJBClient.createProxy(locator);
    remote.reset();
    final AppClientWrapper wrapper = new AppClientWrapper(archive, "--host=" + managementClient.getRemoteEjbURL(), "client-dd.jar", "");
    try {
        final String result = remote.awaitAppClientCall();
        assertTrue("App client call failed. App client output: " + wrapper.readAllUnformated(1000), result != null);
        assertEquals("EnvEntry", result);
    } finally {
        wrapper.quit();
    }
}
Also used : AppClientWrapper(org.jboss.as.test.integration.ee.appclient.util.AppClientWrapper) StatelessEJBLocator(org.jboss.ejb.client.StatelessEJBLocator) Test(org.junit.Test)

Example 2 with AppClientWrapper

use of org.jboss.as.test.integration.ee.appclient.util.AppClientWrapper in project wildfly by wildfly.

the class SimpleApplicationClientTestCase method testAppClientJBossDescriptor.

/**
     * Tests an app client with a deployment descriptor, that injects an env-entry and an EJB.
     *
     * @throws Exception
     */
@Test
public void testAppClientJBossDescriptor() throws Exception {
    final StatelessEJBLocator<AppClientSingletonRemote> locator = new StatelessEJBLocator(AppClientSingletonRemote.class, APP_NAME, MODULE_NAME, AppClientStateSingleton.class.getSimpleName(), "");
    final AppClientSingletonRemote remote = EJBClient.createProxy(locator);
    remote.reset();
    URL props = getClass().getClassLoader().getResource("jboss-ejb-client.properties");
    final AppClientWrapper wrapper = new AppClientWrapper(archive, " -Dnode0=" + managementClient.getMgmtAddress() + " --ejb-client-properties=" + props, "client-override.jar", "");
    try {
        final String result = remote.awaitAppClientCall();
        assertTrue("App client call failed. App client output: " + wrapper.readAllUnformated(1000), result != null);
        assertEquals("OverridenEnvEntry", result);
    } finally {
        wrapper.quit();
    }
}
Also used : AppClientWrapper(org.jboss.as.test.integration.ee.appclient.util.AppClientWrapper) StatelessEJBLocator(org.jboss.ejb.client.StatelessEJBLocator) URL(java.net.URL) Test(org.junit.Test)

Example 3 with AppClientWrapper

use of org.jboss.as.test.integration.ee.appclient.util.AppClientWrapper in project wildfly by wildfly.

the class SimpleApplicationClientTestCase method simpleAppClientTest.

/**
     * Tests a simple app client that calls an ejb with its command line parameters
     */
@Test
public void simpleAppClientTest() throws Exception {
    final StatelessEJBLocator<AppClientSingletonRemote> locator = new StatelessEJBLocator(AppClientSingletonRemote.class, APP_NAME, MODULE_NAME, AppClientStateSingleton.class.getSimpleName(), "");
    final AppClientSingletonRemote remote = EJBClient.createProxy(locator);
    remote.reset();
    final AppClientWrapper wrapper = new AppClientWrapper(archive, "--host=" + managementClient.getRemoteEjbURL(), "client-annotation.jar", "cmdLineParam");
    try {
        final String result = remote.awaitAppClientCall();
        assertTrue("App client call failed. App client output: " + wrapper.readAllUnformated(1000), result != null);
        assertEquals("cmdLineParam", result);
    } finally {
        wrapper.quit();
    }
}
Also used : AppClientWrapper(org.jboss.as.test.integration.ee.appclient.util.AppClientWrapper) StatelessEJBLocator(org.jboss.ejb.client.StatelessEJBLocator) Test(org.junit.Test)

Aggregations

AppClientWrapper (org.jboss.as.test.integration.ee.appclient.util.AppClientWrapper)3 StatelessEJBLocator (org.jboss.ejb.client.StatelessEJBLocator)3 Test (org.junit.Test)3 URL (java.net.URL)1