mirror of
https://github.com/valitydev/schedulator-proxy.git
synced 2024-11-06 08:25:18 +00:00
BJ-686: add revision id (#6)
This commit is contained in:
parent
a6902a3020
commit
89f0099920
2
pom.xml
2
pom.xml
@ -53,7 +53,7 @@
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
<artifactId>schedulator-proto</artifactId>
|
||||
<version>1.14-eecbfda</version>
|
||||
<version>1.11-efc08c2</version>
|
||||
</dependency>
|
||||
|
||||
<!--spring-->
|
||||
|
@ -1,9 +1,6 @@
|
||||
package com.rbkmoney.schedulatorproxy;
|
||||
|
||||
import com.rbkmoney.damsel.schedule.ContextValidationResponse;
|
||||
import com.rbkmoney.damsel.schedule.ExecuteJobRequest;
|
||||
import com.rbkmoney.damsel.schedule.ScheduledJobContext;
|
||||
import com.rbkmoney.damsel.schedule.ScheduledJobExecutorSrv;
|
||||
import com.rbkmoney.damsel.schedule.*;
|
||||
import com.rbkmoney.schedulatorproxy.model.JobContext;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -26,7 +23,9 @@ public class JobExecutor implements ScheduledJobExecutorSrv.Iface {
|
||||
log.info("Validate job state: {}", jobState);
|
||||
|
||||
ContextValidationResponse contextValidationResponse = new ContextValidationResponse();
|
||||
contextValidationResponse.setErrors(Collections.emptyList());
|
||||
ValidationResponseStatus validationResponseStatus = new ValidationResponseStatus();
|
||||
validationResponseStatus.setSuccess(new ValidationSuccess());
|
||||
contextValidationResponse.setResponseStatus(validationResponseStatus);
|
||||
return contextValidationResponse;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,10 @@ public class SchedulatorProxyController {
|
||||
jobContext.setSchedulerId(registerJobDto.getSchedulerId());
|
||||
jobContext.setServicePath(registerJobDto.getServicePath());
|
||||
registerJobRequest.setContext(jobStateSerializer.writeByte(jobContext));
|
||||
registerJobRequest.setSchedule(buildsSchedule(registerJobDto.getSchedulerId(), registerJobDto.getCalendarId()));
|
||||
Schedule schedule = buildsSchedule(registerJobDto.getSchedulerId(),
|
||||
registerJobDto.getCalendarId(),
|
||||
registerJobDto.getRevisionId());
|
||||
registerJobRequest.setSchedule(schedule);
|
||||
|
||||
try {
|
||||
schedulatorClient.registerJob(registerJobDto.getJobId(), registerJobRequest);
|
||||
@ -65,11 +68,12 @@ public class SchedulatorProxyController {
|
||||
}
|
||||
}
|
||||
|
||||
private Schedule buildsSchedule(int scheduleRefId, int calendarRefId) {
|
||||
private Schedule buildsSchedule(int scheduleRefId, int calendarRefId, long revision) {
|
||||
Schedule schedule = new Schedule();
|
||||
DominantBasedSchedule dominantBasedSchedule = new DominantBasedSchedule()
|
||||
.setBusinessScheduleRef(new BusinessScheduleRef().setId(scheduleRefId))
|
||||
.setCalendarRef(new CalendarRef().setId(calendarRefId));
|
||||
.setCalendarRef(new CalendarRef().setId(calendarRefId))
|
||||
.setRevision(revision);
|
||||
schedule.setDominantSchedule(dominantBasedSchedule);
|
||||
|
||||
return schedule;
|
||||
|
@ -24,6 +24,9 @@ public class RegisterJobDto {
|
||||
@JsonProperty("calendar_id")
|
||||
private Integer calendarId;
|
||||
|
||||
@JsonProperty("revision_id")
|
||||
private Long revisionId;
|
||||
|
||||
@NotEmpty
|
||||
@JsonProperty("service_path")
|
||||
private String servicePath;
|
||||
|
@ -39,6 +39,7 @@ public class SchedulatorControllerTest {
|
||||
.servicePath("testServicePath")
|
||||
.calendarId(1)
|
||||
.schedulerId(64)
|
||||
.revisionId(4325L)
|
||||
.build();
|
||||
String json = objectMapper.writer().withDefaultPrettyPrinter().writeValueAsString(registerJobDto);
|
||||
mvc.perform(post("/schedulator/proxy/register")
|
||||
|
Loading…
Reference in New Issue
Block a user