Package com.dtolabs.rundeck.core.common

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


        super(name);
    }

    public void setUp() {
        super.setUp();
        final Framework frameworkInstance = getFrameworkInstance();
        final FrameworkProject frameworkProject = frameworkInstance.getFrameworkProjectMgr().createFrameworkProject(
            PROJ_NAME);
        File resourcesfile = new File(frameworkProject.getNodesResourceFilePath());
        //copy test nodes to resources file
        try {
            FileUtils.copyFileStreams(new File("src/test/resources/com/dtolabs/rundeck/core/common/test-nodes1.xml"),
View Full Code Here


        }
    }

    public void testQueueOption() throws Exception {
        //test action calls
        final Framework framework = getFrameworkInstance();

        {
            ExecTool main = newExecTool();
            main.setFramework(framework);
            final testCentralDispatcher test = new testCentralDispatcher();
            framework.setCentralDispatcherMgr(test);

            //exec the dispatch

            main.run(new String[]{"-p", "testProject", "-Q", "--", "shell", "command", "string"});
            test.assertQueueScriptOnlyCalled();
            assertNotNull("args should not be null", test.passedinScript.getArgs());
            assertEquals("wrong args size",3, test.passedinScript.getArgs().length);
            assertEquals("wrong args entry","shell", test.passedinScript.getArgs()[0]);
            assertEquals("wrong args entry","command", test.passedinScript.getArgs()[1]);
            assertEquals("wrong args entry","string", test.passedinScript.getArgs()[2]);
            assertNull(test.passedinScript.getScript());
            assertNull(test.passedinScript.getServerScriptFilePath());
            assertNull(test.passedinScript.getScriptAsStream());
            assertEquals("testProject", test.passedinScript.getFrameworkProject());
        }
        {
            ExecTool main = newExecTool();
            main.setFramework(framework);
            final testCentralDispatcher test = new testCentralDispatcher();
            framework.setCentralDispatcherMgr(test);

            //exec the dispatch

            main.run(new String[]{"-p", "testProject", "-Q", "--", "shell", "space string"});
            test.assertQueueScriptOnlyCalled();
            assertNotNull("args should not be null", test.passedinScript.getArgs());
            assertEquals("wrong args size", 2, test.passedinScript.getArgs().length);
            assertEquals("wrong args entry", "shell", test.passedinScript.getArgs()[0]);
            assertEquals("wrong args entry", "space string", test.passedinScript.getArgs()[1]);
            assertNull(test.passedinScript.getScript());
            assertNull(test.passedinScript.getServerScriptFilePath());
            assertNull(test.passedinScript.getScriptAsStream());
            assertEquals("testProject", test.passedinScript.getFrameworkProject());
        }
        {
            //test script path input available as InputStream when queueing dispatch

            ExecTool main = newExecTool();
            main.setFramework(framework);
            final testCentralDispatcher test = new testCentralDispatcher();
            framework.setCentralDispatcherMgr(test);

            //exec the dispatch

            main.run(new String[]{"-p", "testProject", "-Q", "-s",
                "src/test/resources/com/dtolabs/rundeck/core/cli/test-dispatch-script.txt"});
            test.assertQueueScriptOnlyCalled();
            assertNull("unexpected value: ", test.passedinScript.getArgs());
            assertNull("unexpected value: "+ test.passedinScript.getScript(), test.passedinScript.getScript());
            assertEquals("unexpected value: " + test.passedinScript.getServerScriptFilePath(),
                new File("src/test/resources/com/dtolabs/rundeck/core/cli/test-dispatch-script.txt").getAbsolutePath(), test.passedinScript.getServerScriptFilePath());
            assertNull(test.passedinScript.getScriptAsStream());
            assertEquals("testProject", test.passedinScript.getFrameworkProject());
        }

        {
            //test the node filter arguments

            ExecTool main = newExecTool();
            main.setFramework(framework);
            final testCentralDispatcher test = new testCentralDispatcher();
            framework.setCentralDispatcherMgr(test);

            //exec the dispatch

            main.run(
                new String[]{"-p", "testProject", "-K", "-C", "2", "-I", "hostname1", "-X", "tags=baloney", "-Q", "--",
View Full Code Here

    FrameworkProject frameworkProject;

    public void setUp() {
        super.setUp();
        final Framework frameworkInstance = getFrameworkInstance();
        frameworkProject = frameworkInstance.getFrameworkProjectMgr().createFrameworkProject(
            PROJ_NAME);
        File resourcesfile = new File(frameworkProject.getNodesResourceFilePath());
        //copy test nodes to resources file
        try {
            FileUtils.copyFileStreams(new File("src/test/resources/com/dtolabs/rundeck/core/common/test-nodes1.xml"),
View Full Code Here

        super(name);
    }

    public void setUp() {
        super.setUp();
        final Framework frameworkInstance = getFrameworkInstance();
        final FrameworkProject frameworkProject = frameworkInstance.getFrameworkProjectMgr().createFrameworkProject(
            PROJ_NAME);
        File resourcesfile = new File(frameworkProject.getNodesResourceFilePath());
        //copy test nodes to resources file
        try {
            FileUtils.copyFileStreams(new File("src/test/resources/com/dtolabs/rundeck/core/common/test-nodes1.xml"),
View Full Code Here

            final String script,
            final INodeEntry node,
            final File destination
    ) throws FileCopierException
    {
        final Framework framework = context.getFramework();

        //create new dataContext with the node data, and write the script (file,
        // content or strea) to a temp file
        //using the dataContext for substitution.
        final Map<String, Map<String, String>> origContext = context.getDataContext();
View Full Code Here

    }

    FrameworkProject frameworkProject;
    public void setUp() {

        final Framework frameworkInstance = getFrameworkInstance();
        frameworkProject = frameworkInstance.getFrameworkProjectMgr().createFrameworkProject(
            PROJ_NAME);
        File resourcesfile = new File(frameworkProject.getNodesResourceFilePath());
        //copy test nodes to resources file
        try {
            FileUtils.copyFileStreams(new File("src/test/resources/com/dtolabs/rundeck/core/common/test-nodes1.xml"),
View Full Code Here

        super(name);
    }

    public void setUp() {
        super.setUp();
        final Framework frameworkInstance = getFrameworkInstance();
        final FrameworkProject frameworkProject = frameworkInstance.getFrameworkProjectMgr().createFrameworkProject(
            PROJ_NAME);
        resourcesfile = new File(frameworkProject.getNodesResourceFilePath());
        //copy test nodes to resources file
        try {
            FileUtils.copyFileStreams(new File("src/test/resources/com/dtolabs/rundeck/core/common/test-nodes1.xml"), resourcesfile);
View Full Code Here

        FileUtils.deleteDir(projectdir);

    }

    public void testGetNodeDispatcher() throws Exception {
        final Framework frameworkInstance = getFrameworkInstance();
        final NodeDispatcherService service = NodeDispatcherService.getInstanceForFramework(
            frameworkInstance);
        {
            final NodeSet nodeSet = new NodeSet();
            nodeSet.createInclude().setName(".*");
            nodeSet.setThreadCount(2);
            //get node dispatcher for a context.  nodeset>1 and threadcount>1 returns parallel provider
            final ExecutionContext context = ExecutionContextImpl.builder()
                .frameworkProject(PROJ_NAME)
                .framework(frameworkInstance)
                .user("blah")
                .nodeSelector(nodeSet)
                .nodes(frameworkInstance.filterNodeSet(nodeSet,PROJ_NAME,null))
                .threadCount(nodeSet.getThreadCount())
                .keepgoing(nodeSet.isKeepgoing())
                .build();


            final NodeDispatcher nodeDispatcher = service.getNodeDispatcher(context);
            assertNotNull(nodeDispatcher);
            assertTrue(nodeDispatcher instanceof ParallelNodeDispatcher);

        }

        {   //get node dispatcher for a context.  nodeset>1 and threadcount<2 returns sequential provider

            final NodeSet nodeSet = new NodeSet();
            nodeSet.createInclude().setName(".*");
            nodeSet.setThreadCount(1);
            final ExecutionContext context = ExecutionContextImpl.builder()
                .frameworkProject(PROJ_NAME)
                .framework(frameworkInstance)
                .user("blah")
                .nodeSelector(nodeSet)
                .threadCount(nodeSet.getThreadCount())
                .keepgoing(nodeSet.isKeepgoing())
                .build();


            final NodeDispatcher nodeDispatcher = service.getNodeDispatcher(context);
            assertNotNull(nodeDispatcher);
            assertTrue(nodeDispatcher instanceof SequentialNodeDispatcher);

        }

        {   //get node dispatcher for a context.  nodeset<2 and threadcount<2 returns sequential provider

            final NodeSet nodeSet = new NodeSet();
            nodeSet.setSingleNodeName("test1");
            nodeSet.setThreadCount(1);
            final ExecutionContext context = ExecutionContextImpl.builder()
                .frameworkProject(PROJ_NAME)
                .framework(frameworkInstance)
                .user("blah")
                .nodeSelector(nodeSet)
                .threadCount(nodeSet.getThreadCount())
                .keepgoing(nodeSet.isKeepgoing())
                .build();


            final NodeDispatcher nodeDispatcher = service.getNodeDispatcher(context);
            assertNotNull(nodeDispatcher);
            assertTrue(nodeDispatcher instanceof SequentialNodeDispatcher);

        }

        {   //get node dispatcher for a context.  nodeset<2 and threadcount>1 returns sequential provider

            final NodeSet nodeSet = new NodeSet();
            nodeSet.setSingleNodeName("test1");
            nodeSet.setThreadCount(2);
            final ExecutionContext context = ExecutionContextImpl.builder()
                .frameworkProject(PROJ_NAME)
                .framework(frameworkInstance)
                .user("blah")
                .nodeSelector(nodeSet)
                .nodes(frameworkInstance.filterNodeSet(nodeSet,PROJ_NAME,null))
                .threadCount(nodeSet.getThreadCount())
                .keepgoing(nodeSet.isKeepgoing())
                .build();


View Full Code Here

    /**
     * Test specifying an external nodes file
     */
    public void testExtResources() throws Exception {
        final Framework frameworkInstance = getFrameworkInstance();
        final NodeDispatcherService service = NodeDispatcherService.getInstanceForFramework(
            frameworkInstance);
        {   //use test-1 file
            final NodeSet nodeSet = new NodeSet();
            nodeSet.createInclude().setTags("priority1"); //matches single nodes in test1 file
            nodeSet.setThreadCount(2);
            //get node dispatcher for a context.  nodeset<2 and threadcount>1 returns sequential provider
            final ExecutionContext context = ExecutionContextImpl.builder()
                .frameworkProject(PROJ_NAME)
                .framework(frameworkInstance)
                .user("blah")
                .nodeSelector(nodeSet)
                .threadCount(nodeSet.getThreadCount())
                .keepgoing(nodeSet.isKeepgoing())
                .nodesFile(resourcesfile)
                .nodes(frameworkInstance.filterNodeSet(nodeSet, PROJ_NAME, resourcesfile))
                .build();


            final NodeDispatcher nodeDispatcher = service.getNodeDispatcher(context);
            assertNotNull(nodeDispatcher);
            assertTrue(nodeDispatcher instanceof SequentialNodeDispatcher);
        }
        {
            final NodeSet nodeSet = new NodeSet();
            nodeSet.createInclude().setTags("priority1"); //matches two nodes in external file
            nodeSet.setThreadCount(2);
            //get node dispatcher for a context.  nodeset>1 and threadcount>1 returns parallel provider
            final ExecutionContext context = ExecutionContextImpl.builder()
                .frameworkProject(PROJ_NAME)
                .framework(frameworkInstance)
                .user("blah")
                .nodeSelector(nodeSet)
                .threadCount(nodeSet.getThreadCount())
                .keepgoing(nodeSet.isKeepgoing())
                .nodesFile(extResourcesfile)
                .nodes(frameworkInstance.filterNodeSet(nodeSet, PROJ_NAME, extResourcesfile))
                .build();
            assertEquals(2,context.getNodes().getNodeNames().size());

            final NodeDispatcher nodeDispatcher = service.getNodeDispatcher(context);
            assertNotNull(nodeDispatcher);
View Full Code Here

        super(name);
    }

    public void setUp() {
        super.setUp();
        final Framework frameworkInstance = getFrameworkInstance();
        final FrameworkProject frameworkProject = frameworkInstance.getFrameworkProjectMgr().createFrameworkProject(
            PROJ_NAME);
        File resourcesfile = new File(frameworkProject.getNodesResourceFilePath());
        //copy test nodes to resources file
        try {
            FileUtils.copyFileStreams(new File("src/test/resources/com/dtolabs/rundeck/core/common/test-nodes1.xml"),
View Full Code Here

TOP

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

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.