0 Replies Latest reply on Jul 23, 2013 4:40 PM by P B

    Tests Fail to Run: Glassfish 3.1, Netbeans 7.3.1 (no maven)

    P B Newbie

      I'm working on adding Arquillian tests to an existing project and am having trouble getting the tests to run. I have a couple of questions. Big thanks to anyone who can help out!

       

      1) Where should the Arquillian.xml file be? This project is not structured to have src/test/resources/ directory, so I can't put it there. Is there a way to tell Arquillian where to find the Arquillian.xml file? Our source tree looks like: https://github.com/IQSS/dvn/tree/develop/src

       

      2) Once I know where Arquillian.xml should be, what should be in it to make glassfish 3.1.2 work? Here's what I have now:

       

      <?xml version="1.0"?>
      <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="http://jboss.org/schema/arquillian"
          xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
          <container qualifier="glassfish" default="true">
              <configuration>
                  <property name="remoteServerAddress">localhost</property>
                  <property name="remoteServerHttpPort">8080</property>
                  <property name="remoteServerAdminPort">4848</property>
              </configuration>
          </container>
      
          <container qualifier="glassfish-auth">
              <configuration>
                  <property name="remoteServerAddress">localhost</property>
                  <property name="remoteServerHttpPort">8080</property>
                  <property name="remoteServerAdminPort">4848</property>
                  <property name="remoteServerAdminUser">admin</property>
                  <property name="remoteServerAdminPassword">******</property>
              </configuration>
          </container>
      </arquillian>
      

       

      3) Since I'm not using Maven, what dependencies will I need?  Here's what I have:

      Screen Shot 2013-07-23 at 4.37.35 PM.png

       

      4) Here's the error that I'm getting. I think that the container is not setup properly, but I'm not sure.

       

      Testsuite: edu.harvard.iq.dvn.core.BasicIntegrationTest
      Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.058 sec
      
      Testcase: initializationError(edu.harvard.iq.dvn.core.BasicIntegrationTest):    Caused an ERROR
      org/jboss/shrinkwrap/descriptor/impl/base/NodeProviderImplBase
      java.lang.NoClassDefFoundError: org/jboss/shrinkwrap/descriptor/impl/base/NodeProviderImplBase
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
          at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
          at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:270)
          at org.jboss.shrinkwrap.descriptor.api.DescriptorConstructionInfo.<init>(DescriptorConstructionInfo.java:69)
          at org.jboss.shrinkwrap.descriptor.api.DescriptorInstantiator.getDescriptorConstructionInfoForUserView(DescriptorInstantiator.java:275)
          at org.jboss.shrinkwrap.descriptor.api.DescriptorInstantiator.createFromUserView(DescriptorInstantiator.java:93)
          at org.jboss.shrinkwrap.descriptor.api.Descriptors.create(Descriptors.java:72)
          at org.jboss.shrinkwrap.descriptor.api.Descriptors.create(Descriptors.java:49)
          at org.jboss.arquillian.impl.bootstrap.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:55)
          at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)
          at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)
          at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)
          at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)
          at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)
          at org.jboss.arquillian.impl.core.ManagerImpl.<init>(ManagerImpl.java:91)
          at org.jboss.arquillian.impl.core.ManagerBuilder.create(ManagerBuilder.java:74)
          at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:97)
          at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:67)
          at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:82)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      Caused by: java.lang.ClassNotFoundException: org.jboss.shrinkwrap.descriptor.impl.base.NodeProviderImplBase
          at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      

       

      5) FYI, here's the test class implementation.

       

      /*
       * To change this template, choose Tools | Templates
       * and open the template in the editor.
       */
      package edu.harvard.iq.dvn.core;
      
      import edu.harvard.iq.dvn.core.visualization.VisualizationDisplay;
      
      import javax.inject.Inject;
      
      import org.jboss.arquillian.container.test.api.Deployment;
      import org.jboss.arquillian.junit.Arquillian;
      import org.jboss.shrinkwrap.api.asset.EmptyAsset;
      import org.jboss.shrinkwrap.api.ShrinkWrap;
      import org.jboss.shrinkwrap.api.spec.WebArchive;
      
      import org.junit.Test;
      import org.junit.runner.RunWith;
      import static org.junit.Assert.*;
      
      /**
       *
       * @author peterbull
       */
      @RunWith(Arquillian.class)
      public class BasicIntegrationTest {    
          @Inject
          VisualizationDisplay vizTest;
      
          @Deployment
          public static WebArchive getArchive()
          {
              return ShrinkWrap.create(WebArchive.class, BasicIntegrationTest.class.getSimpleName() + ".war")
                  .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
                  .addClass(VisualizationDisplay.class);
          }
      
          @Test
          public void getsId() {
              vizTest.setId(Long.MIN_VALUE);
              assertEquals((long)vizTest.getId(), (long)Long.MIN_VALUE);
          }
      }