use of okhttp3.Request.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testUpdateConfig_NotFound.
@Test(expected = NotFoundException.class)
public void testUpdateConfig_NotFound() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.30");
server.enqueue(new MockResponse().setResponseCode(404).addHeader("Content-Type", "application/json"));
final ConfigSpec configSpec = ConfigSpec.builder().data(Base64.encodeAsString("foobar")).name("foo.yaml").build();
dockerClient.updateConfig("ktnbjxoalbkvbvedmg1urrz8h", 11L, configSpec);
}
use of okhttp3.Request.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testCustomHeaders.
@Test
public void testCustomHeaders() throws Exception {
builder.header("int", 1);
builder.header("string", "2");
builder.header("list", Lists.newArrayList("a", "b", "c"));
server.enqueue(new MockResponse());
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
dockerClient.info();
final RecordedRequest recordedRequest = takeRequestImmediately();
assertThat(recordedRequest.getMethod(), is("GET"));
assertThat(recordedRequest.getPath(), is("/info"));
assertThat(recordedRequest.getHeader("int"), is("1"));
assertThat(recordedRequest.getHeader("string"), is("2"));
// TODO (mbrown): this seems like incorrect behavior - the client should send 3 headers with
// name "list", not one header with a value of "[a, b, c]"
assertThat(recordedRequest.getHeaders().values("list"), contains("[a, b, c]"));
}
use of okhttp3.Request.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testCreateConfig_ConflictingName.
@Test(expected = ConflictException.class)
public void testCreateConfig_ConflictingName() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.30");
server.enqueue(new MockResponse().setResponseCode(409).addHeader("Content-Type", "application/json"));
final ConfigSpec configSpec = ConfigSpec.builder().data(Base64.encodeAsString("foobar")).name("foo.yaml").build();
dockerClient.createConfig(configSpec);
}
use of okhttp3.Request.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testInspectConfig.
@Test
public void testInspectConfig() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.30");
server.enqueue(new MockResponse().setResponseCode(200).addHeader("Content-Type", "application/json").setBody(fixture("fixtures/1.30/inspectConfig.json")));
final Config config = dockerClient.inspectConfig("ktnbjxoalbkvbvedmg1urrz8h");
assertThat(config, notNullValue());
assertThat(config.id(), equalTo("ktnbjxoalbkvbvedmg1urrz8h"));
assertThat(config.version().index(), equalTo(11L));
final ConfigSpec configSpec = config.configSpec();
assertThat(configSpec.name(), equalTo("app-dev.crt"));
}
use of okhttp3.Request.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testDeleteConfig.
@Test
public void testDeleteConfig() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.30");
server.enqueue(new MockResponse().setResponseCode(204).addHeader("Content-Type", "application/json"));
dockerClient.deleteConfig("ktnbjxoalbkvbvedmg1urrz8h");
}
Aggregations