use of com.thinkbiganalytics.scheduler.model.DefaultTriggerInfo in project kylo by Teradata.
the class TriggerInfoImplTest method setUp.
@Before
public void setUp() throws Exception {
today = new Date();
trigger = new DefaultTriggerInfo(Mockito.mock(JobIdentifier.class), Mockito.mock(TriggerIdentifier.class));
trigger.setJobIdentifier(Mockito.mock(JobIdentifier.class));
trigger.setState(TriggerInfo.TriggerState.BLOCKED);
trigger.setTriggerClass(Object.class);
trigger.setTriggerIdentifier(Mockito.mock(TriggerIdentifier.class));
}
use of com.thinkbiganalytics.scheduler.model.DefaultTriggerInfo in project kylo by Teradata.
the class QuartzScheduler method buildTriggerInfo.
private TriggerInfo buildTriggerInfo(JobIdentifier jobIdentifier, Trigger trigger) {
TriggerInfo triggerInfo = new DefaultTriggerInfo(jobIdentifier, triggerIdentifierForTriggerKey(trigger.getKey()));
triggerInfo.setDescription(trigger.getDescription());
triggerInfo.setTriggerClass(trigger.getClass());
String cronExpression = null;
triggerInfo.setCronExpressionSummary("");
if (trigger instanceof CronTrigger) {
CronTrigger ct = (CronTrigger) trigger;
cronExpression = ct.getCronExpression();
triggerInfo.setCronExpressionSummary(ct.getExpressionSummary());
}
boolean isSimpleTrigger = (!CronTrigger.class.isAssignableFrom(trigger.getClass()) && SimpleTrigger.class.isAssignableFrom(trigger.getClass()));
triggerInfo.setSimpleTrigger(isSimpleTrigger);
boolean isScheduled = CronTrigger.class.isAssignableFrom(triggerInfo.getTriggerClass());
triggerInfo.setScheduled(isScheduled);
triggerInfo.setCronExpression(cronExpression);
triggerInfo.setNextFireTime(trigger.getNextFireTime());
triggerInfo.setStartTime(trigger.getStartTime());
triggerInfo.setEndTime(trigger.getEndTime());
// triggerInfo.setFinalFireTime(trigger.getFinalFireTime());
triggerInfo.setPreviousFireTime(trigger.getPreviousFireTime());
return triggerInfo;
}
use of com.thinkbiganalytics.scheduler.model.DefaultTriggerInfo in project kylo by Teradata.
the class SchedulerObjectSerializatoinTest method testTriggerInfoSerialization.
@Test
public void testTriggerInfoSerialization() {
try {
TriggerInfo info = new DefaultTriggerInfo(new DefaultJobIdentifier(), new DefaultTriggerIdentifier());
ObjectMapper objectMapper = new ObjectMapper();
String json = null;
json = objectMapper.writeValueAsString(info);
System.out.println(json);
TriggerInfo info2 = objectMapper.readValue(json, TriggerInfo.class);
System.out.println(info2);
} catch (JsonProcessingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations