9
I use Arquillian to test an stateless session bean that has an explicit local and remote interface. But in the test Arquillian does not "inject" anything in a field that has the type of the local interface, but it works for the remote interface.
@Stateless
public class TestServiceImpl implements TestServiceLocal, TestServiceRemote {
public String greet() {
return "hallo";
}
}
The remote interface:
@Remote
public interface TestServiceRemote {
public String greet();
}
The 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;
//Will Fail
@Test
public void testTestServiceLocal() {
assertNotNull(this.testServiceLocal);
}
//Success
@Test
public void testTestServiceRemote() {
assertNotNull(this.testServiceRemote);
}
}
I am using arquillian-glassfish-embedded 1.0.0.CR2, glassfish-embedded-all 3.1 and arquillian-junit-container 1.0.0.CR5 The relevant part of my pom is:
<!-- arquillian test -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.0.0.CR5</version>
<scope>test</s