-
1. Re: Switchyard Junit
igarashitm Sep 6, 2016 4:29 AM (in response to prameelapodigiri)You don't have to instantiate mixins when it runs with SwitchYardRunner. Although I don't see any benefit to access CDIMixIn instance from test code, if you want to access the CDIMixIn instance anyway, just put a instance variable, then SwitchYard test framework would inject the CDIMixIn instance.
-
2. Re: Switchyard Junit
prameelapodigiri Sep 6, 2016 6:18 AM (in response to prameelapodigiri)Hi Tomohisa igarashi,
Thanks for your reply.I removed instance for CDIMixIn and declared CDIMixIn as a property as per your explanation so switchyard framework injecting CDIMixIn instance automatically,but still i am getting same error.Please find the piece of code and error message.kindly help me to resolve this issue.
Code
---------------
@RunWith(SwitchYardRunner.class)
@SwitchYardTestCaseConfig(config = "META-INF/switchyard.xml",mixins = {CDIMixIn.class},exclude = "jms")
public class FMJobReaderJunit {
private static CDIMixIn cdiMixIn;
}
Error Log
------------------------------------
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1365)
at org.switchyard.component.test.mixins.cdi.CDIMixIn.uninitialize(CDIMixIn.java:245)
at org.switchyard.test.SwitchYardTestKit.cleanupMixIns(SwitchYardTestKit.java:810)
at org.switchyard.test.SwitchYardTestKit.cleanup(SwitchYardTestKit.java:186)
at org.switchyard.test.SwitchYardRunner$TestLifecycleListener.testFinished(SwitchYardRunner.java:95)
at org.junit.runner.notification.RunNotifier$7.notifyListener(RunNotifier.java:191)
at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:61)
at org.junit.runner.notification.RunNotifier.fireTestFinished(RunNotifier.java:188)
at org.junit.internal.runners.model.EachTestNotifier.fireTestFinished(EachTestNotifier.java:39)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:277)
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)
Thanks
-Prameela
-
3. Re: Switchyard Junit
igarashitm Sep 6, 2016 6:48 AM (in response to prameelapodigiri)That stacktrace means that the CDIMixIn failed to create Weld instance on initialization. Is there any other error messages before that?
-
-
5. Re: Switchyard Junit
igarashitm Sep 8, 2016 7:43 PM (in response to prameelapodigiri)Can you find what is different from bean-service quickstart? I tried adding CDIMixIn field in WebServiceTest but I didn't see that stacktrace.
diff --git a/quickstarts/bean-service/src/test/java/org/switchyard/quickstarts/bean/service/WebServiceTest.java b/quickstarts/bean-service/src/test/java/org/switchyard/quickstarts/bean/service/WebServiceTest.java index 1d32689..dd2555f 100644 --- a/quickstarts/bean-service/src/test/java/org/switchyard/quickstarts/bean/service/WebServiceTest.java +++ b/quickstarts/bean-service/src/test/java/org/switchyard/quickstarts/bean/service/WebServiceTest.java @@ -33,6 +33,7 @@ import org.switchyard.transform.config.model.TransformSwitchYardScanner; public class WebServiceTest { private HTTPMixIn httpMixIn; + private CDIMixIn cdiMixIn; @BeforeDeploy public void setProperties() { @@ -41,6 +42,7 @@ public class WebServiceTest { @Test public void invokeOrderWebService() throws Exception { + System.out.println(">>>>> " + cdiMixIn); // Use the HttpMixIn to invoke the SOAP binding endpoint with a SOAP input (from the test classpath) // and compare the SOAP response to a SOAP response resource (from the test classpath)... httpMixIn.setContentType("application/soap+xml");
>>>>> org.switchyard.component.test.mixins.cdi.CDIMixIn@5a3a1bf9
-
6. Re: Switchyard Junit
prameelapodigiri Sep 12, 2016 1:49 AM (in response to prameelapodigiri)Hi Tomohisa igarashi,
In the above shared example you are not loading any switchyard.xml file.So you are not getting that exception.In switchyard.xml file all the configuration classes and interfaces are loading sequentially.I am getting exception at the middle while loading the below code in switchyard.xml file
"
<resteasy:binding.rest name="rest1">
<resteasy:interfaces>com.alu.ipprd.aor.core.fm.handlers.job.IFMJobHandlerRestService</resteasy:interfaces>
<resteasy:contextPath>FMExternalService</resteasy:contextPath>
</resteasy:binding.rest>
"
I tried excluding this rest tag in xml file ,but still getting same exception..
I annotated my class with below annotations..Please check
@RunWith(SwitchYardRunner.class)
@SwitchYardTestCaseConfig(config = "META-INF/switchyard.xml",mixins = {CDIMixIn.class},exclude = {"soap","jms"})
public class FMJobReaderJunit {
private static CDIMixIn cdiMixIn;
}
If you require any additional information kindly let me know.
Thanks
-Prameela
-
7. Re: Switchyard Junit
igarashitm Sep 12, 2016 2:00 AM (in response to prameelapodigiri)It's loading a config at default location, i.e. /META-INF/switchyard.xml
config = SwitchYardTestCaseConfig.SWITCHYARD_XML,
Starting from this testcase and add what you want one by one would help you to find what is causing your problem.