@Test void loadOneTimeScheduledTask() { Bundle bundle = new Bundle(); loader.load(bundle, createScheduledTaskXml(DocumentTools.INSTANCE.getDocumentBuilder().newDocument(), true)); final ScheduledTask entity = bundle.getScheduledTasks().get("Test"); assertNotNull(entity); assertEquals("id", entity.getId()); assertEquals("Test", entity.getName()); assertFalse(entity.getIsOneNode()); assertEquals("One time", entity.getJobType()); assertEquals("someDate", entity.getExecutionDate()); assertNull(entity.getCronExpression()); assertEquals("Scheduled", entity.getJobStatus()); assertFalse(entity.getShouldExecuteOnCreate()); assertEquals("testValue", entity.getProperties().get("testProp")); }
@Override public void load(Bundle bundle, Element element) { final Element scheduledTask = getSingleChildElement(getSingleChildElement(element, RESOURCE), SCHEDULED_TASK); final String policyId = getSingleChildElementAttribute(scheduledTask, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(scheduledTask, NAME); final boolean isOneNode = toBoolean(getSingleChildElementTextContent(scheduledTask, ONE_NODE)); final String jobType = getSingleChildElementTextContent(scheduledTask, JOB_TYPE); final String jobStatus = getSingleChildElementTextContent(scheduledTask, JOB_STATUS); final String executionDate = getSingleChildElementTextContent(scheduledTask, EXECUTION_DATE); final String cronExpression = getSingleChildElementTextContent(scheduledTask, CRON_EXPRESSION); final boolean shouldExecuteOnCreate = toBoolean(getSingleChildElementTextContent(scheduledTask, EXECUTE_ON_CREATE)); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(scheduledTask, PROPERTIES, true), PROPERTIES); ScheduledTask task = new ScheduledTask(); task.setId(scheduledTask.getAttribute(ATTRIBUTE_ID)); task.setPolicy(policyId); task.setName(name); task.setOneNode(isOneNode); task.setJobType(jobType); task.setJobStatus(jobStatus); task.setExecutionDate(executionDate); task.setCronExpression(cronExpression); task.setShouldExecuteOnCreate(shouldExecuteOnCreate); task.setProperties(properties); bundle.getScheduledTasks().put(name, task); }
ScheduledTaskLoader implements BundleEntityLoader { @Override public void load(Bundle bundle, Element element) { final Element scheduledTask = getSingleChildElement(getSingleChildElement(element, RESOURCE), SCHEDULED_TASK); final String policyId = getSingleChildElementAttribute(scheduledTask, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(scheduledTask, NAME); final boolean isOneNode = toBoolean(getSingleChildElementTextContent(scheduledTask, ONE_NODE)); final String jobType = getSingleChildElementTextContent(scheduledTask, JOB_TYPE); final String jobStatus = getSingleChildElementTextContent(scheduledTask, JOB_STATUS); final String executionDate = getSingleChildElementTextContent(scheduledTask, EXECUTION_DATE); final String cronExpression = getSingleChildElementTextContent(scheduledTask, CRON_EXPRESSION); final boolean shouldExecuteOnCreate = toBoolean(getSingleChildElementTextContent(scheduledTask, EXECUTE_ON_CREATE)); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(scheduledTask, PROPERTIES, true), PROPERTIES); ScheduledTask task = new ScheduledTask(); task.setId(scheduledTask.getAttribute(ATTRIBUTE_ID)); task.setPolicy(policyId); task.setName(name); task.setOneNode(isOneNode); task.setJobType(jobType); task.setJobStatus(jobStatus); task.setExecutionDate(executionDate); task.setCronExpression(cronExpression); task.setShouldExecuteOnCreate(shouldExecuteOnCreate); task.setProperties(properties); bundle.getScheduledTasks().put(name, task); } }
ScheduledTaskLoader implements BundleEntityLoader { @Override public void load(Bundle bundle, Element element) { final Element scheduledTask = getSingleChildElement(getSingleChildElement(element, RESOURCE), SCHEDULED_TASK); final String policyId = getSingleChildElementAttribute(scheduledTask, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(scheduledTask, NAME); final boolean isOneNode = toBoolean(getSingleChildElementTextContent(scheduledTask, ONE_NODE)); final String jobType = getSingleChildElementTextContent(scheduledTask, JOB_TYPE); final String jobStatus = getSingleChildElementTextContent(scheduledTask, JOB_STATUS); final String executionDate = getSingleChildElementTextContent(scheduledTask, EXECUTION_DATE); final String cronExpression = getSingleChildElementTextContent(scheduledTask, CRON_EXPRESSION); final boolean shouldExecuteOnCreate = toBoolean(getSingleChildElementTextContent(scheduledTask, EXECUTE_ON_CREATE)); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(scheduledTask, PROPERTIES, true), PROPERTIES); ScheduledTask task = new ScheduledTask(); task.setId(scheduledTask.getAttribute(ATTRIBUTE_ID)); task.setPolicy(policyId); task.setName(name); task.setOneNode(isOneNode); task.setJobType(jobType); task.setJobStatus(jobStatus); task.setExecutionDate(executionDate); task.setCronExpression(cronExpression); task.setShouldExecuteOnCreate(shouldExecuteOnCreate); task.setProperties(properties); bundle.getScheduledTasks().put(name, task); }  }
ScheduledTaskLoader implements BundleEntityLoader { @Override public void load(Bundle bundle, Element element) { final Element scheduledTask = getSingleChildElement(getSingleChildElement(element, RESOURCE), SCHEDULED_TASK); final String policyId = getSingleChildElementAttribute(scheduledTask, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(scheduledTask, NAME); final boolean isOneNode = toBoolean(getSingleChildElementTextContent(scheduledTask, ONE_NODE)); final String jobType = getSingleChildElementTextContent(scheduledTask, JOB_TYPE); final String jobStatus = getSingleChildElementTextContent(scheduledTask, JOB_STATUS); final String executionDate = getSingleChildElementTextContent(scheduledTask, EXECUTION_DATE); final String cronExpression = getSingleChildElementTextContent(scheduledTask, CRON_EXPRESSION); final boolean shouldExecuteOnCreate = toBoolean(getSingleChildElementTextContent(scheduledTask, EXECUTE_ON_CREATE)); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(scheduledTask, PROPERTIES, true), PROPERTIES); ScheduledTask task = new ScheduledTask(); task.setId(scheduledTask.getAttribute(ATTRIBUTE_ID)); task.setPolicy(policyId); task.setName(name); task.setOneNode(isOneNode); task.setJobType(jobType); task.setJobStatus(jobStatus); task.setExecutionDate(executionDate); task.setCronExpression(cronExpression); task.setShouldExecuteOnCreate(shouldExecuteOnCreate); task.setProperties(properties); bundle.getScheduledTasks().put(name, task); }  @Override void load(Bundle bundle, Element element); @Override String getEntityType(); }
ScheduledTaskLoader implements BundleEntityLoader { @Override public void load(Bundle bundle, Element element) { final Element scheduledTask = getSingleChildElement(getSingleChildElement(element, RESOURCE), SCHEDULED_TASK); final String policyId = getSingleChildElementAttribute(scheduledTask, POLICY_REFERENCE, ATTRIBUTE_ID); final String name = getSingleChildElementTextContent(scheduledTask, NAME); final boolean isOneNode = toBoolean(getSingleChildElementTextContent(scheduledTask, ONE_NODE)); final String jobType = getSingleChildElementTextContent(scheduledTask, JOB_TYPE); final String jobStatus = getSingleChildElementTextContent(scheduledTask, JOB_STATUS); final String executionDate = getSingleChildElementTextContent(scheduledTask, EXECUTION_DATE); final String cronExpression = getSingleChildElementTextContent(scheduledTask, CRON_EXPRESSION); final boolean shouldExecuteOnCreate = toBoolean(getSingleChildElementTextContent(scheduledTask, EXECUTE_ON_CREATE)); final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(scheduledTask, PROPERTIES, true), PROPERTIES); ScheduledTask task = new ScheduledTask(); task.setId(scheduledTask.getAttribute(ATTRIBUTE_ID)); task.setPolicy(policyId); task.setName(name); task.setOneNode(isOneNode); task.setJobType(jobType); task.setJobStatus(jobStatus); task.setExecutionDate(executionDate); task.setCronExpression(cronExpression); task.setShouldExecuteOnCreate(shouldExecuteOnCreate); task.setProperties(properties); bundle.getScheduledTasks().put(name, task); }  @Override void load(Bundle bundle, Element element); @Override String getEntityType();  }