use of okhttp3.FormBody.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testInspectConfig_NonSwarmNode.
@Test(expected = NonSwarmNodeException.class)
public void testInspectConfig_NonSwarmNode() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.30");
server.enqueue(new MockResponse().setResponseCode(503).addHeader("Content-Type", "application/json"));
dockerClient.inspectConfig("ktnbjxoalbkvbvedmg1urrz8h");
}
use of okhttp3.FormBody.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testListNodesWithServerError.
@Test(expected = DockerException.class)
public void testListNodesWithServerError() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.28");
server.enqueue(new MockResponse().setResponseCode(500).addHeader("Content-Type", "application/json"));
dockerClient.listNodes();
}
use of okhttp3.FormBody.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.FormBody.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.FormBody.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);
}
Aggregations