6 Replies Latest reply: Mar 24, 2011 11:07 AM by Stephan Pabinger RSS

    Alpha5 - problem with producer methods/fields

    Stephan Pabinger Newbie

      Hi,

       

      I just upgraded arquillian from alpha4 to alpha5 and experience now the problem that my producer methods/fields do not work anymore.

       

      Example:

       

      I have a producer field for the EntityManger:

       

      public class DBFactory
      {
        @PersistenceUnit(unitName = "seqbench")
        @Produces
        @ExtensionManaged
        @SBPersistence
        EntityManagerFactory emf;
      }
      

       

      The produced EntityManager is then used in my class:

       

      @Stateless
      public class UsermanagementBridge implements Serializable
      {  
        @Inject
        @SBRequestPersistence
        private EntityManager entityManager;
      
        ...
      }
      

       

       

      Using arquillian alpha4 that just worked fine but with alpha5 I get a

       

      Unsatisfied dependencies for type [EntityManager] with qualifiers [@SBRequestPersistence] at injection point [[field] @Inject @SBRequestPersistence private at.icbi.seqbench.component.usermanagement.UsermanagementBridge.entityManager]

       

       

      Does anybody know a solution to this problem?

       

      Thanks

      Stephan

        • 1. Alpha5 - problem with producer methods/fields
          Aslak Knutsen Master

          Which arquillian container are you using and which contianer v (+ actual container runtime lib v's)?

          • 2. Alpha5 - problem with producer methods/fields
            Stephan Pabinger Newbie

            I have the following versions in my pom file:

             

            Test:

            - arquillian.version -> 1.0.0.Alpha5

            - version.junit -> 4.8.2

            - weld.core.version -> 1.1.0.Final

             

            Container:

            - JBoss 6.0.0.Final

            remote configuration (arquillian-jbossas-remote-6)

             

            Seam:

            version CR3

            - config

            - faces

            - international

            - persistence

            - security

            - servlet

            - solder

            • 3. Alpha5 - problem with producer methods/fields
              Aslak Knutsen Master

              hmm, what about your @Deployment definition?

              • 4. Re: Alpha5 - problem with producer methods/fields
                Stephan Pabinger Newbie

                I've added all methods that are used in the method annotated with @Deployment

                 

                 @Deployment
                  public static Archive<?> createTestArchive()
                  {
                     WebArchive war = JBossasTestUtils.createSolderPersistenceTestArchive();
                
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_SERVLET_API));
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_SERVLET_IMPL));
                
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_CONFIG));
                
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_INTERNATIONAL_API));
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_INTERNATIONAL_IMPL));
                
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_FACES_API));
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_FACES_IMPL));
                
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.JAVAX_FACES));
                
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_SECURITY_API));     
                
                     //Project specific lib
                     war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.USERMANAGEMENT_UTILS));
                
                     war.addClasses(getTestClasses());
                
                     return war;
                  }
                
                

                 

                 

                public static Class<?>[] getTestClasses()
                  {
                    return new Class[] {       
                        DBFactoryRequest.class,
                        SBRequestPersistence.class,
                
                        //Project classes
                        ...
                
                        };
                  }
                

                 

                 

                 

                  public static WebArchive createSolderPersistenceTestArchive()
                  {
                    WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
                    war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_SOLDER));    war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
                    war.addAsLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
                
                    war.addAsResource(new File("src/test/resources/seamTest-persistence.xml"), ArchivePaths.create("META-INF/persistence.xml"));
                
                    war.addAsWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");   
                    return war;  }
                
                
                • 5. Re: Alpha5 - problem with producer methods/fields
                  Aslak Knutsen Master

                  The ShrinkWrap API has changed a bit, in createSolderPersistenceTestArchive

                   

                  war.addAsWebResource will put beans.xml in /, you want to use addAsWebInfResource to have it placed in /WEB-INF.

                  • 6. Re: Alpha5 - problem with producer methods/fields
                    Stephan Pabinger Newbie

                    Thanks a lot. That fixed the problem.

                     

                    Stephan