Search in sources :

Example 1 with ServiceInterface

use of org.switchyard.metadata.ServiceInterface in project quickstarts by jboss-switchyard.

the class CamelSqlRetrieveTest method shouldRetrieveGreetings.

@Test
public void shouldRetrieveGreetings() throws Exception {
    _testKit.removeService("GreetingService");
    MockHandler handler = new MockHandler();
    ServiceInterface metadata = JavaService.fromClass(GreetingService.class);
    _testKit.getServiceDomain().registerService(_testKit.createQName("GreetingService"), metadata, handler);
    PreparedStatement statement = connection.prepareStatement("INSERT INTO greetings (receiver, sender) VALUES (?,?)");
    statement.setString(1, RECEIVER);
    statement.setString(2, SENDER);
    assertEquals(1, statement.executeUpdate());
    PreparedStatement statement2 = connection.prepareStatement("INSERT INTO greetings (receiver, sender) VALUES (?,?)");
    statement2.setString(1, RECEIVER_2);
    statement2.setString(2, SENDER_2);
    assertEquals(1, statement2.executeUpdate());
    Set<Greeting> greetings = getContents(handler);
    assertEquals(2, greetings.size());
    assertEquals(true, checkGreeting(RECEIVER, SENDER, greetings));
    assertEquals(true, checkGreeting(RECEIVER_2, SENDER_2, greetings));
}
Also used : Greeting(org.switchyard.quickstarts.camel.sql.binding.Greeting) ServiceInterface(org.switchyard.metadata.ServiceInterface) MockHandler(org.switchyard.test.MockHandler) PreparedStatement(java.sql.PreparedStatement) Test(org.junit.Test)

Aggregations

PreparedStatement (java.sql.PreparedStatement)1 Test (org.junit.Test)1 ServiceInterface (org.switchyard.metadata.ServiceInterface)1 Greeting (org.switchyard.quickstarts.camel.sql.binding.Greeting)1 MockHandler (org.switchyard.test.MockHandler)1