Java Code Examples for org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo#setScheduleProperties()

The following examples show how to use org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo#setScheduleProperties() . 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: KubernetesScheduler.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 6 votes vote down vote up
@Override
public List<ScheduleInfo> list() {
	CronJobList cronJobList = this.client.batch().cronjobs().list();

	List<CronJob> cronJobs = cronJobList.getItems();
	List<ScheduleInfo> scheduleInfos = new ArrayList<>();

	for (CronJob cronJob : cronJobs) {
		if (cronJob.getMetadata() != null && cronJob.getMetadata().getLabels() != null &&
				StringUtils.hasText(cronJob.getMetadata().getLabels().get(SPRING_CRONJOB_ID_KEY))) {
			Map<String, String> properties = new HashMap<>();
			properties.put(SchedulerPropertyKeys.CRON_EXPRESSION, cronJob.getSpec().getSchedule());

			ScheduleInfo scheduleInfo = new ScheduleInfo();
			scheduleInfo.setScheduleName(cronJob.getMetadata().getName());
			scheduleInfo.setTaskDefinitionName(cronJob.getMetadata().getLabels().get(SPRING_CRONJOB_ID_KEY));
			scheduleInfo.setScheduleProperties(properties);

			scheduleInfos.add(scheduleInfo);
		}
	}

	return scheduleInfos;
}
 
Example 2
Source File: TaskScheduleCommandTemplate.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
public void list() {
	ScheduleInfo scheduleInfo = new ScheduleInfo();
	scheduleInfo.setScheduleName("schedName");
	scheduleInfo.setTaskDefinitionName("testDefinition");
	scheduleInfo.setScheduleProperties(Collections.EMPTY_MAP);

	when(schedule.listForPlatform(null)).thenReturn(Arrays.asList(scheduleInfo));

	String wholeCommand = "task schedule list";
	CommandResult cr = dataFlowShell.executeCommand(wholeCommand);

	Table table = (Table) cr.getResult();
	assertEquals("schedName", table.getModel().getValue(1, 0));
}
 
Example 3
Source File: TaskScheduleCommandTemplate.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
public void listByTaskDefinition(String definitionName) {
	ScheduleInfo scheduleInfo = new ScheduleInfo();
	scheduleInfo.setScheduleName("schedName");
	scheduleInfo.setTaskDefinitionName("testDefinition");
	scheduleInfo.setScheduleProperties(Collections.EMPTY_MAP);

	when(schedule.list(definitionName, null)).thenReturn(Arrays.asList(scheduleInfo));

	String wholeCommand = String.format("task schedule list --definitionName %s", definitionName);
	CommandResult cr = dataFlowShell.executeCommand(wholeCommand);

	Table table = (Table) cr.getResult();
	assertEquals("schedName", table.getModel().getValue(1, 0));
}
 
Example 4
Source File: BaseDocumentation.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private List<ScheduleInfo> getSampleList() {
	List<ScheduleInfo> result = new ArrayList<>();
	ScheduleInfo scheduleInfo = new ScheduleInfo();
	scheduleInfo.setScheduleName("FOO");
	scheduleInfo.setTaskDefinitionName("BAR");
	Map<String, String> props = new HashMap<>(1);
	props.put("scheduler.AAA.spring.cloud.scheduler.cron.expression", "00 41 17 ? * *");
	scheduleInfo.setScheduleProperties(props);
	result.add(scheduleInfo);
	return result;
}
 
Example 5
Source File: DefaultSchedulerServiceMultiplatformTests.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private ScheduleInfo createScheduleInfo(String scheduleName, String taskDefinitionName) {
	ScheduleInfo scheduleInfo = new ScheduleInfo();
	scheduleInfo.setScheduleName(scheduleName);
	scheduleInfo.setTaskDefinitionName(taskDefinitionName);
	scheduleInfo.setScheduleProperties(this.resolvedProperties);
	return scheduleInfo;
}
 
Example 6
Source File: DefaultSchedulerServiceTests.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private ScheduleInfo createScheduleInfo(String scheduleName, String taskDefinitionName) {
	ScheduleInfo scheduleInfo = new ScheduleInfo();
	scheduleInfo.setScheduleName(scheduleName);
	scheduleInfo.setTaskDefinitionName(taskDefinitionName);
	scheduleInfo.setScheduleProperties(this.resolvedProperties);
	return scheduleInfo;
}