use of com.yahoo.messagebus.test.SimpleMessage in project vespa by vespa-engine.
the class MbusServerTestCase method requireThatNonMbusResponseCausesEmptyReply.
@Test
public void requireThatNonMbusResponseCausesEmptyReply() {
MyRequestHandler requestHandler = MyRequestHandler.newInstance();
ServerTestDriver driver = ServerTestDriver.newInstance(requestHandler);
assertTrue(driver.sendMessage(new SimpleMessage("foo")));
assertNotNull(requestHandler.awaitRequest());
assertTrue(requestHandler.sendResponse(new Response(Response.Status.OK)));
assertNotNull(driver.awaitSuccess());
assertTrue(driver.close());
}
use of com.yahoo.messagebus.test.SimpleMessage in project vespa by vespa-engine.
the class MbusServerTestCase method requireThatRequestDeniedExceptionIsCaught.
@Test
public void requireThatRequestDeniedExceptionIsCaught() {
ServerTestDriver driver = ServerTestDriver.newInstance(MyRequestHandler.newRequestDenied());
assertTrue(driver.sendMessage(new SimpleMessage("foo")));
assertNotNull(driver.awaitErrors(ErrorCode.APP_FATAL_ERROR));
assertTrue(driver.close());
}
use of com.yahoo.messagebus.test.SimpleMessage in project vespa by vespa-engine.
the class MbusServerTestCase method requireThatBindingNotFoundExceptionIsCaught.
@Test
public void requireThatBindingNotFoundExceptionIsCaught() {
ServerTestDriver driver = ServerTestDriver.newUnboundInstance();
assertTrue(driver.sendMessage(new SimpleMessage("foo")));
assertNotNull(driver.awaitErrors(ErrorCode.APP_FATAL_ERROR));
assertTrue(driver.close());
}
use of com.yahoo.messagebus.test.SimpleMessage in project vespa by vespa-engine.
the class MbusServerTestCase method requireThatMbusRequestContentCallsCompletion.
@Test
public void requireThatMbusRequestContentCallsCompletion() throws InterruptedException {
MyRequestHandler requestHandler = MyRequestHandler.newInstance();
ServerTestDriver driver = ServerTestDriver.newInstance(requestHandler);
assertTrue(driver.sendMessage(new SimpleMessage("foo")));
assertNotNull(requestHandler.awaitRequest());
ContentChannel content = requestHandler.responseHandler.handleResponse(new Response(Response.Status.OK));
assertNotNull(content);
MyCompletion completion = new MyCompletion();
content.close(completion);
assertTrue(completion.completedLatch.await(60, TimeUnit.SECONDS));
assertNotNull(driver.awaitSuccess());
assertTrue(driver.close());
}
use of com.yahoo.messagebus.test.SimpleMessage in project vespa by vespa-engine.
the class MbusServerTestCase method requireThatRequestIsMbus.
@Test
public void requireThatRequestIsMbus() {
MyRequestHandler requestHandler = MyRequestHandler.newInstance();
ServerTestDriver driver = ServerTestDriver.newInstance(requestHandler);
assertTrue(driver.sendMessage(new SimpleMessage("foo")));
Request request = requestHandler.awaitRequest();
assertTrue(request instanceof MbusRequest);
Message msg = ((MbusRequest) request).getMessage();
assertTrue(msg instanceof SimpleMessage);
assertEquals("foo", ((SimpleMessage) msg).getValue());
assertTrue(requestHandler.sendResponse(new Response(Response.Status.OK)));
assertNotNull(driver.awaitSuccess());
assertTrue(driver.close());
}
Aggregations