use of okhttp3.FormBody.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.FormBody.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");
}
use of okhttp3.FormBody.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testInspectVolume.
@Test
public void testInspectVolume() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
server.enqueue(new MockResponse().setResponseCode(200).addHeader("Content-Type", "application/json").setBody(fixture("fixtures/1.33/inspectVolume.json")));
final Volume volume = dockerClient.inspectVolume("my-volume");
assertThat(volume.name(), is("tardis"));
assertThat(volume.driver(), is("custom"));
assertThat(volume.mountpoint(), is("/var/lib/docker/volumes/tardis"));
assertThat(volume.status(), is(ImmutableMap.of("hello", "world")));
assertThat(volume.labels(), is(ImmutableMap.of("com.example.some-label", "some-value", "com.example.some-other-label", "some-other-value")));
assertThat(volume.scope(), is("local"));
assertThat(volume.options(), is(ImmutableMap.of("foo", "bar", "baz", "qux")));
}
use of okhttp3.FormBody.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testCapAddAndDrop.
@Test
@SuppressWarnings("unchecked")
public void testCapAddAndDrop() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
final HostConfig hostConfig = HostConfig.builder().capAdd(ImmutableList.of("foo", "bar")).capAdd(ImmutableList.of("baz", "qux")).build();
final ContainerConfig containerConfig = ContainerConfig.builder().hostConfig(hostConfig).build();
server.enqueue(new MockResponse());
dockerClient.createContainer(containerConfig);
final RecordedRequest recordedRequest = takeRequestImmediately();
assertThat(recordedRequest.getMethod(), is("POST"));
assertThat(recordedRequest.getPath(), is("/containers/create"));
assertThat(recordedRequest.getHeader("Content-Type"), is("application/json"));
// TODO (mbrown): use hamcrest-jackson for this, once we upgrade to Java 8
final JsonNode requestJson = toJson(recordedRequest.getBody());
final JsonNode capAddNode = requestJson.get("HostConfig").get("CapAdd");
assertThat(capAddNode.isArray(), is(true));
assertThat(childrenTextNodes((ArrayNode) capAddNode), containsInAnyOrder("baz", "qux"));
}
use of okhttp3.FormBody.Builder in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testInspectNodeNonManager.
@Test
public void testInspectNodeNonManager() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.27");
server.enqueue(new MockResponse().setResponseCode(200).addHeader("Content-Type", "application/json").setBody(fixture("fixtures/1.27/nodeInfoNonManager.json")));
NodeInfo nodeInfo = dockerClient.inspectNode("24ifsmvkjbyhk");
assertThat(nodeInfo, notNullValue());
assertThat(nodeInfo.id(), is("24ifsmvkjbyhk"));
assertThat(nodeInfo.status(), notNullValue());
assertThat(nodeInfo.status().addr(), is("172.17.0.2"));
assertThat(nodeInfo.managerStatus(), nullValue());
}
Aggregations