@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
 private Exchange getExchangeCP(String path) throws IOException {
   Exchange exc = new Exchange(null);
   exc.setResponse(
       Response.ok()
           .contentType("text/xml")
           .body(getClass().getClassLoader().getResourceAsStream(path), true)
           .build());
   return exc;
 }
  @Test
  public void doit() throws Exception {
    Exchange exc = new Exchange(null);
    exc.setResponse(
        Response.ok().header("a", "b").header("c", "d").header("c", "d2").header("e", "f").build());

    HeaderFilterInterceptor fhi = new HeaderFilterInterceptor();
    fhi.setRules(
        Lists.newArrayList(
            new Rule[] {
              new Rule("Server", Action.REMOVE), // implicitly set by Response.ok()
              new Rule("a", Action.KEEP),
              new Rule("c.*", Action.REMOVE),
            }));
    fhi.handleResponse(exc);

    HeaderField[] h = exc.getResponse().getHeader().getAllHeaderFields();
    assertEquals(3, h.length);
    assertEquals("Content-Length", h[0].getHeaderName().toString());
    assertEquals("a", h[1].getHeaderName().toString());
    assertEquals("e", h[2].getHeaderName().toString());
  }