コード例 #1
0
 @Test
 public void testHandleResponseValidArticleMessage() throws Exception {
   exc.setRequest(requestTB);
   exc.setResponse(Response.ok().body(getContent("/articleResponse.xml")).build());
   assertEquals(
       Outcome.CONTINUE, createValidatorInterceptor(ARTICLE_SERVICE_WSDL).handleResponse(exc));
 }
コード例 #2
0
  @Test
  public void testRequest() throws Exception {
    HttpRouter r = new HttpRouter();
    r.setApplicationContext(applicationContext);
    when(applicationContext.getBean("abc")).thenReturn("OK");

    Exchange exc = new Exchange(null);
    exc.setRequest(new Request());

    GroovyInterceptor i = new GroovyInterceptor();
    i.setSrc("exc.setProperty('foo', 'bar')\n" + "def b = spring.getBean('abc')\n" + "CONTINUE");
    i.init(r);

    assertEquals(Outcome.CONTINUE, i.handleRequest(exc));
    assertEquals("bar", exc.getProperty("foo"));
    verify(applicationContext, times(1)).getBean("abc");
  }
コード例 #3
0
 private Outcome getOutcome(Request request, Interceptor interceptor, String fileName)
     throws Exception {
   request.setBodyContent(getContent(fileName));
   exc.setRequest(request);
   return interceptor.handleRequest(exc);
 }