5 Replies Latest reply on Jan 25, 2011 1:40 PM by henk53

    How to set up Arquillian for non-Maven projects?

    gorter

      I need to use Arquillian to test a large number of libraries that are already written, but that are not Maven projects. I am using Eclipse Helios, and I have gotten the Arquillian projects into Eclipse but I am not able to run any tests as of now. When I try to run the simple TemperatureConverter test from the examples, I get no compile/build errors, but I do get the following error:

       

      Jan 10, 2011 3:43:07 PM org.jboss.arquillian.impl.XmlConfigurationBuilder loadArquillianConfiguration

      INFO: building configuration from XML file: arquillian.xml

      Jan 10, 2011 3:43:07 PM org.jboss.arquillian.impl.XmlConfigurationBuilder matchContainerConfiguration

      WARNING: No container configuration found for URI: java:urn:org.jboss.arquillian.impl

       

      I am guessing that I am gettting this error because I have not done enough setup, but I am not sure what I should all change because the TemperatureConverter and TemperatureConverterTest classes are in an Eclipse Plug-in Project. There is no pom.xml file, so where do I setup the profiles which specify which container will be used?

       

      I have JBoss 6.0 running on my machine, and I am using JUnit in Eclipse.

       

      I have attached the classes.

       

      Thanks,

      Nathan

        • 1. How to set up Arquillian for non-Maven projects?
          aslak
          • 2. How to set up Arquillian for non-Maven projects?
            gorter

            Thanks, I took a look at that article and the examples it referenced, and they helped a lot and I am close, but not quite there yet. I am running into the following error while trying to run build.xml:

             

            Testsuite: org.vanbelle.test.TemperatureConverterTest

            Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.328 sec

            ------------- Standard Error -----------------

            log4j:WARN No appenders could be found for logger (org.jnp.interfaces.TimedSocketFactory).

            log4j:WARN Please initialize the log4j system properly.

            ------------- ---------------- ---------------

             

            Testcase: initializationError took 0.016 sec

                      Caused an ERROR

            org.jboss.arquillian.spi.LifecycleException: Could not connect to container

            org.jboss.arquillian.impl.event.FiredEventException: org.jboss.arquillian.spi.LifecycleException: Could not connect to container

                      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)

                      at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)

                      at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)

                      at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:89)

                      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

            Caused by: org.jboss.arquillian.spi.LifecycleException: Could not connect to container

                      at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:90)

                      at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:52)

                      at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:41)

                      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)

            Caused by: java.lang.Exception: Can not make remoting client invocation due to not being connected to server.

                      at org.jboss.remoting.Client.invoke(Client.java:1639)

                      at org.jboss.remoting.Client.invoke(Client.java:548)

                      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.aop.generatedproxies.AOPProxy$0.getDeploymentManager(AOPProxy$0.java)

                      at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.initDeploymentManager(JBossASRemoteContainer.java:222)

                      at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:85)

             

            I have JBoss 6.0.0.Final running, and I know it is doing something because I get different errors if I try to run build.xml if the server is stopped. Here is my ivy.xml file, in case I have some problems with dependencies, verisons, etc.:

             

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

            <ivy-module version="2.0" xmlns:m="http://ant.apache.ord/ivy/maven">

                      <info organisation="org.vanbelle"

                                          module="arquillian-example-tests"

                                          revision="1.0.0-SNAPSHOT">

                      </info>

                      <configurations>

                                <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime, master" />

                                <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies" />

                                <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths." />

                                <conf name="compile-only" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths." extends="compile" />

                                <conf name="provided" visibility="public" description="this is much like compile, but indicated you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive." />

                                <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile" />

                                <conf name="test" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in teh runtime and test classpaths, but not the compile classpath." extends="runtime" />

                                <conf name="test-jbossas-remote" visibility="private" description="This scope is for executing Arquillian tests on a remote JBoss AS instance." extends="test" />

                      </configurations>

                      <dependencies>

                                <dependency org="org.jboss.spec" name="jboss-javaee-6.0" rev="1.0.0.Beta7" conf="compile-only->compile(*)">

                                          <artifact name="jboss-javaee-6.0" type="pom" ext="pom" conf="" />

                                </dependency>

             

                                <dependency org="org.jboss.arquillian" name="arquillian-junit" rev="1.0.0.Alpha4" conf="test->default(*)" />

                                <dependency org="junit" name="junit" rev="4.8.1" conf="test->default(*)" />

                                <dependency org="org.hamcrest" name="hamcrest-core" rev="1.2" conf="test->default(*)" />

                                <dependency org="javax.enterprise" name="cdi-api" rev="1.0-SP1" conf="test-jbossas-remote->default(*)" />

             

                                <dependency org="org.jboss.arquillian.container" name="arquillian-jbossas-remote-6" rev="1.0.0.Alpha4" conf="test-jbossas-remote->default(*)" />

                                <dependency org="org.jboss.jbossas" name="jboss-as-server" m:classifier="client" rev="6.0.0.Final" conf="test-jbossas-remote->default(*)" transitive="false" />

                                <dependency org="org.jboss.jbossas" name="jboss-as-profileservice" m:classifier="client" rev="6.0.0.Final" conf="test-jbossas-remote->default(*)" />

                                <dependency org="org.jboss.naming" name="jnpserver" rev="5.0.3.GA" />

                                <dependency org="org.jboss.aop" name="jboss-aop" rev="2.2.0.Final" />

                                <dependency org="jboss" name="jboss-remoting" rev="4.2.2.GA" />

                                <dependency org="jboss.jbossas.core-libs" name="jboss-aspect-library" rev="4.0.4.GA" />

                                <dependency org="org.jboss.integration" name="jboss-profileservice-spi" rev="6.0.0.Alpha9" />

                                <dependency org="org.jboss.security" name="jbosssx-client" rev="4.2.2.GA" />

                      </dependencies>

            </ivy-module>

             

            Many of those last dependencies I added at the end because I was getting ClassNotFoundExceptions for them.

            • 3. How to set up Arquillian for non-Maven projects?
              aslak

              If you look at the Maven example here, you should see the correct dependencies needed to run it:

               

              http://docs.jboss.org/arquillian/reference/snapshot/en-US/html_single/#container.jbossas-remote-6

               

              Which version of ivy do you use? I remember someone mentioning some issues in a previous ivy v. not supporting the import scope introduced in the latest maven versions.

               

              Do you have a jndi.properties file on classpath as well?

              https://github.com/arquillian/arquillian/blob/master/examples/junit/src/test/jboss-resources/jndi.properties

              • 4. How to set up Arquillian for non-Maven projects?
                gorter

                I have finally gotten Arquillian running with JBoss/Ant! It was a little confusing because the examples found at https://github.com/mojavelinux/arquillian-showcase/tree/master/cdi/ called for the following dependencies:

                 

                <dependency org="org.jboss.arquillian.container" name="arquillian-jbossas-remote-6" rev="1.0.0.Alpha4" conf="test-jbossas-remote->default(*)"/>

                <dependency org="org.jboss.jbossas" name="jboss-as-server" m:classifier="client" rev="6.0.0.Final" conf="test-jbossas-remote->default(*)" transitive="false"/>

                <dependency org="org.jboss.jbossas" name="jboss-as-profileservice" m:classifier="client" rev="6.0.0.Final" conf="test-jbossas-remote->default(*)"/>

                 

                while the reference guide http://docs.jboss.org/arquillian/reference/snapshot/en-US/html_single/#container.jbossas-remote-6 seems to call for the following dependencies:

                 

                <dependency org="org.jboss.arquillian.container" name="arquillian-jboss-remote-6" rev="1.0.0.Alpha4" />

                <dependency org="org.jboss.jbossas" name="jboss-as-client" rev="6.0.0.Final" />

                 

                I only got the tests running with the first set of dependencies, not the second. Just for clarification, why are there different dependencies listed and should they both work?

                • 5. How to set up Arquillian for non-Maven projects?
                  henk53

                  This one might also be of help: Integration testing using Arquillian without Maven

                   

                  It describes how to set up a testing environment without using Maven and has direct links to all the required artifacts for the current alpha 4 release.