Package org.apache.qpid.server.configuration

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


        Broker broker = BrokerTestHelper.createBrokerMock();
        _virtualHostRegistry = broker.getVirtualHostRegistry();

        Configuration config = new PropertiesConfiguration();
        config.setProperty("store.type", MemoryMessageStore.TYPE);
        VirtualHostConfiguration configuration = new  VirtualHostConfiguration(virtualHostName, config, broker);
        VirtualHost host = new VirtualHostImpl(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(mock(Broker.class), false), configuration);
        _virtualHostRegistry.registerVirtualHost(host);
        return host;
    }
View Full Code Here


    public void testSetSystemConfiguration() throws Exception
    {
        // create virtual host configuration, registry and host instance
        addVirtualHostConfiguration();
        String vhostName = "test" + _masterPort;
        VirtualHostConfiguration configuration = new VirtualHostConfiguration(vhostName, _configXml.subset("virtualhosts.virtualhost." + vhostName), BrokerTestHelper.createBrokerMock());
        _virtualHost = BrokerTestHelper.createVirtualHost(configuration);
        BDBHAMessageStore store = (BDBHAMessageStore) _virtualHost.getMessageStore();

        // test whether JVM system settings were applied
        Environment env = store.getEnvironment();
View Full Code Here

    public void testSetSystemConfiguration() throws Exception
    {
        // create virtual host configuration, registry and host instance
        addVirtualHostConfiguration();
        String vhostName = "test" + _masterPort;
        VirtualHostConfiguration configuration = new VirtualHostConfiguration(vhostName, _configXml.subset("virtualhosts.virtualhost." + vhostName), BrokerTestHelper.createBrokerMock());

        _virtualHost = BrokerTestHelper.createVirtualHost(configuration,null,_modelVhost);
        BDBHAMessageStore store = (BDBHAMessageStore) _virtualHost.getMessageStore();

        // test whether JVM system settings were applied
View Full Code Here

            }
        }

        try
        {
            _virtualHost = BrokerTestHelper.createVirtualHost(new VirtualHostConfiguration(getClass().getName(), _config, _broker),new VirtualHostRegistry(_broker.getEventLogger()),getVirtualHostModel());
        }
        catch (Exception e)
        {
            _logger.error("Error creating virtual host", e);
            fail(e.getMessage());
View Full Code Here

    {
        VirtualHostRegistry virtualHostRegistry = _broker.getVirtualHostRegistry();
        String virtualHostName = getName();
        try
        {
            VirtualHostConfiguration configuration = createVirtualHostConfiguration(virtualHostName);
            String type = configuration.getType();
            final VirtualHostFactory factory = VirtualHostFactory.FACTORIES.get(type);
            if(factory == null)
            {
                throw new IllegalArgumentException("Unknown virtual host type: " + type);
            }
View Full Code Here

        }
    }

    private VirtualHostConfiguration createVirtualHostConfiguration(String virtualHostName) throws ConfigurationException
    {
        VirtualHostConfiguration configuration;
        String configurationFile = (String)getAttribute(CONFIG_PATH);
        if (configurationFile == null)
        {
            final MyConfiguration basicConfiguration = new MyConfiguration();
            PropertiesConfiguration config = new PropertiesConfiguration();
            final String type = (String) getAttribute(TYPE);
            config.addProperty("type", type);
            VirtualHostFactory factory = VirtualHostFactory.FACTORIES.get(type);
            if(factory != null)
            {
                for(Map.Entry<String,Object> entry : factory.createVirtualHostConfiguration(this).entrySet())
                {
                    config.addProperty(entry.getKey(), entry.getValue());
                }
            }
            basicConfiguration.addConfiguration(config);

            CompositeConfiguration compositeConfiguration = new CompositeConfiguration();
            compositeConfiguration.addConfiguration(new SystemConfiguration());
            compositeConfiguration.addConfiguration(basicConfiguration);
            configuration = new VirtualHostConfiguration(virtualHostName, compositeConfiguration , _broker);
        }
        else
        {
            if (!new File(configurationFile).exists())
            {
                throw new IllegalConfigurationException("Configuration file '" + configurationFile + "' does not exist");
            }
            configuration = new VirtualHostConfiguration(virtualHostName, new File(configurationFile) , _broker);
            String type = configuration.getType();
            changeAttribute(TYPE,null,type);
            VirtualHostFactory factory = VirtualHostFactory.FACTORIES.get(type);
            if(factory != null)
            {
                for(Map.Entry<String,Object> entry : factory.convertVirtualHostConfiguration(configuration.getConfig()).entrySet())
                {
                    changeAttribute(entry.getKey(), getAttribute(entry.getKey()), entry.getValue());
                }
            }
View Full Code Here

            configFilePath = configFileParent + configFilePath.substring(configVar.length());
        }

        if (configFilePath.indexOf(".xml") != -1 )
        {
            VirtualHostConfiguration vHostConfig = new VirtualHostConfiguration(configFilePath);
            vHostConfig.performBindings();
        }
        else
        {
            // the virtualhosts value is a path. Search it for XML files.

            File virtualHostDir = new File(configFilePath);

            String[] fileNames = virtualHostDir.list();

            for (int each=0; each < fileNames.length; each++)
            {
                if (fileNames[each].endsWith(".xml"))
                {
                    VirtualHostConfiguration vHostConfig = new VirtualHostConfiguration(configFilePath+"/"+fileNames[each]);
                    vHostConfig.performBindings();
                }
            }
        }
    }
View Full Code Here

        super.setUp();
        //Create Application Registry for test
        ApplicationRegistry applicationRegistry = (ApplicationRegistry)ApplicationRegistry.getInstance();

        PropertiesConfiguration env = new PropertiesConfiguration();
        _virtualHost = new VirtualHostImpl(new VirtualHostConfiguration(getClass().getName(), env), _store);
        applicationRegistry.getVirtualHostRegistry().registerVirtualHost(_virtualHost);

        _queue = (SimpleAMQQueue) AMQQueueFactory.createAMQQueueImpl(_qname, false, _owner, false, false, _virtualHost, _arguments);

        _exchange = (DirectExchange)_virtualHost.getExchangeRegistry().getExchange(ExchangeDefaults.DIRECT_EXCHANGE_NAME);
View Full Code Here

            }
        }

        try
        {
            setVirtualHost(ApplicationRegistry.getInstance().createVirtualHost(new VirtualHostConfiguration(getClass().getName(), _config)));
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

            }
        }

        try
        {
            setVirtualHost(ApplicationRegistry.getInstance().createVirtualHost(new VirtualHostConfiguration(getClass().getName(), _config)));
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

TOP

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

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.