How?=> JBI component testing using JUnit
Hi,
I want to test each and every life cycle method of JBI component using JUnit asserts statements. In short i want to write a component which itself consists of JUnit testcases. Is it possible? How should i approach?
I tried using asserts statements directly ....
e.g. Asserts.assertsequals(true, compLC==null?false:true); But if it fails it stops
everything.
Can u plz tell me better way of doing this?
Thanks,
Kulbhushan
I'm not completely clear on what you're trying to accomplish. Are you trying to test an existing JBI component?
When you say "But if it fails it stops everything", exactly what is the context? Are the asserts inside a JBI component? Are you saying that a failure stops JBI or just the component itself?
mark
hai ,
ide :Netbeans 5.5
server:Sun Applicaton Server
I developed LoanProcessing (example on netbeans ide)
I created the JBI Module it is success.and i use the LoanProcessing (example) it is also success.and i created LoanProcessingCompositeApplication it si also deployed succesful but when i am tested it fails.It gives the error like
caught exception while processing message
java.lang.RuntimeException: Error sending fault to the NMR. MessageExchange is InOut and role is provider. MessageExchangeId is 167865099140895-21929-133846915113590145, service name is {http://enterprise.netbeans.org/bpel/LoanRequestor1}EjbImplementation, endpoint name is LoanProcessorRole_partnerRole, operation name is processApplication.
at com.sun.jbi.engine.bpel.EngineChannel.sendServerFaultForInOutRequest(EngineChannel.java:428)
at com.sun.jbi.engine.bpel.BPELSEInOutThread.processRequest(BPELSEInOutThread.java:393)
at com.sun.jbi.engine.bpel.BPELSEInOutThread.processMsgEx(BPELSEInOutThread.java:197)
at com.sun.jbi.engine.bpel.BPELSEInOutThread.run(BPELSEInOutThread.java:138)
Caused by: javax.jbi.messaging.MessagingException: Faults not supported in exchange pattern.
at com.sun.jbi.messaging.MessageExchangeProxy.createFault(MessageExchangeProxy.java:461)
at com.sun.jbi.engine.bpel.EngineChannel.sendServerFaultForInOutRequest(EngineChannel.java:415)
... 3 more
If You know the answer send the reply as early as possible
Thanks,
radhi.
Our team has actually created a Mock JBI implementation that we use to write unit tests for our JBI components. It is based on Dependency Injection so it is fairly easy to inject your own basic mock implementations; we already have very basic impls.
I would suggest doing the same. My company is currently exploring being able to open up what we have created to the public, but unfortunately until that happens I can't release it.
You need to post this as a new topic, this topic is related to junit testing. If you post this as a separate topic, you will have a much better chance of receiving a response from the appropriate developers.
Just as a follow up Kulbhushan, I wanted to let you know the JBI Mock Framework is now available for download.
The JBI Mock Framework is a set of classes that allow developers to test JBI Components at a unit level, mocking out the Normalized Message Router (NMR).
Main features are:
- Provides Mock interfaces and Basic implementations for the majority of JBI interfaces
- Mock classes to write unit tests for Binding Components and Service Engines
- Examples showing how to use the Spring Framework and JUnit to create a unit test
Please visit the Open JBI Components project on java.net for more information: https://open-jbi-components.dev.java.net/
Or go directly to the JBI Mock Framework wiki: http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=JBIMockFramework