Examples of JPAService


Examples of org.apache.oozie.service.JPAService

        addRecordToCoordActionTable(job.getId(), actionNum, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
        _testPendingFalseCount(job.getId(), 3);
    }

    private void _testPendingFalseCount(String jobId, int expected) throws Exception {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        CoordActionsPendingFalseCountGetJPAExecutor actionPendingFalseCmd = new CoordActionsPendingFalseCountGetJPAExecutor(jobId);
        int cnt = jpaService.execute(actionPendingFalseCmd);
        assertEquals(expected, cnt);
    }
View Full Code Here

Examples of org.apache.oozie.service.JPAService

     * @throws Exception
     */
    public void testBundleStart1() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PREP, false);

        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(job.getStatus(), Job.Status.PREP);

        new BundleStartXCommand(job.getId()).call();

        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(job.getStatus(), Job.Status.RUNNING);

        Thread.sleep(2000);

        BundleActionsGetJPAExecutor bundleActionsGetExecutor = new BundleActionsGetJPAExecutor(job.getId());
        List<BundleActionBean> actions = jpaService.execute(bundleActionsGetExecutor);

        assertEquals(2, actions.size());
        assertEquals(true, actions.get(0).isCritical());
        assertEquals(job.getId(), actions.get(0).getBundleId());
        assertEquals(false, actions.get(1).isCritical());
View Full Code Here

Examples of org.apache.oozie.service.JPAService

     * @throws Exception
     */
    public void testBundleStart2() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PREP, false);

        final JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);

        Configuration jobConf = null;
        try {
            jobConf = new XConfiguration(new StringReader(job.getConf()));
        }
        catch (IOException ioe) {
            log.warn("Configuration parse error. read from DB :" + job.getConf(), ioe);
            throw new CommandException(ErrorCode.E1005, ioe);
        }

        Path appPath = new Path(jobConf.get(OozieClient.BUNDLE_APP_PATH), "bundle.xml");
        jobConf.set(OozieClient.BUNDLE_APP_PATH, appPath.toString());

        BundleSubmitXCommand submitCmd = new BundleSubmitXCommand(jobConf, job.getAuthToken());
        submitCmd.call();

        BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(submitCmd.getJob().getId());
        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(job.getStatus(), Job.Status.PREP);

        new BundleStartXCommand(job.getId()).call();

        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(job.getStatus(), Job.Status.RUNNING);

        Thread.sleep(2000);

        final BundleActionsGetJPAExecutor bundleActionsGetExecutor = new BundleActionsGetJPAExecutor(job.getId());
        List<BundleActionBean> actions = jpaService.execute(bundleActionsGetExecutor);
        assertEquals(2, actions.size());

        waitFor(200000, new Predicate() {
            public boolean evaluate() throws Exception {
                List<BundleActionBean> actions = jpaService.execute(bundleActionsGetExecutor);
                return actions.get(0).getStatus().equals(Job.Status.RUNNING)
                        && actions.get(1).getStatus().equals(Job.Status.RUNNING);
            }
        });

        actions = jpaService.execute(bundleActionsGetExecutor);
        assertEquals(Job.Status.RUNNING, actions.get(0).getStatus());
        assertEquals(true, actions.get(0).isCritical());
        assertEquals(job.getId(), actions.get(0).getBundleId());
        assertEquals(Job.Status.RUNNING, actions.get(1).getStatus());
        assertEquals(false, actions.get(1).isCritical());
View Full Code Here

Examples of org.apache.oozie.service.JPAService

     * @throws Exception
     */
    public void testBundleStartDryrun() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PREP, false);

        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(job.getStatus(), Job.Status.PREP);

        new BundleStartXCommand(job.getId(), true).call();

        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(job.getStatus(), Job.Status.RUNNING);

        Thread.sleep(2000);

        BundleActionsGetJPAExecutor bundleActionsGetExecutor = new BundleActionsGetJPAExecutor(job.getId());
        List<BundleActionBean> actions = jpaService.execute(bundleActionsGetExecutor);

        assertEquals(2, actions.size());
        assertEquals(true, actions.get(0).isCritical());
        assertEquals(job.getId(), actions.get(0).getBundleId());
        assertEquals(false, actions.get(1).isCritical());
