appRequest.put("docker_image", dockerInfo.getImage()); if (dockerInfo.getDockerCredentials() != null) { appRequest.put("docker_credentials", dockerInfo.getDockerCredentials());
@Test public void testWithValidImageWithoutUserCredentials() { List<Map<String, Object>> parameters = new ArrayList<>(); Map<String, Object> moduleParameters = new HashMap<>(); Map<String, String> dockerParameters = new HashMap<>(); String sampleImage = "cloudfoundry/test-app"; dockerParameters.put("image", sampleImage); moduleParameters.put("docker", dockerParameters); parameters.add(moduleParameters); DockerInfo actualDockerInfo = dockerInfoParser.parse(parameters); DockerInfo expectedDockerInfo = new DockerInfo(sampleImage); assertEquals(expectedDockerInfo.getImage(), actualDockerInfo.getImage()); assertEquals(expectedDockerInfo.getDockerCredentials(), actualDockerInfo.getDockerCredentials()); }
private Map<String, Object> createStagingParameters(Staging staging) { Map<String, Object> stagingParameters = new HashMap<>(); if (staging.getBuildpackUrl() != null) { stagingParameters.put(BUILDPACK_PARAMETER, staging.getBuildpackUrl()); } if (staging.getCommand() != null) { stagingParameters.put(COMMAND_PARAMETER, staging.getCommand()); } if (staging.getHealthCheckTimeout() != null) { stagingParameters.put(HEALTH_CHECK_TIMEOUT_PARAMETER, staging.getHealthCheckTimeout()); } if (staging.getHealthCheckType() != null) { stagingParameters.put(HEALTH_CHECK_TYPE_PARAMETER, staging.getHealthCheckType()); } if (staging.getHealthCheckHttpEndpoint() != null) { stagingParameters.put(HEALTH_CHECK_HTTP_ENDPOINT_PARAMETER, staging.getHealthCheckHttpEndpoint()); } if (staging.isSshEnabled() != null) { stagingParameters.put(ENABLE_SSH_PARAMETER, staging.isSshEnabled()); } if (staging.getDockerInfo() != null) { stagingParameters.put(DOCKER_IMAGE, staging.getDockerInfo().getImage()); if (staging.getDockerInfo().getDockerCredentials() != null) { stagingParameters.put(DOCKER_CREDENTIALS, staging.getDockerInfo().getDockerCredentials()); } } return stagingParameters; }
.getImage()); if (staging.getDockerInfo() .getDockerCredentials() != null) {
@Test public void testWithValidImageAndCredentials() { List<Map<String, Object>> parameters = new ArrayList<>(); Map<String, Object> moduleParameters = new HashMap<>(); Map<String, String> dockerParameters = new HashMap<>(); String sampleImage = "cloudfoundry/test-app"; String username = "someUsername"; String password = "somePassword"; dockerParameters.put("image", sampleImage); dockerParameters.put("username", username); dockerParameters.put("password", password); moduleParameters.put("docker", dockerParameters); parameters.add(moduleParameters); DockerInfo actualDockerInfo = dockerInfoParser.parse(parameters); DockerInfo expectedDockerInfo = new DockerInfo(sampleImage); expectedDockerInfo.setDockerCredentials(new DockerCredentials(username, password)); assertEquals(expectedDockerInfo.getImage(), actualDockerInfo.getImage()); assertEquals(expectedDockerInfo.getDockerCredentials() .getUsername(), actualDockerInfo.getDockerCredentials() .getUsername()); assertEquals(expectedDockerInfo.getDockerCredentials() .getPassword(), actualDockerInfo.getDockerCredentials() .getPassword()); }
execution.getStepLogger() .info(Messages.CREATING_APP_FROM_DOCKER_IMAGE, app.getName(), app.getDockerInfo() .getImage());
execution.getStepLogger() .info(Messages.CREATING_APP_FROM_DOCKER_IMAGE, app.getName(), app.getDockerInfo() .getImage());