Package org.apache.qpid.server.security.access.firewall

Examples of org.apache.qpid.server.security.access.firewall.NetworkFirewallRule


    public void testIpRule() throws Exception
    {
        String ipAddressInRule = OTHER_IP_1;

        _networkFirewallRule = new NetworkFirewallRule(ipAddressInRule);

        assertFalse(_networkFirewallRule.matches(_addressNotInRule));
        assertTrue(_networkFirewallRule.matches(InetAddress.getByName(ipAddressInRule)));
    }
View Full Code Here


    }

    public void testNetMask() throws Exception
    {
        String ipAddressInRule = "192.168.23.0/24";
        _networkFirewallRule = new NetworkFirewallRule(ipAddressInRule);

        assertFalse(_networkFirewallRule.matches(InetAddress.getByName("192.168.24.1")));
        assertTrue(_networkFirewallRule.matches(InetAddress.getByName("192.168.23.0")));
        assertTrue(_networkFirewallRule.matches(InetAddress.getByName("192.168.23.255")));
    }
View Full Code Here

    public void testWildcard() throws Exception
    {
        // Test xxx.xxx.*

        assertFalse(new NetworkFirewallRule("192.168.*")
             .matches(InetAddress.getByName("192.169.1.0")));

        assertTrue(new NetworkFirewallRule("192.168.*")
            .matches(InetAddress.getByName("192.168.1.0")));

        assertTrue(new NetworkFirewallRule("192.168.*")
            .matches(InetAddress.getByName("192.168.255.255")));

        // Test xxx.xxx.xxx.*

        assertFalse(new NetworkFirewallRule("192.168.1.*")
             .matches(InetAddress.getByName("192.169.2.0")));

        assertTrue(new NetworkFirewallRule("192.168.1.*")
            .matches(InetAddress.getByName("192.168.1.0")));

        assertTrue(new NetworkFirewallRule("192.168.1.*")
            .matches(InetAddress.getByName("192.168.1.255")));
    }
View Full Code Here

    public void testMultipleNetworks() throws Exception
    {
        String[] ipAddressesInRule = new String[] {OTHER_IP_1, OTHER_IP_2};

        _networkFirewallRule = new NetworkFirewallRule(ipAddressesInRule);

        assertFalse(_networkFirewallRule.matches(_addressNotInRule));
        for (String ipAddressInRule : ipAddressesInRule)
        {
            assertTrue(_networkFirewallRule.matches(InetAddress.getByName(ipAddressInRule)));
View Full Code Here

        }
    }

    public void testEqualsAndHashCode()
    {
        NetworkFirewallRule rule = new NetworkFirewallRule(LOCALHOST_IP, OTHER_IP_1);
        NetworkFirewallRule equalRule = new NetworkFirewallRule(LOCALHOST_IP, OTHER_IP_1);

        assertTrue(rule.equals(rule));
        assertTrue(rule.equals(equalRule));
        assertTrue(equalRule.equals(rule));

        assertTrue(rule.hashCode() == equalRule.hashCode());

        assertFalse("Different networks should cause rules to be unequal",
                rule.equals(new NetworkFirewallRule(LOCALHOST_IP, OTHER_IP_2)));
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.security.access.firewall.NetworkFirewallRule

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.