internal void DistributeTo(AttributeSet set, IEnumerable <Node> nodes) { var create = new CreateAttributeSet(_node, set); var confirmable = _confirmables.UnconfirmedFor(create, nodes); _outbound.Application(ApplicationSays.From(_node.Id, _node.Name, create.ToPayload()), confirmable.UnconfirmedNodes); _application.InformAttributeSetCreated(set.Name); foreach (var tracked in set.All) { DistributeTo(set, tracked, ApplicationMessageType.AddAttribute, nodes); } }
public void TestInboundStreamInterestCreateAttributeSet() { var inboundStreamInterest = TestWorld.ActorFor <IInboundStreamInterest>( () => new AttributesAgentActor(_localNode, Application, _outboundStream.Actor, Config, _interest)); var message = CreateAttributeSet.From(_localNode, _set); inboundStreamInterest.Actor.HandleInboundStreamMessage(AddressType.Op, RawMessageFor(_localNodeId, _localNode.Name, message)); var channel1 = _channelProvider.ChannelFor(_localNodeId); Assert.Single(Mock(channel1).Writes); Assert.Equal(1, Application.InformAttributeSetCreatedCheck.Get()); }
public void TestInboundStreamInterestRemoveAttributeSet() { var inboundStreamInterest = TestWorld.ActorFor <IInboundStreamInterest>( Definition.Has <AttributesAgentActor>( Definition.Parameters(_localNode, Application, _outboundStream.Actor, Config, _interest))); var createMessage = CreateAttributeSet.From(_localNode, _set); inboundStreamInterest.Actor.HandleInboundStreamMessage(AddressType.Op, RawMessageFor(_localNodeId, _localNode.Name, createMessage)); var removeMessage = RemoveAttributeSet.From(_localNode, _set); inboundStreamInterest.Actor.HandleInboundStreamMessage(AddressType.Op, RawMessageFor(_localNodeId, _localNode.Name, removeMessage)); var channel1 = _channelProvider.ChannelFor(_localNodeId); Assert.Equal(2, Mock(channel1).Writes.Count); Assert.Equal(1, Application.InformAttributeSetCreatedCheck.Get()); Assert.Equal(1, Application.InformAttributeSetRemovedCheck.Get()); }