public void SendMessage() { Expect.Call(_requestChannel.Send(_messageMock)).Return(true); _mocks.ReplayAll(); _simpleMessagingGateway.Send(_messageMock); _mocks.VerifyAll(); }
public void TestAggregatorWithPojoCompletionStrategy() { IMessageChannel input = (IMessageChannel)_ctx.GetObject("aggregatorWithPojoCompletionStrategyInput"); EventDrivenConsumer endpoint = (EventDrivenConsumer)_ctx.GetObject("aggregatorWithPojoCompletionStrategy"); ICompletionStrategy completionStrategy = (ICompletionStrategy) TestUtils.GetFieldValue(TestUtils.GetFieldValue(endpoint, "_handler"), "_completionStrategy"); Assert.IsTrue(completionStrategy is CompletionStrategyAdapter); //DirectFieldAccessor completionStrategyAccessor = new DirectFieldAccessor(completionStrategy); IMethodInvoker invoker = (IMethodInvoker)TestUtils.GetFieldValue(completionStrategy, "_invoker"); Assert.IsTrue(TestUtils.GetFieldValue(invoker, "_obj") is MaxValueCompletionStrategy); Assert.IsTrue( ((MethodInfo)TestUtils.GetFieldValue(completionStrategy, "_method")).Name.Equals("CheckCompleteness")); input.Send(CreateMessage(1l, "id1", 0, 0, null)); input.Send(CreateMessage(2l, "id1", 0, 0, null)); input.Send(CreateMessage(3l, "id1", 0, 0, null)); IPollableChannel outputChannel = (IPollableChannel)_ctx.GetObject("outputChannel"); IMessage reply = outputChannel.Receive(TimeSpan.Zero); Assert.IsNull(reply); input.Send(CreateMessage(5l, "id1", 0, 0, null)); reply = outputChannel.Receive(TimeSpan.Zero); Assert.IsNotNull(reply); Assert.That(reply.Payload, Is.EqualTo(11l)); }
public void TestDatatypeChannelWithAssignableSubTypes() { IApplicationContext ctx = TestUtils.GetContext(@"Channel\Config\ChannelParserTests.xml"); IMessageChannel channel = (IMessageChannel)ctx.GetObject("numberChannel"); Assert.IsTrue(channel.Send(new Message <int>(123))); Assert.IsTrue(channel.Send(new Message <double>(123.45))); }
public void TestMultipleDatatypeChannelWithCorrectTypes() { IApplicationContext ctx = TestUtils.GetContext(@"Channel\Config\ChannelParserTests.xml"); IMessageChannel channel = (IMessageChannel)ctx.GetObject("stringOrNumberChannel"); Assert.IsTrue(channel.Send(new Message <double>(123.45))); Assert.IsTrue(channel.Send(new StringMessage("accepted type"))); }
public void MultipleTypes() { IMessageChannel channel = CreateChannel(typeof(string), typeof(int)); Assert.True(channel.Send(Message.Create("test1"))); Assert.True(channel.Send(Message.Create <int>(2))); Exception exception = null; try { channel.Send(Message.Create <DateTime>(default));
public void TestChannelWithCapacity() { IApplicationContext ctx = TestUtils.GetContext(@"Channel\Config\ChannelParserTests.xml"); IMessageChannel channel = (IMessageChannel)ctx.GetObject("capacityChannel"); for (int i = 0; i < 10; i++) { bool result = channel.Send(new Message <string>("test"), TimeSpan.FromMilliseconds(10)); Assert.IsTrue(result); } Assert.IsFalse(channel.Send(new Message <string>("test"), TimeSpan.FromMilliseconds(3))); }
/// <summary> /// /// </summary> public virtual void Execute(ActivateProcessInstanceCmd cmd) { processEngine.Activate(cmd); ActivateProcessInstanceResults cmdResult = new ActivateProcessInstanceResults(cmd.Id); commandResults.Send(MessageBuilder <ActivateProcessInstanceResults> .WithPayload(cmdResult).Build()); }
public void TestDatatypeChannelWithIncorrectType() { IApplicationContext ctx = TestUtils.GetContext(@"Channel\Config\ChannelParserTests.xml"); IMessageChannel channel = (IMessageChannel)ctx.GetObject("integerChannel"); channel.Send(new StringMessage("incorrect type")); }
public override void Display() { base.Display(); var nodeId = Input.ReadInt("Enter node Id :", 1, 254); var dbNode = _unitOfWork.Nodes.Include(_ => _.Metadata).SingleOrDefault(_ => _.Id == nodeId); if (dbNode == null) { Output.WriteLine(ConsoleColor.Red, $"Node with id {nodeId} not found in database"); } else { var confirm = Input.ReadString($"Will send restart to node {dbNode.Metadata.Name}. Confirm (Y/N)?"); if (confirm != "Y") { Output.WriteLine(ConsoleColor.Red, "Cancelled"); } else { _msgChannel.Send(new RestartCommand { ToRfAddress = dbNode.RfAddress }); Output.WriteLine(ConsoleColor.Blue, "Restart sent"); } } Output.DisplayPrompt("Press any key"); Console.ReadKey(); Program.NavigateBack(); }
/// <summary> /// /// </summary> /// <param name="cmd"></param> public virtual void Execute(ReleaseTaskCmd cmd) { processEngine.ReleaseTask(cmd); ReleaseTaskResults cmdResult = new ReleaseTaskResults(cmd.Id); commandResults.Send(MessageBuilder <ReleaseTaskResults> .WithPayload(cmdResult).Build()); }
public void TestMultipleDatatypeChannelWithIncorrectType() { IApplicationContext ctx = TestUtils.GetContext(@"Channel\Config\ChannelParserTests.xml"); IMessageChannel channel = (IMessageChannel)ctx.GetObject("stringOrNumberChannel"); channel.Send(new Message <bool>(true)); }
public void Enviar(IMessageChannel canal, string content, string[] names) { foreach (Contact item in this.Search(names)) { canal.Send(canal.Mensajear(Owner, item, content)); } }
/// <summary> /// /// </summary> public virtual void Execute(CompleteTaskCmd cmd) { processEngine.CompleteTask(cmd); CompleteTaskResults cmdResult = new CompleteTaskResults(cmd.Id); commandResults.Send(MessageBuilder <CompleteTaskResults> .WithPayload(cmdResult).Build()); }
public void TestDatatypeChannelWithCorrectType() { IApplicationContext ctx = TestUtils.GetContext(@"Channel\Config\ChannelParserTests.xml"); IMessageChannel channel = (IMessageChannel)ctx.GetObject("integerChannel"); Assert.IsTrue(channel.Send(new Message <int>(123))); }
public void exceptionThrowingFilterRejects() { IApplicationContext ctx = TestUtils.GetContext(@"Config\FilterParserTests-context.xml"); IMessageChannel exceptionInput = (IMessageChannel)ctx.GetObject("exceptionInput"); exceptionInput.Send(new StringMessage("")); }
/// <summary> /// /// </summary> /// <param name="cmd"></param> public virtual void Execute(SignalCmd cmd) { processEngine.Signal(cmd); SignalProcessInstancesResults cmdResult = new SignalProcessInstancesResults(cmd.Id); commandResults.Send(MessageBuilder <SignalProcessInstancesResults> .WithPayload(cmdResult).Build()); }
public void Send(Contact contact, string text, IMessageChannel channel) { Message msg = new Message(this.Owner.Name, contact); msg.Text = text; channel.Send(msg); }
/// <summary> /// /// </summary> /// <param name="cmd"></param> public virtual void Execute(SetProcessVariablesCmd cmd) { processEngine.SetProcessVariables(cmd); SetProcessVariablesResults cmdResult = new SetProcessVariablesResults(cmd.Id); commandResults.Send(MessageBuilder <SetProcessVariablesResults> .WithPayload(cmdResult).Build()); }
public void SendMessage(ToStitchMessage message) { Assert.ArgNotNull(message, nameof(message)); var messageBuffer = _serializer.Serialize(message); _messageChannel.Send(messageBuffer); }
/// <summary> /// /// </summary> private void SendAuditEvent(IntegrationRequestEvent integrationRequestEvent) { if (runtimeBundleProperties.EventsProperties.IntegrationAuditEventsEnabled) { IntegrationRequestSentEventImpl @event = new IntegrationRequestSentEventImpl(runtimeBundleProperties.AppName, runtimeBundleProperties.AppVersion, runtimeBundleProperties.ServiceName, runtimeBundleProperties.ServiceFullName, runtimeBundleProperties.ServiceType, runtimeBundleProperties.ServiceVersion, integrationRequestEvent.ExecutionId, integrationRequestEvent.ProcessDefinitionId, integrationRequestEvent.ProcessInstanceId, integrationRequestEvent.IntegrationContextId, integrationRequestEvent.FlowNodeId); auditProducer.Send(MessageBuilder <IProcessEngineEvent[]> .WithPayload(new IProcessEngineEvent[] { @event }).Build()); } }
public void InvalidPayload() { IApplicationContext context = TestUtils.GetContext(@"Config\Xml\PayloadSerializingTransformerParserTests-context.xml"); IMessageChannel directInput = (IMessageChannel)context.GetObject("directInput"); directInput.Send(new Message <NonSerializableTestObject>(new NonSerializableTestObject())); }
public void SendMessage(IMessageChannel channel, IMessage message, string[] names) { List <Contact> destinatarios = Search(names); foreach (Contact destinatario in destinatarios) { IMessage msg = new Message(this.Owner.Name, destinatario.Name); channel.Send(message, destinatario); } }
public void ReturnAddressFallbackButNotAvailable() { IApplicationContext context = TestUtils.GetContext(@"Endpoint\returnAddressTests.xml"); IMessageChannel channel3 = (IMessageChannel)context.GetObject("channel3"); ((AbstractApplicationContext)context).Start(); StringMessage message = new StringMessage("*"); channel3.Send(message); }
public void exceptionThrowingFilterAccepts() { IApplicationContext ctx = TestUtils.GetContext(@"Config\FilterParserTests-context.xml"); IMessageChannel exceptionInput = (IMessageChannel)ctx.GetObject("exceptionInput"); exceptionInput.Send(new StringMessage("test")); IPollableChannel implementationOutput = (IPollableChannel)ctx.GetObject("implementationOutput"); IMessage reply = implementationOutput.Receive(TimeSpan.Zero); Assert.IsNotNull(reply); }
private static void StartResponder(IPollableChannel requestChannel, IMessageChannel replyChannel) { Executors.NewSingleThreadExecutor().Execute(delegate { IMessage request = requestChannel.Receive(); IMessage reply = MessageBuilder.FromMessage(request).SetCorrelationId (request.Headers.Id).Build(); replyChannel.Send(reply); }); }
public void filterWithSelectorAdapterRejects() { IApplicationContext ctx = TestUtils.GetContext(@"Config\FilterParserTests-context.xml"); IMessageChannel adapterInput = (IMessageChannel)ctx.GetObject("adapterInput"); adapterInput.Send(new StringMessage("")); IPollableChannel adapterOutput = (IPollableChannel)ctx.GetObject("adapterOutput"); IMessage reply = adapterOutput.Receive(TimeSpan.Zero); Assert.IsNull(reply); }
public void SubscribableChannel() { IApplicationContext context = TestUtils.GetContext(@"Config\Xml\BridgeParserTests-context.xml"); IMessage message = new StringMessage("test2"); IMessageChannel subscribableChannel = (IMessageChannel)context.GetObject("subscribableChannel"); subscribableChannel.Send(message); IPollableChannel output2 = (IPollableChannel)context.GetObject("output2"); IMessage reply = output2.Receive(TimeSpan.Zero); Assert.That(reply, Is.EqualTo(message)); }
// Método para enviar mediante un canal, especificado por el usuario public void Send(String[] contactsList, IMessageChannel channelM, string textC) { Message messageC; List <Contact> contactsM = this.Search(contactsList); foreach (Contact contactM in contactsM) { messageC = channelM.createMessage(this.Owner, contactM, textC); messageC.Text = textC; channelM.Send(messageC); } }
private bool DoSend(IMessage message, IMessageChannel channel) { AssertUtils.ArgumentNotNull(channel, "channel", "channel must not be null"); TimeSpan timeout = _sendTimeout; bool sent = (timeout.TotalMilliseconds >= 0) ? channel.Send(message, timeout) : channel.Send(message); if (!sent && _logger.IsTraceEnabled) { _logger.Trace("failed to send message to channel '" + channel + "' within timeout: " + timeout); } return(sent); }
public void filterWithSelectorImplementationAccepts() { IApplicationContext ctx = TestUtils.GetContext(@"Config\FilterParserTests-context.xml"); IMessageChannel implementationInput = (IMessageChannel)ctx.GetObject("implementationInput"); implementationInput.Send(new StringMessage("test")); IPollableChannel implementationOutput = (IPollableChannel)ctx.GetObject("implementationOutput"); IMessage reply = implementationOutput.Receive(TimeSpan.Zero); Assert.IsNotNull(reply); Assert.That(reply.Payload, Is.EqualTo("test")); }
public static void ReceiveTimeout(IMessageChannel channel) { var ts = new TimeSpan(0, 0, 0, 0, 500); channel.Open(); channel.Clear(); var m = new FakeMessage(); var m2 = new FakeMessage(); channel.Send(m); channel.Send(m2); var count = 0; foreach (var msg in channel.ReceiveMany(2, ts)) { count++; Thread.Sleep(500); } Assert.AreEqual(1, count); }
public static void SendAndReceiveSingleMessage(IMessageChannel channel) { channel.Open(); channel.Clear(); var m = GetNewMessage(); channel.Send(m); var m2 = channel.ReceiveSingle(TimeSpan.MaxValue); Assert.NotNull(m2); Assert.AreEqual(m.Identifier, m2.Identifier); channel.Close(); }
public static void Clear(IMessageChannel channel) { channel.Open(); for (var i = 0; i < 5; i++) { var m = new FakeMessage(); channel.Send(m); } channel.Clear(); var messages = channel.ReceiveMany(5, TimeSpan.MaxValue); Assert.AreEqual(0, messages.Count()); channel.Close(); }
private static void SendMessages(IMessageChannel channel, int numberOfMessagesToCreate) { for (var i = 0; i < numberOfMessagesToCreate; i++) { var msg = GetNewMessage(); channel.Send(msg); } }
public static void TestSendingMessageOnClosedTransport(IMessageChannel channel) { channel.Open(); channel.Close(); var m = GetNewMessage(); Assert.Throws(typeof(InvalidOperationException), () => channel.Send(m)); }