1 Reply Latest reply on Jul 30, 2015 3:46 AM by Mohan Radhakrishnan

    Loading dependencies from external pom.xml

    Mohan Radhakrishnan Newbie

      Hi,

              I have two different projects. One is my Arquillian unit test project and the other is my actual project. Can I load dependencies from my actual project's pom.xml which is external to my Arquillian test project. This external pom has its modules and a  parent-child hierarchy. I also want to load classes from my project using ShrinkWrap.and execute unit tests.

       

      Is that possible ?

       

      I want to build an EAR but at this time I am executing this sample code successfully. So the EAR will have queues configured by HornetQ.

       

          public static WebArchive createTestArchive() {

        

              File[] files = Maven.resolver().loadPomFromFile("D:/Code Quality/Drop1_T1T2_Refactor/SCOS/pom.xml")

                      .importRuntimeDependencies().resolve().withTransitivity().asFile();

       

       

              WebArchive archive = ShrinkWrap.create(WebArchive.class,"scos-hrg.war")

                     .addAsLibraries(files)

                     .addAsWebInfResource("hornetq-jms.xml");

              for( File f : files ){

              l.info(f.toString());

              }

              l.info(archive.toString());

              return archive;

          }

      Thanks,

      Mohan

        • 1. Re: Loading dependencies from external pom.xml
          Mohan Radhakrishnan Newbie

          I am following this(Arquillian test with real EAR from build) procedure in order to work with the existing EAR.

          My DataSource is like this for testing.

           

          <?xml version="1.0" encoding="UTF-8"?>

          <datasources xmlns="http://www.jboss.org/ironjacamar/schema"

              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

              xsi:schemaLocation="

                  http://www.jboss.org/ironjacamar/schema

                  http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

              <datasource enabled="true"

                  jndi-name="jndi/SCOS_DS"

                  pool-name="ArquillianEmbeddedH2Pool">

                  <connection-url>jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1</connection-url>

                  <driver>h2</driver>

              </datasource>

          </datasources>

           

          What else is needed to avoid this error ?

           

              Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionScheduler': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.hrg.storecard.businessservice.DeviceService com.hrg.storecard.businessservice.impl.SessionSchedulerImpl.deviceService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deviceServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.hrg.storecard.businessservice.MessageSenderService com.hrg.storecard.businessservice.impl.DeviceServiceImpl.messageSenderService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSenderServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jms.core.JmsTemplate com.hrg.storecard.businessservice.impl.MessageSenderServiceImpl.regResponseJmsTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsTemplate' defined in file [D:\\arquillian\\wildfly-9.0.0.Final\\wildfly-9.0.0.Final\\standalone\\tmp\\vfs\\deployment\\deploymentb060a197a69196c9\\SCOS-Web.war-86d57a94b24f22f5\\WEB-INF\\applicationContext-listener.xml]: Cannot resolve reference to bean 'jmsQueueConnectionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsQueueConnectionFactory' defined in file [D:\\arquillian\\wildfly-9.0.0.Final\\wildfly-9.0.0.Final\\standalone\\tmp\\vfs\\deployment\\deploymentb060a197a69196c9\\SCOS-Web.war-86d57a94b24f22f5\\WEB-INF\\applicationContext-listener.xml]: Cannot resolve reference to bean 'jmsInternalQueueConnectionFactory' while setting bean property 'targetConnectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsInternalQueueConnectionFactory' defined in file [D:\\arquillian\\wildfly-9.0.0.Final\\wildfly-9.0.0.Final\\standalone\\tmp\\vfs\\deployment\\deploymentb060a197a69196c9\\SCOS-Web.war-86d57a94b24f22f5\\WEB-INF\\applicationContext-listener.xml]: Cannot resolve reference to bean 'jndiTemplate' while setting bean property 'jndiTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'jndiTemplate' is defined

          Mohan