Package org.apache.qpid.server.model

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


    {

        Broker<?> broker = createBrokerMock();
        ConfiguredObjectFactory objectFactory = broker.getObjectFactory();

        VirtualHostNode virtualHostNode = mock(VirtualHostNode.class);
        when(virtualHostNode.getTaskExecutor()).thenReturn(TASK_EXECUTOR);

        when(virtualHostNode.getParent(eq(Broker.class))).thenReturn(broker);

        DurableConfigurationStore dcs = mock(DurableConfigurationStore.class);
        when(virtualHostNode.getConfigurationStore()).thenReturn(dcs);
        when(virtualHostNode.getParent(eq(VirtualHostNode.class))).thenReturn(virtualHostNode);
        when(virtualHostNode.getModel()).thenReturn(objectFactory.getModel());
        when(virtualHostNode.getObjectFactory()).thenReturn(objectFactory);
        when(virtualHostNode.getCategoryClass()).thenReturn(VirtualHostNode.class);
        when(virtualHostNode.getTaskExecutor()).thenReturn(TASK_EXECUTOR);
        AbstractVirtualHost host = (AbstractVirtualHost) objectFactory.create(VirtualHost.class, attributes, virtualHostNode );
        host.start();

        return host;
    }
View Full Code Here


        aliases.addAll(getChildren(VirtualHostAlias.class));

        for(VirtualHostAlias alias : aliases)
        {
            VirtualHostNode vhn = alias.getVirtualHostNode(name);
            if (vhn != null)
            {
                return (VirtualHostImpl) vhn.getVirtualHost();
            }
        }
        return null;
    }
View Full Code Here

    public static VirtualHostImpl<?, ?, ?> createVirtualHost(final Map<String, Object> attributes,
                                                                final Broker<?> broker)
    {
        ConfiguredObjectFactory objectFactory = broker.getObjectFactory();

        VirtualHostNode virtualHostNode = mock(VirtualHostNode.class);
        when(virtualHostNode.getName()).thenReturn((String) attributes.get(VirtualHostNode.NAME));
        when(virtualHostNode.getTaskExecutor()).thenReturn(TASK_EXECUTOR);

        when(virtualHostNode.getParent(eq(Broker.class))).thenReturn(broker);

        Collection<VirtualHostNode<?>> nodes = broker.getVirtualHostNodes();
        nodes = new ArrayList<>(nodes != null ?  nodes : Collections.<VirtualHostNode<?>>emptyList());
        nodes.add(virtualHostNode);
        when(broker.getVirtualHostNodes()).thenReturn(nodes);

        DurableConfigurationStore dcs = mock(DurableConfigurationStore.class);
        when(virtualHostNode.getConfigurationStore()).thenReturn(dcs);
        when(virtualHostNode.getParent(eq(VirtualHostNode.class))).thenReturn(virtualHostNode);
        when(virtualHostNode.getModel()).thenReturn(objectFactory.getModel());
        when(virtualHostNode.getObjectFactory()).thenReturn(objectFactory);
        when(virtualHostNode.getCategoryClass()).thenReturn(VirtualHostNode.class);
        when(virtualHostNode.getTaskExecutor()).thenReturn(TASK_EXECUTOR);
        AbstractVirtualHost
                host = (AbstractVirtualHost) objectFactory.create(VirtualHost.class, attributes, virtualHostNode );
        host.start();
        when(virtualHostNode.getVirtualHost()).thenReturn(host);
        return host;
    }
View Full Code Here

                registerMBean(host, _pluginMBeanProvider, mbean);
                return mbean;
            }
            catch (InstanceAlreadyExistsException e)
            {
                VirtualHostNode parent = host.getParent(VirtualHostNode.class);
                Set<ConfiguredObject<?>> registered = _children.keySet();
                for (ConfiguredObject<?> object: registered)
                {
                    if (object instanceof VirtualHost && object.getParent(VirtualHostNode.class) == parent)
                    {
View Full Code Here

TOP

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

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.