Job testing with remote EJB invocation
TweetPosted on Wednesday Feb 26, 2014 at 04:50PM in Technology
I introduced that a way to test a JSR352 job with Arquillian, but I guess it's might too complex for testing of a JSR352 job, so I'm going to try to test them without Arquillian.
Environment
- WildFly 8.0.0.Final
- Oracle JDK7u51
Sample project
- Whole resources are available at GitHub.
- Example test class is HelloJobTest.
How does it work?
- JUnit test class lookups javax.batch.operations.JobOperator instance from Remote WildFly through Remote EJB Interface.
- Test class kicks the job.
- Test class will wait till the job finished.
- Assert BatchStatus.
How do I run on other application servers?
- I don't know surely, but edit below resources may helps:
- jndi.properties
- AbstractJobTest.java (JNDI_NAME)
- Also appropriate jar files for remote EJB invocation are required.
Log of WildFly
17:06:18,214 INFO [stdout] (batch-batch - 3) hello
Local log
2 26, 2014 5:14:39 午後 org.xnio.Xnio <clinit> INFO: XNIO version 3.2.0.Final 2 26, 2014 5:14:40 午後 org.xnio.nio.NioXnio <clinit> INFO: XNIO NIO Implementation Version 3.2.0.Final 2 26, 2014 5:14:40 午後 org.jboss.remoting3.EndpointImpl <clinit> INFO: JBoss Remoting version 4.0.0.Final 2 26, 2014 5:14:40 午後 org.jboss.ejb.client.remoting.VersionReceiver handleMessage INFO: EJBCLIENT000017: Received server version 2 and marshalling strategies [river] 2 26, 2014 5:14:40 午後 org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@2db9e6d7, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@7e244b5,channel=jboss.ejb,nodename=kyle-no-macbook]} on channel Channel ID c584a9f3 (outbound) of Remoting connection 09168b43 to localhost/127.0.0.1:8080 2 26, 2014 5:14:40 午後 org.jboss.ejb.client.EJBClient <clinit> INFO: JBoss EJB Client version 2.0.0.Final
Remarks
- It's much faster than Arquillian Remoting on my environment.
Tags: jbatch