@Test
public void testCallbackWithObjectNameAndMethodName() {
ServiceQueue serviceQueue = ServiceBuilder.serviceBuilder().setRootAddress("/services")
.setServiceAddress("/todo-service")
.setServiceObject(new TodoService()).build().startServiceQueue();
SendQueue<MethodCall<Object>> requests = serviceQueue.requests();
TodoItem todoItem = new TodoItem("call mom", "give mom a call", new Date());
MethodCall<Object> addMethodCall = QBit.factory().createMethodCallByNames("add", "/todo-service", "call1:localhost", todoItem, null);
requests.send(addMethodCall);
MethodCall<Object> listMethodCall = QBit.factory().createMethodCallByNames("list", "/todo-service", "call2:localhost", todoItem, null);
requests.sendAndFlush(listMethodCall);
Sys.sleep(100);
ReceiveQueue<Response<Object>> responses = serviceQueue.responses();
Response<Object> response = responses.take();
Object body = response.body();
if (body instanceof List) {
@SuppressWarnings("unchecked") List<TodoItem> items = (List) body;
ok = items.size() > 0 || die("items should have one todo in it");
TodoItem todoItem1 = items.get(0);
ok = todoItem.equals(todoItem1) || die("TodoItem ", todoItem, todoItem1);
} else {
die("Response was not a list", body);
}
}