コード例 #1
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    validEndpoint = resolveMandatoryEndpoint("mock:valid", MockEndpoint.class);
    invalidEndpoint = resolveMandatoryEndpoint("mock:invalid", MockEndpoint.class);

    validEndpoint.whenAnyExchangeReceived(
        ProcessorBuilder.setBody(Builder.constant("validResult")));
    invalidEndpoint.whenAnyExchangeReceived(
        ProcessorBuilder.setBody(Builder.constant("invalidResult")));
  }
コード例 #2
0
 @DirtiesContext
 @Test
 public void helloRouteMustHaveBeenCalled() throws InterruptedException {
   JsonObject model = Json.createObjectBuilder().add("helloMessage", "toto").build();
   Map headers = new HashMap();
   headers.put("httpRequestType", Builder.constant("POST"));
   helloEntryPoint.sendBodyAndHeaders(model.toString(), headers);
   verify(helloService).persistHello((HelloEntity) anyObject());
   helloRouteMock.expectedMessageCount(1);
   helloRouteMock.assertIsSatisfied();
 }
コード例 #3
0
 public ProcessorDefinition<?> apply(RouteDefinition rd) {
   return rd.onException(Exception.class)
       .handled(true)
       .transform(Builder.exceptionMessage())
       .end();
 }