@Test public void submitNScheduleQueryCronExp() throws Exception { String endDate = Util.modifyDate(currentDate, format, Calendar.DATE, 1); XJob xJob = scheduleHelper.getXJob("job-submit-schedule-cronExp", QueryInventory.QUERY, null, currentDate, endDate, "0/30 * * * * ?"); String jobHandle = scheduleHelper.submitNScheduleJob(xJob, sessionHandleString); Assert.assertNotNull(jobHandle); XJob job = scheduleHelper.getJobDefinition(jobHandle, sessionHandleString, MediaType.APPLICATION_XML_TYPE, MediaType.APPLICATION_XML).getData(); Assert.assertNotNull(job); Assert.assertEquals(job.getName(), "job-submit-schedule-cronExp"); }
/** * {@inheritDoc} */ @Override public SchedulerJobHandle submitJob(LensSessionHandle sessionHandle, XJob job) throws LensException { LensSessionImpl session = getSession(sessionHandle); // Validate XJob validateJob(session, job); SchedulerJobHandle handle = UtilityMethods.generateSchedulerJobHandle(); long createdOn = System.currentTimeMillis(); SchedulerJobInfo info = new SchedulerJobInfo(handle, job, session.getLoggedInUser(), SchedulerJobState.NEW, createdOn, createdOn); if (schedulerDAO.storeJob(info) == 1) { log.info("Successfully submitted job with handle {}", handle); return handle; } else { throw new LensException(LensSchedulerErrorCode.CANT_SUBMIT_JOB.getLensErrorInfo(), null, job.getName()); } }
@Test public void submitNScheduleQuery() throws Exception { String startDate = Util.modifyDate(currentDate, format, Calendar.DATE, -1); String endDate = Util.modifyDate(currentDate, format, Calendar.DATE, 3); XJob xJob = scheduleHelper.getXJob("job-submit-schedule", QueryInventory.JDBC_CUBE_QUERY, null, startDate, endDate, XFrequencyEnum.DAILY); String jobHandle = scheduleHelper.submitNScheduleJob(xJob, sessionHandleString); Assert.assertNotNull(jobHandle); Assert.assertEquals(scheduleHelper.getJobStatus(jobHandle), SchedulerJobState.SCHEDULED); SchedulerJobInfo jobInfo = scheduleHelper.getJobDetails(jobHandle, sessionHandleString).getData(); Assert.assertNotNull(jobInfo); Assert.assertEquals(jobInfo.getJob().getName(), "job-submit-schedule"); }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { theName = this.getName(); strategy.appendField(locator, this, "name", buffer, theName);
/** * Inserts the Job info object into job table * * @param jobInfo * @return number of rows inserted. * @throws SQLException */ public int insertIntoJobTable(SchedulerJobInfo jobInfo) throws SQLException { String insertSQL = "INSERT INTO " + JOB_TABLE + " VALUES(?,?,?,?,?,?,?)"; JAXBElement<XJob> xmlJob = jobFactory.createJob(jobInfo.getJob()); return runner.update(insertSQL, jobInfo.getId().toString(), ToXMLString.toString(xmlJob), jobInfo.getUserName(), jobInfo.getJobState().name(), jobInfo.getCreatedOn(), jobInfo.getModifiedOn(), jobInfo.getJob().getName()); }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { theName = this.getName(); strategy.appendField(locator, this, "name", buffer, theName);
String queryName = job.getName(); queryName += "-" + scheduledTimeMillis;
@Test public void testUpdateJob() throws Exception { String endDate = Util.modifyDate(currentDate, format, Calendar.DATE, 4); XJob job = scheduleHelper.getXJob("job-update", QueryInventory.QUERY, null, currentDate, endDate, XFrequencyEnum.WEEKLY); String jobHandle = scheduleHelper.submitJob(job, sessionHandleString); XJob tmp = scheduleHelper.getJobDefinition(jobHandle, sessionHandleString).getData(); tmp.setName("modified-name"); endDate = Util.modifyDate(currentDate, format, Calendar.DATE, 6); tmp.setEndTime(Util.getGregorianCalendar(endDate)); scheduleHelper.updateJob(tmp, jobHandle, sessionHandleString); XJob modifiedJob = scheduleHelper.getJobDefinition(jobHandle, sessionHandleString).getData(); Assert.assertEquals(modifiedJob.getName(), "modified-name"); String modifiedEndTime = Util.getDateStringFromGregorainCalender(modifiedJob.getEndTime(), format); Assert.assertEquals(modifiedEndTime, endDate); }
theName = this.getName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "name", theName), currentHashCode, theName);
theName = this.getName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "name", theName), currentHashCode, theName);