Package com.dtolabs.rundeck.core.common

Examples of com.dtolabs.rundeck.core.common.INodeSet


    public DispatcherResult dispatch(final StepExecutionContext context,
                                     final NodeStepExecutionItem item, final Dispatchable toDispatch) throws
                                                                                                      DispatcherException {

        INodeSet nodes = context.getNodes();
        if (nodes.getNodes().size() < 1) {
            throw new DispatcherException("No nodes matched");
        }
        boolean keepgoing = context.isKeepgoing();

        context.getExecutionListener()
            .log(4, "preparing for sequential execution on " + nodes.getNodes().size() + " nodes");
        final HashSet<String> nodeNames = new HashSet<String>(nodes.getNodeNames());
        final HashMap<String, NodeStepResult> failures = new HashMap<String, NodeStepResult>();
        FailedNodesListener failedListener = context.getExecutionListener().getFailedNodesListener();
        if (null != failedListener) {
            failedListener.matchedNodes(nodeNames);
        }
View Full Code Here


    }

    public DispatcherResult dispatch(final StepExecutionContext context,
                                     final NodeStepExecutionItem item, final Dispatchable toDispatch) throws
        DispatcherException {
        INodeSet nodes = context.getNodes();
        boolean keepgoing = context.isKeepgoing();

        final HashSet<String> nodeNames = new HashSet<String>();
        FailedNodesListener failedListener = context.getExecutionListener().getFailedNodesListener();

        Project project = new Project();

        context.getExecutionListener().log(3,
            "preparing for parallel execution...(keepgoing? " + keepgoing + ", threads: "
            + context.getThreadCount()
            + ")");
        configureNodeContextThreadLocalsForProject(project);
        final Parallel parallelTask = new Parallel();
        parallelTask.setProject(project);
        parallelTask.setThreadCount(context.getThreadCount());
        parallelTask.setFailOnAny(!keepgoing);
        boolean success = false;
        final HashMap<String, NodeStepResult> resultMap = new HashMap<String, NodeStepResult>();
        final HashMap<String, NodeStepResult> failureMap = new HashMap<String, NodeStepResult>();
        final Collection<INodeEntry> nodes1 = nodes.getNodes();
        //reorder based on configured rank property and order
        final String rankProperty = null != context.getNodeRankAttribute() ? context.getNodeRankAttribute() : "nodename";
        final boolean rankAscending = context.isNodeRankOrderAscending();
        final INodeEntryComparator comparator = new INodeEntryComparator(rankProperty);
        final TreeSet<INodeEntry> orderedNodes = new TreeSet<INodeEntry>(
View Full Code Here

                return iNodeEntries;
            }
        }, test);

        Assert.assertNull(test.stored);
        INodeSet nodes = source.getNodes();
        Assert.assertTrue(test.storedCalled);
        Assert.assertFalse(test.loadCalled);
        Assert.assertEquals(iNodeEntries, nodes);
        Assert.assertEquals(iNodeEntries, test.stored);
    }
View Full Code Here

                return null;
            }
        }, test);
        test.cached = iNodeEntries;
        Assert.assertNull(test.stored);
        INodeSet nodes = source.getNodes();
        Assert.assertFalse(test.storedCalled);
        Assert.assertTrue(test.loadCalled);
        Assert.assertEquals(iNodeEntries, nodes);
        Assert.assertNull(test.stored);
    }
View Full Code Here

                throw new ResourceModelSourceException("test exception");
            }
        }, test);
        test.cached = iNodeEntries;
        Assert.assertNull(test.stored);
        INodeSet nodes = source.getNodes();
        Assert.assertFalse(test.storedCalled);
        Assert.assertTrue(test.loadCalled);
        Assert.assertEquals(iNodeEntries, nodes);
        Assert.assertNull(test.stored);
    }
