Search in sources :

Example 6 with BuildImageParams

use of org.eclipse.che.plugin.docker.client.params.BuildImageParams in project che by eclipse.

the class DockerConnectorTest method shouldThrowDockerExceptionWhileBuildingImageIfResponseCodeIsNotSuccess.

@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = EXCEPTION_ERROR_MESSAGE)
public void shouldThrowDockerExceptionWhileBuildingImageIfResponseCodeIsNotSuccess() throws IOException, InterruptedException {
    AuthConfigs authConfigs = DtoFactory.newDto(AuthConfigs.class);
    AuthConfig authConfig = DtoFactory.newDto(AuthConfig.class);
    Map<String, AuthConfig> auth = new HashMap<>();
    auth.put("auth", authConfig);
    authConfigs.setConfigs(auth);
    BuildImageParams getExecInfoParams = BuildImageParams.create(dockerfile).withAuthConfigs(authConfigs);
    when(dockerResponse.getStatus()).thenReturn(RESPONSE_ERROR_CODE);
    dockerConnector.buildImage(getExecInfoParams, progressMonitor);
    verify(dockerResponse).getStatus();
}
Also used : AuthConfigs(org.eclipse.che.plugin.docker.client.dto.AuthConfigs) HashMap(java.util.HashMap) AuthConfig(org.eclipse.che.plugin.docker.client.dto.AuthConfig) Matchers.anyString(org.mockito.Matchers.anyString) BuildImageParams(org.eclipse.che.plugin.docker.client.params.BuildImageParams) Test(org.testng.annotations.Test)

Aggregations

BuildImageParams (org.eclipse.che.plugin.docker.client.params.BuildImageParams)6 HashMap (java.util.HashMap)5 AuthConfig (org.eclipse.che.plugin.docker.client.dto.AuthConfig)5 AuthConfigs (org.eclipse.che.plugin.docker.client.dto.AuthConfigs)5 Matchers.anyString (org.mockito.Matchers.anyString)5 Test (org.testng.annotations.Test)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 InputStream (java.io.InputStream)3 URI (java.net.URI)3 CloseConnectionInputStream (org.eclipse.che.plugin.docker.client.connection.CloseConnectionInputStream)3 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 MachineException (org.eclipse.che.api.machine.server.exception.MachineException)1