use of org.apache.http.client.fluent.Executor in project substitution-schedule-parser by vertretungsplanme.
the class LoginHandlerTest method testBasicAuthFailUrl.
@Test(expected = CredentialInvalidException.class)
public void testBasicAuthFailUrl() throws JSONException, IOException, CredentialInvalidException {
stubBasicAuth();
Executor exec = newExecutor();
LoginHandler handler = new LoginHandler(dataBasicUrl, wrong, null);
handler.handleLogin(exec, null);
}
use of org.apache.http.client.fluent.Executor in project acs-aem-commons by Adobe-Consulting-Services.
the class HttpClientFactoryImplTest method testJsonGet.
@Test
public void testJsonGet() throws Exception {
impl.activate(config);
Request get = impl.get("/anonJson");
Executor exec = impl.getExecutor();
JSONObject jsonObject = exec.execute(get).handleResponse(new JsonObjectResponseHandler());
assertThat(jsonObject.has("foo"), is(true));
assertThat(jsonObject.getString("foo"), is("bar"));
}
use of org.apache.http.client.fluent.Executor in project redisson by redisson.
the class RedissonSessionManagerTest method testUpdateTwoServers_readValue.
@Test
public void testUpdateTwoServers_readValue() throws Exception {
TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/");
TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/");
try {
server1.start();
server2.start();
Executor executor = Executor.newInstance();
BasicCookieStore cookieStore = new BasicCookieStore();
executor.use(cookieStore);
write(8080, executor, "test", "from_server1");
write(8081, executor, "test", "from_server2");
read(8080, executor, "test", "from_server2");
read(8080, executor, "test", "from_server2");
} finally {
Executor.closeIdleConnections();
server1.stop();
server2.stop();
}
}
use of org.apache.http.client.fluent.Executor in project redisson by redisson.
the class RedissonSessionManagerTest method testRecreate.
@Test
public void testRecreate() throws Exception {
// start the server at http://localhost:8080/myapp
TomcatServer server = new TomcatServer("myapp", 8080, "src/test/");
server.start();
Executor executor = Executor.newInstance();
write(8080, executor, "test", "1");
recreate(executor, "test", "2");
read(8080, executor, "test", "2");
Executor.closeIdleConnections();
server.stop();
}
use of org.apache.http.client.fluent.Executor in project redisson by redisson.
the class RedissonSessionManagerTest method testUpdateTwoServers_twoValues.
@Test
public void testUpdateTwoServers_twoValues() throws Exception {
TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/");
TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/");
try {
server1.start();
server2.start();
Executor executor = Executor.newInstance();
BasicCookieStore cookieStore = new BasicCookieStore();
executor.use(cookieStore);
write(8080, executor, "key1", "value1");
write(8080, executor, "key2", "value1");
write(8081, executor, "key1", "value2");
write(8081, executor, "key2", "value2");
read(8080, executor, "key1", "value2");
read(8080, executor, "key2", "value2");
} finally {
Executor.closeIdleConnections();
server1.stop();
server2.stop();
}
}
Aggregations