Package org.apache.qpid.server.configuration

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


    @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


                                    BrokerOptions.DEFAULT_LOG_CONFIG_FILE, qpidHome, false);

        configureLogging(logConfigFile, options.getLogWatchFrequency());

        ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configFile, options.getBundleContext());
        ServerConfiguration serverConfig = config.getConfiguration();
        updateManagementPorts(serverConfig, options.getJmxPortRegistryServer(), options.getJmxPortConnectorServer());

        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, options.getLogWatchFrequency());

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

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

            Set<Integer> ports = new HashSet<Integer>(options.getPorts());
            if(ports.isEmpty())
            {
                parsePortList(ports, serverConfig.getPorts());
            }

            Set<Integer> sslPorts = new HashSet<Integer>(options.getSSLPorts());
            if(sslPorts.isEmpty())
            {
                parsePortList(sslPorts, serverConfig.getSSLPorts());
            }

            Set<Integer> exclude_0_10 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_10));
            if(exclude_0_10.isEmpty())
            {
                parsePortList(exclude_0_10, serverConfig.getPortExclude010());
            }

            Set<Integer> exclude_0_9_1 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9_1));
            if(exclude_0_9_1.isEmpty())
            {
                parsePortList(exclude_0_9_1, serverConfig.getPortExclude091());
            }

            Set<Integer> exclude_0_9 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9));
            if(exclude_0_9.isEmpty())
            {
                parsePortList(exclude_0_9, serverConfig.getPortExclude09());
            }

            Set<Integer> exclude_0_8 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_8));
            if(exclude_0_8.isEmpty())
            {
                parsePortList(exclude_0_8, serverConfig.getPortExclude08());
            }

            String bindAddr = options.getBind();
            if (bindAddr == null)
            {
                bindAddr = serverConfig.getBind();
            }

            InetAddress bindAddress = null;
            if (bindAddr.equals(WILDCARD_ADDRESS))
            {
                bindAddress = new InetSocketAddress(0).getAddress();
            }
            else
            {
                bindAddress = InetAddress.getByAddress(parseIP(bindAddr));
            }
            String hostName = bindAddress.getCanonicalHostName();

            if (!serverConfig.getSSLOnly())
            {
                for(int port : ports)
                {
                    final Set<AmqpProtocolVersion> supported =
                                    getSupportedVersions(port, exclude_0_10, exclude_0_9_1, exclude_0_9, exclude_0_8);
                    final NetworkTransportConfiguration settings =
                                    new ServerNetworkTransportConfiguration(serverConfig, port, bindAddress.getHostName(), Transport.TCP);

                    final IncomingNetworkTransport transport = Transport.getIncomingTransportInstance();
                    final MultiVersionProtocolEngineFactory protocolEngineFactory =
                                    new MultiVersionProtocolEngineFactory(hostName, supported);

                    transport.accept(settings, protocolEngineFactory, null);
                    ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, port),
                                    new QpidAcceptor(transport,"TCP"));
                    CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port));
                }
            }

            if (serverConfig.getEnableSSL())
            {
                final String keystorePath = serverConfig.getConnectorKeyStorePath();
                final String keystorePassword = serverConfig.getConnectorKeyStorePassword();
                final String certType = serverConfig.getConnectorCertType();
                final SSLContext sslContext = SSLContextFactory.buildServerContext(keystorePath, keystorePassword, certType);

                for(int sslPort : sslPorts)
                {
                    final Set<AmqpProtocolVersion> supported =
View Full Code Here

            {
                appInfoMap.put(propName, en.getValue().toString());
            }
        }

        ServerConfiguration sc;
        try
        {
            sc = ApplicationRegistry.getInstance().getConfiguration();
            if (null != sc)
            {
                appInfoMap.put("jmxport", sc.getJMXPortRegistryServer() + "");
                appInfoMap.put("port", sc.getPorts().toString());
                appInfoMap.put("version", QpidProperties.getReleaseVersion());
                appInfoMap.put("vhosts", "standalone");
                appInfoMap.put("KeystorePath", sc.getConnectorKeyStorePath());
                appInfoMap.put("PluginDirectory", sc.getPluginDirectory());
                appInfoMap.put("CertType", sc.getConnectorCertType());
                appInfoMap.put("QpidWork", sc.getQpidWork());
                appInfoMap.put("Bind", sc.getBind());
            }
        }
        catch (Exception e)
        {
            // drop everything to be silent
View Full Code Here

        this(configurationURL, null);
    }

    public ConfigurationFileApplicationRegistry(File configurationURL, BundleContext bundleContext) throws ConfigurationException
    {
        super(new ServerConfiguration(configurationURL), bundleContext);
    }
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

        List<String> results = findMatches(VHT_PREFIX + "1002");
       
        try
        {
            // Load VirtualHost list from file.
            ServerConfiguration configuration = new ServerConfiguration(_configFile);
            configuration.initialise();
            List<String> vhosts = Arrays.asList(configuration.getVirtualHosts());

            assertEquals("Each vhost did not close their store.", vhosts.size(), results.size());
        }
        catch (AssertionFailedError afe)
        {
View Full Code Here

        // 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-1006");

        assertTrue("Each vhost did not close its store.", vhosts.size() <= results.size());

        for (int index = 0; index < results.size(); index++)
        {
            String result = getLogMessage(results, index);

            if (getMessageString(result).contains("Recovery Complete :"))
            {
                //Don't test queue start recoveries
                continue;
            }

            // 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);

            assertEquals("MST-1006 does have expected message", "Recovery Complete",
View Full Code Here

        // 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 :");

        // We are only looking for the default queue defined in local host being
        // recovered. If other tests have made queues in test then we want to
        // exclude them here.
        results = filterResultsByVirtualHost(results, "/localhost");

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

        String result = getLogMessage(results, 0);

        // 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-1006 does end with queue 'test-queue':" + getMessageString(result),
View Full Code Here

        // 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-1006 : Recovery Complete :");

        // We are only looking for the default queue defined in local host being
        // recovered. If other tests have made queues in test then we want to
        // exclude them here.
        results = filterResultsByVirtualHost(results, "/localhost");

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

        String result = getLogMessage(results, 0);

        // 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-1006 does end with queue 'test-queue':" + getMessageString(result),
View Full Code Here

            // 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

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.