Package org.apache.qpid.server.configuration

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


                    @Override
                    public ConfiguredObject create(RecovererProvider recovererProvider, ConfigurationEntry entry, ConfiguredObject... parents)
                    {
                        for (int i = 0; i < entries.length; i++)
                        {
                            ConfigurationEntry e = entries[i];
                            if (entry == e)
                            {
                                return objectsToRecoverer[i];
                            }
                        }
View Full Code Here


        Map<String, Object> attributes = getTrustStoreAttributes();
        Map<String, Object> attributesCopy = new HashMap<String, Object>(attributes);

        UUID id = UUID.randomUUID();
        Broker broker = mock(Broker.class);
        ConfigurationEntry entry = mock(ConfigurationEntry.class);
        when(entry.getAttributes()).thenReturn(attributes);
        when(entry.getId()).thenReturn(id);

        TrustStoreRecoverer recoverer = new TrustStoreRecoverer();

        final TrustStore trustStore = recoverer.create(null, entry, broker);
        assertNotNull("Trust store configured object is not created", trustStore);
View Full Code Here

    {
        Map<String, Object> attributes = getTrustStoreAttributes();

        UUID id = UUID.randomUUID();
        Broker broker = mock(Broker.class);
        ConfigurationEntry entry = mock(ConfigurationEntry.class);
        when(entry.getAttributes()).thenReturn(attributes);
        when(entry.getId()).thenReturn(id);

        TrustStoreRecoverer recoverer = new TrustStoreRecoverer();

        String[] mandatoryProperties = {TrustStore.NAME, TrustStore.PATH, TrustStore.PASSWORD};
        for (int i = 0; i < mandatoryProperties.length; i++)
        {
            Map<String, Object> properties =  new HashMap<String, Object>(attributes);
            properties.remove(mandatoryProperties[i]);
            when(entry.getAttributes()).thenReturn(properties);
            try
            {
                recoverer.create(null, entry, broker);
                fail("Cannot create key store without a " + mandatoryProperties[i]);
            }
View Full Code Here

            preferencesAttributes.put(PreferencesProvider.TYPE, FileSystemPreferencesProvider.PROVIDER_TYPE);
            preferencesAttributes.put(PreferencesProvider.NAME, "test-provider");
            File file = TestFileUtils.createTempFile(this, ".prefs.json",
                    "{\"test_user\":{\"pref1\": \"pref1Value\", \"pref2\": 1.0} }");
            preferencesAttributes.put(FileSystemPreferencesProvider.PATH, file.getAbsolutePath());
            ConfigurationEntry preferencesEntry = new ConfigurationEntry(preferencesId, PreferencesProvider.class.getSimpleName(),
                    preferencesAttributes, Collections.<UUID> emptySet(), _configurationStore);
            when(_configurationStore.getEntry(preferencesId)).thenReturn(preferencesEntry);

            ConfigurationEntry authenticationProviderEntry = new ConfigurationEntry(authenticationId,
                    AuthenticationProvider.class.getSimpleName(), authenticationAttributes, Collections.singleton(preferencesId),
                    _configurationStore);
            try
            {
                AuthenticationProvider authenticationProvider = _recoverer.create(recovererProvider, authenticationProviderEntry,
View Full Code Here

        Map<String, Object> attributes = getKeyStoreAttributes();
        Map<String, Object> attributesCopy = new HashMap<String, Object>(attributes);

        UUID id = UUID.randomUUID();
        Broker broker = mock(Broker.class);
        ConfigurationEntry entry = mock(ConfigurationEntry.class);
        when(entry.getAttributes()).thenReturn(attributes);
        when(entry.getId()).thenReturn(id);

        KeyStoreRecoverer recoverer = new KeyStoreRecoverer();
        final KeyStore keyStore = recoverer.create(null, entry, broker);

        assertNotNull("Key store configured object is not created", keyStore);
View Full Code Here

    {
        Map<String, Object> attributes = getKeyStoreAttributes();

        UUID id = UUID.randomUUID();
        Broker broker = mock(Broker.class);
        ConfigurationEntry entry = mock(ConfigurationEntry.class);
        when(entry.getId()).thenReturn(id);

        KeyStoreRecoverer recoverer = new KeyStoreRecoverer();

        String[] mandatoryProperties = {KeyStore.NAME, KeyStore.PATH, KeyStore.PASSWORD};
        for (int i = 0; i < mandatoryProperties.length; i++)
        {
            Map<String, Object> properties =  new HashMap<String, Object>(attributes);
            properties.remove(mandatoryProperties[i]);
            when(entry.getAttributes()).thenReturn(properties);
            try
            {
                recoverer.create(null, entry, broker);
                fail("Cannot create key store without a " + mandatoryProperties[i]);
            }
View Full Code Here

{
    public void testCreate()
    {
        StatisticsGatherer statisticsGatherer = mock(StatisticsGatherer.class);
        SecurityManager securityManager = mock(SecurityManager.class);
        ConfigurationEntry entry = mock(ConfigurationEntry.class);
        Broker parent = mock(Broker.class);
        when(parent.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(3000l);
        when(parent.getSecurityManager()).thenReturn(securityManager);

        VirtualHostRecoverer recoverer = new VirtualHostRecoverer(statisticsGatherer);
        Map<String, Object> attributes = new HashMap<String, Object>();
        String name = getName();
        attributes.put(VirtualHost.NAME, name);
        File file = TestFileUtils.createTempFile(this, ".xml", "<virtualhosts><virtualhost><name>" + name + "</name><" + name
                + "></" + name + "></virtualhost></virtualhosts>");
        attributes.put(VirtualHost.CONFIG_PATH, file.getAbsolutePath());
        when(entry.getAttributes()).thenReturn(attributes);

        VirtualHost host = recoverer.create(null, entry, parent);

        assertNotNull("Null is returned", host);
        assertEquals("Unexpected name", getName(), host.getName());
View Full Code Here

    public void testCreateVirtualHostFromStoreConfigAttributes()
    {
        StatisticsGatherer statisticsGatherer = mock(StatisticsGatherer.class);
        SecurityManager securityManager = mock(SecurityManager.class);
        ConfigurationEntry entry = mock(ConfigurationEntry.class);
        Broker parent = mock(Broker.class);
        when(parent.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(3000l);
        when(parent.getSecurityManager()).thenReturn(securityManager);

        VirtualHostRecoverer recoverer = new VirtualHostRecoverer(statisticsGatherer);
        Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put(VirtualHost.NAME, getName());
        attributes.put(VirtualHost.TYPE, StandardVirtualHostFactory.TYPE);

        attributes.put(VirtualHost.STORE_TYPE, "TESTMEMORY");
        when(entry.getAttributes()).thenReturn(attributes);

        VirtualHost host = recoverer.create(null, entry, parent);

        assertNotNull("Null is returned", host);
        assertEquals("Unexpected name", getName(), host.getName());
View Full Code Here

    public void checkMandatoryAttributesAreValidated(String[] mandatoryAttributes, Map<String, Object> attributes)
    {
        StatisticsGatherer statisticsGatherer = mock(StatisticsGatherer.class);
        SecurityManager securityManager = mock(SecurityManager.class);
        ConfigurationEntry entry = mock(ConfigurationEntry.class);
        Broker parent = mock(Broker.class);
        when(parent.getSecurityManager()).thenReturn(securityManager);
        VirtualHostRecoverer recoverer = new VirtualHostRecoverer(statisticsGatherer);

        for (String name : mandatoryAttributes)
        {
            Map<String, Object> copy = new HashMap<String, Object>(attributes);
            copy.remove(name);
            when(entry.getAttributes()).thenReturn(copy);
            try
            {
                recoverer.create(null, entry, parent);
                fail("Cannot create a virtual host without a mandatory attribute " + name);
            }
View Full Code Here

        }
    }

    public void testGetEntry()
    {
        ConfigurationEntry authenticationProviderConfigEntry = _store.getEntry(_authenticationProviderId);
        assertNotNull("Provider with id " + _authenticationProviderId + " should exist", authenticationProviderConfigEntry);
        assertEquals("Unexpected id", _authenticationProviderId, authenticationProviderConfigEntry.getId());
        assertEquals("Unexpected type ", AuthenticationProvider.class.getSimpleName(), authenticationProviderConfigEntry.getType());
        Map<String, Object> attributes = authenticationProviderConfigEntry.getAttributes();
        assertNotNull("Attributes cannot be null", attributes);
        assertEquals("Unexpected attributes", _authenticationProviderAttributes, attributes);
    }
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.