org.springframework.cloud.deployer.spi.local.LocalAppDeployer Java Examples

The following examples show how to use org.springframework.cloud.deployer.spi.local.LocalAppDeployer. 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 vote down vote up
@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: DeployerRepositoryTests.java    From spring-cloud-skipper with Apache License 2.0 5 votes vote down vote up
@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 #3
Source File: LocalConfigurationTests.java    From spring-cloud-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void testConfig() {
	SpringApplication app = new SpringApplication(LocalTestDataFlowServer.class);
	int randomPort = SocketUtils.findAvailableTcpPort();
	String dataSourceUrl = String.format("jdbc:h2:tcp://localhost:%s/mem:dataflow", randomPort);
	context = app.run(new String[] { "--server.port=0",
			"--spring.datasource.url=" + dataSourceUrl});
	assertThat(context.containsBean(APP_DEPLOYER_BEAN_NAME), is(true));
	assertThat(context.getBean(APP_DEPLOYER_BEAN_NAME), instanceOf(LocalAppDeployer.class));
	assertNotNull(context.getBean(AppRegistry.class));
}
 
Example #4
Source File: TickTock.java    From spring-cloud-deployer-local with Apache License 2.0 5 votes vote down vote up
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));
}