JobNodeResourceImpl implements JobNodeResource { @Override public void setSchedule(final Integer id, final String schedule) { modifyJobNode(id, jobNode -> jobNode.setSchedule(schedule)); } @Inject  JobNodeResourceImpl(final JobNodeService jobNodeService,
                        final NodeService nodeService,
                        final NodeInfo nodeInfo,
                        final WebTargetFactory webTargetFactory,
                        final DocumentEventLog documentEventLog); @Override JobNodeListResponse list(final String jobName, final String nodeName); @Override JobNodeInfo info(final String jobName, final String nodeName); @Override void setTaskLimit(final Integer id, final Integer taskLimit); @Override void setSchedule(final Integer id, final String schedule); @Override void setEnabled(final Integer id, final Boolean enabled);  }
@Test void setSchedule() { initSingleNode(); final String subPath = ResourcePaths.buildPath("1", JobNodeResource.SCHEDULE_PATH_PART); final String newSchedule = "1 1 1"; doPutTest( subPath, newSchedule); final ArgumentCaptor<JobNode> jobNodeCaptor = ArgumentCaptor.forClass(JobNode.class); verify(jobNodeServiceMap.get("node1"), times(1)) .update(jobNodeCaptor.capture()); assertThat(jobNodeCaptor.getValue().getSchedule()) .isEqualTo(newSchedule); final ArgumentCaptor<JobNode> beforeCaptor = ArgumentCaptor.forClass(JobNode.class); final ArgumentCaptor<JobNode> afterCaptor = ArgumentCaptor.forClass(JobNode.class); verify(documentEventLogMap.get("node1"), times(1)) .update(beforeCaptor.capture(), afterCaptor.capture(), any()); assertThat(beforeCaptor.getValue()) .isEqualTo(afterCaptor.getValue()); assertThat(beforeCaptor.getValue().getVersion()) .isNotEqualTo(afterCaptor.getValue().getVersion()); assertThat(afterCaptor.getValue().getSchedule()) .isEqualTo(newSchedule); assertThat(afterCaptor.getValue().getSchedule()) .isNotEqualTo(JOB_NODE_1.getSchedule()); }