Package org.apache.qpid.server.model

Examples of org.apache.qpid.server.model.Broker


        return provider;
    }

    public void testCreatePasswordCredentialManagingAuthenticationProviderFailsWhenAnotherOneAlready()
    {
        Broker broker = mock(Broker.class);
        PasswordCredentialManagingAuthenticationProvider anotherProvider = mock(PasswordCredentialManagingAuthenticationProvider.class);
        when(broker.getAuthenticationProviders()).thenReturn(Collections.<AuthenticationProvider>singleton(anotherProvider));

        QpidServiceLoader<AuthenticationManagerFactory> loader = mock(QpidServiceLoader.class);
        AuthenticationManagerFactory managerFactory = mock(AuthenticationManagerFactory.class);
        when(managerFactory.createInstance(any(Map.class))).thenReturn(mock(PrincipalDatabaseAuthenticationManager.class));
        when(loader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(Collections.singleton(managerFactory));
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    public void testCreateNonPasswordCredentialManagingAuthenticationProviderWhenAnotherOneAlreadyExist()
    {
        Broker broker = mock(Broker.class);
        AuthenticationProvider anotherProvider = mock(AuthenticationProvider.class);
        when(broker.getAuthenticationProviders()).thenReturn(Collections.singleton(anotherProvider));

        QpidServiceLoader<AuthenticationManagerFactory> loader = mock(QpidServiceLoader.class);
        AuthenticationManagerFactory managerFactory = mock(AuthenticationManagerFactory.class);
        when(managerFactory.createInstance(any(Map.class))).thenReturn(mock(AuthenticationManager.class));
        when(loader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(Collections.singleton(managerFactory));
View Full Code Here

    public static Broker createBrokerMock()
    {
        SubjectCreator subjectCreator = mock(SubjectCreator.class);
        when(subjectCreator.getMechanisms()).thenReturn("");
        Broker broker = mock(Broker.class);
        when(broker.getAttribute(Broker.CONNECTION_SESSION_COUNT_LIMIT)).thenReturn(1);
        when(broker.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(10000l);
        when(broker.getId()).thenReturn(UUID.randomUUID());
        when(broker.getSubjectCreator(any(SocketAddress.class))).thenReturn(subjectCreator);
        RootMessageLogger rootMessageLogger = CurrentActor.get().getRootMessageLogger();
        when(broker.getRootMessageLogger()).thenReturn(rootMessageLogger);
        when(broker.getVirtualHostRegistry()).thenReturn(new VirtualHostRegistry());
        when(broker.getSecurityManager()).thenReturn(new SecurityManager(mock(Broker.class), false));
        GenericActor.setDefaultMessageLogger(rootMessageLogger);
        return broker;
    }
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 recovever = new KeyStoreRecoverer();
View Full Code Here

    public void testCreateWithMissedRequiredAttributes()
    {
        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 recovever = new KeyStoreRecoverer();
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);
View Full Code Here

    public void testCreateVirtualHostFromStoreConfigAtrributes()
    {
        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.STORE_PATH, "/path/to/virtualhost/store");
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);
View Full Code Here

    }


    private VirtualHost createVirtualHost(String vhostName, File config) throws Exception
    {
        Broker broker = BrokerTestHelper.createBrokerMock();
        _virtualHostRegistry = broker.getVirtualHostRegistry();

        VirtualHostConfiguration configuration = new  VirtualHostConfiguration(vhostName, config, broker);
        VirtualHost host = new VirtualHostImpl(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(mock(Broker.class), false), configuration);
        _virtualHostRegistry.registerVirtualHost(host);
View Full Code Here

        return tmpFile;
    }

    private VirtualHost createVirtualHostUsingStoreType(String virtualHostName) throws ConfigurationException, Exception
    {
        Broker broker = BrokerTestHelper.createBrokerMock();
        _virtualHostRegistry = broker.getVirtualHostRegistry();

        Configuration config = new PropertiesConfiguration();
        config.setProperty("store.type", MemoryMessageStore.TYPE);
        VirtualHostConfiguration configuration = new  VirtualHostConfiguration(virtualHostName, config, broker);
        VirtualHost host = new VirtualHostImpl(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(mock(Broker.class), false), configuration);
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.model.Broker

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.