mardi 20 janvier 2015

Cannot find embedded-jboss-beans.xml in EJB project with Testing

I try to use Jboss-embedded and Testing in my EJB project to test my EJBs but when i run maven as test it's gives me that errors in the consol:


nb: i use Jbosse EAP6



Running TestSuite
Begin beforeMyTest
DEBUG [main] (KernelFactory.java:86) - Starting JBoss Kernel construction...
DEBUG [main] (KernelFactory.java:112) - Completed JBoss Kernel
construction. Duration: 128 milliseconds
Tests run: 5, Failures: 2, Errors: 0, Skipped: 3, Time elapsed: 0.412 sec<<< FAILURE! - in TestSuite
beforeMyTest(org.oap.service.all.subscription.impl.SubscriptionFactoryTest) Time elapsed: 0.382 sec <<< FAILURE!
java.lang.RuntimeException: java.lang.RuntimeException: Cannot find embedded-jboss-beans.xml
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:372)
at org.oap.service.all.subscription.impl.SubscriptionFactoryTest.beforeMyTest(SubscriptionFactoryTest.java:23)
beforeMyTest(org.oap.service.all.subscription.impl.SubscriptionFactoryTest) Time elapsed: 0.383 sec <<< FAILURE!
java.lang.RuntimeException: java.lang.RuntimeException: Cannot find embedded-jboss-beans.xml
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:372)
at org.oap.service.all.subscription.impl.SubscriptionFactoryTest.beforeMyTest(SubscriptionFactoryTest.java:23)
Results :
Failed tests:
org.oap.service.all.subscription.impl.SubscriptionFactoryTest.beforeMyTest(org.oap.service.all.subscription.impl.SubscriptionFactoryTest)
Run 1: SubscriptionFactoryTest.beforeMyTest:23 » Runtime java.lang.RuntimeException: ...
------------------------------------------------------------------------
[INFO] BUILD FAILURE


I added in my pom.xml:



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>ejbModule/src/main/resources/testing.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>

<dependency>


<groupId>org.jboss.embedded</groupId>
<artifactId>jboss-embedded-all</artifactId>
<version>beta3.SP9</version>
</dependency>
<dependency>
<groupId>org.jboss.embedded</groupId>
<artifactId>thirdparty-all</artifactId>
<version>beta3.SP9</version>
</dependency>


In the ejbModule/src/main/resources i made:


testing.xml:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://ift.tt/19x2mI9" >
<suite name="Suite1">
<test name="SubscriptionFactor">
<classes>
<class name="org.oap.service.all.subscription.impl.SubscriptionFactoryTest"/>
</classes> </test>
</suite>


in the same derictory i added also: bean.xml , embedded-jboss-beans.xml , jndi.properties and default.persistence.properties.


About my classe of test :



import java.io.File;
import javax.naming.InitialContext;
import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap;
import org.jboss.ejb3.embedded.EJB3StandaloneDeployer;
import org.testng.*;

import org.oap.interfaces.all.subscription.locals.ISubscriptionFactoryLocal;


public class SubscriptionFactoryTest {
private EJB3StandaloneDeployer deployer;
@BeforeTest
public void beforeMyTest() {
System.out.println("Begin beforeMyTest");
EJB3StandaloneBootstrap.boot(null);
System.out.println("scanClasspath");
EJB3StandaloneBootstrap.scanClasspath();
System.out.println("deployXmlResource");
EJB3StandaloneBootstrap.deployXmlResource("ejbModule/src/main/resources/beans.xml");
EJB3StandaloneBootstrap.deployXmlResource("ejbModule/src/main/resources/embedded-jboss-beans.xml");
deployer = EJB3StandaloneBootstrap.createDeployer();
try {
deployer.getArchives().add(new File("target/classes").toURI().toURL());
deployer.create();
deployer.start();
} catch (Exception exception) {
exception.printStackTrace();
}
}
@Test
public void testGetSubscriptionById() throws Exception {
InitialContext context = new InitialContext();
ISubscriptionFactoryLocal messageHandler = (ISubscriptionFactoryLocal) context.lookup("ISubscriptionFactoryLocal/local");
// ISubscriptionFactoryLocal messageHandler = (ISubscriptionFactoryLocal) context
// .lookup("ejb:/oap-services-all/SubscriptionFactory!org.opa.spb.interfaces.all.subscription.locals.ISubscriptionFactoryLocal");
// ISubscriptionFactoryLocal messageHandler = (ISubscriptionFactoryLocal) context
if (messageHandler != null) {
// .lookup("SubscriptionFactoryLocal/local");
Assert.assertNotNull(messageHandler.getSubscriptionById(null));
} else {
System.out.println("messageHandler == null");
}
}
@AfterTest
public void afterTest() {
EJB3StandaloneBootstrap.shutdown();
}
}


why i have these erros at the top?


Aucun commentaire:

Enregistrer un commentaire