1 2 Previous Next 16 Replies Latest reply on Jul 27, 2006 11:51 AM by jc7442 Go to original post
      • 15. Re: Embeddable EJB3 with Maven2?
        wonnekeysers

        Got it working the following:

        pom.xml:

        ...
        <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
         <suiteXmlFiles>
         <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
         </suiteXmlFiles>
        
         <!-- This trick allows the JBoss EJB3StandaloneBootstrap to find and deploy our compiled EJBs!! -->
         <systemProperties>
         <property>
         <name>java.class.path</name>
         <value>target/classes</value>
         </property>
         </systemProperties>
         </configuration>
        </plugin>
        ...
        


        TestNG test class:

        public class EJB3Test extends AssertJUnit {
        
         @Configuration(groups = "integration.ejb3", beforeSuite = true)
         public static void startupEmbeddedJboss()
         {
         EJB3StandaloneBootstrap.boot(null);
         EJB3StandaloneBootstrap.scanClasspath();
         }
        
         @Configuration(groups = "integration.ejb3", afterSuite = true)
         public static void shutdownEmbeddedJboss()
         {
         EJB3StandaloneBootstrap.shutdown();
         }
        
         @Test(groups = "integration.ejb3")
         public void testSubtract() throws Exception {
         Calculator calculator = (Calculator) new InitialContext().lookup("CalculatorBean/local");
         assertEquals(0, calculator.subtract(1, 1));
         }
        
        }
        



        • 16. Re: Embeddable EJB3 with Maven2?
          jc7442

          Right it should works !

          Another great features for EJB3StandaloneBootstrap class will be to have a method:

          EJB3StandaloneBootstrap.scanClasspath(URL[] urls)

          where url is a list of url to deploy (in replacement of using the system property). That's short to implement but as all methods in the class are static and attributes private static, it is difficult to patch EJB3StandaloneBootstrap to test that features ...



          1 2 Previous Next