Package com.dtolabs.rundeck.core.common

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


        Assert.assertEquals(iNodeEntries, nodes);
    }
    @Test
    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 {
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

        tags = configuration.getProperty("tags");
    }

    @Override
    public INodeSet getNodes() throws ResourceModelSourceException {
        NodeSetImpl iNodeEntries = new NodeSetImpl();
        for(int i=0;i<count;i++){
            NodeEntryImpl nodeEntry = new NodeEntryImpl();
            nodeEntry.setNodename((prefix != null ? prefix : "node") + "-" + i  + (suffix != null ? suffix : ""));
            nodeEntry.setHostname((prefix != null ? prefix : "") + "host" + (suffix != null ? suffix : ""));
            nodeEntry.setUsername((prefix != null ? prefix : "") + "user" + (suffix != null ? suffix : ""));
            nodeEntry.setAttribute("node-executor", "stub");
            nodeEntry.setAttribute("file-copier", "stub");
            if(null!=tags){
                nodeEntry.setTags(new HashSet(Arrays.asList(tags.split("\\s*,\\s*"))));
            }

            iNodeEntries.putNode(nodeEntry);
        }
        return iNodeEntries;
    }
View Full Code Here

    private List<Integer> stepContext;
    private StorageTree storageTree;

    private ExecutionContextImpl() {
        stepContext = new ArrayList<Integer>();
        nodes = new NodeSetImpl();
        nodeDataContext = new HashMap<String, Map<String, Map<String, String>>>();
    }
View Full Code Here

    public Set<String> getMIMETypes() {
        return MIME_TYPES;
    }

    public INodeSet parseDocument(final File file) throws ResourceFormatParserException {
        final NodeSetImpl nodeReceiver = new NodeSetImpl();
        try {
            new NodesXMLParser(file, nodeReceiver).parse();
        } catch (NodeFileParserException e) {
            throw new ResourceFormatParserException(e);
        }
View Full Code Here

        }
        return nodeReceiver;
    }

    public INodeSet parseDocument(final InputStream input) throws ResourceFormatParserException {
        final NodeSetImpl nodeReceiver = new NodeSetImpl();
        try {
            new NodesXMLParser(input, nodeReceiver).parse();
        } catch (NodeFileParserException e) {
            throw new ResourceFormatParserException(e);
        }
View Full Code Here

    public Set<String> getMIMETypes() {
        return MIME_TYPES;
    }

    public INodeSet parseDocument(final File file) throws ResourceFormatParserException {
        final NodeSetImpl nodes = new NodeSetImpl();
        try {
            new NodesYamlParser(file, nodes).parse();
        } catch (NodeFileParserException e) {
            throw new ResourceFormatParserException(e);
        }
View Full Code Here

        }
        return nodes;
    }

    public INodeSet parseDocument(final InputStream input) throws ResourceFormatParserException {
        final NodeSetImpl nodes = new NodeSetImpl();
        try {
            new NodesYamlParser(input, nodes).parse();
        } catch (NodeFileParserException e) {
            throw new ResourceFormatParserException(e);
        }
View Full Code Here

    }

    public void generateDocument(final INodeSet nodeset, final OutputStream stream) throws
        ResourceFormatGeneratorException {
        try {
            final NodeSetImpl nodeSet = new NodeSetImpl();
            nodeSet.putNodes(nodeset);

            final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(stream, "UTF-8");
            try {
                outputStreamWriter.write(test.toJson(nodesFromNodeSet(nodeset)));
            } finally {
View Full Code Here

        }
        return nodeSetFromNodes(nodes);
    }

    static NodeSetImpl nodeSetFromNodes(final Nodes nodes) {
        final NodeSetImpl nodeset = new NodeSetImpl();
        for (final Map.Entry<String, Node> entry : nodes.getNodes().entrySet()) {
            final String name = entry.getKey();
            final Node value = entry.getValue();
            final NodeEntryImpl nodeEntry = new NodeEntryImpl();
            if (null != value.getAttributes()) {
                nodeEntry.setAttributes(value.getAttributes());
            }
            if (null != value.getTags()) {
                nodeEntry.setTags(value.getTags());
            }
            nodeEntry.setNodename(name);
            nodeset.putNode(nodeEntry);
        }
        return nodeset;
    }
View Full Code Here

TOP

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

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.