Search in sources :

Example 1 with SimpleStatefulHome

use of org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome in project wildfly by wildfly.

the class AnnotationHomeTestCase method testGetEjbLocalObject.

@Test
public void testGetEjbLocalObject() throws Exception {
    final String message = "Bean Message";
    final SimpleStatefulHome home = (SimpleStatefulHome) iniCtx.lookup("java:module/SimpleStatefulBean!" + SimpleStatefulHome.class.getName());
    SimpleInterface ejbInstance = home.createSimple(message);
    try {
        Assert.assertEquals(message, ejbInstance.otherMethod());
    } catch (EJBException e) {
        Assert.assertEquals(IllegalStateException.class, e.getCause().getClass());
    }
}
Also used : EJBException(javax.ejb.EJBException) SimpleInterface(org.jboss.as.test.integration.ejb.home.remotehome.SimpleInterface) SimpleStatefulHome(org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome) Test(org.junit.Test)

Example 2 with SimpleStatefulHome

use of org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome in project wildfly by wildfly.

the class AnnotationHomeTestCase method testStatefulLocalHome.

@Test
public void testStatefulLocalHome() throws Exception {
    final String message = "Bean Message";
    final SimpleStatefulHome home = (SimpleStatefulHome) iniCtx.lookup("java:module/SimpleStatefulBean!" + SimpleStatefulHome.class.getName());
    SimpleInterface ejbInstance = home.createSimple(message);
    Assert.assertEquals(message, ejbInstance.sayHello());
    ejbInstance = home.createComplex("hello", "world");
    Assert.assertEquals("hello world", ejbInstance.sayHello());
    ejbInstance.remove();
    try {
        ejbInstance.sayHello();
        fail("Expected bean to be removed");
    } catch (NoSuchObjectException expected) {
    }
}
Also used : NoSuchObjectException(java.rmi.NoSuchObjectException) SimpleInterface(org.jboss.as.test.integration.ejb.home.remotehome.SimpleInterface) SimpleStatefulHome(org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome) Test(org.junit.Test)

Example 3 with SimpleStatefulHome

use of org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome in project wildfly by wildfly.

the class SimpleHomeTestCase method testStatefulLocalHome.

@Test
public void testStatefulLocalHome() throws Exception {
    final String message = "Bean Message";
    final SimpleStatefulHome home = (SimpleStatefulHome) iniCtx.lookup("java:module/SimpleStatefulHomeBean!" + SimpleStatefulHome.class.getName());
    SimpleInterface ejbInstance = home.createSimple(message);
    Assert.assertEquals(message, ejbInstance.sayHello());
    ejbInstance = home.createComplex("hello", "world");
    Assert.assertEquals("hello world", ejbInstance.sayHello());
}
Also used : SimpleInterface(org.jboss.as.test.integration.ejb.home.remotehome.SimpleInterface) SimpleStatefulHome(org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome) Test(org.junit.Test)

Example 4 with SimpleStatefulHome

use of org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome in project wildfly by wildfly.

the class SimpleHomeTestCase method testgetEjbLocalObject.

@Test
public void testgetEjbLocalObject() throws Exception {
    final String message = "Bean Message";
    final SimpleStatefulHome home = (SimpleStatefulHome) iniCtx.lookup("java:module/SimpleStatefulHomeBean!" + SimpleStatefulHome.class.getName());
    SimpleInterface ejbInstance = home.createSimple(message);
    Assert.assertEquals(message, ejbInstance.otherMethod());
    ejbInstance = home.createComplex("hello", "world");
    Assert.assertEquals("hello world", ejbInstance.otherMethod());
}
Also used : SimpleInterface(org.jboss.as.test.integration.ejb.home.remotehome.SimpleInterface) SimpleStatefulHome(org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome) Test(org.junit.Test)

Example 5 with SimpleStatefulHome

use of org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome in project wildfly by wildfly.

the class StatefulEJBRemoteHomeRuntimeNameTestCase method testStatefulLocalHome.

@Test
@InSequence(value = 2)
public void testStatefulLocalHome() throws Exception {
    SimpleStatefulHome home = (SimpleStatefulHome) context.lookup(getEJBHomeJNDIBinding());
    SimpleInterface ejbInstance = home.createSimple("Hello World");
    Assert.assertEquals("Hello World", ejbInstance.sayHello());
    home = (SimpleStatefulHome) ejbInstance.getEJBHome();
    ejbInstance = home.createSimple("Hello World");
    Assert.assertEquals("Hello World", ejbInstance.sayHello());
}
Also used : SimpleInterface(org.jboss.as.test.integration.ejb.home.remotehome.SimpleInterface) SimpleStatefulHome(org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

SimpleInterface (org.jboss.as.test.integration.ejb.home.remotehome.SimpleInterface)5 SimpleStatefulHome (org.jboss.as.test.integration.ejb.home.remotehome.SimpleStatefulHome)5 Test (org.junit.Test)5 NoSuchObjectException (java.rmi.NoSuchObjectException)1 EJBException (javax.ejb.EJBException)1 InSequence (org.jboss.arquillian.junit.InSequence)1