Search in sources :

Example 21 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 status coord job status
 * @param pending true if pending is true
 * @param doneMatd true if doneMaterialization is true
 * @return coord job bean
 * @throws Exception
 */
protected CoordinatorJobBean addRecordToCoordJobTable(CoordinatorJob.Status status, boolean pending, boolean doneMatd) throws Exception {
    CoordinatorJobBean coordJob = createCoordJob(status, pending, doneMatd);
    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 22 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 start start time
 * @param end end time
 * @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, Date start, Date end, boolean pending, boolean doneMatd, int lastActionNumber) throws Exception {
    CoordinatorJobBean coordJob = createCoordJob(status, start, end, pending, doneMatd, 0);
    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)

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