Examples of ConfigurationFileApplicationRegistry


Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

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

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

        // 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)));
    }
View Full Code Here

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

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

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

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

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

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

        // 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)));
    }
View Full Code Here

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

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

        // 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)));
    }
View Full Code Here

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

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

        // Load config
        ApplicationRegistry reg = new ConfigurationFileApplicationRegistry(mainFile);
        ApplicationRegistry.initialise(reg);
   
        // 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

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

            File configFileDirectory = configFile.getParentFile();
            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);
View Full Code Here

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

            setConfigurationProperty("management.jmxport", String.valueOf(getManagementPort(port)));
            setConfigurationProperty(ServerConfiguration.MGMT_CUSTOM_REGISTRY_SOCKET, String.valueOf(false));
            saveTestConfiguration();
           
            // create an in_VM broker
            final ConfigurationFileApplicationRegistry registry = new ConfigurationFileApplicationRegistry(_configFile);
            try
            {
                ApplicationRegistry.initialise(registry, port);
            }
            catch (Exception e)
            {
                _logger.error("Broker initialise failed due to:",e);
                try
                {
                    registry.close();
                }
                catch (Throwable closeE)
                {
                    closeE.printStackTrace();
                }
View Full Code Here

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

        out.write("\t</virtualhosts>\n");
        out.write("</broker>\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");
        AMQCodecFactory codecFactory = new AMQCodecFactory(true);

        TestIoSession iosession = new TestIoSession();
        iosession.setAddress("127.0.0.1");
       
        AMQProtocolSession session = new AMQMinaProtocolSession(iosession, virtualHostRegistry, codecFactory);
        assertFalse(reg.getAccessManager().authoriseConnect(session, virtualHost));
       
        iosession.setAddress("127.1.2.3");
        session = new AMQMinaProtocolSession(iosession, virtualHostRegistry, codecFactory);
        assertTrue(reg.getAccessManager().authoriseConnect(session, virtualHost));
    }
View Full Code Here

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

        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");
        AMQCodecFactory codecFactory = new AMQCodecFactory(true);

        TestIoSession iosession = new TestIoSession();
        iosession.setAddress("127.0.0.1");
       
        AMQProtocolSession session = new AMQMinaProtocolSession(iosession, virtualHostRegistry, codecFactory);
        assertFalse(reg.getAccessManager().authoriseConnect(session, virtualHost));
    }
View Full Code Here

Examples of org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry

        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
        TestIoSession iosession = new TestIoSession();
        iosession.setAddress("127.0.0.1");
        VirtualHostRegistry virtualHostRegistry = reg.getVirtualHostRegistry();
        VirtualHost virtualHost = virtualHostRegistry.getVirtualHost("test");
        AMQCodecFactory codecFactory = new AMQCodecFactory(true);
        AMQProtocolSession session = new AMQMinaProtocolSession(iosession, virtualHostRegistry, codecFactory);
        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().reparseConfigFile();
       
        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().reparseConfigFile();
       
        assertFalse(reg.getAccessManager().authoriseConnect(session, virtualHost));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.