Search in sources :

Example 6 with CoordJobInsertJPAExecutor

use of org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor in project oozie by apache.

the class XDataTestCase method addRecordToCoordJobTable.

/**
 * Insert coord job for testing.
 *
 * @param testFileName test file name
 * @param status coord job status
 * @param start start time
 * @param end end time
 * @param pending true if pending is true
 * @param doneMatd true if doneMaterialization is true
 * @param lastActionNum last action number
 * @return coord job bean
 * @throws Exception
 */
protected CoordinatorJobBean addRecordToCoordJobTable(String testFileName, CoordinatorJob.Status status, Date start, Date end, boolean pending, boolean doneMatd, int lastActionNum) throws Exception {
    CoordinatorJobBean coordJob = createCoordJob(testFileName, status, start, end, pending, doneMatd, lastActionNum);
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
        jpaService.execute(coordInsertCmd);
    } catch (JPAExecutorException je) {
        je.printStackTrace();
        fail("Unable to insert the test coord job record to table");
        throw je;
    }
    return coordJob;
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordJobInsertJPAExecutor(org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Example 7 with CoordJobInsertJPAExecutor

use of org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor in project oozie by apache.

the class XDataTestCase method addRecordToCoordJobTableForWaiting.

protected CoordinatorJobBean addRecordToCoordJobTableForWaiting(String testFileName, CoordinatorJobBean coordJob) throws Exception {
    String testDir = getTestCaseDir();
    String appXml = getCoordJobXmlForWaiting(testFileName, testDir);
    coordJob.setJobXml(appXml);
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
        jpaService.execute(coordInsertCmd);
    } catch (JPAExecutorException je) {
        je.printStackTrace();
        fail("Unable to insert the test coord job record to table");
        throw je;
    }
    return coordJob;
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordJobInsertJPAExecutor(org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Example 8 with CoordJobInsertJPAExecutor

use of org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor in project oozie by apache.

the class XDataTestCase method addRecordToCoordJobTableWithBundle.

/**
 * Add coordinator job bean with bundle id info.
 *
 * @param bundleId bundle id
 * @param coordId coord id and coord name
 * @param status job status
 * @param pending true if pending is true
 * @param doneMatd true if doneMaterialization is true
 * @param lastActionNumber last action number
 * @return coordinator job bean
 * @throws Exception
 */
protected CoordinatorJobBean addRecordToCoordJobTableWithBundle(String bundleId, String coordId, CoordinatorJob.Status status, boolean pending, boolean doneMatd, int lastActionNumber) throws Exception {
    CoordinatorJobBean coordJob = createCoordJob(status, pending, doneMatd);
    coordJob.setBundleId(bundleId);
    // coord id and coord name are the same
    coordJob.setId(coordId);
    coordJob.setAppName(coordId);
    coordJob.setLastActionNumber(lastActionNumber);
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
        jpaService.execute(coordInsertCmd);
    } catch (JPAExecutorException je) {
        je.printStackTrace();
        fail("Unable to insert the test coord job record to table");
        throw je;
    }
    return coordJob;
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordJobInsertJPAExecutor(org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Example 9 with CoordJobInsertJPAExecutor

use of org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor in project oozie by apache.

the class TestCoordMaterializeTransitionXCommand method addRecordToCoordJobTable.

protected CoordinatorJobBean addRecordToCoordJobTable(CoordinatorJob.Status status, Date startTime, Date endTime, Date pauseTime, int timeout, String freq, CoordinatorJob.Execution execution, int matThrottling) throws Exception {
    CoordinatorJobBean coordJob = createCoordJob(status, startTime, endTime, false, false, 0);
    coordJob.setStartTime(startTime);
    coordJob.setEndTime(endTime);
    coordJob.setPauseTime(pauseTime);
    coordJob.setFrequency(freq);
    coordJob.setTimeUnit(Timeunit.MINUTE);
    coordJob.setTimeout(timeout);
    coordJob.setConcurrency(3);
    coordJob.setMatThrottling(matThrottling);
    coordJob.setExecutionOrder(execution);
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
        jpaService.execute(coordInsertCmd);
    } catch (JPAExecutorException ex) {
        ex.printStackTrace();
        fail("Unable to insert the test coord job record to table");
        throw ex;
    }
    return coordJob;
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordJobInsertJPAExecutor(org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Example 10 with CoordJobInsertJPAExecutor

use of org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor in project oozie by apache.

the class TestPurgeXCommand method addRecordToCoordJobTable.

@Override
protected CoordinatorJobBean addRecordToCoordJobTable(CoordinatorJob.Status status, boolean pending, boolean doneMatd) throws Exception {
    CoordinatorJobBean coordJob = createCoordJob(status, pending, doneMatd);
    coordJob.setLastModifiedTime(DateUtils.parseDateOozieTZ("2009-12-18T01:00Z"));
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
        jpaService.execute(coordInsertCmd);
    } catch (JPAExecutorException je) {
        je.printStackTrace();
        fail("Unable to insert the test coord job record to table");
        throw je;
    }
    return coordJob;
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordJobInsertJPAExecutor(org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Aggregations

CoordJobInsertJPAExecutor (org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor)22 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)21 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)20 JPAService (org.apache.oozie.service.JPAService)19 Date (java.util.Date)6 CommandException (org.apache.oozie.command.CommandException)3 StatusTransitRunnable (org.apache.oozie.service.StatusTransitService.StatusTransitRunnable)3 XConfiguration (org.apache.oozie.util.XConfiguration)3 IOException (java.io.IOException)2 CoordJobGetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor)2 Configuration (org.apache.hadoop.conf.Configuration)1 Path (org.apache.hadoop.fs.Path)1 BundleActionBean (org.apache.oozie.BundleActionBean)1 BundleJobBean (org.apache.oozie.BundleJobBean)1 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)1 BundleJobGetJPAExecutor (org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor)1 CoordActionGetJPAExecutor (org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor)1 Services (org.apache.oozie.service.Services)1 StoreException (org.apache.oozie.store.StoreException)1