Package org.apache.qpid.server.configuration

Examples of org.apache.qpid.server.configuration.ServerConfiguration


            // Validation

            assertTrue("MST messages not logged", results.size() > 0);

            // Load VirtualHost list from file.
            ServerConfiguration configuration = new ServerConfiguration(_configFile);
            configuration.initialise();
            List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");

            //Validate each vhost logs a creation
            results = waitAndFindMatches("MST-1004 : Recovery Start : " + queueName);

            assertEquals("Recovered test queue not found.", 1, results.size());

            String result = getLogMessage(results, 0);

            validateMessageID("MST-1004", result);

            assertTrue("MST-1004 does end with queue '" + queueName + "':" + getMessageString(result),
                       getMessageString(result).endsWith(queueName));

            results = waitAndFindMatches("MST-1005");

            assertTrue("Insufficient MST-1005 logged.", results.size()>0);

            result = null;

            // If the first message is not our queue the second one will be
            for(String resultEntry : results)
            {
                // Look for first match and set that to result
                if (resultEntry.contains(queueName))
                {
                    result = getLog(resultEntry);
                    break;
                }
            }

            assertNotNull("MST-1005 entry for queue:" + queueName + ". Not found", result);

            // getSlize will return extract the vhost from vh(/test) -> '/test'
            // so remove the '/' to get the name
            String vhostName = AbstractTestLogSubject.getSlice("vh", result).substring(1);

            // To get the store class used in the configuration we need to know
            // the virtualhost name, found above. AND
            // the index that the virtualhost is within the configuration.
            // we can retrive that from the vhosts list previously extracted.
            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");

            // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
            String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);

            assertTrue("MST-1005 does end with queue 'test-queue':" + getMessageString(result),
View Full Code Here


        }
    }

    static int getConfiguredFrameSize()
    {
        final ServerConfiguration config = ApplicationRegistry.getInstance().getConfiguration();
        final int framesize = config.getFrameSize();
        _logger.info("Framesize set to " + framesize);
        return framesize;
    }
View Full Code Here

            // Write the test config file to test output
            message.append("Server configuration overrides in use:\n");
            message.append(FileUtils.readFileAsString(getTestConfigFile()));

            message.append("\nVirtualhost maxMessageCount:\n");
            ServerConfiguration config = new ServerConfiguration(_configFile);
            config.initialise();
            message.append(config.getVirtualHostConfig(VIRTUALHOST).getMaximumMessageCount());

            fail(message.toString());
        }
    }
View Full Code Here

        _monitor = new LogMonitor(_outputFile);
    }

    protected ServerConfiguration getServerConfig() throws ConfigurationException
    {
        ServerConfiguration _serverConfiguration;
        if (isExternalBroker())
        {
            _serverConfiguration = new ServerConfiguration(_configFile)
            {
                @Override
                public void initialise() throws ConfigurationException
                {
                    //Overriding initialise to only setup the vhosts and not
                    //perform the ConfigurationPlugin setup, removing need for
                    //an ApplicationRegistry to be loaded.
                    setupVirtualHosts(getConfig());
                }
            };
            _serverConfiguration.initialise();
        }
        else
        {
            _serverConfiguration = ApplicationRegistry.getInstance().getConfiguration();
        }
View Full Code Here

        // Call save Configuration to be sure we have saved the test specific
        // file. As the optional status
        saveTestConfiguration();
        saveTestVirtualhosts();

        ServerConfiguration configuration = new ServerConfiguration(_configFile);
        // Don't need to configuration.configure() here as we are just pulling
        // values directly by String.
        return configuration.getConfig().getString(property);
    }
