Package org.apache.qpid.server.registry

Examples of org.apache.qpid.server.registry.ApplicationRegistry$StatisticsReportingTask


        writeMultipleVhostsConfigFile(mainFile, new File[] { vhostsFileOne, vhostsFileTwo });
       
        // Load config
        try
        {
            ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
            ApplicationRegistry.initialise(reg, 1);
            fail("Multiple virtualhost XML configurations not allowed");
        }
        catch (ConfigurationException ce)
        {
View Full Code Here


        File mainFile = File.createTempFile(getClass().getName(), null);
        mainFile.deleteOnExit();
        writeConfigFile(mainFile, false);

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        try
        {
            ApplicationRegistry.initialise(reg, 1);

            // Test config
            assertFalse(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));
            assertTrue(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.1.2.3", 65535)));
        }
        finally
        {
            ApplicationRegistry.remove(1);
        }
View Full Code Here

        out.write("\t<rule access=\"deny\" network=\"127.0.0.1\"/>");
        out.write("</firewall>\n");
        out.close();

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        try
        {
            ApplicationRegistry.initialise(reg, 1);

            // Test config
            assertFalse(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));
        }
        finally
        {
            ApplicationRegistry.remove(1);
        }
View Full Code Here

        mainFile.deleteOnExit();
        writeConfigFile(mainFile, false);

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        try
        {
            ApplicationRegistry.initialise(reg, 1);

            // Test config
            assertFalse(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));

            // Switch to deny the connection
            writeConfigFile(mainFile, true);

            reg.getConfiguration().reparseConfigFileSecuritySections();

            assertTrue(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));
        }
        finally
        {
            ApplicationRegistry.remove(1);
        }
View Full Code Here

        out.write("\t<rule access=\"deny\" network=\"127.0.0.1\"/>");
        out.write("</firewall>\n");
        out.close();

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        try
        {
            ApplicationRegistry.initialise(reg, 1);

            // Test config
            assertFalse(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));

            RandomAccessFile fileBRandom = new RandomAccessFile(fileB, "rw");
            fileBRandom.setLength(0);
            fileBRandom.seek(0);
            fileBRandom.close();

            out = new FileWriter(fileB);
            out.write("<firewall>\n");
            out.write("\t<rule access=\"allow\" network=\"127.0.0.1\"/>");
            out.write("</firewall>\n");
            out.close();

            reg.getConfiguration().reparseConfigFileSecuritySections();

            assertTrue(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));

            fileBRandom = new RandomAccessFile(fileB, "rw");
            fileBRandom.setLength(0);
            fileBRandom.seek(0);
            fileBRandom.close();

            out = new FileWriter(fileB);
            out.write("<firewall>\n");
            out.write("\t<rule access=\"deny\" network=\"127.0.0.1\"/>");
            out.write("</firewall>\n");
            out.close();

            reg.getConfiguration().reparseConfigFileSecuritySections();

            assertFalse(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));
        }
        finally
        {
            ApplicationRegistry.remove(1);
        }
View Full Code Here

        vhostsFile.deleteOnExit();
        writeConfigFile(mainFile, false, false, vhostsFile, null);   
        writeFirewallVhostsFile(vhostsFile, false);

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        ApplicationRegistry.initialise(reg, 1);

        // Test config
        VirtualHostRegistry virtualHostRegistry = reg.getVirtualHostRegistry();
        VirtualHost virtualHost = virtualHostRegistry.getVirtualHost("test");

        assertEquals("Incorrect virtualhost count", 1, virtualHostRegistry.getVirtualHosts().size());
        assertEquals("Incorrect virtualhost name", "test", virtualHost.getName());
    }
View Full Code Here

        _taskExecutor.start();
        SystemConfig systemConfig = configFactory.newInstance(_taskExecutor, _eventLogger, logRecorder, options, this);
        systemConfig.open();
        DurableConfigurationStore store = systemConfig.getConfigurationStore();

        _applicationRegistry = new ApplicationRegistry(store, systemConfig);
        try
        {
            _applicationRegistry.initialise(options);
        }
        catch(Exception e)
View Full Code Here

        File mainFile = File.createTempFile(getClass().getName(), "config");
        mainFile.deleteOnExit();
        writeConfigFile(mainFile, false, true, null, "test");

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        ApplicationRegistry.initialise(reg, 1);

        // Test config
        VirtualHostRegistry virtualHostRegistry = reg.getVirtualHostRegistry();
        String defaultVirtualHost = reg.getConfiguration().getDefaultVirtualHost();
        VirtualHost virtualHost = virtualHostRegistry.getVirtualHost("test");
        Exchange exchange = virtualHost.getExchangeRegistry().getExchange(new AMQShortString("test.topic"));

        assertEquals("Incorrect default host", "test", defaultVirtualHost);
        assertEquals("Incorrect virtualhost count", 1, virtualHostRegistry.getVirtualHosts().size());
View Full Code Here

        vhostsFile.deleteOnExit();
        writeConfigFile(mainFile, false, false, vhostsFile, null);   
        writeVirtualHostsFile(vhostsFile, "test");

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        ApplicationRegistry.initialise(reg, 1);

        // Test config
        VirtualHostRegistry virtualHostRegistry = reg.getVirtualHostRegistry();
        String defaultVirtualHost = reg.getConfiguration().getDefaultVirtualHost();
        VirtualHost virtualHost = virtualHostRegistry.getVirtualHost("test");
        Exchange exchange = virtualHost.getExchangeRegistry().getExchange(new AMQShortString("test.topic"));

        assertEquals("Incorrect default host", "test", defaultVirtualHost);
        assertEquals("Incorrect virtualhost count", 1, virtualHostRegistry.getVirtualHosts().size());
View Full Code Here

        File mainFile = File.createTempFile(getClass().getName(), "config");
        mainFile.deleteOnExit();
        writeConfigFile(mainFile, false, false, vhostsFile, null);

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        ApplicationRegistry.initialise(reg, 1);

        // Test config
        VirtualHostRegistry virtualHostRegistry = reg.getVirtualHostRegistry();

        assertEquals("Incorrect virtualhost count", 2, virtualHostRegistry.getVirtualHosts().size());
       
        // test topic host
        VirtualHost topicVirtualHost = virtualHostRegistry.getVirtualHost("topic");
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.registry.ApplicationRegistry$StatisticsReportingTask

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.