Search in sources :

Example 6 with Network

use of org.eclipse.che.plugin.docker.client.json.network.Network in project che by eclipse.

the class DockerConnectorTest method shouldBeAbleToInspectNetworkWithParams.

@Test
public void shouldBeAbleToInspectNetworkWithParams() throws Exception {
    // given
    Network originNetwork = createNetwork();
    ByteArrayInputStream inputStream = new ByteArrayInputStream(GSON.toJson(originNetwork).getBytes());
    doReturn(inputStream).when(dockerResponse).getInputStream();
    // when
    Network actual = dockerConnector.inspectNetwork(InspectNetworkParams.create(originNetwork.getId()));
    // then
    assertEquals(actual, originNetwork);
    verify(dockerConnectionFactory).openConnection(any(URI.class));
    verify(dockerConnection).method(REQUEST_METHOD_GET);
    verify(dockerConnection).path("/networks/" + originNetwork.getId());
    verify(dockerConnection).request();
    verify(dockerResponse).getStatus();
    verify(dockerResponse).getInputStream();
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) Network(org.eclipse.che.plugin.docker.client.json.network.Network) ContainerInNetwork(org.eclipse.che.plugin.docker.client.json.network.ContainerInNetwork) NewNetwork(org.eclipse.che.plugin.docker.client.json.network.NewNetwork) URI(java.net.URI) Test(org.testng.annotations.Test)

Aggregations

ContainerInNetwork (org.eclipse.che.plugin.docker.client.json.network.ContainerInNetwork)6 Network (org.eclipse.che.plugin.docker.client.json.network.Network)6 Test (org.testng.annotations.Test)4 NewNetwork (org.eclipse.che.plugin.docker.client.json.network.NewNetwork)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 Filters (org.eclipse.che.plugin.docker.client.json.Filters)2 Pod (io.fabric8.kubernetes.api.model.Pod)1 PodList (io.fabric8.kubernetes.api.model.PodList)1 Service (io.fabric8.kubernetes.api.model.Service)1 ServiceList (io.fabric8.kubernetes.api.model.ServiceList)1 HashMap (java.util.HashMap)1 Ipam (org.eclipse.che.plugin.docker.client.json.network.Ipam)1 IpamConfig (org.eclipse.che.plugin.docker.client.json.network.IpamConfig)1 GetNetworksParams (org.eclipse.che.plugin.docker.client.params.network.GetNetworksParams)1 InspectNetworkParams (org.eclipse.che.plugin.docker.client.params.network.InspectNetworkParams)1 KubernetesService (org.eclipse.che.plugin.openshift.client.kubernetes.KubernetesService)1 Matchers.anyString (org.mockito.Matchers.anyString)1