Arquillian and SwitchYardRunner test cases don't like to coexist in same project while working with UserTransaction

Solution Unverified - Updated -

Issue

  • There are two separate JUnit test cases packaged inside the same SwitchYard project. One JUnit is to test the CDI's (annotated with @RunWith(Arquillian.class) which makes it an Arquillian test case) and another to test services ( annotated with @RunWith(SwitchYardRunner.class) which makes it a SwitchYardRunner test case).
    The problem is with the tests performed with @RunWith(SwitchYardRunner.class), where it is observed that if the test with @RunWith(Arquillian.class) has the CDI injection of UserTransaction the other test throws this exception.
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [UserTransaction] with qualifiers [@Default] at injection point [[field] @Inject com.sample.arquillian.test.ServiceArquillianTest.utx]
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:274)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:243)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:106)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:126)
    at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:345)
    at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:330)
    at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
    at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.validateBeans(ForwardingBootstrap.java:85)
    at org.jboss.weld.environment.se.Weld.initialize(Weld.java:134)
    at org.switchyard.component.test.mixins.cdi.CDIMixIn.initialize(CDIMixIn.java:123)
    at org.switchyard.test.SwitchYardTestKit.initializeMixIns(SwitchYardTestKit.java:786)
    at org.switchyard.test.SwitchYardTestKit.<init>(SwitchYardTestKit.java:167)
    at org.switchyard.test.SwitchYardRunner.createTest(SwitchYardRunner.java:53)
    at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:244)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:241)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.switchyard.test.SwitchYardRunner.run(SwitchYardRunner.java:85)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Environment

  • Red Hat JBoss Fuse Service Works (FSW)
    • 6.0.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.