0 Replies Latest reply on Dec 30, 2015 8:09 AM by fs_arquillian

    Getting several Errors while running Arquillian Test Class

    fs_arquillian

      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:

       

      1. @Path("/AUTHENTICATION")
      2. public class AuthEndpoint
      3. {
      4. /**
      5. * the local database that stores the token
      6. */
      7. @Inject
      8. private DatabaseInterface database;
      9. /**
      10. * based on the given uuid this service will return a hashed value that might be used as password
      11. * @param info the information about the device as {@link DeviceInfo}
      12. * @return the complete device login info as {@link LoginInfo}
      13. */
      14. @POST
      15. @Produces({ "application/json" })
      16. @Consumes({ "application/json" })
      17. @Path("CREATEMOBILELOGIN")
      18. public LoginInfo createMobileLogin(DeviceInfo info)
      19. {
      20.     System.err.println();
      21.     LoginInfo response = null;
      22.     if (info != null && info.getUuid() != null)
      23.     {
      24.         String password = this.database.registerDevice(info.getUuid());
      25.         if (password != null)
      26.         {
      27.             response = new LoginInfo();
      28.             response.setPw(password);
      29.             response.setUuid(info.getUuid());
      30.         }
      31.     }
      32.     return response;
      33. }
      34. }

       

      Here my TestClass:


      1. @RunWith(Arquillian.class)
      2. @RunAsClient
      3. public class AuthTestMyself
      4. {
      5. @Deployment
      6.   public static JavaArchive createDeployment()
      7. {
      8.   return ShrinkWrap.create(JavaArchive.class)
      9.   .addClass(AuthEndpoint.class)
      10.   .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
      11.   }
      12. @Inject
      13. AuthEndpoint authEndpoint;
      14. @Test
      15. public void registerUUIDTest()
      16. {
      17.     String sResponse = null;
      18.     final ObjectMapper mapper = new ObjectMapper();
      19.     DeviceInfo info = new DeviceInfo();
      20.     info.setUuid("myself");
      21.     info.setDate("2014-12-12");
      22.     LoginInfo resp = null;
      23.     final String input = mapper.writeValueAsString(info);
      24.     resp = this.authEndpoint.createMobileLogin(info);
      25.     Assert.assertEquals("myself", resp.getUuid());
      26. }
      27. }

       

      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