Getting several Errors while running Arquillian test class
Dear forum members,
I am quite new to Arquillian and I have just completed the getting started tutorial from
http://arquillian.org/guides/getting_started/
I tried to implement the same procedure to my own Java program but it does not work. To replicate my problem here my Class:
@Path( "/AUTHENTICATION" )
public class AuthEndpoint
{
/**
* the local database that stores the token
*/
@Inject
private DatabaseInterface database;
/**
* based on the given uuid this service will return a hashed value that might be used as password
* @param info the information about the device as {@link DeviceInfo}
* @return the complete device login info as {@link LoginInfo}
*/
@POST
@Produces( { "application/json" } )
@Consumes( { "application/json" } )
@Path( "CREATEMOBILELOGIN" )
public LoginInfo createMobileLogin( DeviceInfo info)
{
System .err .println ( ) ;
LoginInfo response = null ;
if ( info != null && info.getUuid ( ) != null )
{
String password = this .database .registerDevice ( info.getUuid ( ) ) ;
if ( password != null )
{
response = new LoginInfo( ) ;
response.setPw ( password) ;
response.setUuid ( info.getUuid ( ) ) ;
}
}
return response;
}
}
Here my TestClass:
@RunWith( Arquillian.class )
@RunAsClient
public class AuthTestMyself
{
@Deployment
public static JavaArchive createDeployment( )
{
return ShrinkWrap.create ( JavaArchive.class )
.addClass ( AuthEndpoint.class )
.addAsManifestResource ( EmptyAsset.INSTANCE , "beans.xml" ) ;
}
@Inject
AuthEndpoint authEndpoint;
@Test
public void registerUUIDTest( )
{
String sResponse = null ;
final ObjectMapper mapper = new ObjectMapper( ) ;
DeviceInfo info = new DeviceInfo( ) ;
info.setUuid ( "myself" ) ;
info.setDate ( "2014-12-12" ) ;
LoginInfo resp = null ;
final String input = mapper.writeValueAsString ( info) ;
resp = this .authEndpoint .createMobileLogin ( info) ;
Assert .assertEquals ( "myself" , resp.getUuid ( ) ) ;
}
}
I have added my pom file in the attachments
The outcome is:
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
Caused by: java.lang.reflect.InvocationTargetException
Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container gf4_managed
Caused by: java.lang.IllegalStateException: Multiple service implementations found for interface org.jboss.arquillian.container.spi.client.container.DeployableContainer. org.jboss.arquillian.container.glassfish.managed_3_1.GlassFishManagedDeployableContainer, org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer
Why am I getting this?? I have not changed anything from the tutorial.
I would appreciate any help.
regards