Search in sources :

Example 11 with Exchange

use of org.switchyard.Exchange in project quickstarts by jboss-switchyard.

the class CamelJpaBindingReceiveTest method receiveEntity.

@Test
public void receiveEntity() throws Exception {
    _testKit.removeService("GreetingService");
    _testKit.removeService("StoreReference");
    service = _testKit.registerInOnlyService("GreetingService");
    PreparedStatement statement = connection.prepareStatement("insert into events (createdAt,sender,receiver) values(now(), ?, ?)");
    statement.setString(1, SENDER);
    statement.setString(2, RECEIVER);
    statement.execute();
    service.waitForOKMessage();
    final LinkedBlockingQueue<Exchange> receivedMessages = service.getMessages();
    assertNotNull(receivedMessages);
    final Exchange recievedExchange = receivedMessages.iterator().next();
    Greet receiver = recievedExchange.getMessage().getContent(Greet.class);
    assertEquals(SENDER, receiver.getSender());
    assertEquals(RECEIVER, receiver.getReceiver());
}
Also used : Exchange(org.switchyard.Exchange) Greet(org.switchyard.quickstarts.camel.jpa.binding.domain.Greet) PreparedStatement(java.sql.PreparedStatement) Test(org.junit.Test)

Aggregations

Exchange (org.switchyard.Exchange)11 Test (org.junit.Test)10 MockHandler (org.switchyard.test.MockHandler)9 MulticastSocket (java.net.MulticastSocket)2 SyndEntry (com.sun.syndication.feed.synd.SyndEntry)1 SyndFeed (com.sun.syndication.feed.synd.SyndFeed)1 DataOutputStream (java.io.DataOutputStream)1 FileInputStream (java.io.FileInputStream)1 DatagramPacket (java.net.DatagramPacket)1 InetAddress (java.net.InetAddress)1 Socket (java.net.Socket)1 KeyStore (java.security.KeyStore)1 PreparedStatement (java.sql.PreparedStatement)1 HashSet (java.util.HashSet)1 KeyManagerFactory (javax.net.ssl.KeyManagerFactory)1 SSLContext (javax.net.ssl.SSLContext)1 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)1 TrustManagerFactory (javax.net.ssl.TrustManagerFactory)1 FOMEntry (org.apache.abdera.parser.stax.FOMEntry)1 BlockingConnection (org.fusesource.mqtt.client.BlockingConnection)1