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

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


    {
        String hostnameInRule = "hostnameInRule";
        InetAddress addressWithMatchingHostname = mock(InetAddress.class);
        when(addressWithMatchingHostname.getCanonicalHostName()).thenReturn(hostnameInRule);

        _HostnameFirewallRule = new HostnameFirewallRule(hostnameInRule);

        assertFalse(_HostnameFirewallRule.matches(_addressNotInRule));
        assertTrue(_HostnameFirewallRule.matches(addressWithMatchingHostname));
    }
View Full Code Here


    {
        String hostnameInRule = ".*FOO.*";
        InetAddress addressWithMatchingHostname = mock(InetAddress.class);
        when(addressWithMatchingHostname.getCanonicalHostName()).thenReturn("xxFOOxx");

        _HostnameFirewallRule = new HostnameFirewallRule(hostnameInRule);

        assertFalse(_HostnameFirewallRule.matches(_addressNotInRule));
        assertTrue(_HostnameFirewallRule.matches(addressWithMatchingHostname));
    }
View Full Code Here

    public void testMultipleHostnames() throws Exception
    {
        String[] hostnamesInRule = new String[] {"hostnameInRule1", "hostnameInRule2"};

        _HostnameFirewallRule = new HostnameFirewallRule(hostnamesInRule);

        assertFalse(_HostnameFirewallRule.matches(_addressNotInRule));
        for (String hostnameInRule : hostnamesInRule)
        {
            InetAddress addressWithMatchingHostname = mock(InetAddress.class);
View Full Code Here

    public void testEqualsAndHashCode()
    {
        String hostname1 = "hostname1";
        String hostname2 = "hostname2";

        HostnameFirewallRule rule = new HostnameFirewallRule(hostname1, hostname2);
        HostnameFirewallRule equalRule = new HostnameFirewallRule(hostname1, hostname2);

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

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

        assertFalse("Different hostnames should cause rules to be unequal",
                rule.equals(new HostnameFirewallRule(hostname1, "different-hostname")));
    }
View Full Code Here

    {
        String hostnameInRule = "hostnameInRule";
        InetAddress addressWithMatchingHostname = mock(InetAddress.class);
        when(addressWithMatchingHostname.getCanonicalHostName()).thenReturn(hostnameInRule);

        _HostnameFirewallRule = new HostnameFirewallRule(hostnameInRule);

        assertFalse(_HostnameFirewallRule.matches(_addressNotInRule));
        assertTrue(_HostnameFirewallRule.matches(addressWithMatchingHostname));
    }
View Full Code Here

    {
        String hostnameInRule = ".*FOO.*";
        InetAddress addressWithMatchingHostname = mock(InetAddress.class);
        when(addressWithMatchingHostname.getCanonicalHostName()).thenReturn("xxFOOxx");

        _HostnameFirewallRule = new HostnameFirewallRule(hostnameInRule);

        assertFalse(_HostnameFirewallRule.matches(_addressNotInRule));
        assertTrue(_HostnameFirewallRule.matches(addressWithMatchingHostname));
    }
View Full Code Here

    public void testMultipleHostnames() throws Exception
    {
        String[] hostnamesInRule = new String[] {"hostnameInRule1", "hostnameInRule2"};

        _HostnameFirewallRule = new HostnameFirewallRule(hostnamesInRule);

        assertFalse(_HostnameFirewallRule.matches(_addressNotInRule));
        for (String hostnameInRule : hostnamesInRule)
        {
            InetAddress addressWithMatchingHostname = mock(InetAddress.class);
View Full Code Here

    public void testEqualsAndHashCode()
    {
        String hostname1 = "hostname1";
        String hostname2 = "hostname2";

        HostnameFirewallRule rule = new HostnameFirewallRule(hostname1, hostname2);
        HostnameFirewallRule equalRule = new HostnameFirewallRule(hostname1, hostname2);

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

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

        assertFalse("Different hostnames should cause rules to be unequal",
                rule.equals(new HostnameFirewallRule(hostname1, "different-hostname")));
    }
View Full Code Here

TOP

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

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.