@Before public void setup() { dummy = context.mock(ClientHandler.class); authFilter = new BasicAuthFilter("admin", "lamepass"); ReflectionTestUtils.setField(authFilter, "next", dummy); clientRequest = context.mock(ClientRequest.class); headers = new MultivaluedMapImpl(); context.checking(new Expectations() { { allowing(clientRequest).getHeaders(); will(returnValue(headers)); allowing(dummy).handle(with(aNonNull(ClientRequest.class))); will(returnValue(null)); } }); }
protected ClientBase(ClientConfig cc, ClientHandler handler) { JacksonJsonProvider provider = new JacksonJsonProvider(objectMapper()); cc.getSingletons().add(provider); if (handler == null) { this.client = Client.create(cc); } else { this.client = new Client(handler, cc); } }
/** * * @param config config REST Client configuration * @param handler handler Jersey client handler. Useful when plugging in various http client interaction modules (e.g. ribbon) * @param filters Chain of client side filters to be applied per request */ public TaskClient(ClientConfig config, ClientHandler handler, ClientFilter...filters) { super(config, handler); for(ClientFilter filter : filters) { super.client.addFilter(filter); } }
/** * * @param config config REST Client configuration * @param handler handler Jersey client handler. Useful when plugging in various http client interaction modules (e.g. ribbon) * @param filters Chain of client side filters to be applied per request */ public WorkflowClient(ClientConfig config, ClientHandler handler, ClientFilter...filters) { super(config, handler); for(ClientFilter filter : filters) { super.client.addFilter(filter); } }
@Override protected void before() throws Throwable { ClientHandler handler = new URLConnectionClientHandler(); ClientConfig config = new DefaultClientConfig(ObjectMapperProvider.class); client = new Client(handler, config); }
@Before public void setUp() throws Exception { next = mock(ClientHandler.class); restResponse = mock(ClientResponse.class); restRequest = mock(ClientRequest.class); filter = new DebugJerseyFilter(); filter.setAsync(isAsync); filter.setDisabled(false); DebugContext.init(null); ReflectionTestUtils.setField(filter, "next", next); }
/** * * @param config REST Client configuration * @param handler Jersey client handler. Useful when plugging in various http client interaction modules (e.g. ribbon) */ public TaskClient(ClientConfig config, ClientHandler handler) { super(config, handler); }
/** * * @param config REST Client configuration * @param handler Jersey client handler. Useful when plugging in various http client interaction modules (e.g. ribbon) */ public WorkflowClient(ClientConfig config, ClientHandler handler) { super(config, handler); }