Package org.qzerver.model.domain.entities.job

Examples of org.qzerver.model.domain.entities.job.ScheduleExecutionResult


        Assert.assertNotNull(scheduleExecution);

        control.verify();

        ScheduleExecutionNode scheduleExecutionNode;
        ScheduleExecutionResult scheduleExecutionResult;

        scheduleExecution = scheduleExecutionManagementService.findExecution(scheduleExecution.getId());
        Assert.assertEquals(ScheduleExecutionStatus.SUCCEED, scheduleExecution.getStatus());
        Assert.assertEquals(1, scheduleExecution.getNodes().size());
        Assert.assertEquals(1, scheduleExecution.getResults().size());

        scheduleExecutionNode =scheduleExecution.getNodes().get(0);
        Assert.assertNotNull(scheduleExecutionNode);
        Assert.assertEquals(clusterNode2.getAddress(), scheduleExecutionNode.getAddress());
        scheduleExecutionResult = scheduleExecutionNode.getResult();
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertTrue(scheduleExecutionResult.isSucceed());
    }
View Full Code Here


        Assert.assertNotNull(scheduleExecution);

        control.verify();

        ScheduleExecutionNode scheduleExecutionNode;
        ScheduleExecutionResult scheduleExecutionResult;

        scheduleExecution = scheduleExecutionManagementService.findExecution(scheduleExecution.getId());
        Assert.assertEquals(ScheduleExecutionStatus.FAILED, scheduleExecution.getStatus());
        Assert.assertEquals(2, scheduleExecution.getNodes().size());
        Assert.assertEquals(2, scheduleExecution.getResults().size());

        scheduleExecutionNode =scheduleExecution.getNodes().get(0);
        Assert.assertNotNull(scheduleExecutionNode);
        Assert.assertEquals(clusterNode2.getAddress(), scheduleExecutionNode.getAddress());
        scheduleExecutionResult = scheduleExecutionNode.getResult();
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertFalse(scheduleExecutionResult.isSucceed());

        scheduleExecutionNode =scheduleExecution.getNodes().get(1);
        Assert.assertNotNull(scheduleExecutionNode);
        Assert.assertEquals(clusterNode1.getAddress(), scheduleExecutionNode.getAddress());
        scheduleExecutionResult = scheduleExecutionNode.getResult();
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertTrue(scheduleExecutionResult.isSucceed());
    }
View Full Code Here

        Assert.assertNotNull(scheduleExecution);

        control.verify();

        ScheduleExecutionNode scheduleExecutionNode;
        ScheduleExecutionResult scheduleExecutionResult;

        scheduleExecution = scheduleExecutionManagementService.findExecution(scheduleExecution.getId());
        Assert.assertEquals(ScheduleExecutionStatus.FAILED, scheduleExecution.getStatus());
        Assert.assertEquals(2, scheduleExecution.getNodes().size());
        Assert.assertEquals(2, scheduleExecution.getResults().size());

        scheduleExecutionNode =scheduleExecution.getNodes().get(0);
        Assert.assertNotNull(scheduleExecutionNode);
        Assert.assertEquals(clusterNode2.getAddress(), scheduleExecutionNode.getAddress());
        scheduleExecutionResult = scheduleExecutionNode.getResult();
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertFalse(scheduleExecutionResult.isSucceed());

        scheduleExecutionNode =scheduleExecution.getNodes().get(1);
        Assert.assertNotNull(scheduleExecutionNode);
        Assert.assertEquals(clusterNode1.getAddress(), scheduleExecutionNode.getAddress());
        scheduleExecutionResult = scheduleExecutionNode.getResult();
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertFalse(scheduleExecutionResult.isSucceed());
    }
View Full Code Here

        Assert.assertNotNull(scheduleExecution);

        control.verify();

        ScheduleExecutionNode scheduleExecutionNode;
        ScheduleExecutionResult scheduleExecutionResult;

        scheduleExecution = scheduleExecutionManagementService.findExecution(scheduleExecution.getId());
        Assert.assertEquals(ScheduleExecutionStatus.EXCEPTION, scheduleExecution.getStatus());
        Assert.assertEquals(2, scheduleExecution.getNodes().size());
        Assert.assertEquals(2, scheduleExecution.getResults().size());

        scheduleExecutionNode =scheduleExecution.getNodes().get(0);
        Assert.assertNotNull(scheduleExecutionNode);
        Assert.assertEquals(clusterNode2.getAddress(), scheduleExecutionNode.getAddress());
        scheduleExecutionResult = scheduleExecutionNode.getResult();
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertFalse(scheduleExecutionResult.isSucceed());

        scheduleExecutionNode =scheduleExecution.getNodes().get(1);
        Assert.assertNotNull(scheduleExecutionNode);
        Assert.assertEquals(clusterNode1.getAddress(), scheduleExecutionNode.getAddress());
        scheduleExecutionResult = scheduleExecutionNode.getResult();
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertTrue(scheduleExecutionResult.isSucceed());
    }
