org.springframework.cloud.deployer.resource.docker.DockerResource Java Examples
The following examples show how to use
org.springframework.cloud.deployer.resource.docker.DockerResource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CloudFoundryApplicationManifestUtils.java From spring-cloud-skipper with Apache License 2.0 | 6 votes |
public static ApplicationManifest updateApplicationPath(ApplicationManifest cfApplicationManifest, Resource application) { ApplicationManifest.Builder applicationManifestBuilder = ApplicationManifest.builder() .from(cfApplicationManifest); try { if (application != null && application instanceof DockerResource) { String uriString = application.getURI().toString(); applicationManifestBuilder.docker( Docker.builder().image(uriString.replaceFirst("docker:", "")).build()) .path(null); } else { applicationManifestBuilder.path(application.getFile().toPath()); } } catch (IOException e) { throw new SkipperException(e.getMessage()); } return applicationManifestBuilder.build(); }
Example #2
Source File: DefaultValidationService.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
private boolean validateResource(Resource resource) { boolean result = false; if(resource != null) { try { if ((resource instanceof DockerResource)) { result = validateDockerResource(dockerValidatorProperties, (DockerResource) resource); } else { new BootClassLoaderFactory(resolveAsArchive(resource), null) .createClassLoader(); result = true; } } catch (Exception ex) { logger.info("The app was marked invalid because: ", ex); } } return result; }
Example #3
Source File: AppResourceCommon.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
private String getDockerImageWithoutVersion(DockerResource dockerResource) { try { String uri = dockerResource.getURI().toString().substring("docker:".length()); DockerImage dockerImage = DockerImage.fromImageName(uri); StringBuilder sb = new StringBuilder("docker:"); if (StringUtils.hasText(dockerImage.getHost())) { sb.append(dockerImage.getHost()); sb.append(DockerImage.SECTION_SEPARATOR); } sb.append(dockerImage.getNamespaceAndRepo()); return sb.toString(); } catch (IOException e) { throw new IllegalArgumentException( "Docker Resource URI is not in expected format to extract version. " + dockerResource.getDescription(), e); } }
Example #4
Source File: AppResourceCommon.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
/** * Extracts the version from the resource. Supported resource types are * MavenResource, {@link DockerResource}, and {@link UrlResource}. * @param resource the resource to use. * @return the version the resource. */ public String getResourceVersion(Resource resource) { Assert.notNull(resource, "resource must not be null"); if (resource instanceof MavenResource) { MavenResource mavenResource = (MavenResource) resource; return mavenResource.getVersion(); } else if (resource instanceof DockerResource) { DockerResource dockerResource = (DockerResource) resource; return getDockerImageTag(dockerResource); } else if (resource instanceof UrlResource) { return getUrlResourceVersion((UrlResource) resource); } else { throw new IllegalArgumentException("Do not support extracting resource from Resource of type " + resource.getClass().getSimpleName()); } }
Example #5
Source File: DockerCommandBuilderTests.java From spring-cloud-deployer-local with Apache License 2.0 | 6 votes |
@Test public void testSpringApplicationJSON() throws Exception { LocalDeployerProperties properties = new LocalDeployerProperties(); LocalAppDeployer deployer = new LocalAppDeployer(properties); AppDefinition definition = new AppDefinition("foo", Collections.singletonMap("foo","bar")); Resource resource = new DockerResource("foo/bar"); Map<String, String> deploymentProperties = new HashMap<>(); deploymentProperties.put(LocalDeployerProperties.DEBUG_PORT, "9999"); deploymentProperties.put(LocalDeployerProperties.DEBUG_SUSPEND, "y"); deploymentProperties.put(LocalDeployerProperties.INHERIT_LOGGING, "true"); AppDeploymentRequest request = new AppDeploymentRequest(definition, resource, deploymentProperties); ProcessBuilder builder = deployer.buildProcessBuilder(request, request.getDefinition().getProperties(), Optional.of(1), "foo" ); String SAJ = LocalDeployerUtils.isWindows() ? "SPRING_APPLICATION_JSON={\\\"foo\\\":\\\"bar\\\"}" : "SPRING_APPLICATION_JSON={\"foo\":\"bar\"}"; assertThat(builder.command(), hasItems("-e", SAJ)); }
Example #6
Source File: DockerRegistryValidator.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
private String getDockerImageWithoutVersion(DockerResource dockerResource) { try { String uri = dockerResource.getURI().toString().substring("docker:".length()); DockerImage dockerImage = DockerImage.fromImageName(uri); StringBuilder sb = new StringBuilder(); if (StringUtils.hasText(dockerImage.getHost())) { sb.append(dockerImage.getHost()); sb.append(DockerImage.SECTION_SEPARATOR); } sb.append(dockerImage.getNamespaceAndRepo()); return sb.toString(); } catch (IOException e) { throw new IllegalArgumentException( "Docker Resource URI is not in expected format to extract version. " + dockerResource.getDescription(), e); } }
Example #7
Source File: LocalTaskLauncherIntegrationTests.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
@Override protected Resource testApplication() { if (useDocker) { log.info("Using Docker image for tests"); return new DockerResource("springcloud/spring-cloud-deployer-spi-test-app:latest"); } return super.testApplication(); }
Example #8
Source File: DefaultSchedulerServiceTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private List<String> getCommandLineArguments(List<String> commandLineArguments) { Scheduler mockScheduler = mock(SimpleTestScheduler.class); TaskDefinitionRepository mockTaskDefinitionRepository = mock(TaskDefinitionRepository.class); AppRegistryService mockAppRegistryService = mock(AppRegistryService.class); Launcher launcher = new Launcher("default", "defaultType", null, mockScheduler); List<Launcher> launchers = new ArrayList<>(); launchers.add(launcher); List<TaskPlatform> taskPlatform = Collections.singletonList(new TaskPlatform("testTaskPlatform", launchers)); SchedulerService mockSchedulerService = new DefaultSchedulerService(mock(CommonApplicationProperties.class), taskPlatform, mockTaskDefinitionRepository, mockAppRegistryService, mock(ResourceLoader.class), this.taskConfigurationProperties, mock(DataSourceProperties.class), "uri", mock(ApplicationConfigurationMetadataResolver.class), mock(SchedulerServiceProperties.class), mock(AuditRecordService.class)); TaskDefinition taskDefinition = new TaskDefinition(BASE_DEFINITION_NAME, "timestamp"); when(mockTaskDefinitionRepository.findById(BASE_DEFINITION_NAME)).thenReturn(Optional.of(taskDefinition)); when(mockAppRegistryService.getAppResource(any())).thenReturn(new DockerResource("springcloudtask/timestamp-task:latest")); when(mockAppRegistryService.find(taskDefinition.getRegisteredAppName(), ApplicationType.task)) .thenReturn(new AppRegistration()); mockSchedulerService.schedule(BASE_SCHEDULE_NAME, BASE_DEFINITION_NAME, this.testProperties, commandLineArguments, null); ArgumentCaptor<ScheduleRequest> scheduleRequestArgumentCaptor = ArgumentCaptor.forClass(ScheduleRequest.class); verify(mockScheduler).schedule(scheduleRequestArgumentCaptor.capture()); return scheduleRequestArgumentCaptor.getValue().getCommandlineArguments(); }
Example #9
Source File: AppResourceCommon.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
/** * Returns a string representing the resource with version subtracted * @param resource to be represented as string. * @return String representation of the resource. */ public String getResourceWithoutVersion(Resource resource) { Assert.notNull(resource, "resource must not be null"); if (resource instanceof MavenResource) { MavenResource mavenResource = (MavenResource) resource; StringBuilder mavenResourceStringBuilder = new StringBuilder(); mavenResourceStringBuilder.append(String.format("maven://%s:%s", mavenResource.getGroupId(), mavenResource.getArtifactId())); if (StringUtils.hasText(mavenResource.getExtension())) { mavenResourceStringBuilder.append(":" + mavenResource.getExtension()); } else { mavenResourceStringBuilder.append(":jar"); } if (StringUtils.hasText(mavenResource.getClassifier())) { mavenResourceStringBuilder.append(":" + mavenResource.getClassifier()); } return mavenResourceStringBuilder.toString(); } else if (resource instanceof DockerResource) { DockerResource dockerResource = (DockerResource) resource; return getDockerImageWithoutVersion(dockerResource); } else if (resource instanceof UrlResource) { return getUrlResourceWithoutVersion((UrlResource) resource); } else { throw new IllegalArgumentException("Do not support extracting resource from Resource of type " + resource.getClass().getSimpleName()); } }
Example #10
Source File: AppResourceCommon.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private String getDockerImageTag(DockerResource dockerResource) { try { String uri = dockerResource.getURI().toString().substring("docker:".length()); DockerImage dockerImage = DockerImage.fromImageName(uri); String tag = dockerImage.getTag(); Assert.isTrue(StringUtils.hasText(tag), "Could not extract tag from " + dockerResource.getDescription()); return tag; } catch (IOException e) { throw new IllegalArgumentException("Docker Resource URI is not in expected format to extract version. " + dockerResource.getDescription(), e); } }
Example #11
Source File: DefaultSchedulerServiceMultiplatformTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private List<String> getCommandLineArguments(List<String> commandLineArguments) { Scheduler mockScheduler = mock(SimpleTestScheduler.class); TaskDefinitionRepository mockTaskDefinitionRepository = mock(TaskDefinitionRepository.class); AppRegistryService mockAppRegistryService = mock(AppRegistryService.class); Launcher launcher = new Launcher("default", "defaultType", null, mockScheduler); List<Launcher> launchers = new ArrayList<>(); launchers.add(launcher); List<TaskPlatform> taskPlatform = Collections.singletonList(new TaskPlatform("testTaskPlatform", launchers)); SchedulerService mockSchedulerService = new DefaultSchedulerService(mock(CommonApplicationProperties.class), taskPlatform, mockTaskDefinitionRepository, mockAppRegistryService, mock(ResourceLoader.class), this.taskConfigurationProperties, mock(DataSourceProperties.class), "uri", mock(ApplicationConfigurationMetadataResolver.class), mock(SchedulerServiceProperties.class), mock(AuditRecordService.class)); TaskDefinition taskDefinition = new TaskDefinition(BASE_DEFINITION_NAME, "timestamp"); when(mockTaskDefinitionRepository.findById(BASE_DEFINITION_NAME)).thenReturn(Optional.of(taskDefinition)); when(mockAppRegistryService.getAppResource(any())).thenReturn(new DockerResource("springcloudtask/timestamp-task:latest")); when(mockAppRegistryService.find(taskDefinition.getRegisteredAppName(), ApplicationType.task)) .thenReturn(new AppRegistration()); mockSchedulerService.schedule(BASE_SCHEDULE_NAME, BASE_DEFINITION_NAME, this.testProperties, commandLineArguments, null); ArgumentCaptor<ScheduleRequest> scheduleRequestArgumentCaptor = ArgumentCaptor.forClass(ScheduleRequest.class); verify(mockScheduler).schedule(scheduleRequestArgumentCaptor.capture()); return scheduleRequestArgumentCaptor.getValue().getCommandlineArguments(); }
Example #12
Source File: BootApplicationConfigurationMetadataResolverTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void appDockerResourceBrokenFormat() { byte[] bytes = "Invalid metadata json content1".getBytes(); Map<String, String> result = Collections.singletonMap("org.springframework.cloud.dataflow.spring-configuration-metadata.json", StringEscapeUtils.escapeJson(new String(bytes))); when(containerImageMetadataResolver.getImageLabels("test/test:latest")).thenReturn(result); List<ConfigurationMetadataProperty> properties = resolver.listProperties(new DockerResource("test/test:latest")); assertThat(properties.size(), is(0)); }
Example #13
Source File: BootApplicationConfigurationMetadataResolverTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void appDockerResource() throws IOException { byte[] bytes = StreamUtils.copyToByteArray(new ClassPathResource( "apps/no-whitelist/META-INF/spring-configuration-metadata.json", getClass()).getInputStream()); when(containerImageMetadataResolver.getImageLabels("test/test:latest")) .thenReturn(Collections.singletonMap("org.springframework.cloud.dataflow.spring-configuration-metadata.json", StringEscapeUtils.escapeJson(new String(bytes)))); List<ConfigurationMetadataProperty> properties = resolver.listProperties(new DockerResource("test/test:latest")); assertThat(properties.size(), is(3)); }
Example #14
Source File: BootApplicationConfigurationMetadataResolverTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void appDockerResourceEmptyLabels() { when(containerImageMetadataResolver.getImageLabels("test/test:latest")).thenReturn(new HashMap<>()); List<ConfigurationMetadataProperty> properties = resolver .listProperties(new DockerResource("test/test:latest")); assertThat(properties.size(), is(0)); }
Example #15
Source File: AppResourceCommonTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void testDockerUriString() throws Exception { String dockerUri = "docker:springcloudstream/log-sink-rabbit:1.2.0.RELEASE"; Resource resource = appResourceCommon.getResource(dockerUri); assertTrue(resource instanceof DockerResource); assertThat(resource.getURI().toString().equals(dockerUri)); }
Example #16
Source File: DockerCommandBuilderTests.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
@Test public void testContainerNameWithDockerNetwork() { AppDefinition appDefinition = new AppDefinition("foo", null); Resource resource = new DockerResource("foo/bar"); Map<String, String> deploymentProperties = Collections.singletonMap(DockerCommandBuilder.DOCKER_CONTAINER_NAME_KEY, "gogo"); AppDeploymentRequest request = new AppDeploymentRequest(appDefinition, resource, deploymentProperties); String[] command = new DockerCommandBuilder("spring-cloud-dataflow-server_default") .buildExecutionCommand(request, Collections.emptyMap(), Optional.of(1)); assertThat(command, arrayContaining("docker", "run", "--network", "spring-cloud-dataflow-server_default", "--name=gogo-1", "foo/bar")); }
Example #17
Source File: DockerCommandBuilderTests.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
@Test public void testContainerName() { AppDefinition appDefinition = new AppDefinition("foo", null); Resource resource = new DockerResource("foo/bar"); Map<String, String> deploymentProperties = Collections.singletonMap(DockerCommandBuilder.DOCKER_CONTAINER_NAME_KEY, "gogo"); AppDeploymentRequest request = new AppDeploymentRequest(appDefinition, resource, deploymentProperties); String[] command = commandBuilder.buildExecutionCommand(request, Collections.emptyMap(), Optional.of(1)); assertThat(command, arrayContaining("docker", "run", "--name=gogo-1", "foo/bar")); }
Example #18
Source File: LocalAppDeployerIntegrationTests.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
@Test public void testInDebugModeWithSuspendedUseCamelCase() throws Exception { Map<String, String> properties = new HashMap<>(); AppDefinition definition = new AppDefinition(randomName(), properties); Resource resource = testApplication(); Map<String, String> deploymentProperties = new HashMap<>(); deploymentProperties.put(LocalDeployerProperties.PREFIX + ".debugPort", "8888"); deploymentProperties.put(LocalDeployerProperties.PREFIX + ".debugSuspend", "y"); deploymentProperties.put(LocalDeployerProperties.PREFIX + ".inheritLogging", "true"); AppDeploymentRequest request = new AppDeploymentRequest(definition, resource, deploymentProperties); AppDeployer deployer = appDeployer(); String deploymentId = deployer.deploy(request); Thread.sleep(5000); AppStatus appStatus = deployer.status(deploymentId); if (resource instanceof DockerResource) { try { String containerId = getCommandOutput("docker ps -q --filter ancestor="+ TESTAPP_DOCKER_IMAGE_NAME); String logOutput = getCommandOutput("docker logs "+ containerId); assertTrue(logOutput.contains("Listening for transport dt_socket at address: 8888")); } catch (IOException e) { } } else { assertEquals("deploying", appStatus.toString()); } deployer.undeploy(deploymentId); }
Example #19
Source File: LocalAppDeployerIntegrationTests.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
@Test public void testInDebugModeWithSuspended() throws Exception { Map<String, String> properties = new HashMap<>(); AppDefinition definition = new AppDefinition(randomName(), properties); Resource resource = testApplication(); Map<String, String> deploymentProperties = new HashMap<>(); deploymentProperties.put(LocalDeployerProperties.DEBUG_PORT, "9999"); deploymentProperties.put(LocalDeployerProperties.DEBUG_SUSPEND, "y"); deploymentProperties.put(LocalDeployerProperties.INHERIT_LOGGING, "true"); AppDeploymentRequest request = new AppDeploymentRequest(definition, resource, deploymentProperties); AppDeployer deployer = appDeployer(); String deploymentId = deployer.deploy(request); Thread.sleep(5000); AppStatus appStatus = deployer.status(deploymentId); if (resource instanceof DockerResource) { try { String containerId = getCommandOutput("docker ps -q --filter ancestor="+ TESTAPP_DOCKER_IMAGE_NAME); String logOutput = getCommandOutput("docker logs "+ containerId); assertTrue(logOutput.contains("Listening for transport dt_socket at address: 9999")); } catch (IOException e) { } } else { assertEquals("deploying", appStatus.toString()); } deployer.undeploy(deploymentId); }
Example #20
Source File: LocalAppDeployerIntegrationTests.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
@Override protected Resource testApplication() { if (useDocker) { log.info("Using Docker image for tests"); return new DockerResource(TESTAPP_DOCKER_IMAGE_NAME); } return super.testApplication(); }
Example #21
Source File: LocalAppDeployerEnvironmentIntegrationTests.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
@Test public void testInDebugModeWithSuspended() throws Exception { Map<String, String> properties = new HashMap<>(); AppDefinition definition = new AppDefinition(randomName(), properties); Resource resource = testApplication(); Map<String, String> deploymentProperties = new HashMap<>(); deploymentProperties.put(LocalDeployerProperties.DEBUG_PORT, "9999"); deploymentProperties.put(LocalDeployerProperties.DEBUG_SUSPEND, "y"); deploymentProperties.put(LocalDeployerProperties.INHERIT_LOGGING, "true"); AppDeploymentRequest request = new AppDeploymentRequest(definition, resource, deploymentProperties); AppDeployer deployer = appDeployer(); String deploymentId = deployer.deploy(request); Thread.sleep(5000); AppStatus appStatus = deployer.status(deploymentId); if (resource instanceof DockerResource) { try { String containerId = getCommandOutput("docker ps -q --filter ancestor="+ TESTAPP_DOCKER_IMAGE_NAME); String logOutput = getCommandOutput("docker logs "+ containerId); assertTrue(logOutput.contains("Listening for transport dt_socket at address: 9999")); } catch (IOException e) { } } else { assertEquals("deploying", appStatus.toString()); } deployer.undeploy(deploymentId); }
Example #22
Source File: LocalAppDeployerEnvironmentIntegrationTests.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
@Override protected Resource testApplication() { if (useDocker) { log.info("Using Docker image for tests"); return new DockerResource(TESTAPP_DOCKER_IMAGE_NAME); } return super.testApplication(); }
Example #23
Source File: DockerRegistryValidator.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
public DockerRegistryValidator(DockerValidatorProperties dockerValidatorProperties, DockerResource dockerResource) { this.dockerValidatiorProperties = dockerValidatorProperties; this.dockerResource = dockerResource; this.restTemplate = configureRestTemplate(); this.dockerAuth = getDockerAuth(); this.appResourceCommon = new AppResourceCommon(new MavenProperties(), null); }
Example #24
Source File: DockerCommandBuilder.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
private List<String> addDockerOptions(AppDeploymentRequest request, Map<String, String> appInstanceEnv, Optional<Integer> appInstanceNumber) { List<String> commands = new ArrayList<>(); commands.add("docker"); commands.add("run"); if (StringUtils.hasText(this.dockerNetwork)) { commands.add("--network"); commands.add(this.dockerNetwork); } // Add env vars for (String env : appInstanceEnv.keySet()) { commands.add("-e"); commands.add(String.format("%s=%s", env, appInstanceEnv.get(env))); } setPort(commands, appInstanceEnv); if(request.getDeploymentProperties().containsKey(DOCKER_CONTAINER_NAME_KEY)) { if(appInstanceNumber.isPresent()) { commands.add(String.format("--name=%s-%d", request.getDeploymentProperties().get(DOCKER_CONTAINER_NAME_KEY), appInstanceNumber.get())); } else { commands.add(String.format("--name=%s", request.getDeploymentProperties().get(DOCKER_CONTAINER_NAME_KEY))); } } DockerResource dockerResource = (DockerResource) request.getResource(); try { String dockerImageURI = dockerResource.getURI().toString(); commands.add(dockerImageURI.substring("docker:".length())); } catch (IOException e) { throw new IllegalStateException(e); } return commands; }
Example #25
Source File: CloudFoundryAppDeployerTests.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Test public void deployDockerResource() { Resource resource = new DockerResource("somecorp/someimage:latest"); given(this.applicationNameGenerator.generateAppName("test-application")).willReturn("test-application-id"); givenRequestGetApplication("test-application-id", Mono.error(new IllegalArgumentException()), Mono.just( ApplicationDetail.builder() .diskQuota(0) .id("test-application-id") .instances(1) .memoryLimit(0) .name("test-application") .requestedState("RUNNING") .runningInstances(0) .stack("test-stack") .build())); givenRequestPushApplication(PushApplicationManifestRequest.builder() .manifest(ApplicationManifest.builder() .docker(Docker.builder().image("somecorp/someimage:latest").build()) .disk(1024) .environmentVariables(defaultEnvironmentVariables()) .instances(1) .memory(1024) .name("test-application-id") .service("test-service-2") .service("test-service-1") .build()) .stagingTimeout(this.deploymentProperties.getStagingTimeout()) .startupTimeout(this.deploymentProperties.getStartupTimeout()) .build(), Mono.empty()); String deploymentId = this.deployer.deploy( new AppDeploymentRequest(new AppDefinition("test-application", Collections.emptyMap()), resource, Collections.emptyMap())); assertThat(deploymentId, equalTo("test-application-id")); }
Example #26
Source File: AppResourceCommonTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void testMetadataUriDockerApp() throws Exception { String appUri = "docker:springcloudstream/log-sink-rabbit:1.2.0.RELEASE"; Resource metadataResource = appResourceCommon.getMetadataResource(new URI(appUri), null); assertThat(metadataResource).isNotNull(); assertTrue(metadataResource instanceof DockerResource); }
Example #27
Source File: CloudFoundryDataFlowServerConfiguration.java From spring-cloud-dataflow-server-cloudfoundry with Apache License 2.0 | 4 votes |
@Bean public DelegatingResourceLoaderBuilderCustomizer dockerDelegatingResourceLoaderBuilderCustomizer() { return customizer -> customizer.loader(DockerResource.URI_SCHEME, new DockerResourceLoader()); }
Example #28
Source File: ResourceUtilsTests.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
@Test public void testDockerResourceProcessingWithHostIP() { DockerResource dockerResource = new DockerResource("192.168.99.100:80/myrepo/rabbitsink:current"); assertThat(appResourceService.getResourceWithoutVersion(dockerResource)).isEqualTo("docker:192.168.99.100:80/myrepo/rabbitsink"); assertThat(appResourceService.getResourceVersion(dockerResource)).isEqualTo("current"); }
Example #29
Source File: DefaultAppValidationServiceTests.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
private void initializeDockerRegistry(AppRegistryService appRegistry, String imageUrl) { when(appRegistry.find(anyString(), any(ApplicationType.class))).thenReturn( new AppRegistration("some-name", ApplicationType.task, URI.create(imageUrl))); when(appRegistry.getAppResource(any())).thenReturn(new DockerResource(imageUrl)); when(appRegistry.getAppMetadataResource(any())).thenReturn(null); }
Example #30
Source File: ResourceUtilsTests.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
@Test(expected = IllegalArgumentException.class) public void testInvalidDockerResourceProcessing() { DockerResource dockerResource = new DockerResource("springcloudstream:file-source-kafka-10:1.2.0.RELEASE"); appResourceService.getResourceWithoutVersion(dockerResource); }