Package org.apache.qpid.server.configuration

Examples of org.apache.qpid.server.configuration.ConfigurationEntry


        return recoverer.create(_recovererProvider, entry, _broker);
    }

    private ConfigurationEntry createConfigurationEntry(String type, Map<String, Object> attributes, ConfigurationEntryStore store)
    {
        return new ConfigurationEntry(UUID.randomUUID(), type, attributes, Collections.<UUID>emptySet(), store);
    }
View Full Code Here


        return createConfigurationEntry(GroupProvider.class.getSimpleName(), attributes , _store);
    }

    private ConfigurationEntry getPortConfigurationEntry()
    {
        ConfigurationEntry authProviderEntry = getAuthenticationProviderConfigurationEntry();
        AuthenticationProvider authProvider = (AuthenticationProvider)createConfiguredObject(authProviderEntry);

        Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put(Port.NAME, getTestName());
        attributes.put(Port.PROTOCOLS, Collections.<Protocol>singleton(Protocol.HTTP));
View Full Code Here

{
    public void testGetChildren()
    {
        ConfigurationEntryStore store = mock(ConfigurationEntryStore.class);

        ConfigurationEntry virtualHostEntry1 = new ConfigurationEntry(UUID.randomUUID(), VirtualHost.class.getSimpleName(),
                Collections.<String, Object> emptyMap(), Collections.<UUID> emptySet(), store);
        ConfigurationEntry virtualHostEntry2 = new ConfigurationEntry(UUID.randomUUID(), VirtualHost.class.getSimpleName(),
                Collections.<String, Object> emptyMap(), Collections.<UUID> emptySet(), store);
        ConfigurationEntry portEntry = new ConfigurationEntry(UUID.randomUUID(), Port.class.getSimpleName(),
                Collections.<String, Object> emptyMap(), Collections.<UUID> emptySet(), store);

        when(store.getEntry(virtualHostEntry1.getId())).thenReturn(virtualHostEntry1);
        when(store.getEntry(virtualHostEntry2.getId())).thenReturn(virtualHostEntry2);
        when(store.getEntry(portEntry.getId())).thenReturn(portEntry);

        Set<UUID> childrenIds = new HashSet<UUID>();
        childrenIds.add(virtualHostEntry1.getId());
        childrenIds.add(virtualHostEntry2.getId());
        childrenIds.add(portEntry.getId());
        ConfigurationEntry parentEntry = new ConfigurationEntry(UUID.randomUUID(), Broker.class.getSimpleName(),
                Collections.<String, Object> emptyMap(), childrenIds, store);

        Map<String, Collection<ConfigurationEntry>> children = parentEntry.getChildren();
        assertNotNull("Null is returned for children", children);
        assertEquals("Unexpected size", 2, children.size());
        Collection<ConfigurationEntry> virtualHosts = children.get(VirtualHost.class.getSimpleName());
        Collection<ConfigurationEntry> ports = children.get(Port.class.getSimpleName());
        assertEquals("Unexpected virtual hosts",
View Full Code Here

    public void testHashCode()
    {
        ConfigurationEntryStore store = mock(ConfigurationEntryStore.class);

        UUID id = UUID.randomUUID();
        ConfigurationEntry entry1 = new ConfigurationEntry(id, VirtualHost.class.getSimpleName(),
                Collections.<String, Object> emptyMap(), Collections.singleton(UUID.randomUUID()), store);
        ConfigurationEntry entry2 = new ConfigurationEntry(id, VirtualHost.class.getSimpleName(),
                Collections.<String, Object> emptyMap(), Collections.singleton(UUID.randomUUID()), store);
        ConfigurationEntry entryWithDifferentId = new ConfigurationEntry(UUID.randomUUID(),
                VirtualHost.class.getSimpleName(), Collections.<String, Object> emptyMap(), Collections.singleton(UUID.randomUUID()), store);

        assertTrue(entry1.hashCode() == entry2.hashCode());
        assertFalse(entry1.hashCode() == entryWithDifferentId.hashCode());
    }
View Full Code Here

        UUID id = UUID.randomUUID();
        Map<String, Object> attributes1 = new HashMap<String, Object>();
        attributes1.put(VirtualHost.NAME, "name1");
        Set<UUID> childrenIds = Collections.singleton(UUID.randomUUID());
        ConfigurationEntry entry1 = new ConfigurationEntry(id, VirtualHost.class.getSimpleName(), attributes1,
                childrenIds, store);

        Map<String, Object> attributes2 = new HashMap<String, Object>();
        attributes2.put(VirtualHost.NAME, "name2");

        ConfigurationEntry entry2 = new ConfigurationEntry(id, VirtualHost.class.getSimpleName(), attributes1,
                childrenIds, store);
        ConfigurationEntry entryWithDifferentId = new ConfigurationEntry(UUID.randomUUID(),
                VirtualHost.class.getSimpleName(), attributes1, childrenIds, store);

        assertTrue(entry1.equals(entry2));
        assertFalse("Entries should be different because of different IDs", entry1.equals(entryWithDifferentId));

        ConfigurationEntry entryWithDifferentChildId = new ConfigurationEntry(id,
                VirtualHost.class.getSimpleName(), attributes1, Collections.singleton(UUID.randomUUID()), store);
        assertFalse("Entries should be different because of different children", entry1.equals(entryWithDifferentChildId));

        ConfigurationEntry entryWithDifferentName = new ConfigurationEntry(id,
                VirtualHost.class.getSimpleName(), attributes2, childrenIds, store);
        assertFalse("Entries should be different because of different attributes", entry1.equals(entryWithDifferentName));

        ConfigurationEntry entryWithDifferentType = new ConfigurationEntry(id,
                Broker.class.getSimpleName(), attributes1, childrenIds, store);
        assertFalse("Entries should be different because of different types", entry1.equals(entryWithDifferentType));
    }
View Full Code Here

    public void testCreateBrokerWithMultipleAuthenticationProvidersAndPorts()
    {
        //Create a second authentication provider
        AuthenticationProvider authenticationProvider2 = mock(AuthenticationProvider.class);
        when(authenticationProvider2.getName()).thenReturn("authenticationProvider2");
        ConfigurationEntry authenticationProviderEntry2 = mock(ConfigurationEntry.class);
        _brokerEntryChildren.put(AuthenticationProvider.class.getSimpleName(), Arrays.asList(_authenticationProviderEntry1, authenticationProviderEntry2));

        //Add a couple ports
        ConfigurationEntry portEntry1 = mock(ConfigurationEntry.class);
        Port port1 = mock(Port.class);
        when(port1.getId()).thenReturn(UUIDGenerator.generateRandomUUID());
        when(port1.getName()).thenReturn("port1");
        when(port1.getPort()).thenReturn(5671);
        when(port1.getAttribute(Port.AUTHENTICATION_PROVIDER)).thenReturn("authenticationProvider1");
        ConfigurationEntry portEntry2 = mock(ConfigurationEntry.class);
        Port port2 = mock(Port.class);
        when(port2.getId()).thenReturn(UUIDGenerator.generateRandomUUID());
        when(port2.getName()).thenReturn("port2");
        when(port2.getPort()).thenReturn(5672);
        when(port2.getAttribute(Port.AUTHENTICATION_PROVIDER)).thenReturn("authenticationProvider2");
View Full Code Here

        assertTrue(ports.contains(port2));
    }

    public void testCreateBrokerWithGroupProvider()
    {
        ConfigurationEntry groupProviderEntry = mock(ConfigurationEntry.class);
        GroupProvider groupProvider = mock(GroupProvider.class);
        _brokerEntryChildren.put(GroupProvider.class.getSimpleName(), Arrays.asList(groupProviderEntry));

        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{groupProviderEntry, _authenticationProviderEntry1},
                                                                     new ConfiguredObject[]{groupProvider, _authenticationProvider1});
View Full Code Here

        assertEquals(Collections.singletonList(groupProvider), broker.getGroupProviders());
    }

    public void testCreateBrokerWithPlugins()
    {
        ConfigurationEntry pluginEntry = mock(ConfigurationEntry.class);
        Plugin plugin = mock(Plugin.class);
        _brokerEntryChildren.put(Plugin.class.getSimpleName(), Arrays.asList(pluginEntry));

        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{pluginEntry, _authenticationProviderEntry1},
                                                                     new ConfiguredObject[]{plugin, _authenticationProvider1});
View Full Code Here

        assertEquals(Collections.singleton(plugin), new HashSet<ConfiguredObject>(broker.getChildren(Plugin.class)));
    }

    public void testCreateBrokerWithKeyStores()
    {
        ConfigurationEntry pluginEntry = mock(ConfigurationEntry.class);
        KeyStore keyStore = mock(KeyStore.class);
        _brokerEntryChildren.put(KeyStore.class.getSimpleName(), Arrays.asList(pluginEntry));

        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{pluginEntry, _authenticationProviderEntry1},
                                                                     new ConfiguredObject[]{keyStore, _authenticationProvider1});
View Full Code Here

        assertEquals(Collections.singleton(keyStore), new HashSet<ConfiguredObject>(broker.getChildren(KeyStore.class)));
    }

    public void testCreateBrokerWithTrustStores()
    {
        ConfigurationEntry pluginEntry = mock(ConfigurationEntry.class);
        TrustStore trustStore = mock(TrustStore.class);
        _brokerEntryChildren.put(TrustStore.class.getSimpleName(), Arrays.asList(pluginEntry));

        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{pluginEntry, _authenticationProviderEntry1},
                                                                     new ConfiguredObject[]{trustStore, _authenticationProvider1});
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.configuration.ConfigurationEntry

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.