Skip to content

Instantly share code, notes, and snippets.

@jganoff
Created February 19, 2010 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jganoff/308364 to your computer and use it in GitHub Desktop.
Save jganoff/308364 to your computer and use it in GitHub Desktop.
SimpleEventForwardTest.java:
...
@Deployment
public static JavaArchive createTestDeployment()
{
JavaArchive archive = Archives.create("test.jar", JavaArchive.class);
archive.addPackages(false, Seam3JmsExtension.class.getPackage(), SimpleEventForwardTest.class.getPackage(), Destination.class.getPackage());
archive.addManifestResource(new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
archive.addServiceProvider(Extension.class, Seam3JmsExtension.class);
archive.addServiceProvider(EventPropagator.class, JmsEventPropagator.class);
// Include JBoss Messaging topic
archive.addManifestResource("topic_T-service.xml");
return archive;
}
@Inject Connection c;
@Inject Session s;
@Inject @Destination(jndiName = "topic/T") Topic t;
@Inject Seam3JmsExtension jmsExt;
@Inject Event<String> event;
@Test(timeout=5000)
public void forwardEvent() throws Exception
{
String expected = "test";
jmsExt.register(String.class, t);
MessageConsumer mc = s.createConsumer(t);
c.start();
event.fire(expected);
Message m = mc.receive();
assertNotNull(m);
assertTrue(m instanceof ObjectMessage);
assertEquals(expected, ((ObjectMessage) m).getObject());
}
-------------------------------------------------------------------------------
Test set: org.jboss.seam.jms.test.bridge.SimpleEventForwardTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.024 sec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment