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.ShouldEqual(node2.MachineName); persistence.LoadNode(node1.Id) .MachineName.ShouldEqual(node1.MachineName); }
public void persist_and_load_transport_nodes() { var node1 = new TransportNode { Id = Guid.NewGuid(), MachineName = "Box1", NodeName = "Node1", Addresses = new Uri[] { "memory://1".ToUri(), "memory://2".ToUri() } }; persistence.Persist(node1); var node2 = new TransportNode { Id = Guid.NewGuid(), MachineName = "Box2", NodeName = "Node2", Addresses = new Uri[] { "memory://3".ToUri(), "memory://4".ToUri() } }; persistence.Persist(node2); persistence.NodesForGroup("Node1").Single() .ShouldEqual(node1); persistence.NodesForGroup("Node2").Single() .ShouldEqual(node2); }
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); }
public void Persist(TransportNode node) { if (node.Id == Guid.Empty) { node.Id = Guid.NewGuid(); } _nodes.Fill(node); }
public void SaveTransportNode() { var node = new TransportNode(_graph); if (!FindPeers().Contains(node)) { node.Id = Guid.NewGuid(); _persistence.Persist(node); } }
public virtual void SendSubscriptionChangedToPeer(TransportNode node) { var envelope = new Envelope { Message = new SubscriptionsChanged(), Destination = node.Addresses.FirstOrDefault() }; _sender.Send(envelope); }
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 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); }
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.ShouldEqual(graph.NodeId); }
public void remove_ownership_from_a_different_node() { var subject = "foo://1".ToUri(); var local = new TransportNode(channelGraph); var fooNode = new TransportNode { Id = "Foo" }; fooNode.AddOwnership(subject); theRepository.Persist(local, fooNode, new TransportNode { Id = "Bar" }); theRepository.RemoveOwnershipFromNode(fooNode.Id, subject); fooNode.OwnedTasks.ShouldNotContain(subject); }
public void equals_positive() { var node1 = new TransportNode { Addresses = new Uri[] {"foo://1".ToUri(), "bar://1".ToUri()} }; var node2 = new TransportNode { Addresses = new Uri[] { "bar://1".ToUri(), "foo://1".ToUri() } }; node1.ShouldEqual(node2); node2.ShouldEqual(node1); }
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 TransportNodeItem(TransportNode node) { NodeName = node.NodeName; Address = node.Addresses.FirstOrDefault(x => x.Scheme == InMemoryChannel.Protocol).ToString(); }
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(", ")); }); }
protected bool Equals(TransportNode other) { return(string.Equals(Id, other.Id)); }
protected bool Equals(TransportNode other) { return _addresses.OrderBy(x => x.ToString()).SequenceEqual(other._addresses.OrderBy(x => x.ToString())); }
protected bool Equals(TransportNode other) { return string.Equals(Id, other.Id); }
public void Persist(TransportNode node) { _transaction.Execute<IDocumentSession>(x => x.Store(node)); }
private TransportPeer toPeer(TransportNode node) { return new TransportPeer(_settings, node, _repository, _serviceBus, _logger); }