View Full Code Here

                throw new RuntimeException("test exception");
            }
        }, test);
        test.cached = iNodeEntries;
        Assert.assertNull(test.stored);
        INodeSet nodes = source.getNodes();
        Assert.assertFalse(test.storedCalled);
        Assert.assertTrue(test.loadCalled);
        Assert.assertEquals(iNodeEntries, nodes);
        Assert.assertNull(test.stored);
    }
View Full Code Here

    @Test
    public void testSubexception() throws Exception{
        testSource testSource = new TestExceptionCatchingResourceModelSource.testSource();
        testSource.returnNodes = null;
        testSource.throwRTException = true;
        INodeSet nodes = new ExceptionCatchingResourceModelSource(testSource) {
            @Override
            INodeSet returnResultNodes(INodeSet nodes) throws ResourceModelSourceException {
                Assert.assertNull(nodes);
                throw new ResourceModelSourceException("test exception");
            }
View Full Code Here

    public void testSubexceptionValues() throws Exception{
        testSource testSource = new TestExceptionCatchingResourceModelSource.testSource();
        final NodeSetImpl iNodeEntries = new NodeSetImpl();
        testSource.returnNodes = iNodeEntries;
        testSource.throwRTException = false;
        INodeSet nodes = new ExceptionCatchingResourceModelSource(testSource) {
            @Override
            INodeSet returnResultNodes(INodeSet nodes) throws ResourceModelSourceException {
                Assert.assertEquals(iNodeEntries,nodes);
                throw new ResourceModelSourceException("test exception");
            }
View Full Code Here

    public void testSubRTexceptionValues() throws Exception{
        testSource testSource = new TestExceptionCatchingResourceModelSource.testSource();
        final NodeSetImpl iNodeEntries = new NodeSetImpl();
        testSource.returnNodes = iNodeEntries;
        testSource.throwRTException = false;
        INodeSet nodes = new ExceptionCatchingResourceModelSource(testSource) {
            @Override
            INodeSet returnResultNodes(INodeSet nodes) throws ResourceModelSourceException {
                Assert.assertEquals(iNodeEntries,nodes);
                throw new RuntimeException("test exception");
            }
View Full Code Here

        final ResourceModelSourceService service = ResourceModelSourceService.getInstanceForFramework(
            getFrameworkInstance());
        {
            final test1 factory = new test1();
            final sourceTest1 provider = new sourceTest1();
            final INodeSet nodesettest = new NodeSetImpl();
            provider.toReturn = nodesettest;
            factory.toReturn = provider;

            service.registerInstance("test", factory);

            //no properties
            final ResourceModelSource result = service.getSourceForConfiguration("test", null);
            assertNotNull(result);
            assertTrue(factory.called);
            assertNull(factory.createNodesProviderConfiguration);
            assertNotNull(result.getNodes());
            assertEquals(nodesettest, result.getNodes());
        }
        {
            final test1 factory = new test1();
            final sourceTest1 provider = new sourceTest1();
            final INodeSet nodesettest = new NodeSetImpl();
            provider.toReturn = nodesettest;
            factory.toReturn = provider;

            service.registerInstance("test", factory);
            final Properties properties = new Properties();

            //use properties
            final ResourceModelSource result = service.getSourceForConfiguration("test", properties);
            assertNotNull(result);
            assertTrue(factory.called);
            assertNotNull(factory.createNodesProviderConfiguration);
            assertEquals(properties, factory.createNodesProviderConfiguration);
            assertNotNull(result.getNodes());
            assertEquals(nodesettest, result.getNodes());
        }

        {
            final test1 factory = new test1();
            final sourceTest1 provider = new sourceTest1();
            final INodeSet nodesettest = new NodeSetImpl();

            provider.toReturn = nodesettest;
            factory.toReturn = provider;
            factory.toThrow = new ConfigurationException("test1");
View Full Code Here

TOP

Related Classes of com.dtolabs.rundeck.core.common.INodeSet

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.