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));
}
Aggregations