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

Examples of org.apache.qpid.junit.extensions.util.ParsedProperties


    {
        // Run the test setup tasks. This may create an in-vm broker, if a decorator has injected a task for this.
        getTaskHandler().runSetupTasks();

        // Get the test parameters, any overrides on the command line will have been applied.
        ParsedProperties testProps = TestContextProperties.getInstance(MessagingTestConfigProperties.defaults);

        // Customize the test parameters.
        testProps.setProperty("TEST_NAME", "DEFAULT_CIRCUIT_TEST");
        testProps.setProperty(MessagingTestConfigProperties.SEND_DESTINATION_NAME_ROOT_PROPNAME, "testqueue");

        // Get the test circuit factory to create test circuits and run the standard test procedure through.
        CircuitFactory circuitFactory = getCircuitFactory();

        // Create the test circuit. This projects the circuit onto the available test nodes and connects it up.
View Full Code Here


    {
        super(overrides);
        log.debug("public PingDurableClient(Properties overrides = " + overrides + "): called");

        // Extract the additional configuration parameters.
        ParsedProperties properties = new ParsedProperties(defaults);
        properties.putAll(overrides);

        numMessages = properties.getPropertyAsInteger(NUM_MESSAGES_PROPNAME);
        String durationSpec = properties.getProperty(DURATION_PROPNAME);
        numMessagesToAction = properties.getPropertyAsInteger(NUM_MESSAGES_TO_ACTION_PROPNAME);

        if (durationSpec != null)
        {
            duration = MathUtils.parseDuration(durationSpec) * 1000000;
        }
View Full Code Here

    {
        // log.debug("public PingPongProducer(Properties overrides = " + overrides + "): called");
        instanceId = _instanceIdGenerator.getAndIncrement();

        // Create a set of parsed properties from the defaults overriden by the passed in values.
        ParsedProperties properties = new ParsedProperties(defaults);
        properties.putAll(overrides);

        // Extract the configuration properties to set the pinger up with.
        _overrideClientId = properties.getPropertyAsBoolean(OVERRIDE_CLIENT_ID_PROPNAME);
        _factoryName = properties.getProperty(FACTORY_NAME_PROPNAME);
        _fileProperties = properties.getProperty(FILE_PROPERTIES_PROPNAME);
        _brokerDetails = properties.getProperty(BROKER_PROPNAME);
        _username = properties.getProperty(USERNAME_PROPNAME);
        _password = properties.getProperty(PASSWORD_PROPNAME);
        _virtualpath = properties.getProperty(VIRTUAL_HOST_PROPNAME);
        _destinationName = properties.getProperty(PING_QUEUE_NAME_PROPNAME);
        _queueNamePostfix = properties.getProperty(QUEUE_NAME_POSTFIX_PROPNAME);
        _selector = properties.getProperty(SELECTOR_PROPNAME);
        _transacted = properties.getPropertyAsBoolean(TRANSACTED_PROPNAME);
        _consTransacted = properties.getPropertyAsBoolean(CONSUMER_TRANSACTED_PROPNAME);
        _persistent = properties.getPropertyAsBoolean(PERSISTENT_MODE_PROPNAME);
        _messageSize = properties.getPropertyAsInteger(MESSAGE_SIZE_PROPNAME);
        _verbose = properties.getPropertyAsBoolean(VERBOSE_PROPNAME);
        _failAfterCommit = properties.getPropertyAsBoolean(FAIL_AFTER_COMMIT_PROPNAME);
        _failBeforeCommit = properties.getPropertyAsBoolean(FAIL_BEFORE_COMMIT_PROPNAME);
        _failAfterSend = properties.getPropertyAsBoolean(FAIL_AFTER_SEND_PROPNAME);
        _failBeforeSend = properties.getPropertyAsBoolean(FAIL_BEFORE_SEND_PROPNAME);
        _failOnce = properties.getPropertyAsBoolean(FAIL_ONCE_PROPNAME);
        _txBatchSize = properties.getPropertyAsInteger(TX_BATCH_SIZE_PROPNAME);
        _noOfDestinations = properties.getPropertyAsInteger(DESTINATION_COUNT_PROPNAME);
        _noOfConsumers = properties.getPropertyAsInteger(NUM_CONSUMERS_PROPNAME);
        _rate = properties.getPropertyAsInteger(RATE_PROPNAME);
        _isPubSub = properties.getPropertyAsBoolean(PUBSUB_PROPNAME);
        _isUnique = properties.getPropertyAsBoolean(UNIQUE_DESTS_PROPNAME);
        _isDurable = properties.getPropertyAsBoolean(DURABLE_DESTS_PROPNAME);
        _ackMode = _transacted ? 0 : properties.getPropertyAsInteger(ACK_MODE_PROPNAME);
        _consAckMode = _consTransacted ? 0 : properties.getPropertyAsInteger(CONSUMER_ACK_MODE_PROPNAME);
        _maxPendingSize = properties.getPropertyAsInteger(MAX_PENDING_PROPNAME);
        _preFill = properties.getPropertyAsInteger(PREFILL_PROPNAME);
        _delayBeforeConsume = properties.getPropertyAsLong(DELAY_BEFORE_CONSUME_PROPNAME);
        _consumeOnly = properties.getPropertyAsBoolean(CONSUME_ONLY_PROPNAME);
        _sendOnly = properties.getPropertyAsBoolean(SEND_ONLY_PROPNAME);

        // Check that one or more destinations were specified.
        if (_noOfDestinations < 1)
        {
            throw new IllegalArgumentException("There must be at least one destination.");
View Full Code Here

                    { "-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);
View Full Code Here

    {
        // log.debug("public PingPongProducer(Properties overrides = " + overrides + "): called");
        instanceId = _instanceIdGenerator.getAndIncrement();

        // Create a set of parsed properties from the defaults overriden by the passed in values.
        ParsedProperties properties = new ParsedProperties(defaults);
        properties.putAll(overrides);

        // Extract the configuration properties to set the pinger up with.
        _overrideClientId = properties.getPropertyAsBoolean(OVERRIDE_CLIENT_ID_PROPNAME);
        _factoryName = properties.getProperty(FACTORY_NAME_PROPNAME);
        _fileProperties = properties.getProperty(FILE_PROPERTIES_PROPNAME);
        _brokerDetails = properties.getProperty(BROKER_PROPNAME);
        _username = properties.getProperty(USERNAME_PROPNAME);
        _password = properties.getProperty(PASSWORD_PROPNAME);
        _virtualpath = properties.getProperty(VIRTUAL_HOST_PROPNAME);
        _destinationName = properties.getProperty(PING_QUEUE_NAME_PROPNAME);
        _queueNamePostfix = properties.getProperty(QUEUE_NAME_POSTFIX_PROPNAME);
        _selector = properties.getProperty(SELECTOR_PROPNAME);
        _transacted = properties.getPropertyAsBoolean(TRANSACTED_PROPNAME);
        _consTransacted = properties.getPropertyAsBoolean(CONSUMER_TRANSACTED_PROPNAME);
        _persistent = properties.getPropertyAsBoolean(PERSISTENT_MODE_PROPNAME);
        _messageSize = properties.getPropertyAsInteger(MESSAGE_SIZE_PROPNAME);
        _verbose = properties.getPropertyAsBoolean(VERBOSE_PROPNAME);
        _failAfterCommit = properties.getPropertyAsBoolean(FAIL_AFTER_COMMIT_PROPNAME);
        _failBeforeCommit = properties.getPropertyAsBoolean(FAIL_BEFORE_COMMIT_PROPNAME);
        _failAfterSend = properties.getPropertyAsBoolean(FAIL_AFTER_SEND_PROPNAME);
        _failBeforeSend = properties.getPropertyAsBoolean(FAIL_BEFORE_SEND_PROPNAME);
        _failOnce = properties.getPropertyAsBoolean(FAIL_ONCE_PROPNAME);
        _txBatchSize = properties.getPropertyAsInteger(TX_BATCH_SIZE_PROPNAME);
        _noOfDestinations = properties.getPropertyAsInteger(DESTINATION_COUNT_PROPNAME);
        _noOfConsumers = properties.getPropertyAsInteger(NUM_CONSUMERS_PROPNAME);
        _rate = properties.getPropertyAsInteger(RATE_PROPNAME);
        _isPubSub = properties.getPropertyAsBoolean(PUBSUB_PROPNAME);
        _isUnique = properties.getPropertyAsBoolean(UNIQUE_DESTS_PROPNAME);
        _isDurable = properties.getPropertyAsBoolean(DURABLE_DESTS_PROPNAME);
        _ackMode = _transacted ? 0 : properties.getPropertyAsInteger(ACK_MODE_PROPNAME);
        _consAckMode = _consTransacted ? 0 : properties.getPropertyAsInteger(CONSUMER_ACK_MODE_PROPNAME);
        _maxPendingSize = properties.getPropertyAsInteger(MAX_PENDING_PROPNAME);

        // Check that one or more destinations were specified.
        if (_noOfDestinations < 1)
        {
            throw new IllegalArgumentException("There must be at least one destination.");
View Full Code Here

    {
        // Run the test setup tasks. This may create an in-vm broker, if a decorator has injected a task for this.
        taskHandler.runSetupTasks();

        // Get the test parameters, any overrides on the command line will have been applied.
        ParsedProperties testProps = TestContextProperties.getInstance(MessagingTestConfigProperties.defaults);

        // Customize the test parameters.
        testProps.setProperty("TEST_NAME", "DEFAULT_CIRCUIT_TEST");
        testProps.setProperty(MessagingTestConfigProperties.SEND_DESTINATION_NAME_ROOT_PROPNAME, "testqueue");

        // Get the test circuit factory to create test circuits and run the standard test procedure through.
        CircuitFactory circuitFactory = getCircuitFactory();

        // Create the test circuit. This projects the circuit onto the available test nodes and connects it up.
View Full Code Here

        // Use the command line parser to evaluate the command line with standard handling behaviour (print errors
        // 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(org.apache.qpid.junit.extensions.util.CommandLineParser.processCommandLine(args,
                    new org.apache.qpid.junit.extensions.util.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" },
                            { "n", "The name of the test client.", "name", "false" },
                            { "j", "Join this test client to running test.", "false" }
                        }), testContextProperties));

        // Extract the command line options.
        String brokerUrl = options.getProperty("b");
        String virtualHost = options.getProperty("h");
        String clientName = options.getProperty("n");
        clientName = (clientName == null) ? CLIENT_NAME : clientName;
        boolean join = options.getPropertyAsBoolean("j");

        // To distinguish logging output set up an NDC on the client name.
        NDC.push(clientName);

        // Create a test client and start it running.
View Full Code Here

        {
            // Use the command line parser to evaluate the command line with standard handling behaviour (print errors
            // 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" },
                                {
                                    "e", "The test execution engine to use. Default is interop.", "engine", "interop",
                                    "^interop$|^fanout$", "true"
                                },
                                { "t", "Terminate test clients on completion of tests.", null, "false" },
                                { "-csv", "Output test results in CSV format.", null, "false" },
                                { "-xml", "Output test results in XML format.", null, "false" },
                                {
                                    "-trefaddr", "To specify an alternative to hostname for time singal reference.",
                                    "address", "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 },
                                { "v", "Verbose mode.", null, "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"
                                }
                            }), testContextProperties));

            // Extract the command line options.
            String brokerUrl = options.getProperty("b");
            String virtualHost = options.getProperty("h");
            String reportDir = options.getProperty("o");
            reportDir = (reportDir == null) ? "." : reportDir;
            String testEngine = options.getProperty("e");
            TestEngine engine = "fanout".equals(testEngine) ? TestEngine.FANOUT : TestEngine.INTEROP;
            boolean terminate = options.getPropertyAsBoolean("t");
            boolean csvResults = options.getPropertyAsBoolean("-csv");
            boolean xmlResults = options.getPropertyAsBoolean("-xml");
            String threadsString = options.getProperty("c");
            Integer repetitions = options.getPropertyAsInteger("r");
            String durationString = options.getProperty("d");
            String paramsString = options.getProperty("s");
            boolean verbose = options.getPropertyAsBoolean("v");
            String testRunName = options.getProperty("n");
            String decorators = options.getProperty("X:decorators");

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

            // If broker or virtual host settings were specified as command line options, override the defaults in the
            // test context properties with them.

            // Collection all of the test cases to be run.
            Collection<Class<? extends FrameworkBaseCase>> testCaseClasses =
                new ArrayList<Class<? extends FrameworkBaseCase>>();

            // Create a list of test decorator factories for use specified decorators to be applied.
            List<TestDecoratorFactory> decoratorFactories = parseDecorators(decorators);

            // Scan for available test cases using a classpath scanner.
            // ClasspathScanner.getMatches(DistributedTestCase.class, "^Test.*", true);

            // Hard code the test classes till the classpath scanner is fixed.
            // Collections.addAll(testCaseClasses, InteropTestCase1DummyRun.class, InteropTestCase2BasicP2P.class,
            // InteropTestCase3BasicPubSub.class);

            // Parse all of the free arguments as test cases to run.
            for (int i = 1; true; i++)
            {
                String nextFreeArg = options.getProperty(Integer.toString(i));

                // Terminate the loop once all free arguments have been consumed.
                if (nextFreeArg == null)
                {
                    break;
View Full Code Here

     *
     * @param args Address of reference clock as arg 1.
     */
    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()));

        String address = options.getProperty("1");

        // Create a clock synchronizer.
        UDPClockSynchronizer clockSyncher = new UDPClockSynchronizer(address);

        // Set up a shutdown hook for it.
View Full Code Here

        // Use the command line parser to evaluate the command line with standard handling behaviour (print errors
        // 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(org.apache.qpid.junit.extensions.util.CommandLineParser.processCommandLine(args,
                    new org.apache.qpid.junit.extensions.util.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" },
                            { "n", "The name of the test client.", "name", "false" },
                            { "j", "Join this test client to running test.", "false" }
                        }), testContextProperties));

        // Extract the command line options.
        String brokerUrl = options.getProperty("b");
        String virtualHost = options.getProperty("h");
        String clientName = options.getProperty("n");
        clientName = (clientName == null) ? CLIENT_NAME : clientName;
        boolean join = options.getPropertyAsBoolean("j");

        // To distinguish logging output set up an NDC on the client name.
        NDC.push(clientName);

        // Create a test client and start it running.
View Full Code Here

TOP

Related Classes of org.apache.qpid.junit.extensions.util.ParsedProperties

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.