View Full Code Here

            logConfigFile = new File(configFileDirectory, DEFAULT_LOG_CONFIG_FILENAME);
            configureLogging(logConfigFile, logWatchTime);
        }

        ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configFile);
        ServerConfiguration serverConfig = config.getConfiguration();
        updateManagementPort(serverConfig, commandLine.getOptionValue("m"));

        ApplicationRegistry.initialise(config);

        // We have already loaded the BrokerMessages class by this point so we
        // need to refresh the locale setting incase we had a different value in
        // the configuration.
        BrokerMessages.reload();

        // AR.initialise() sets and removes its own actor so we now need to set the actor
        // for the remainder of the startup, and the default actor if the stack is empty
        CurrentActor.set(new BrokerActor(config.getCompositeStartupMessageLogger()));
        CurrentActor.setDefault(new BrokerActor(config.getRootMessageLogger()));
        GenericActor.setDefaultMessageLogger(config.getRootMessageLogger());
       

        try
        {
            configureLoggingManagementMBean(logConfigFile, logWatchTime);

            ConfigurationManagementMBean configMBean = new ConfigurationManagementMBean();
            configMBean.register();

            ServerInformationMBean sysInfoMBean = new ServerInformationMBean(config);
            sysInfoMBean.register();


            String[] portStr = commandLine.getOptionValues("p");

            Set<Integer> ports = new HashSet<Integer>();
            Set<Integer> exclude_0_10 = new HashSet<Integer>();
            Set<Integer> exclude_0_9_1 = new HashSet<Integer>();
            Set<Integer> exclude_0_9 = new HashSet<Integer>();
            Set<Integer> exclude_0_8 = new HashSet<Integer>();

            if(portStr == null || portStr.length == 0)
            {

                parsePortList(ports, serverConfig.getPorts());
                parsePortList(exclude_0_10, serverConfig.getPortExclude010());
                parsePortList(exclude_0_9_1, serverConfig.getPortExclude091());
                parsePortList(exclude_0_9, serverConfig.getPortExclude09());
                parsePortList(exclude_0_8, serverConfig.getPortExclude08());

            }
            else
            {
                parsePortArray(ports, portStr);
                parsePortArray(exclude_0_10, commandLine.getOptionValues("exclude-0-10"));
                parsePortArray(exclude_0_9_1, commandLine.getOptionValues("exclude-0-9-1"));
                parsePortArray(exclude_0_9, commandLine.getOptionValues("exclude-0-9"));
                parsePortArray(exclude_0_8, commandLine.getOptionValues("exclude-0-8"));

            }




            String bindAddr = commandLine.getOptionValue("b");
            if (bindAddr == null)
            {
                bindAddr = serverConfig.getBind();
            }
            InetAddress bindAddress = null;



            if (bindAddr.equals("wildcard"))
            {
                bindAddress = new InetSocketAddress(0).getAddress();
            }
            else
            {
                bindAddress = InetAddress.getByAddress(parseIP(bindAddr));
            }

            String hostName = bindAddress.getCanonicalHostName();


            String keystorePath = serverConfig.getKeystorePath();
            String keystorePassword = serverConfig.getKeystorePassword();
            String certType = serverConfig.getCertType();
            SSLContextFactory sslFactory = null;

            if (!serverConfig.getSSLOnly())
            {

                for(int port : ports)
                {

                    NetworkDriver driver = new MINANetworkDriver();

                    Set<VERSION> supported = EnumSet.allOf(VERSION.class);

                    if(exclude_0_10.contains(port))
                    {
                        supported.remove(VERSION.v0_10);
                    }

                    if(exclude_0_9_1.contains(port))
                    {
                        supported.remove(VERSION.v0_9_1);
                    }
                    if(exclude_0_9.contains(port))
                    {
                        supported.remove(VERSION.v0_9);
                    }
                    if(exclude_0_8.contains(port))
                    {
                        supported.remove(VERSION.v0_8);
                    }

                    MultiVersionProtocolEngineFactory protocolEngineFactory =
                            new MultiVersionProtocolEngineFactory(hostName, supported);



                    driver.bind(port, new InetAddress[]{bindAddress}, protocolEngineFactory,
                                serverConfig.getNetworkConfiguration(), null);
                    ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, port),
                                                                  new QpidAcceptor(driver,"TCP"));
                    CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port));

                }

            }

            if (serverConfig.getEnableSSL())
            {
                sslFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
                NetworkDriver driver = new MINANetworkDriver();

                String sslPort = commandLine.getOptionValue("s");
                int port = 0;
                if (null != sslPort)
                {
                    port = Integer.parseInt(sslPort);
                }
                else
                {
                    port = serverConfig.getSSLPort();
                }

                driver.bind(port, new InetAddress[]{bindAddress},
                            new AMQProtocolEngineFactory(), serverConfig.getNetworkConfiguration(), sslFactory);
                ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, port),
                        new QpidAcceptor(driver,"TCP"));
                CurrentActor.get().message(BrokerMessages.LISTENING("TCP/SSL", port));
            }
