1 Reply Latest reply on Mar 27, 2012 6:21 AM by Karel Piwko

    Problem to add dependences into ShrinkWrap

    Romulo Lana Newbie

      Hello people...

       

      Anyone knows how to import the dependences into ShrinkWrap, I'm using Maven and the project uses J2EE, Vaadin and JPA. In short I have a test case that isn't work.

       

      Just log the message:

       

      EjbInjectionTestCase: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive EjbInjectionTestCase.createTestArchive()

       

      The code is the following:

       

      import javax.ejb.EJB;

       

      import org.jboss.arquillian.container.test.api.Deployment;

      import org.jboss.arquillian.junit.Arquillian;

      import org.jboss.shrinkwrap.api.ShrinkWrap;

      import org.jboss.shrinkwrap.api.asset.EmptyAsset;

      import org.jboss.shrinkwrap.api.spec.WebArchive;

      import org.junit.Assert;

      import org.junit.Test;

      import org.junit.runner.RunWith;

       

       

      import br.gov.mg.mp.tutorial.business.cadastro.ClienteBC;

       

       

      @RunWith(Arquillian.class)

      public class EjbInjectionTestCase {

       

                @Deployment

                public static WebArchive createTestArchive() {

       

       

                          return ((ShrinkWrap

                                              .create(WebArchive.class, "EjbInjectionTestCase.war")

                                              .addAsManifestResource("META-INF/persistence.xml","META-INF/persistence.xml"))

                                              .addAsResource(EmptyAsset.INSTANCE, "META-INF/beans.xml")

                                              .addPackages(true,"br.gov.mg.mp")

         

                                              //FIXME WHEN I PUT THIS CODE, OCCURS THE ERROR:    EjbInjectionTestCase: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive EjbInjectionTestCase.createTestArchive()

                                              /*

                                              .addAsLibraries(

                                                                  DependencyResolvers

                                                                  .use(MavenDependencyResolver.class)

                                                                  .loadSettings("C:/Users/romulolana/.m2/settings.xml")

                                                                  .loadEffectivePom("pom.xml")

                                                                  .importAllDependencies()

                                                                  .resolveAsFiles())

                                              */

       

                                              );

                }

       

                @EJB

                private ClienteBC clienteBC;

       

                @Test

                public void shouldBeAbleToInjectEJB() throws Exception {

       

                          Assert.assertEquals("JOHN SMITH",                                        clienteBC.getById(new Integer(1)));

                }

      }

       

       

      Thanks in advance,

       

      Lana, Rômulo

      Systems Analyst – Public Prosecutor of the State of Minas Gerais

      IT Superintendent – Information Systems – System Architecture