Package org.apache.qpid.server.registry

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


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

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

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

        TestNetworkDriver testDriver = new TestNetworkDriver();
        testDriver.setRemoteAddress("127.0.0.1");

        AMQProtocolEngine session = new AMQProtocolEngine(virtualHostRegistry, testDriver);
        assertFalse(reg.getAccessManager().authoriseConnect(session, virtualHost));

        testDriver.setRemoteAddress("127.1.2.3");
        session = new AMQProtocolEngine(virtualHostRegistry, testDriver);
        assertTrue(reg.getAccessManager().authoriseConnect(session, virtualHost));
    }
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);
        ApplicationRegistry.initialise(reg, 1);

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

        TestNetworkDriver testDriver = new TestNetworkDriver();
        testDriver.setRemoteAddress("127.0.0.1");

        AMQProtocolEngine session = new AMQProtocolEngine(virtualHostRegistry, testDriver);
        session.setNetworkDriver(testDriver);
        assertFalse(reg.getAccessManager().authoriseConnect(session, virtualHost));
    }
View Full Code Here

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

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

        // Test config
        TestNetworkDriver testDriver = new TestNetworkDriver();
        testDriver.setRemoteAddress("127.0.0.1");
        VirtualHostRegistry virtualHostRegistry = reg.getVirtualHostRegistry();
        VirtualHost virtualHost = virtualHostRegistry.getVirtualHost("test");
        AMQProtocolSession session = new AMQProtocolEngine(virtualHostRegistry, testDriver);
       
        assertFalse(reg.getAccessManager().authoriseConnect(session, virtualHost));
      
        // Switch to deny the connection
        writeConfigFile(mainFile, true);
       
        reg.getConfiguration().reparseConfigFileSecuritySections();

        assertTrue(reg.getAccessManager().authoriseConnect(session, virtualHost));

    }
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);
        ApplicationRegistry.initialise(reg, 1);

        // Test config
        TestNetworkDriver testDriver = new TestNetworkDriver();
        testDriver.setRemoteAddress("127.0.0.1");
        VirtualHostRegistry virtualHostRegistry = reg.getVirtualHostRegistry();
        VirtualHost virtualHost = virtualHostRegistry.getVirtualHost("test");
        AMQProtocolSession session = new AMQProtocolEngine(virtualHostRegistry, testDriver);
        assertFalse(reg.getAccessManager().authoriseConnect(session, virtualHost));

        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.getAccessManager().authoriseConnect(session, virtualHost));

        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.getAccessManager().authoriseConnect(session, virtualHost));
    }
View Full Code Here

    @Override
    public void setUp() throws Exception
    {
        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

    public void testMaxDeliveryCount() throws Exception
    {
        try
        {
            ApplicationRegistry registry = new TestApplicationRegistry(new ServerConfiguration(_env));
            ApplicationRegistry.initialise(registry);

            // Check default value
            QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
            assertEquals("Unexpected default server configuration for max delivery count ", 0, qConf.getMaxDeliveryCount());
View Full Code Here

     */
    public void testIsDeadLetterQueueEnabled() throws Exception
    {
        try
        {
            ApplicationRegistry registry = new TestApplicationRegistry(new ServerConfiguration(_env));
            ApplicationRegistry.initialise(registry);

            // Check default value
            QueueConfiguration qConf = new QueueConfiguration("test", _emptyConf);
            assertFalse("Unexpected queue configuration for dead letter enabled attribute", qConf.isDeadLetterQueueEnabled());
View Full Code Here

        configXml.addProperty("virtualhosts.virtualhost(-1).name", getName());
        configXml.addProperty("virtualhosts.virtualhost(-1)."+getName()+".store.class", TestableMemoryMessageStore.class.getName());

        ServerConfiguration configuration = new ServerConfiguration(configXml);

        ApplicationRegistry registry = new TestApplicationRegistry(configuration);
        ApplicationRegistry.initialise(registry);
        registry.getVirtualHostRegistry().setDefaultVirtualHostName(getName());

        _virtualHost = registry.getVirtualHostRegistry().getVirtualHost(getName());

        _queueRegistry = _virtualHost.getQueueRegistry();

    }
View Full Code Here

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

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

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

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

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

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

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.