View Full Code Here

    protected void setUp() throws Exception
    {
        super.setUp();

        //the factory needs a registry instance
        ApplicationRegistry.initialise(new TestApplicationRegistry(new ServerConfiguration(new XMLConfiguration())));
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception
    {
        super.setUp();
        _serverConfig = new ServerConfiguration(new XMLConfiguration());
        ApplicationRegistry.initialise(new TestApplicationRegistry(_serverConfig));
        _address = new InetSocketAddress("127.0.0.1", 65535);
    }
View Full Code Here

            logConfigFile = new File(configFileDirectory, DEFAULT_LOG_CONFIG_FILENAME);
            configureLogging(logConfigFile, logWatchTime);
        }*/

        ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configFile);
        ServerConfiguration serverConfig = config.getConfiguration();
        updateManagementPort(serverConfig, commandLine.getOptionValue("m"));

        ApplicationRegistry.initialise(config);

        // We have already loaded the BrokerMessages class by this point so we
        // need to refresh the locale setting incase we had a different value in
        // the configuration.
        BrokerMessages.reload();

        // AR.initialise() sets and removes its own actor so we now need to set the actor
        // for the remainder of the startup, and the default actor if the stack is empty
        CurrentActor.set(new BrokerActor(config.getCompositeStartupMessageLogger()));
        CurrentActor.setDefault(new BrokerActor(config.getRootMessageLogger()));
        GenericActor.setDefaultMessageLogger(config.getRootMessageLogger());
       

        try
        {
            //configureLoggingManagementMBean(logConfigFile, logWatchTime);

            ConfigurationManagementMBean configMBean = new ConfigurationManagementMBean();
            configMBean.register();

            ServerInformationMBean sysInfoMBean = new ServerInformationMBean(config);
            sysInfoMBean.register();


            String[] portStr = commandLine.getOptionValues("p");

            Set<Integer> ports = new HashSet<Integer>();
            Set<Integer> exclude_0_10 = new HashSet<Integer>();
            Set<Integer> exclude_0_9_1 = new HashSet<Integer>();
            Set<Integer> exclude_0_9 = new HashSet<Integer>();
            Set<Integer> exclude_0_8 = new HashSet<Integer>();

            if(portStr == null || portStr.length == 0)
            {

                parsePortList(ports, serverConfig.getPorts());
                parsePortList(exclude_0_10, serverConfig.getPortExclude010());
                parsePortList(exclude_0_9_1, serverConfig.getPortExclude091());
                parsePortList(exclude_0_9, serverConfig.getPortExclude09());
                parsePortList(exclude_0_8, serverConfig.getPortExclude08());

            }
            else
            {
                parsePortArray(ports, portStr);
                parsePortArray(exclude_0_10, commandLine.getOptionValues("exclude-0-10"));
                parsePortArray(exclude_0_9_1, commandLine.getOptionValues("exclude-0-9-1"));
                parsePortArray(exclude_0_9, commandLine.getOptionValues("exclude-0-9"));
                parsePortArray(exclude_0_8, commandLine.getOptionValues("exclude-0-8"));

            }




            String bindAddr = commandLine.getOptionValue("b");
            if (bindAddr == null)
            {
                bindAddr = serverConfig.getBind();
            }
            InetAddress bindAddress = null;



            if (bindAddr.equals("wildcard"))
            {
                bindAddress = new InetSocketAddress(0).getAddress();
            }
            else
            {
                bindAddress = InetAddress.getByAddress(parseIP(bindAddr));
            }

            String hostName = bindAddress.getCanonicalHostName();


            String keystorePath = serverConfig.getKeystorePath();
            String keystorePassword = serverConfig.getKeystorePassword();
            String certType = serverConfig.getCertType();
            SSLContextFactory sslFactory = null;

            if (!serverConfig.getSSLOnly())
            {

                for(int port : ports)
                {

                    NetworkDriver driver = new MINANetworkDriver();

                    Set<VERSION> supported = EnumSet.allOf(VERSION.class);

                    if(exclude_0_10.contains(port))
                    {
                        supported.remove(VERSION.v0_10);
                    }

                    if(exclude_0_9_1.contains(port))
                    {
                        supported.remove(VERSION.v0_9_1);
                    }
                    if(exclude_0_9.contains(port))
                    {
                        supported.remove(VERSION.v0_9);
                    }
                    if(exclude_0_8.contains(port))
                    {
                        supported.remove(VERSION.v0_8);
                    }

                    MultiVersionProtocolEngineFactory protocolEngineFactory =
                            new MultiVersionProtocolEngineFactory(hostName, supported);



                    driver.bind(port, new InetAddress[]{bindAddress}, protocolEngineFactory,
                                serverConfig.getNetworkConfiguration(), null);
                    ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, port),
                                                                  new QpidAcceptor(driver,"TCP"));
                    //CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port));
                    _logger.info("Qpid broker TCP port : " + port);
                }

            }

            if (serverConfig.getEnableSSL())
            {
                sslFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
                NetworkDriver driver = new MINANetworkDriver();

                //int port = serverConfig.getSSLPort();
                String sslPort = commandLine.getOptionValue("s");
                int port = 0;
                if (null != sslPort) {
                    port = Integer.parseInt(sslPort);
                } else {
                    port = serverConfig.getSSLPort();
                }

                Set<VERSION> supported = EnumSet.allOf(VERSION.class);

                if(exclude_0_10.contains(port)){
                    supported.remove(VERSION.v0_10);
                }

                if(exclude_0_9_1.contains(port)){
                    supported.remove(VERSION.v0_9_1);
                }

                if(exclude_0_9.contains(port)){
                    supported.remove(VERSION.v0_9);
                }

                if(exclude_0_8.contains(port)){
                    supported.remove(VERSION.v0_8);
                }

                MultiVersionProtocolEngineFactory protoclEngineFactory =
                        new MultiVersionProtocolEngineFactory(hostName, supported);
                driver.bind(port , new InetAddress[]{bindAddress}, protoclEngineFactory,
                        serverConfig.getNetworkConfiguration(), sslFactory);

                ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, serverConfig.getSSLPort()),
                        new QpidAcceptor(driver,"TCP"));
                //CurrentActor.get().message(BrokerMessages.LISTENING("TCP/SSL", serverConfig.getSSLPort()));
                _logger.info("Qpid broker TLS port : " + sslPort);
            }

View Full Code Here

        // Call save Configuration to be sure we have saved the test specific
        // file. As the optional status
        saveTestConfiguration();
        saveTestVirtualhosts();

        ServerConfiguration configuration = new ServerConfiguration(_configFile);
        // Don't need to configuration.configure() here as we are just pulling
        // values directly by String.
        return configuration.getConfig().getString(property);
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.configuration.ServerConfiguration

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.