I use Arquillian to test a non-bean session that has an explicit local and remote interface. But in the test, Arkillian does not "inject" anything into a field that has the type of a local interface, but works for a remote interface.
@Stateless public class TestServiceImpl implements TestServiceLocal, TestServiceRemote { public String greet() { return "hallo"; } }
Remote Interface:
@Remote public interface TestServiceRemote { public String greet(); }
Locale Interface:
@Local public interface TestServiceLocal { public String greet(); }
And this is the test:
@RunWith(Arquillian.class) public class GenericEntityDaoEjbIntegrationTest { @Deployment public static JavaArchive createTestArchive() throws UnsupportedEncodingException { return ShrinkWrap.create(JavaArchive.class, "test.jar") .addClasses( TestServiceLocal.class, TestServiceRemote.class, TestServiceImpl.class); } @EJB private TestServiceLocal testServiceLocal; @EJB private TestServiceRemote testServiceRemote;
I am using arquillian-glassfish-embedded 1.0.0.CR2, glassfish-embedded-all 3.1 and arquillian-junit-container 1.0.0.CR5. Relevant part of my pom:
<dependency> <groupId>org.jboss.arquillian.junit</groupId> <artifactId>arquillian-junit-container</artifactId> <version>1.0.0.CR5</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.container</groupId> <artifactId>arquillian-container-spi</artifactId> <version>1.0.0.CR5</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.container</groupId> <artifactId>arquillian-glassfish-embedded-3.1</artifactId> <version>1.0.0.CR2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.glassfish.extras</groupId> <artifactId>glassfish-embedded-all</artifactId> <version>3.1</version> <scope>test</scope> </dependency>
This is the corresponding part of the log file (it does not contain any exceptions):
10.04.2012 15:38:16 com.sun.ejb.containers.BaseContainer initializeHome INFO: Portable JNDI names for EJB TestServiceImpl : [java:global/test/TestServiceImpl!de.test.service.TestServiceRemote, java:global/test/TestServiceImpl!de.test.service.TestServiceLocal] 10.04.2012 15:38:16 com.sun.ejb.containers.BaseContainer initializeHome INFO: Glassfish-specific (Non-portable) JNDI names for EJB TestServiceImpl : [de.test.service.TestServiceRemote, de.test.service.TestServiceRemote#de.test.service.TestServiceRemote] 10.04.2012 15:38:16 com.sun.enterprise.web.WebApplication start INFO: WEB0671: Loading application [test] at [/test] 10.04.2012 15:38:16 org.glassfish.deployment.admin.DeployCommand execute INFO: test was successfully deployed in 11.844 milliseconds.
What's my mistake? What do I need to change to get the instance entered for the locale interface?
Ralph source share