jboss-arquillian

Injecting @Stateless EJB in Arquillian tests

早过忘川 提交于 2019-12-06 21:33:32
A weird problem when running Arquillian test. If I try to use an EJB annotated with @Stateless, I get this error: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [MyEjbRemote] with qualifiers [@Default] at injection point [[field] @Inject private com.org.app.ejb.InjectionTest.ejb] I have the following test class + deployment for the Arquillian: @RunWith(Arquillian.class) public class InjectionTest extends TestCase { @Inject private MyEjbRemote ejb; @Deployment public static JavaArchive createDeployment() { JavaArchive jar = ShrinkWrap.create

Cannot run arquillian tests

耗尽温柔 提交于 2019-12-06 20:58:19
问题 I'm trying to use Arquillian for some unit tests, however I can't find why they fail when deployed using Maven. This is the class test: package com.ndeveloper.spec.test; import javax.inject.Inject; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; import org.jboss

Initialize Page Objects - Arquillian - Selenium

柔情痞子 提交于 2019-12-06 19:47:42
I am new to Selenium and Arquillian framework. I am trying to implement Page Object Model. Webdriver browser capabilities are saved in arquillian xml file. I am using TestNG and created the following classes: public class Test{ @Drone Webdriver driver; @Page Login login; @Page Home home; public void createOrderTest(){ login.navigateURL(); login.setcredentials(); home.createOrder(); } } public class Login{ // Webelements needed in methods below are declared here public void navigateURL(){ driver.get("//url/login.aspx"); } public void setCredentials(){ // code to enter username, password and

arquillian UnsupportedOperationException when use InSequence annotation

ⅰ亾dé卋堺 提交于 2019-12-06 11:44:32
I get the error when I add @InSequence annotation to my tests: java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableList$1.set(Collections.java:1412) at java.util.Collections.sort(Collections.java:234) at org.jboss.arquillian.junit.Arquillian.getChildren(Arquillian.java:71) at org.junit.runners.ParentRunner.getFilteredChildren(ParentRunner.java:426) at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:351) at org.junit.runners.Suite.describeChild(Suite.java:123) at com.intellij.junit4.IdeaSuite.describeChild(IdeaSuite.java:68) at com.intellij.junit4

Arquillian with Mockito and CDI

雨燕双飞 提交于 2019-12-06 09:45:06
问题 Is it possible to create spy(mock) object in testing class? Here is tested class. @Stateless @Slf4j public class UserDao { @Inject private TestBean testBean; public String mock() { return testBean.mock(); } public String notMock() { return testBean.notMock(); } } TestBean code @Stateless @Slf4j public class TestBean { public String notMock() { return "NOT MOCK"; } public String mock() { return "IMPLEMENTED MOCK"; } } Here's my test @RunWith(Arquillian.class) public class UserDataTest { @Rule

How to test EJB method call with Arquillian Weld EE Embedded

爷,独闯天下 提交于 2019-12-06 08:49:19
问题 I would like to test an EJB, and I want to test it with Weld EE Embedded as I don't want to deploy an applicatoin server for that. Here is my class : @RunWith(Arquillian.class) public class EJBTest { @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap .create(JavaArchive.class, "test.jar") .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); } @Stateless public static class SomeService { public String someMethod() { return "test"; } }

Weld (CDI): where do I put my test-only beans.xml that configures <alternatives>?

梦想的初衷 提交于 2019-12-06 08:30:18
问题 My webapp has a non-empty production beans.xml under src/main/resources/META-INF . Now, for my tests, I need to swap out 1 bean with an alternative. Where do I put this test beans.xml which contains just this and nothing more? <?xml version="1.0" encoding="UTF-8"?> <beans ...> <alternatives> <class>...MyTestReplacement</class> </alternatives> </beans> I tried under src/test/resources/META-INF but that is ignored. I am using arquillian and my test classpath is added to the ShrinkWrap. 回答1:

Arquillian wildfly8.2 embedded : JBAS014670: Failed initializing module org.jboss.as.logging

二次信任 提交于 2019-12-06 06:29:55
I'm trying to set up a project that uses arquillian to do some kind of integration testing. I already went through some tutorials but can't get my test running. The exception I get is: Cannot not load JBoss LogManager. The LogManager has likely been accessed prior to this initialization. Jul 14, 2015 10:30:37 AM org.jboss.msc.service.ServiceContainerImpl <clinit> INFO: JBoss MSC version 1.2.2.Final Jul 14, 2015 10:30:37 AM org.jboss.as.server.ApplicationServerService start INFO: JBAS015899: WildFly 8.2.0.Final "Tweek" starting Jul 14, 2015 10:30:38 AM org.jboss.as.controller

Arquillian vs EJB embeddable container

一个人想着一个人 提交于 2019-12-05 23:30:01
I am trying to understand the differences between the EJBContainer class provided by Java EE 6 for embeddable unit testing of EJB modules and Arquillian. Is there a good resource or can someone help me in understanding this? Is it worth to write Arquillian tests when I could test EJBs using an embeddable container? Full disclosure: I'm contributor of Arquillian Arquillian is a component model for integration testing . By using the EJBContainer , you bring the runtime(the container in this case) in your tests . By bringing the runtime in your tests, you add configuration complexity to them.

Arquillian: starts the server but doesn't deploy

冷暖自知 提交于 2019-12-05 17:58:59
I am adding Arquillian to my project, I started with helloworld example: @RunWith(Arquillian.class) public class AccountTest { @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap.create(JavaArchive.class).addClasses(CustomerLookupLocal.class, CustomerLookup.class); } @Test public void shouldBeAbleToReadSysPropAtStartup() { Assert.assertTrue(1 == 1); } I added to my pom such dependencies: <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.arquillian</groupId> <artifactId>arquillian-bom</artifactId> <version>${version.arquillian}</version> <scope