View Full Code Here

        Assert.assertTrue(scheduleExecutions.size() > 0);
        Assert.assertTrue(Iterators.contains(scheduleExecutions.iterator(), scheduleExecution));

        // Make some progress

        ScheduleExecutionResult scheduleExecutionResult;

        scheduleExecutionResult = scheduleExecutionManagementService.startExecutionResult(scheduleExecutionNode1.getId());
        Assert.assertNotNull(scheduleExecutionResult);

        scheduleExecutionResult = scheduleExecutionManagementService.finishExecutionResult(scheduleExecutionResult.getId(),
            true, null);
        Assert.assertNotNull(scheduleExecutionResult);

        scheduleExecutionResult = scheduleExecutionManagementService.startExecutionResult(scheduleExecutionNode2.getId());
        Assert.assertNotNull(scheduleExecutionResult);

        scheduleExecutionResult = scheduleExecutionManagementService.finishExecutionResult(scheduleExecutionResult.getId(),
            true, null);
        Assert.assertNotNull(scheduleExecutionResult);

        scheduleExecutionResult = scheduleExecutionManagementService.startExecutionResult(scheduleExecutionNode3.getId());
        Assert.assertNotNull(scheduleExecutionResult);

        scheduleExecutionResult = scheduleExecutionManagementService.finishExecutionResult(scheduleExecutionResult.getId(),
            false, null);
        Assert.assertNotNull(scheduleExecutionResult);

        entityManager.flush();
        entityManager.clear();

        scheduleExecutionModified =
            scheduleExecutionManagementService.findExecution(scheduleExecution.getId());
        Assert.assertNotNull(scheduleExecutionModified);
        Assert.assertEquals(scheduleExecution, scheduleExecutionModified);
        Assert.assertEquals(3, scheduleExecutionModified.getResults().size());

        scheduleExecutionResult = scheduleExecutionModified.getResults().get(0);
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertEquals(0, scheduleExecutionResult.getOrderIndex());
        Assert.assertTrue(scheduleExecutionResult.isSucceed());

        scheduleExecutionResult = scheduleExecutionModified.getResults().get(1);
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertEquals(1, scheduleExecutionResult.getOrderIndex());
        Assert.assertTrue(scheduleExecutionResult.isSucceed());

        scheduleExecutionResult = scheduleExecutionModified.getResults().get(2);
        Assert.assertEquals(2, scheduleExecutionResult.getOrderIndex());
        Assert.assertNotNull(scheduleExecutionResult);
        Assert.assertFalse(scheduleExecutionResult.isSucceed());

        // Finish execution

        scheduleExecutionModified = scheduleExecutionManagementService.finishExecution(
            scheduleExecution.getId(), ScheduleExecutionStatus.SUCCEED);
View Full Code Here

            throw new ExecutionAlreadyFinishedException(scheduleExecution.getId());
        }

        businessEntityDao.lock(scheduleExecution);

        ScheduleExecutionResult result = new ScheduleExecutionResult();
        result.setOrderIndex(node.getOrderIndex());
        result.setStarted(chronometer.getCurrentMoment());
        result.setFinished(null);
        result.setSucceed(false);

        result.setNode(node);
        node.setResult(result);

        result.setExecution(scheduleExecution);
        scheduleExecution.getResults().add(result);

        businessEntityDao.save(result);

        return result;
View Full Code Here

        // Check the result
        int succeedNodes = 0;
        boolean exception = false;
        for (Future<ScheduleExecutionResult> resultFuture : resultFutures) {
            ScheduleExecutionResult result;

            try {
                result = resultFuture.get();
            } catch (Exception e) {
                LOGGER.error("Error while executing node in pool", e);
                exception = true;
                // We could break the loop but we are still rolling - to print into the log all the errors
                result = null;
            }

            if ((result != null) && result.isSucceed()) {
                succeedNodes++;
            }
        }

        if (!exception) {
View Full Code Here

    @Override
    public ScheduleExecutionResult finishExecutionResult(long scheduleExecutionResultId, boolean succeed, byte[] data)
        throws AbstractServiceException
    {
        ScheduleExecutionResult result =
            businessEntityDao.findById(ScheduleExecutionResult.class, scheduleExecutionResultId);

        if (result == null) {
            throw new MissingEntityException(ScheduleExecutionResult.class, scheduleExecutionResultId);
        }

        if (result.getFinished() != null) {
            throw new ResultAlreadyFinishedException(result.getId());
        }

        result.setFinished(chronometer.getCurrentMoment());
        result.setSucceed(succeed);
        result.setPayload(data);

        return result;
    }
View Full Code Here

            // Current node
            ScheduleExecutionNode currentNode = nodeIterator.next();

            // Execution action on node
            ScheduleExecutionResult scheduleExecutionResult = executeJobNode(scheduleExecution, currentNode);

            // If last action succeedes break the node loop
            if (scheduleExecutionResult.isSucceed()) {
                LOGGER.debug("Success execution [{}] on node [{}]",
                    scheduleExecution.getId(), currentNode.getAddress());
                succeedNodes++;
                if (!scheduleExecution.isAllNodes()) {
                    return ScheduleExecutionStatus.SUCCEED;
View Full Code Here

        throws AbstractServiceException
    {
        LOGGER.debug("Start execution [{}] on node [{}]", scheduleExecution.getId(), node.getAddress());

        // Register node execution start, execute and register finish
        ScheduleExecutionResult scheduleExecutionResult =
            executionManagementService.startExecutionResult(node.getId());

        ScheduleAction scheduleAction = scheduleExecution.getAction();

        // Execute action
        boolean succeed = false;
        byte[] data = null;

        try {
            ActionAgentResult actionAgentResult = actionAgent.executeAction(scheduleExecution.getId(),
                scheduleAction.getIdentifier(), scheduleAction.getDefinition(), node.getAddress());
            succeed = actionAgentResult.isSucceed();
            data = actionAgentResult.getData();
        } finally {
            scheduleExecutionResult = executionManagementService.finishExecutionResult(
                scheduleExecutionResult.getId(), succeed, data);
        }

        return scheduleExecutionResult;
    }
View Full Code Here

TOP

Related Classes of org.qzerver.model.domain.entities.job.ScheduleExecutionResult

Copyright © 2018 www.massapicom. 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.