Esempio n. 1
0
        public void SetUp()
        {
            persistence  = new InMemorySubscriptionPersistence();
            channelGraph = new ChannelGraph {
                Name = TheNodeName
            };
            channelGraph.AddReplyChannel("foo", "foo://replies".ToUri());
            channelGraph.AddReplyChannel("bar", "bar://replies".ToUri());

            theRepository = new SubscriptionRepository(channelGraph, persistence);
        }
        public void SetUp()
        {
            theGraph = new ChannelGraph { Name = "FooNode" };

            var requirement = new LocalSubscriptionRequirement<BusSettings>(x => x.Upstream);
            requirement.AddType(typeof(FooMessage));
            requirement.AddType(typeof(BarMessage));

            theLocalReplyUri = InMemoryTransport.ReplyUriForGraph(theGraph);

            theGraph.AddReplyChannel("Fake2", "fake2://2".ToUri());
            theGraph.AddReplyChannel(InMemoryChannel.Protocol, theLocalReplyUri);
            theGraph.AddReplyChannel("Fake1", "fake1://1".ToUri());

            theSubscriptions = requirement.Determine(theSettings, theGraph);
        }
        public void SetUp()
        {
            peers.ClearAll();
            sources.ClearAll();

            theGraph = new ChannelGraph
            {
                NodeId = "Test@Local"
            };

            theGraph.AddReplyChannel("memory", "memory://1".ToUri());

            theCurrentNode = new TransportNode(theGraph);

            theLogger = new RecordingLogger();

            theSubscriptions = new SubscriptionRepository(theGraph, new InMemorySubscriptionPersistence());
            theSubscriptions.Persist(theCurrentNode);

            settings = new HealthMonitoringSettings
            {
                TaskAvailabilityCheckTimeout = 5.Seconds(),
            };

            _controller = new Lazy <PersistentTaskController>(() => {
                var controller = new PersistentTaskController(theGraph, theLogger, this, sources.ToArray());

                sources.SelectMany(x => x.FakeTasks()).Select(x => x.Subject)
                .Each(subject => controller.FindAgent(subject));

                return(controller);
            });

            theContextIs();
        }
Esempio n. 4
0
        public void create_a_transport_node_from_a_channel_graph()
        {
            var graph = new ChannelGraph
            {
                Name = "Service1"
            };

            graph.AddReplyChannel("memory", "memory://replies".ToUri());
            graph.AddReplyChannel("foo", "foo://replies".ToUri());
            graph.AddReplyChannel("bar", "bar://replies".ToUri());

            var node = new TransportNode(graph);

            node.NodeName.ShouldEqual("Service1");

            node.Addresses.OrderBy(x => x.ToString()).ShouldHaveTheSameElementsAs("bar://replies".ToUri(), "foo://replies".ToUri(), "memory://replies".ToUri());
        }
Esempio n. 5
0
        public void create_a_transport_node_from_a_channel_graph()
        {
            var graph = new ChannelGraph
            {
                Name = "Service1"
            };

            graph.AddReplyChannel("memory", "memory://replies".ToUri());
            graph.AddReplyChannel("foo", "foo://replies".ToUri());
            graph.AddReplyChannel("bar", "bar://replies".ToUri());

            var node = new TransportNode(graph);

            node.NodeName.ShouldEqual("Service1");

            node.Addresses.OrderBy(x => x.ToString()).ShouldHaveTheSameElementsAs("bar://replies".ToUri(), "foo://replies".ToUri(), "memory://replies".ToUri());
        }
        public void SetUp()
        {
            theGraph = new ChannelGraph {
                Name = "FooNode"
            };

            var requirement = new LocalSubscriptionRequirement <BusSettings>(x => x.Upstream);

            requirement.AddType(typeof(FooMessage));
            requirement.AddType(typeof(BarMessage));

            theLocalReplyUri = InMemoryTransport.ReplyUriForGraph(theGraph);

            theGraph.AddReplyChannel("Fake2", "fake2://2".ToUri());
            theGraph.AddReplyChannel(InMemoryChannel.Protocol, theLocalReplyUri);
            theGraph.AddReplyChannel("Fake1", "fake1://1".ToUri());

            theSubscriptions = requirement.Determine(theSettings, theGraph);
        }
Esempio n. 7
0
        public void OpenChannels(ChannelGraph graph)
        {
            var nodes = graph.NodesForProtocol(Protocol).ToArray();

            if (Disabled(nodes)) return;

            nodes.OrderByDescending(x => x.Incoming).Each(x => x.Channel = buildChannel(x));
            seedQueues(nodes);

            graph.AddReplyChannel(Protocol, getReplyUri(graph));
        }
Esempio n. 8
0
        public void build_with_channel_graph_sets_the_id_to_the_node_id()
        {
            var graph = new ChannelGraph
            {
                NodeId = "Foo@Bar"
            };

            graph.AddReplyChannel(InMemoryChannel.Protocol, "memory://localhost/replies".ToUri());

            var node = new TransportNode(graph);

            node.Id.ShouldEqual(graph.NodeId);
        }
Esempio n. 9
0
        public void build_with_channel_graph_sets_the_id_to_the_node_id()
        {
            var graph = new ChannelGraph
            {
                NodeId = "Foo@Bar"

            };

            graph.AddReplyChannel(InMemoryChannel.Protocol, "memory://localhost/replies".ToUri());

            var node = new TransportNode(graph);

            node.Id.ShouldEqual(graph.NodeId);
        }
Esempio n. 10
0
        public void OpenChannels(ChannelGraph graph)
        {
            var nodes = graph.NodesForProtocol(Protocol).ToArray();

            if (Disabled(nodes))
            {
                return;
            }

            nodes.OrderByDescending(x => x.Incoming).Each(x => x.Channel = buildChannel(x));
            seedQueues(nodes);

            graph.AddReplyChannel(Protocol, getReplyUri(graph));
        }
Esempio n. 11
0
        public void fallback_to_the_first_incoming_channel_for_control_queue_if_no_explicit_control_queue_exists()
        {
            var graph = new ChannelGraph
            {
                NodeId = "Foo@Bar"
            };

            graph.AddReplyChannel(InMemoryChannel.Protocol, "memory://localhost/replies".ToUri());

            //graph.ControlChannel = new ChannelNode { Uri = "memory://1".ToUri() };

            var node = new TransportNode(graph);

            node.ControlChannel.ShouldBe("memory://localhost/replies".ToUri());
        }
Esempio n. 12
0
        public void use_the_explicit_control_queue_if_it_exists()
        {
            var graph = new ChannelGraph
            {
                NodeId = "Foo@Bar"
            };

            graph.AddReplyChannel(InMemoryChannel.Protocol, "memory://localhost/replies".ToUri());

            graph.ControlChannel = new ChannelNode {
                Uri = "memory://1".ToUri()
            };

            var node = new TransportNode(graph);

            node.ControlChannel.ShouldBe("memory://1".ToUri());
        }
        public void SetUp()
        {
            persistence = new InMemorySubscriptionPersistence();
            channelGraph = new ChannelGraph{Name = TheNodeName};
            channelGraph.AddReplyChannel("foo", "foo://replies".ToUri());
            channelGraph.AddReplyChannel("bar", "bar://replies".ToUri());

            theRepository = new SubscriptionRepository(channelGraph, persistence);
        }