Java Code Examples for org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo#setTaskDefinitionName()
The following examples show how to use
org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo#setTaskDefinitionName() .
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 |
@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: AbstractSchedulerIntegrationTests.java From spring-cloud-deployer with Apache License 2.0 | 6 votes |
@Test public void testListFilter() { String definitionName = randomName(); String scheduleName = scheduleName() + definitionName; for (int i = 0; i < 4; i++) { ScheduleRequest request = createScheduleRequest(scheduleName + i, definitionName + i%2); taskScheduler().schedule(request); } ScheduleInfo scheduleInfo = new ScheduleInfo(); scheduleInfo.setScheduleName(scheduleName+0); scheduleInfo.setTaskDefinitionName(definitionName+0); assertThat(scheduleInfo, eventually( hasSpecifiedSchedulesByTaskDefinitionName(taskScheduler().list(definitionName+0), scheduleInfo.getTaskDefinitionName(), 2), this.scheduleTimeout.maxAttempts, this.scheduleTimeout.pause)); }
Example 3
Source File: TaskScheduleCommandTemplate.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
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 4
Source File: TaskScheduleCommandTemplate.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
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 5
Source File: BaseDocumentation.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
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 6
Source File: DefaultSchedulerServiceMultiplatformTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private ScheduleInfo createScheduleInfo(String scheduleName, String taskDefinitionName) { ScheduleInfo scheduleInfo = new ScheduleInfo(); scheduleInfo.setScheduleName(scheduleName); scheduleInfo.setTaskDefinitionName(taskDefinitionName); scheduleInfo.setScheduleProperties(this.resolvedProperties); return scheduleInfo; }
Example 7
Source File: DefaultSchedulerServiceTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private ScheduleInfo createScheduleInfo(String scheduleName, String taskDefinitionName) { ScheduleInfo scheduleInfo = new ScheduleInfo(); scheduleInfo.setScheduleName(scheduleName); scheduleInfo.setTaskDefinitionName(taskDefinitionName); scheduleInfo.setScheduleProperties(this.resolvedProperties); return scheduleInfo; }