Package org.apache.qpid.junit.extensions.util

Examples of org.apache.qpid.junit.extensions.util.CommandLineParser$CommandLineOption


    public static void main(String[] args)
    {
        try
        {
            Properties options =
                CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}), System.getProperties());

            // Create a ping producer overriding its defaults with all options passed on the command line.
            PingPongProducer pingProducer = new PingPongProducer(options);
            pingProducer.establishConnection(true, true);
View Full Code Here


     * @param args The command line arguments.
     */
    public static void main(String[] args)
    {
        // Use the command line parser to evaluate the command line.
        CommandLineParser commandLine =
            new CommandLineParser(
                new String[][]
                {
                    { "w", "The number of milliseconds between invocations of test cases.", "ms", "false" },
                    { "c", "The number of tests to run concurrently.", "num", "false", MathUtils.SEQUENCE_REGEXP },
                    { "r", "The number of times to repeat each test.", "num", "false" },
                    { "d", "The length of time to run the tests for.", "duration", "false", MathUtils.DURATION_REGEXP },
                    { "f", "The maximum rate to call the tests at.", "frequency", "false", "^([1-9][0-9]*)/([1-9][0-9]*)$" },
                    { "s", "The size parameter to run tests with.", "size", "false", MathUtils.SEQUENCE_REGEXP },
                    { "t", "The name of the test case to execute.", "name", "false" },
                    { "o", "The name of the directory to output test timings to.", "dir", "false" },
                    { "n", "A name for this test run, used to name the output file.", "name", "true" },
                    {
                        "X:decorators", "A list of additional test decorators to wrap the tests in.",
                        "\"class.name[:class.name]*\"", "false"
                    },
                    { "1", "Test class.", "class", "true" },
                    { "-csv", "Output test results in CSV format.", null, "false" },
                    { "-xml", "Output test results in XML format.", null, "false" }
                });

        // Capture the command line arguments or display errors and correct usage and then exit.
        ParsedProperties options = null;

        try
        {
            options = new ParsedProperties(commandLine.parseCommandLine(args));
        }
        catch (IllegalArgumentException e)
        {
            System.out.println(commandLine.getErrors());
            System.out.println(commandLine.getUsage());
            System.exit(FAILURE_EXIT);
        }

        // Extract the command line options.
        Integer delay = options.getPropertyAsInteger("w");
        String threadsString = options.getProperty("c");
        Integer repetitions = options.getPropertyAsInteger("r");
        String durationString = options.getProperty("d");
        String paramsString = options.getProperty("s");
        String testCaseName = options.getProperty("t");
        String reportDir = options.getProperty("o");
        String testRunName = options.getProperty("n");
        String decorators = options.getProperty("X:decorators");
        String testClassName = options.getProperty("1");
        boolean csvResults = options.getPropertyAsBoolean("-csv");
        boolean xmlResults = options.getPropertyAsBoolean("-xml");

        int[] threads = (threadsString == null) ? null : MathUtils.parseSequence(threadsString);
        int[] params = (paramsString == null) ? null : MathUtils.parseSequence(paramsString);
        Long duration = (durationString == null) ? null : MathUtils.parseDuration(durationString);

        // The test run name defaults to the test class name unless a value was specified for it.
        testRunName = (testRunName == null) ? testClassName : testRunName;

        // Add all the command line options and trailing settings to test context properties. Tests may pick up
        // overridden values from there, and these values will be logged in the test results, for analysis and
        // to make tests repeatable.
        commandLine.addTrailingPairsToProperties(TestContextProperties.getInstance());
        commandLine.addOptionsToProperties(TestContextProperties.getInstance());

        // Create and start the test runner.
        try
        {
            // Create a list of test decorator factories for use specified decorators to be applied.
View Full Code Here

    public static void main(String[] args)
    {
        try
        {
            Properties options =
                CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}), System.getProperties());

            // Create a ping producer overriding its defaults with all options passed on the command line.
            PingPongProducer pingProducer = new PingPongProducer(options);
            pingProducer.establishConnection(true, true);
View Full Code Here

            // and usage then exist if there are errors).
            // Any options and trailing name=value pairs are also injected into the test context properties object,
            // to override any defaults that may have been set up.
            ParsedProperties options =
                new ParsedProperties(CommandLineParser.processCommandLine(args,
                        new CommandLineParser(
                            new String[][]
                            {
                                { "b", "The broker URL.", "broker", "false" },
                                { "h", "The virtual host to use.", "virtual host", "false" },
                                { "o", "The name of the directory to output test timings to.", "dir", "false" },
View Full Code Here

     */
    public static void main(String[] args)
    {
        ParsedProperties options =
            new ParsedProperties(CommandLineParser.processCommandLine(args,
                    new CommandLineParser(
                        new String[][]
                        {
                            { "1", "Address of clock reference service.", "address", "true" }
                        }), System.getProperties()));

View Full Code Here

    public static void main(String[] args)
    {
        try
        {
            Properties options =
                CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}), System.getProperties());

            // Create a ping producer overriding its defaults with all options passed on the command line.
            PingPongProducer pingProducer = new PingPongProducer(options);
            pingProducer.establishConnection(true, true);
View Full Code Here

            // and usage then exist if there are errors).
            // Any options and trailing name=value pairs are also injected into the test context properties object,
            // to override any defaults that may have been set up.
            ParsedProperties options =
                new ParsedProperties(CommandLineParser.processCommandLine(args,
                        new CommandLineParser(
                            new String[][]
                            {
                                { "b", "The broker URL.", "broker", "false" },
                                { "h", "The virtual host to use.", "virtual host", "false" },
                                { "o", "The name of the directory to output test timings to.", "dir", "false" },
View Full Code Here

     */
    public static void main(String[] args)
    {
        ParsedProperties options =
            new ParsedProperties(CommandLineParser.processCommandLine(args,
                    new CommandLineParser(
                        new String[][]
                        {
                            { "1", "Address of clock reference service.", "address", "true" }
                        }), System.getProperties()));

View Full Code Here

    public static void main(String[] args)
    {
        try
        {
            Properties options =
                CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}), System.getProperties());

            // Create a ping producer overriding its defaults with all options passed on the command line.
            PingPongProducer pingProducer = new PingPongProducer(options);
            pingProducer.establishConnection(true, true);
View Full Code Here

            // and usage then exist if there are errors).
            // Any options and trailing name=value pairs are also injected into the test context properties object,
            // to override any defaults that may have been set up.
            ParsedProperties options =
                new ParsedProperties(CommandLineParser.processCommandLine(args,
                        new CommandLineParser(
                            new String[][]
                            {
                                { "b", "The broker URL.", "broker", "false" },
                                { "h", "The virtual host to use.", "virtual host", "false" },
                                { "o", "The name of the directory to output test timings to.", "dir", "false" },
View Full Code Here

TOP

Related Classes of org.apache.qpid.junit.extensions.util.CommandLineParser$CommandLineOption

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.