org.springframework.cloud.deployer.spi.local.LocalDeployerProperties Java Examples
The following examples show how to use
org.springframework.cloud.deployer.spi.local.LocalDeployerProperties.
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: SkipperServerPlatformConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 6 votes |
@Bean @Profile("local") public Platform localDeployers(LocalPlatformProperties localPlatformProperties) { List<Deployer> deployers = new ArrayList<>(); Map<String, LocalDeployerProperties> localDeployerPropertiesMap = localPlatformProperties.getAccounts(); if (localDeployerPropertiesMap.isEmpty()) { localDeployerPropertiesMap.put("default", new LocalDeployerProperties()); } for (Map.Entry<String, LocalDeployerProperties> entry : localDeployerPropertiesMap .entrySet()) { LocalAppDeployer localAppDeployer = new LocalAppDeployer(entry.getValue()); Deployer deployer = new Deployer(entry.getKey(), "local", localAppDeployer); deployer.setDescription(prettyPrintLocalDeployerProperties(entry.getValue())); deployers.add(deployer); } return new Platform("Local", deployers); }
Example #2
Source File: TickTock.java From spring-cloud-deployer-local with Apache License 2.0 | 6 votes |
private static AppDeploymentRequest createAppDeploymentRequest(String app, String stream) { MavenResource resource = new MavenResource.Builder() .artifactId(app) .groupId("org.springframework.cloud.stream.app") .version("1.0.0.BUILD-SNAPSHOT") .build(); Map<String, String> properties = new HashMap<>(); properties.put("server.port", "0"); if (app.contains("-source-")) { properties.put("spring.cloud.stream.bindings.output.destination", stream); } else { properties.put("spring.cloud.stream.bindings.input.destination", stream); properties.put("spring.cloud.stream.bindings.input.group", "default"); } AppDefinition definition = new AppDefinition(app, properties); Map<String, String> deploymentProperties = new HashMap<>(); deploymentProperties.put(AppDeployer.GROUP_PROPERTY_KEY, stream); /* * This will allow output to be logged to the output of the process that started * the application. */ deploymentProperties.put(LocalDeployerProperties.INHERIT_LOGGING, "true"); AppDeploymentRequest request = new AppDeploymentRequest(definition, resource, deploymentProperties); return request; }
Example #3
Source File: SkipperServerPlatformConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
private String prettyPrintLocalDeployerProperties(LocalDeployerProperties localDeployerProperties) { StringBuilder builder = new StringBuilder(); if (localDeployerProperties.getJavaOpts() != null) { builder.append("JavaOpts = [" + localDeployerProperties.getJavaOpts() + "], "); } builder.append("ShutdownTimeout = [" + localDeployerProperties.getShutdownTimeout() + "], "); builder.append("EnvVarsToInherit = [" + StringUtils.arrayToCommaDelimitedString(localDeployerProperties.getEnvVarsToInherit()) + "], "); builder.append("JavaCmd = [" + localDeployerProperties.getJavaCmd() + "], "); builder.append("WorkingDirectoriesRoot = [" + localDeployerProperties.getWorkingDirectoriesRoot() + "], "); builder.append("DeleteFilesOnExit = [" + localDeployerProperties.isDeleteFilesOnExit() + "]"); return builder.toString(); }
Example #4
Source File: DeployerRepositoryTests.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
@Test public void basicCrud() { LocalAppDeployer localAppDeployer = new LocalAppDeployer(new LocalDeployerProperties()); Deployer deployer = new Deployer("localDeployer", "local", localAppDeployer); deployer.setDescription("This is a test local Deployer."); this.deployerRepository.save(deployer); // Count is 2 including the default one which was added at the time of bootstrap. assertThat(deployerRepository.count()).isEqualTo(2); assertThat(deployer.getId()).isNotEmpty(); assertThat(deployerRepository.findByName("localDeployer")).isNotNull(); assertThat(deployerRepository.findByName("localDeployer").getDescription()).isNotNull(); assertThat(deployerRepository.findByName("default").getDescription()).isNotNull(); }
Example #5
Source File: PlatformPropertiesTests.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
@Test public void deserializationTest() { Map<String, LocalDeployerProperties> localAccounts = this.localPlatformProperties.getAccounts(); assertThat(localAccounts).hasSize(2); assertThat(localAccounts).containsKeys("localDev", "localDevDebug"); assertThat(localAccounts.get("localDev").getShutdownTimeout()).isEqualTo(60); assertThat(localAccounts.get("localDevDebug").getJavaOpts()).isEqualTo("-Xdebug"); }
Example #6
Source File: JdbchdfsLocalTaskConfiguration.java From spring-cloud-task-app-starters with Apache License 2.0 | 5 votes |
@Bean public TaskLauncher taskLauncher() { LocalDeployerProperties localDeployerProperties = new LocalDeployerProperties(); localDeployerProperties.setDeleteFilesOnExit(false); return new LocalTaskLauncher(localDeployerProperties); }
Example #7
Source File: TickTock.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { LocalAppDeployer deployer = new LocalAppDeployer(new LocalDeployerProperties()); String logId = deployer.deploy(createAppDeploymentRequest("log-sink-kafka", "ticktock")); String timeId = deployer.deploy(createAppDeploymentRequest("time-source-kafka", "ticktock")); for (int i = 0; i < 12; i++) { Thread.sleep(5 * 1000); System.out.println("time: " + deployer.status(timeId)); System.out.println("log: " + deployer.status(logId)); } deployer.undeploy(timeId); deployer.undeploy(logId); System.out.println("time after undeploy: " + deployer.status(timeId)); System.out.println("log after undeploy: " + deployer.status(logId)); }
Example #8
Source File: TimeStamp.java From spring-cloud-deployer-local with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { LocalTaskLauncher launcher = new LocalTaskLauncher(new LocalDeployerProperties()); String timestampId = launcher.launch(createAppDeploymentRequest("timestamp-task")); for (int i = 0; i < 50; i++) { Thread.sleep(100); System.out.println("timestamp: " + launcher.status(timestampId)); } // timestamp completes quickly, but we can 'cancel' the running task launcher.cancel(timestampId); System.out.println("timestamp after cancel: " + launcher.status(timestampId)); }
Example #9
Source File: LocalDataflowResource.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Override protected void before() { originalDataflowServerPort = System.getProperty(DATAFLOW_PORT_PROPERTY); this.dataflowServerPort = SocketUtils.findAvailableTcpPort(); logger.info("Setting Dataflow Server port to " + this.dataflowServerPort); System.setProperty(DATAFLOW_PORT_PROPERTY, String.valueOf(this.dataflowServerPort)); originalConfigLocation = System.getProperty("spring.config.additional-locationn"); if (!StringUtils.isEmpty(configurationLocation)) { final Resource resource = new PathMatchingResourcePatternResolver().getResource(configurationLocation); if (!resource.exists()) { throw new IllegalArgumentException(String.format("Resource 'configurationLocation' ('%s') does not exist.", configurationLocation)); } System.setProperty("spring.config.additional-location", configurationLocation); } app = new SpringApplication(TestConfig.class); configurableApplicationContext = (WebApplicationContext) app.run(new String[] { "--spring.cloud.kubernetes.enabled=false", "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.STREAMS_ENABLED + "=" + this.streamsEnabled, "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.TASKS_ENABLED + "=" + this.tasksEnabled, "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.SCHEDULES_ENABLED + "=" + this.schedulesEnabled, "--spring.cloud.skipper.client.serverUri=http://localhost:" + this.skipperServerPort + "/api" }); skipperClient = configurableApplicationContext.getBean(SkipperClient.class); LauncherRepository launcherRepository = configurableApplicationContext.getBean(LauncherRepository.class); launcherRepository.save(new Launcher("default", "local", new LocalTaskLauncher(new LocalDeployerProperties()))); Collection<Filter> filters = configurableApplicationContext.getBeansOfType(Filter.class).values(); mockMvc = MockMvcBuilders.webAppContextSetup(configurableApplicationContext) .addFilters(filters.toArray(new Filter[filters.size()])).build(); dataflowPort = configurableApplicationContext.getEnvironment().resolvePlaceholders("${server.port}"); }
Example #10
Source File: TaskLauncherSinkTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Bean public TaskLauncher taskLauncher() { LocalDeployerProperties props = new LocalDeployerProperties(); props.setDeleteFilesOnExit(false); return new LocalTaskLauncher(props); }
Example #11
Source File: LocalPlatformPropertiesTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void deserializationTest() { Map<String, LocalDeployerProperties> localAccounts = this.localPlatformProperties.getAccounts(); assertThat(localAccounts).hasSize(2); assertThat(localAccounts).containsKeys("localDev", "localDevDebug"); assertThat(localAccounts.get("localDev").getShutdownTimeout()).isEqualTo(60); assertThat(localAccounts.get("localDevDebug").getJavaOpts()).isEqualTo("-Xdebug"); }
Example #12
Source File: LocalTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private String prettyPrintLocalDeployerProperties(LocalDeployerProperties localDeployerProperties) { StringBuilder builder = new StringBuilder(); if (localDeployerProperties.getJavaOpts() != null) { builder.append("JavaOpts = [" + localDeployerProperties.getJavaOpts() + "], "); } builder.append("ShutdownTimeout = [" + localDeployerProperties.getShutdownTimeout() + "], "); builder.append("EnvVarsToInherit = [" + StringUtils.arrayToCommaDelimitedString(localDeployerProperties.getEnvVarsToInherit()) + "], "); builder.append("JavaCmd = [" + localDeployerProperties.getJavaCmd() + "], "); builder.append("WorkingDirectoriesRoot = [" + localDeployerProperties.getWorkingDirectoriesRoot() + "], "); builder.append("DeleteFilesOnExit = [" + localDeployerProperties.isDeleteFilesOnExit() + "]"); return builder.toString(); }
Example #13
Source File: LocalTaskPlatformFactoryTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void createsConfiguredPlatform() { LocalPlatformProperties platformProperties = new LocalPlatformProperties(); platformProperties.setAccounts(Collections.singletonMap("custom",new LocalDeployerProperties())); LocalTaskPlatformFactory taskPlatformFactory = new LocalTaskPlatformFactory(platformProperties, null); TaskPlatform taskPlatform = taskPlatformFactory.createTaskPlatform(); assertThat(taskPlatform.getLaunchers()).hasSize(1); assertThat(taskPlatform.getName()).isEqualTo("Local"); assertThat(taskPlatform.getLaunchers().get(0).getType()).isEqualTo(taskPlatform.getName()); assertThat(taskPlatform.getLaunchers().get(0).getName()).isEqualTo("custom"); assertThat(taskPlatform.getLaunchers().get(0).getTaskLauncher()).isInstanceOf(LocalTaskLauncher.class); assertThat(taskPlatform.getLaunchers().get(0).getDescription()).isNotEmpty(); }
Example #14
Source File: LocalPlatformProperties.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
public void setAccounts(Map<String, LocalDeployerProperties> accounts) { this.accounts = accounts; }
Example #15
Source File: ConsulBinderTests.java From spring-cloud-consul with Apache License 2.0 | 4 votes |
public ConsulBinderTests() { LocalDeployerProperties properties = new LocalDeployerProperties(); properties.setDeleteFilesOnExit(false); this.deployer = new ClasspathDeployer(properties); }
Example #16
Source File: TaskLaunchConfigurationExistingTests.java From spring-cloud-task with Apache License 2.0 | 4 votes |
@Bean public TaskLauncher taskLauncher() { testTaskLauncher = new LocalTaskLauncher(new LocalDeployerProperties()); return testTaskLauncher; }
Example #17
Source File: LocalTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
private Launcher doCreateLauncher(String account, LocalDeployerProperties deployerProperties) { LocalTaskLauncher localTaskLauncher = new LocalTaskLauncher(deployerProperties); Launcher launcher = new Launcher(account, LOCAL_PLATFORM_TYPE, localTaskLauncher, localScheduler); launcher.setDescription(prettyPrintLocalDeployerProperties(deployerProperties)); return launcher; }
Example #18
Source File: LocalTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
private Launcher createDefaultLauncher() { return doCreateLauncher("default", new LocalDeployerProperties()); }
Example #19
Source File: LocalTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
@Override public Launcher createLauncher(String account) { LocalDeployerProperties deployerProperties = platformProperties.accountProperties(account); return doCreateLauncher(account, deployerProperties); }
Example #20
Source File: LocalPlatformProperties.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
public Map<String, LocalDeployerProperties> getAccounts() { return accounts; }
Example #21
Source File: ConsulBinderTests.java From spring-cloud-consul with Apache License 2.0 | 2 votes |
/** * Instantiates a new local app deployer. * @param properties the properties */ ClasspathDeployer(LocalDeployerProperties properties) { super(properties); }