Package com.dtolabs.rundeck.core.cli

Examples of com.dtolabs.rundeck.core.cli.SingleProjectResolver


            }
        }
        {
            //test missing project param
            final JobsTool tool = new JobsTool(getFrameworkInstance());
            tool.internalResolver=new SingleProjectResolver() {
                public boolean hasSingleProject() {
                    return false;
                }

                public String getSingleProjectName() {
                    return null;
                }
            };
            try {
                final String[] args = {"list", "-n", "test1"};
                final CommandLine line = tool.parseArgs(args);
                tool.validateOptions(line, args);
                fail("should have thrown missing argument exception.");
            } catch (CLIToolOptionsException e) {
                assertNotNull(e);
                assertTrue("wrong message:" + e.getMessage(), e.getMessage().startsWith(
                    "list action: -p/--project option is required"));
            }

        }
        {
            //test missing project param, defaulting to single project
            final JobsTool tool = new JobsTool(getFrameworkInstance());
            tool.internalResolver=new SingleProjectResolver() {
                public boolean hasSingleProject() {
                    return true;
                }

                public String getSingleProjectName() {
View Full Code Here


            }
        }
        {
            //-j option but no -p option
            final RunTool tool = new RunTool(getFrameworkInstance());
            tool.internalResolver=new SingleProjectResolver() {

                public boolean hasSingleProject() {
                    return false;
                }

                public String getSingleProjectName() {
                    return null;
                }
            };
            try {
                final String[] args = {"run","-j","testjob"};
                final CommandLine line = tool.parseArgs(args);
                tool.validateOptions(line, args);
                fail("should have thrown options exception.");
            } catch (CLIToolOptionsException e) {
                assertNotNull(e);
                assertTrue("wrong message: " + e.getMessage(), e.getMessage().endsWith(
                    "-j/--job option requires -p/--project option"));
            }
        }
        {
            //-j option but no -p option, defaulted project name
            final RunTool tool = new RunTool(getFrameworkInstance());
            tool.internalResolver= new SingleProjectResolver() {

                public boolean hasSingleProject() {
                    return true;
                }
View Full Code Here

        }
        {
            //test -p is required for multiple projects
            final QueueTool tool = new QueueTool(getFrameworkInstance());
            tool.internalResolver = new SingleProjectResolver() {
                public boolean hasSingleProject() {
                    return false;
                }

                public String getSingleProjectName() {
                    return null;
                }
            };
            try {
                final String[] args = {"list"};
                final CommandLine commandLine = tool.parseArgs(args);
                tool.validateOptions(commandLine, args);
                fail("Should have thrown exception");
            } catch (CLIToolOptionsException e) {
                assertNotNull(e);
                assertTrue(e.getMessage().endsWith("-p argument is required with list action"));
            }
        }
        {
            //test -p is not required for a single project
            final QueueTool tool = new QueueTool(getFrameworkInstance());
            tool.internalResolver = new SingleProjectResolver() {
                public boolean hasSingleProject() {
                    return true;
                }

                public String getSingleProjectName() {
View Full Code Here

TOP

Related Classes of com.dtolabs.rundeck.core.cli.SingleProjectResolver

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.