Package org.apache.qpid.disttest.controller.config

Examples of org.apache.qpid.disttest.controller.config.Config


    private void runTests(ControllerJmsDelegate jmsDelegate, Context context)
    {
        Controller controller = new Controller(jmsDelegate, DistributedTestConstants.REGISTRATION_TIMEOUT, DistributedTestConstants.COMMAND_RESPONSE_TIMEOUT);

        String testConfigPath = getCliOptions().get(TEST_CONFIG_PROP);
        Config testConfig = buildTestConfigFrom(testConfigPath);
        createClients(testConfig, context);
        controller.setConfig(testConfig);
        try
        {
            List<ResultsForAllTests> results = new ArrayList<ResultsForAllTests>();
View Full Code Here


    }

    private Config buildTestConfigFrom(String testConfigFile)
    {
        ConfigReader configReader = new ConfigReader();
        Config testConfig;
        InputStream configStream = null;
        try
        {
            configStream = getClass().getResourceAsStream(testConfigFile);
            if (configStream != null)
            {
                testConfig = configReader.readConfig(new InputStreamReader(configStream), testConfigFile.endsWith(".js"));
            }
            else
            {
                ConfigFileHelper configFileHelper = new ConfigFileHelper();
                List<String> files = configFileHelper.getTestConfigFiles(testConfigFile);
                List<TestConfig> tests = new ArrayList<TestConfig>();
                for (String file : files)
                {
                    Config config = configReader.getConfigFromFile(file);
                    tests.addAll(config.getTestConfigs());
                }
                testConfig = new Config(tests);
            }
        }
        catch (IOException e)
        {
            throw new DistributedTestException("Exception while loading test config from '"
View Full Code Here

        _respondingJmsDelegate = mock(ControllerJmsDelegate.class);
        _controller = new Controller(_respondingJmsDelegate, REGISTRATION_TIMEOUT, COMMAND_RESPONSE_TIMEOUT);
        _testRunner = mock(TestRunner.class);
        _clientRegistry = mock(ClientRegistry.class);

        Config configWithOneClient = createMockConfig(1);
        _controller.setConfig(configWithOneClient);
        _controller.setClientRegistry(_clientRegistry);
        _controller.setTestRunnerFactory(createTestFactoryReturningMock());

        doAnswer(new Answer<Void>()
View Full Code Here

    }


    public void testControllerRejectsEmptyConfiguration()
    {
        Config configWithZeroClients = createMockConfig(0);

        try
        {
            _controller.setConfig(configWithZeroClients);
            fail("Exception not thrown");
View Full Code Here

        }
    }

    public void testControllerReceivesTwoExpectedClientRegistrations()
    {
        Config configWithTwoClients = createMockConfig(2);
        _controller.setConfig(configWithTwoClients);
        when(_clientRegistry.awaitClients(2, REGISTRATION_TIMEOUT)).thenReturn(0);

        _controller.awaitClientRegistrations();
    }
View Full Code Here

        verify(_respondingJmsDelegate).sendCommandToClient(eq(CLIENT1_REGISTERED_NAME), isA(StopClientCommand.class));
    }

    public void testRunAllTests()
    {
        Config config = createSimpleConfig();
        _controller.setConfig(config);

        TestResult testResult = new TestResult("test1");

        when(_testRunner.run()).thenReturn(testResult);
View Full Code Here

        verify(_testRunner).run();
    }

    private Config createSimpleConfig()
    {
        Config config = mock(Config.class);
        TestInstance testInstance = mock(TestInstance.class);

        List<TestInstance> testInstances = Arrays.asList(testInstance);

        when(config.getTests()).thenReturn(testInstances);
        when(config.getTotalNumberOfClients()).thenReturn(1); // necessary otherwise controller rejects "invalid" config

        return config;
    }
View Full Code Here

        return config;
    }

    private Config createMockConfig(int numberOfClients)
    {
        Config config = mock(Config.class);
        when(config.getTotalNumberOfClients()).thenReturn(numberOfClients);
        return config;
    }
View Full Code Here

        _respondingJmsDelegate = mock(ControllerJmsDelegate.class);
        _controller = new Controller(_respondingJmsDelegate, REGISTRATION_TIMEOUT, COMMAND_RESPONSE_TIMEOUT);
        _testRunner = mock(TestRunner.class);
        _clientRegistry = mock(ClientRegistry.class);

        Config configWithOneClient = createMockConfig(1);
        _controller.setConfig(configWithOneClient);
        _controller.setClientRegistry(_clientRegistry);
        _controller.setTestRunnerFactory(createTestFactoryReturningMock());

        doAnswer(new Answer<Void>()
View Full Code Here

    }


    public void testControllerRejectsEmptyConfiguration()
    {
        Config configWithZeroClients = createMockConfig(0);

        try
        {
            _controller.setConfig(configWithZeroClients);
            fail("Exception not thrown");
View Full Code Here

TOP

Related Classes of org.apache.qpid.disttest.controller.config.Config

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.