View Full Code Here

Examples of org.apache.oozie.service.JPAService

     * @throws Exception
     */
    public void testBundleStartNegative2() throws Exception {
        BundleJobBean job = this.addRecordToBundleJobTableNegative(Job.Status.PREP);

        final JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        final BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(job.getStatus(), Job.Status.PREP);

        new BundleStartXCommand(job.getId()).call();

        waitFor(120000, new Predicate() {
            public boolean evaluate() throws Exception {
                BundleJobBean job1 = jpaService.execute(bundleJobGetExecutor);
                return job1.getStatus().equals(Job.Status.FAILED);
            }
        });
        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(Job.Status.FAILED, job.getStatus());
    }
View Full Code Here

Examples of org.apache.oozie.service.JPAService

        insertJob(jobId, CoordinatorJob.Status.PREP);
        _testCoordJobsToBeMaterialized();
    }

    private void _testCoordJobsToBeMaterialized() {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        try {
            Date d1 = new Date();
            Date d2 = new Date(d1.getTime() + 1000);
            CoordJobsToBeMaterializedJPAExecutor cmatcmd = new CoordJobsToBeMaterializedJPAExecutor(d2, 50);
            List<CoordinatorJobBean> jobList = jpaService.execute(cmatcmd);

            if (jobList.size() == 0) {
                fail("Test of getCoordinatorJobsToBeMaterialized returned no records. Date =" + d2);
            }
            // Assumption: no other older records are there
            d2 = new Date(d1.getTime() - 86400000L * 365L);
            CoordJobsToBeMaterializedJPAExecutor cmatcmdnew = new CoordJobsToBeMaterializedJPAExecutor(d2, 50);
            jobList = jpaService.execute(cmatcmdnew);

            /*
             * if(jobList.size() > 0){ fail("Test of
             * getCoordinatorJobsToBeMaterialized returned some records while
             * expecting no records = " + d2); }
View Full Code Here

Examples of org.apache.oozie.service.JPAService

            e.printStackTrace();
            fail("Could not set Date/time");
        }

        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            assertNotNull(jpaService);
            CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
            jpaService.execute(coordInsertCmd);
        }
        catch (JPAExecutorException ce) {
            ce.printStackTrace();
            fail("Unable to insert the test job record to table");
            throw ce;
View Full Code Here

Examples of org.apache.oozie.service.JPAService

        coordJob.setTimeout(timeout);
        coordJob.setConcurrency(3);
        coordJob.setMatThrottling(3);

        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;
View Full Code Here

Examples of org.apache.oozie.service.JPAService

        return coordJob;
    }

    private void checkCoordJobs(String jobId, CoordinatorJob.Status expectedStatus) {
        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            CoordinatorJobBean job = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
            if (job.getStatus() != expectedStatus) {
                fail("CoordJobMatLookupCommand didn't work because the status for job id"
                        + jobId + " is : " + job.getStatusStr() + "; however expected status is : " + expectedStatus.toString());
            }
        }
View Full Code Here

Examples of org.apache.webbeans.jpa.spi.JPAService

        p.put("movieDatabaseUnmanaged.JtaManaged", "false");
       
        Context context = new InitialContext(p);

        //X Movies movies = (Movies) context.lookup("MoviesLocal");
        JPAService jpaService = new JPAServiceOpenEJBImpl();
       
        EntityManagerFactory emf = jpaService.getPersistenceUnit( "TestUnit" );
        Assert.assertNotNull( emf );
       
        EntityManager em = jpaService.getPersistenceContext( "TestUnit", null );
        Assert.assertNotNull( em );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.