Package org.apache.qpid.server.configuration

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


    public void testCreateWithNullJson()
    {
        MemoryConfigurationEntryStore store = new MemoryConfigurationEntryStore(null, Collections.<String,String>emptyMap());

        ConfigurationEntry root = store.getRootEntry();
        assertNotNull("Root entry is not found", root);
    }
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 manadatory attribute " + name);
            }
View Full Code Here

        Map<String, Object> brokerAttributes = new HashMap<String, Object>();
        brokerAttributes.put(Broker.NAME, getTestName());
        MemoryConfigurationEntryStore  initialStoreFile = (MemoryConfigurationEntryStore)createStore(brokerId, brokerAttributes);
        MemoryConfigurationEntryStore store = new MemoryConfigurationEntryStore(null, initialStoreFile, Collections.<String,String>emptyMap());

        ConfigurationEntry root = store.getRootEntry();
        assertNotNull("Root entry is not found", root);
        assertEquals("Unexpected root entry", brokerId, root.getId());
        Map<String, Object> attributes = root.getAttributes();
        assertNotNull("Attributes not found", attributes);
        assertEquals("Unexpected number of attriburtes", 1, attributes.size());
        assertEquals("Unexpected name attribute", getTestName(), attributes.get(Broker.NAME));
    }
View Full Code Here

            // set the properties in order to resolve the defaults store settings
            setTestSystemProperty("QPID_HOME", TMP_FOLDER);
            setTestSystemProperty("QPID_WORK", TMP_FOLDER + File.separator + "work");
        }
        MemoryConfigurationEntryStore initialStore = new MemoryConfigurationEntryStore(BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, null, new BrokerOptions().getConfigProperties());
        ConfigurationEntry initialStoreRoot = initialStore.getRootEntry();
        assertNotNull("Initial store root entry is not found", initialStoreRoot);

         MemoryConfigurationEntryStore store = new MemoryConfigurationEntryStore(null, initialStore, Collections.<String,String>emptyMap());

        ConfigurationEntry root = store.getRootEntry();
        assertNotNull("Root entry is not found", root);

        assertEquals("Unexpected broker attributes", initialStoreRoot.getAttributes(), root.getAttributes());
        assertEquals("Unexpected broker children", initialStoreRoot.getChildrenIds(), root.getChildrenIds());
    }
View Full Code Here

        return host;
    }

    private VirtualHost createHost(Map<String, Object> attributes)
    {
        ConfigurationEntry entry = new ConfigurationEntry(UUID.randomUUID(), VirtualHost.class.getSimpleName(), attributes,
                Collections.<UUID> emptySet(), null);

        return new VirtualHostRecoverer(_statisticsGatherer).create(_recovererProvider, entry, _broker);
    }
View Full Code Here

        return setObjectAttribute(_store.getRootEntry(), name, value);
    }

    public boolean setObjectAttribute(String objectName, String attributeName, Object value)
    {
        ConfigurationEntry entry = findObjectByName(objectName);
        if (entry == null)
        {
            return false;
        }
        return setObjectAttribute(entry, attributeName, value);
View Full Code Here

        return setObjectAttribute(entry, attributeName, value);
    }

    public boolean setObjectAttributes(String objectName, Map<String, Object> attributes)
    {
        ConfigurationEntry entry = findObjectByName(objectName);
        if (entry == null)
        {
            return false;
        }
        return setObjectAttributes(entry, attributes);
View Full Code Here

        return true;
    }

    public UUID[] removeObjectConfiguration(String name)
    {
        ConfigurationEntry entry = findObjectByName(name);
        if (entry != null)
        {
            return _store.remove(entry.getId());
        }
        return null;
    }
View Full Code Here

    private boolean setObjectAttributes(ConfigurationEntry entry, Map<String, Object> attributes)
    {
        Map<String, Object> newAttributes = new HashMap<String, Object>(entry.getAttributes());
        newAttributes.putAll(attributes);
        ConfigurationEntry newEntry = new ConfigurationEntry(entry.getId(), entry.getType(), newAttributes,
                entry.getChildrenIds(), _store);
        _store.save(newEntry);
        return true;
    }
View Full Code Here

        return true;
    }

    private ConfigurationEntry findObjectByName(String objectName)
    {
        ConfigurationEntry root = _store.getRootEntry();
        return findObjectByName(root, objectName);
    }
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.