public void alter_a_node()
        {
            var node1 = new TransportNode
            {
                Id = Guid.NewGuid().ToString(),
                MachineName = "Box1",
                NodeName = "Node1",
                Addresses = new Uri[] {"memory://1".ToUri(), "memory://2".ToUri()}
            };

            var node2 = new TransportNode
            {
                Id = Guid.NewGuid().ToString(),
                MachineName = "Box2",
                NodeName = "Node2",
                Addresses = new Uri[] {"memory://3".ToUri(), "memory://4".ToUri()}
            };

            var subject = "foo://1".ToUri();

            persistence.Persist(node1, node2);

            persistence.Alter(node1.Id, x => x.AddOwnership(subject));

            persistence.LoadNode(node1.Id).OwnedTasks
                .ShouldContain(subject);
        }
        public void find_local()
        {
            var local = new TransportNode(channelGraph);

            theRepository.Persist(local, new TransportNode{Id="Foo"}, new TransportNode{Id = "Bar"});

            theRepository.FindLocal().ShouldBeTheSameAs(local);
        }
 private void addNode(TransportNode transportNode)
 {
     AddBodyRow(row => {
         row.Cell(transportNode.Id.ToString());
         row.Cell(transportNode.MachineName);
         row.Cell(transportNode.NodeName);
         row.Cell(transportNode.Addresses.Select(x => x.ToString()).Join(", "));
     });
 }
        public void find_peer()
        {
            var local = new TransportNode(channelGraph);

            var fooNode = new TransportNode { Id = "Foo" };
            theRepository.Persist(local, fooNode, new TransportNode { Id = "Bar" });

            theRepository.FindPeer("Foo")
                .ShouldBeTheSameAs(fooNode);
        }
        public virtual void SendSubscriptionChangedToPeer(TransportNode node)
        {
            var envelope = new Envelope
            {
                Message = new SubscriptionsChanged(),
                Destination = node.Addresses.FirstOrDefault()
            };

            _sender.Send(envelope);
        }
        public virtual void SendSubscriptionChangedToPeer(TransportNode node)
        {
            var envelope = new Envelope
            {
                Message = new SubscriptionsChanged(),
                Destination = node.ControlChannel
            };

            _sender.Send(envelope);
        }
        public virtual void SendSubscriptionChangedToPeer(TransportNode node)
        {
            var envelope = new Envelope
            {
                Message     = new SubscriptionsChanged(),
                Destination = node.ControlChannel
            };

            _sender.Send(envelope);
        }
        public virtual void SendSubscriptionChangedToPeer(TransportNode node)
        {
            var envelope = new Envelope
            {
                Message     = new SubscriptionsChanged(),
                Destination = node.Addresses.FirstOrDefault()
            };

            _sender.Send(envelope);
        }
        public void record_multiple_ownerships_to_this_node()
        {
            var subjects = new Uri[] {"foo://1".ToUri(), "foo://2".ToUri(), "bar://1".ToUri()};

            var local = new TransportNode(channelGraph);

            var fooNode = new TransportNode { Id = "Foo" };
            theRepository.Persist(local, fooNode, new TransportNode { Id = "Bar" });

            theRepository.AddOwnershipToThisNode(subjects);

            local.OwnedTasks.ShouldHaveTheSameElementsAs(subjects);
        }
        public void record_ownership_to_this_node_singular()
        {
            var local = new TransportNode(channelGraph);

            var fooNode = new TransportNode { Id = "Foo" };
            theRepository.Persist(local, fooNode, new TransportNode { Id = "Bar" });

            var subject = "foo://1".ToUri();

            theRepository.AddOwnershipToThisNode(subject);

            local.OwnedTasks.ShouldContain(subject);
        }
Exemple #11
0
        public TransportPeer(HealthMonitoringSettings settings, TransportNode node, ISubscriptionRepository subscriptions, IServiceBus serviceBus, ILogger logger)
        {
            _settings = settings;
            _node = node;
            _subscriptions = subscriptions;
            _serviceBus = serviceBus;
            _logger = logger;

            if (!_node.Addresses.Any())
            {
                throw new ArgumentOutOfRangeException("node", "The TransportNode must have at least one reply Uri");
            }
        }
        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.ShouldBe(graph.NodeId);
        }
        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.ShouldBe("Service1");

            node.Addresses.OrderBy(x => x.ToString()).ShouldHaveTheSameElementsAs("bar://replies".ToUri(), "foo://replies".ToUri(), "memory://replies".ToUri());
        }
Exemple #14
0
 protected bool Equals(TransportNode other)
 {
     return(string.Equals(Id, other.Id));
 }
        public void load_a_specific_node()
        {
            var node1 = new TransportNode
            {
                Id = Guid.NewGuid().ToString(),
                MachineName = "Box1",
                NodeName = "Node1",
                Addresses = new Uri[] {"memory://1".ToUri(), "memory://2".ToUri()}
            };

            var node2 = new TransportNode
            {
                Id = Guid.NewGuid().ToString(),
                MachineName = "Box2",
                NodeName = "Node2",
                Addresses = new Uri[] {"memory://3".ToUri(), "memory://4".ToUri()}
            };

            persistence.Persist(node1, node2);

            persistence.LoadNode(node2.Id)
                .MachineName.ShouldBe(node2.MachineName);

            persistence.LoadNode(node1.Id)
                .MachineName.ShouldBe(node1.MachineName);
        }
        public void remove_ownership_from_the_current_node()
        {
            var local = new TransportNode(channelGraph);

            var fooNode = new TransportNode { Id = "Foo" };
            theRepository.Persist(local, fooNode, new TransportNode { Id = "Bar" });

            var subject = "foo://1".ToUri();
            local.AddOwnership(subject);

            theRepository.RemoveOwnershipFromThisNode(subject);

            local.OwnedTasks.ShouldNotContain(subject);
        }
        public void persist_and_load_transport_nodes()
        {
            var node1 = new TransportNode
            {
                Id = Guid.NewGuid().ToString(),
                MachineName = "Box1",
                NodeName = "Node1",
                Addresses = new Uri[] {"memory://1".ToUri(), "memory://2".ToUri()}
            };

            persistence.Persist(node1);

            var node2 = new TransportNode
            {
                Id = Guid.NewGuid().ToString(),
                MachineName = "Box2",
                NodeName = "Node2",
                Addresses = new Uri[] {"memory://3".ToUri(), "memory://4".ToUri()}
            };

            persistence.Persist(node2);

            persistence.NodesForGroup("Node1").Single()
                .ShouldBe(node1);

            persistence.NodesForGroup("Node2").Single()
                .ShouldBe(node2);
        }
 public TransportNodeItem(TransportNode node)
 {
     NodeName = node.NodeName;
     Address = node.Addresses.FirstOrDefault(x => x.Scheme == InMemoryChannel.Protocol).ToString();
 }
Exemple #19
0
 protected bool Equals(TransportNode other)
 {
     return string.Equals(Id, other.Id);
 }
 private TransportPeer toPeer(TransportNode node)
 {
     return new TransportPeer(_settings, node, _repository, _serviceBus, _logger);
 }
 private void addNode(TransportNode transportNode)
 {
     AddBodyRow(row => {
         row.Cell(transportNode.Id.ToString());
         row.Cell(transportNode.MachineName);
         row.Cell(transportNode.NodeName);
         row.Cell(transportNode.ControlChannel.ToString());
     });
 }