Package org.apache.qpid.server.configuration

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


        assertNull("Second virtual host configuration should be removed", _store.getEntry(virtualHost2Id));
    }

    public void testSaveBroker()
    {
        ConfigurationEntry brokerConfigEntry = _store.getRootEntry();
        Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put(Broker.DEFAULT_VIRTUAL_HOST, "test");
        attributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE, 19);
        attributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 18);
        attributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, 17);
        attributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE, 16);
        attributes.put(Broker.QUEUE_ALERT_REPEAT_GAP, 15);
        attributes.put(Broker.QUEUE_FLOW_CONTROL_SIZE_BYTES, 15);
        attributes.put(Broker.QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES, 13);
        attributes.put(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 12);
        attributes.put(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED, false);
        attributes.put(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 11);
        attributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, 11000);
        attributes.put(Broker.CONNECTION_HEART_BEAT_DELAY, 12000);
        attributes.put(Broker.STATISTICS_REPORTING_PERIOD, 14000);
        attributes.put(Broker.STATISTICS_REPORTING_RESET_ENABLED, false);
        ConfigurationEntry updatedBrokerEntry = new ConfigurationEntry(_brokerId, Broker.class.getSimpleName(), attributes,
                brokerConfigEntry.getChildrenIds(), _store);

        _store.save(updatedBrokerEntry);

        ConfigurationEntry newBrokerConfigEntry = _store.getRootEntry();
        assertNotNull("Root entry does not exist", newBrokerConfigEntry);
        assertEquals("Unexpected id", _brokerId, newBrokerConfigEntry.getId());
        assertEquals("Unexpected type ", Broker.class.getSimpleName(), newBrokerConfigEntry.getType());
        Map<String, Object> newBrokerattributes = newBrokerConfigEntry.getAttributes();
        assertNotNull("Attributes cannot be null", newBrokerattributes);
        assertEquals("Unexpected attributes", attributes, newBrokerattributes);
    }
View Full Code Here


    {
        Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
        virtualHostAttributes.put(VirtualHost.NAME, "test1");
        virtualHostAttributes.put(VirtualHost.CONFIG_PATH, "/path/to/phantom/virtualhost/config1");
        UUID virtualHostId = UUID.randomUUID();
        ConfigurationEntry hostEntry = new ConfigurationEntry(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
                Collections.<UUID> emptySet(), _store);

        _store.save(hostEntry);

        ConfigurationEntry configurationEntry = _store.getEntry(virtualHostId);
        assertEquals("Unexpected virtual host configuration", hostEntry, configurationEntry);
        assertEquals("Unexpected type", VirtualHost.class.getSimpleName(), configurationEntry.getType());
        assertEquals("Unexpected virtual host attributes", hostEntry.getAttributes(), configurationEntry.getAttributes());
        assertTrue("Unexpected virtual host children found", hostEntry.getChildrenIds().isEmpty());
    }
View Full Code Here

        assertTrue("Unexpected virtual host children found", hostEntry.getChildrenIds().isEmpty());
    }

    public void testSaveExistingVirtualHost()
    {
        ConfigurationEntry hostEntry = _store.getEntry(_virtualHostId);
        assertNotNull("Host configuration is not found", hostEntry);

        Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
        virtualHostAttributes.put(VirtualHost.NAME, "test");
        virtualHostAttributes.put(VirtualHost.CONFIG_PATH, "/path/to/new/phantom/test/configuration");

        ConfigurationEntry updatedEntry = new ConfigurationEntry(_virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
                hostEntry.getChildrenIds(), _store);
        _store.save(updatedEntry);

        ConfigurationEntry newHostEntry = _store.getEntry(_virtualHostId);
        assertEquals("Unexpected virtual host configuration", updatedEntry, newHostEntry);
        assertEquals("Unexpected type", VirtualHost.class.getSimpleName(), newHostEntry.getType());
        assertEquals("Unexpected virtual host attributes", updatedEntry.getAttributes(), newHostEntry.getAttributes());
        assertEquals("Unexpected virtual host children found", updatedEntry.getChildrenIds(), newHostEntry.getChildrenIds());
    }
View Full Code Here

            entryAttributes.put(attribute.getKey(), value);
        }

        when(_brokerEntry.getAttributes()).thenReturn(entryAttributes);

        final ConfigurationEntry virtualHostEntry = mock(ConfigurationEntry.class);
        String typeName = VirtualHost.class.getSimpleName();
        when(virtualHostEntry.getType()).thenReturn(typeName);
        _brokerEntryChildren.put(typeName, Arrays.asList(virtualHostEntry));
        final VirtualHost virtualHost = mock(VirtualHost.class);
        when(virtualHost.getName()).thenReturn("test");

        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[] { virtualHostEntry, _authenticationProviderEntry1 },
View Full Code Here

        }
    }

    public void testCreateBrokerWithVirtualHost()
    {
        final ConfigurationEntry virtualHostEntry = mock(ConfigurationEntry.class);

        String typeName = VirtualHost.class.getSimpleName();
        when(virtualHostEntry.getType()).thenReturn(typeName);
        _brokerEntryChildren.put(typeName, Arrays.asList(virtualHostEntry));

        final VirtualHost virtualHost = mock(VirtualHost.class);

        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{virtualHostEntry, _authenticationProviderEntry1},
View Full Code Here

    {
        UUID authenticationProviderId = UUID.randomUUID();
        Map<String, Object> authenticationProviderAttributes = new HashMap<String, Object>();
        authenticationProviderAttributes.put(AuthenticationProvider.NAME, "authenticationProvider1");
        authenticationProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, ExternalAuthenticationManager.class.getSimpleName());
        ConfigurationEntry providerEntry = new ConfigurationEntry(authenticationProviderId, AuthenticationProvider.class.getSimpleName(),
                authenticationProviderAttributes, Collections.<UUID> emptySet(), _store);

        _store.save(providerEntry);

        ConfigurationEntry storeEntry = _store.getEntry(authenticationProviderId);
        assertEquals("Unexpected provider configuration", providerEntry, storeEntry);
        assertEquals("Unexpected type", AuthenticationProvider.class.getSimpleName(), storeEntry.getType());
        assertEquals("Unexpected provider attributes", providerEntry.getAttributes(), storeEntry.getAttributes());
        assertTrue("Unexpected provider children found", storeEntry.getChildrenIds().isEmpty());
    }
View Full Code Here

        assertEquals(virtualHost, broker.getVirtualHosts().iterator().next());
    }

    public void testCreateBrokerWithPorts()
    {
        ConfigurationEntry portEntry = mock(ConfigurationEntry.class);
        Port port = mock(Port.class);
        _brokerEntryChildren.put(Port.class.getSimpleName(), Arrays.asList(portEntry));

        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{portEntry, _authenticationProviderEntry1},
                                                                     new ConfiguredObject[]{port, _authenticationProvider1});
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

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.