HypervisorHeartbeatUpdateJob implements AsyncJob { public static HypervisorHeartbeatUpdateJobConfig createJobConfig() { return new HypervisorHeartbeatUpdateJobConfig(); } @Inject  HypervisorHeartbeatUpdateJob(ConsumerCurator consumerCurator); @Override void execute(JobExecutionContext context); static HypervisorHeartbeatUpdateJobConfig createJobConfig(); static final String JOB_KEY; static final String JOB_NAME; }
@Test public void testBasicConfig() { JobConfig config = HypervisorHeartbeatUpdateJob.createJobConfig(); assertEquals(HypervisorHeartbeatUpdateJob.JOB_KEY, config.getJobKey()); assertEquals(HypervisorHeartbeatUpdateJob.JOB_NAME, config.getJobName()); }
@Test public void testConfigSetOwner() { String ownerKey = "test_owner"; Owner owner = new Owner(ownerKey, ownerKey); JobConfig config = HypervisorHeartbeatUpdateJob.createJobConfig() .setOwner(owner); JobArguments args = config.getJobArguments(); assertNotNull(args); assertEquals(1, args.size()); String argKey = args.keySet().iterator().next(); assertNotNull(argKey); assertFalse(argKey.isEmpty()); assertEquals(ownerKey, args.getAsString(argKey)); assertEquals(owner, config.getContextOwner()); }
@Test public void testConfigSetReporterId() { String reporterId = "test_reporter_id"; JobConfig config = HypervisorHeartbeatUpdateJob.createJobConfig() .setReporterId(reporterId); JobArguments args = config.getJobArguments(); assertNotNull(args); assertEquals(1, args.size()); String argKey = args.keySet().iterator().next(); assertNotNull(argKey); assertFalse(argKey.isEmpty()); assertEquals(reporterId, args.getAsString(argKey)); }