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

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


            jobExecutionParameters);
        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


            jobExecutionParameters);
        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

            jobExecutionParameters);
        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

            jobExecutionParameters);
        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.assertNotNull(scheduleExecutionModified);
        Assert.assertEquals(scheduleExecution, scheduleExecutionModified);
        Assert.assertEquals(ScheduleExecutionStatus.INPROGRESS, scheduleExecutionModified.getStatus());
        Assert.assertEquals(3, scheduleExecutionModified.getNodes().size());

        ScheduleExecutionNode scheduleExecutionNode1 = scheduleExecutionModified.getNodes().get(0);
        Assert.assertNotNull(scheduleExecutionNode1);
        Assert.assertEquals(0, scheduleExecutionNode1.getOrderIndex());
        Assert.assertEquals(clusterNode2.getAddress(), scheduleExecutionNode1.getAddress());

        ScheduleExecutionNode scheduleExecutionNode2 = scheduleExecutionModified.getNodes().get(1);
        Assert.assertNotNull(scheduleExecutionNode2);
        Assert.assertEquals(1, scheduleExecutionNode2.getOrderIndex());
        Assert.assertEquals(clusterNode3.getAddress(), scheduleExecutionNode2.getAddress());

        ScheduleExecutionNode scheduleExecutionNode3 = scheduleExecutionModified.getNodes().get(2);
        Assert.assertNotNull(scheduleExecutionNode3);
        Assert.assertEquals(2, scheduleExecutionNode3.getOrderIndex());
        Assert.assertEquals(clusterNode1.getAddress(), scheduleExecutionNode3.getAddress());

        // Search all executions

        List<ScheduleExecution> scheduleExecutions = scheduleExecutionManagementService.findAll(Extraction.ALL);
        Assert.assertNotNull(scheduleExecutions);
        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);
View Full Code Here

        Assert.assertEquals(scheduleExecution, scheduleExecutionModified);
        Assert.assertEquals("Test comment", scheduleExecutionModified.getDescription());
        Assert.assertEquals(ScheduleExecutionStatus.INPROGRESS, scheduleExecutionModified.getStatus());
        Assert.assertEquals(2, scheduleExecutionModified.getNodes().size());

        ScheduleExecutionNode scheduleExecutionNode;

        scheduleExecutionNode = scheduleExecutionModified.getNodes().get(0);
        Assert.assertEquals("192.168.1.1", scheduleExecutionNode.getAddress());

        scheduleExecutionNode = scheduleExecutionModified.getNodes().get(1);
        Assert.assertEquals("192.168.1.2", scheduleExecutionNode.getAddress());
    }
View Full Code Here

        Assert.assertEquals(scheduleExecution, scheduleExecutionModified);
        Assert.assertEquals("Test comment", scheduleExecutionModified.getDescription());
        Assert.assertEquals(ScheduleExecutionStatus.INPROGRESS, scheduleExecutionModified.getStatus());
        Assert.assertEquals(1, scheduleExecutionModified.getNodes().size());

        ScheduleExecutionNode scheduleExecutionNode;

        scheduleExecutionNode = scheduleExecutionModified.getNodes().get(0);
        Assert.assertEquals("localhost", scheduleExecutionNode.getAddress());
    }
View Full Code Here

        if (CollectionUtils.isNotEmpty(parameters.getAddresses())) {
            List<String> addresses = parameters.getAddresses();
            List<ScheduleExecutionNode> result = new ArrayList<ScheduleExecutionNode>(addresses.size());
            for (int i = 0, size = addresses.size(); i < size; i++) {
                String address = parameters.getAddresses().get(i);
                ScheduleExecutionNode executionNode = new ScheduleExecutionNode();
                executionNode.setOrderIndex(i);
                executionNode.setLocalhost(false);
                executionNode.setAddress(address);
                result.add(executionNode);
            }
            return result;
        }

        // If cluster is set then choose some nodes to work on
        ClusterGroup clusterGroup = scheduleJob.getCluster();
        if (clusterGroup != null) {
            List<ClusterNode> selectedNodes = selectClusterNodes(scheduleJob);
            List<ScheduleExecutionNode> result = new ArrayList<ScheduleExecutionNode>(selectedNodes.size());
            for (int i = 0, size = selectedNodes.size(); i < size; i++) {
                ClusterNode clusterNode = selectedNodes.get(i);
                ScheduleExecutionNode executionNode = new ScheduleExecutionNode();
                executionNode.setOrderIndex(i);
                executionNode.setLocalhost(false);
                executionNode.setAddress(clusterNode.getAddress());
                result.add(executionNode);
            }
            return result;
        }

        // If cluster is not set then the only node is 'localhost' node
        ScheduleExecutionNode executionNode = new ScheduleExecutionNode();
        executionNode.setOrderIndex(0);
        executionNode.setLocalhost(true);
        executionNode.setAddress("localhost");
        return Collections.singletonList(executionNode);
    }
View Full Code Here

        return selectedNodes;
    }

    @Override
    public ScheduleExecutionResult startExecutionResult(long scheduleExecutionNodeId) throws AbstractServiceException {
        ScheduleExecutionNode node = businessEntityDao.findById(ScheduleExecutionNode.class, scheduleExecutionNodeId);
        if (node == null) {
            throw new MissingEntityException(ScheduleExecutionNode.class, scheduleExecutionNodeId);
        }

        ScheduleExecution scheduleExecution = node.getExecution();

        if (scheduleExecution.getFinished() != null) {
            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);
View Full Code Here

                LOGGER.debug("Execution [{}] is cancelled", scheduleExecution.getId());
                return ScheduleExecutionStatus.CANCELED;
            }

            // 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;
                }
            } else {
                LOGGER.debug("Failed execution [{}] on node [{}]",
                    scheduleExecution.getId(), currentNode.getAddress());
            }

            // Are there any other pending nodes?
            if (nodeIterator.hasNext()) {
                // Check timeout
View Full Code Here

TOP

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

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.