This is an automated email from the ASF dual-hosted git repository. michaelpearce pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/activemq-nms-openwire.git
commit dd5e07cb889b1d7f5664838aa80a255a3371e756 Author: Bruce Dodson <[email protected]> AuthorDate: Thu Jun 23 14:09:52 2022 -0700 AMQNET-637 Collected changes to help move forward with 2.0.0 AMQNET-637 Collected changes to help move forward with 2.0.0 * Update SharpZipLib to 1.3.3 to address a security warning * Remove unused variable name for an Exception that was not referenced in catch block * Remove a timeout variable that was not referenced * Fix tests using CreateMessageAsync and CreateTextMessageAsync as these do not exist in NMS 2.0.0 * Suppress compiler warning in various async tests that do not contain await, by awaiting Task.CompletedTask --- src/Util/Synchronization/NmsSynchronizationMonitor.cs | 2 +- src/nms-openwire.csproj | 2 +- test/AMQNET366Test.cs | 1 + test/Async/MessageConsumerTestAsync.cs | 8 ++++---- test/Async/MessageProducerTestAsync.cs | 1 - test/DtcTransactionsTestSupport.cs | 4 ++++ test/NMSConnectionFactoryTest.cs | 1 + test/Transport/Inactivity/InactivityMonitorTest.cs | 1 + test/Transport/Mock/MockTransportTest.cs | 3 +++ test/Transport/Tcp/TcpFaultyTransportTest.cs | 3 +++ test/Transport/failover/FailoverTransactionTest.cs | 1 + test/Transport/failover/FailoverTransportTest.cs | 2 ++ 12 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/Util/Synchronization/NmsSynchronizationMonitor.cs b/src/Util/Synchronization/NmsSynchronizationMonitor.cs index 3ec6988..855161f 100644 --- a/src/Util/Synchronization/NmsSynchronizationMonitor.cs +++ b/src/Util/Synchronization/NmsSynchronizationMonitor.cs @@ -185,7 +185,7 @@ namespace Apache.NMS.ActiveMQ.Util.Synchronization nmsLock = await nmsLock.EnterAsync(timeout).Await(); return nmsLock; } - catch (Exception ex) + catch (Exception) { return null; } diff --git a/src/nms-openwire.csproj b/src/nms-openwire.csproj index a4cd0d1..c693f17 100644 --- a/src/nms-openwire.csproj +++ b/src/nms-openwire.csproj @@ -43,7 +43,7 @@ <ItemGroup> <PackageReference Include="Apache.NMS" Version="2.0.0" /> - <PackageReference Include="SharpZipLib" Version="1.3.1" /> + <PackageReference Include="SharpZipLib" Version="1.3.3" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> diff --git a/test/AMQNET366Test.cs b/test/AMQNET366Test.cs index 7aef4fb..0ac244d 100644 --- a/test/AMQNET366Test.cs +++ b/test/AMQNET366Test.cs @@ -79,6 +79,7 @@ namespace Apache.NMS.ActiveMQ.Test { throw new IOException("Simulated Transport Failure"); } + await Task.CompletedTask; } protected void OnMessage(IMessage receivedMsg) diff --git a/test/Async/MessageConsumerTestAsync.cs b/test/Async/MessageConsumerTestAsync.cs index d334879..3bcef29 100644 --- a/test/Async/MessageConsumerTestAsync.cs +++ b/test/Async/MessageConsumerTestAsync.cs @@ -100,8 +100,8 @@ namespace Apache.NMS.ActiveMQ.Test.Async using (IMessageProducer producer = await session.CreateProducerAsync(queue)) { producer.DeliveryMode = MsgDeliveryMode.NonPersistent; - await producer.SendAsync(await producer.CreateTextMessageAsync("First")); - await producer.SendAsync(await producer.CreateTextMessageAsync("Second")); + await producer.SendAsync(producer.CreateTextMessage("First")); + await producer.SendAsync(producer.CreateTextMessage("Second")); } using (IMessageConsumer consumer = await session.CreateConsumerAsync(queue)) @@ -196,8 +196,8 @@ namespace Apache.NMS.ActiveMQ.Test.Async using (IMessageProducer producer = await session.CreateProducerAsync(queue)) { producer.DeliveryMode = MsgDeliveryMode.Persistent; - await producer.SendAsync(await producer.CreateMessageAsync()); - await producer.SendAsync(await producer.CreateMessageAsync()); + await producer.SendAsync(producer.CreateMessage()); + await producer.SendAsync(producer.CreateMessage()); await session.CommitAsync(); // receive first using a dedicated thread. This works diff --git a/test/Async/MessageProducerTestAsync.cs b/test/Async/MessageProducerTestAsync.cs index 1370673..9ec9b19 100644 --- a/test/Async/MessageProducerTestAsync.cs +++ b/test/Async/MessageProducerTestAsync.cs @@ -30,7 +30,6 @@ namespace Apache.NMS.ActiveMQ.Test.Async [Timeout(20_000)] public async Task TestProducerSendWithExpiry() { - int timeout = 1500; // Uri uri = new Uri(string.Format("tcp://localhost")); // Uris uri = new Uri(string.Format("mock://localhost:61616?transport.respondToMessages=false")); string uri = "tcp://${activemqhost}:61616?transport.useLogging=true"; diff --git a/test/DtcTransactionsTestSupport.cs b/test/DtcTransactionsTestSupport.cs index ac067cb..4601421 100644 --- a/test/DtcTransactionsTestSupport.cs +++ b/test/DtcTransactionsTestSupport.cs @@ -571,6 +571,7 @@ namespace Apache.NMS.ActiveMQ.Test throw new Exception("Error writing Prepare command"); } } + await Task.CompletedTask; } public async Task FailOnRollbackTransportHook(ITransport transport, Command command) @@ -584,6 +585,8 @@ namespace Apache.NMS.ActiveMQ.Test throw new Exception("Error writing Rollback command"); } } + await Task.CompletedTask; + } public async Task FailOnCommitTransportHook(ITransport transport, Command command) @@ -597,6 +600,7 @@ namespace Apache.NMS.ActiveMQ.Test throw new Exception("Error writing Commit command"); } } + await Task.CompletedTask; } #endregion diff --git a/test/NMSConnectionFactoryTest.cs b/test/NMSConnectionFactoryTest.cs index 4989c2d..5a6ce48 100644 --- a/test/NMSConnectionFactoryTest.cs +++ b/test/NMSConnectionFactoryTest.cs @@ -151,6 +151,7 @@ namespace Apache.NMS.ActiveMQ.Test { this.info = command as ConnectionInfo; } + await Task.CompletedTask; } [Test] diff --git a/test/Transport/Inactivity/InactivityMonitorTest.cs b/test/Transport/Inactivity/InactivityMonitorTest.cs index a807eeb..ba5fb4f 100644 --- a/test/Transport/Inactivity/InactivityMonitorTest.cs +++ b/test/Transport/Inactivity/InactivityMonitorTest.cs @@ -49,6 +49,7 @@ namespace Apache.NMS.ActiveMQ.Test { Tracer.Debug("Test: Received Command from Transport: " + command ); received.Add( command ); + await Task.CompletedTask; } [SetUp] diff --git a/test/Transport/Mock/MockTransportTest.cs b/test/Transport/Mock/MockTransportTest.cs index f3ebd40..98d565e 100644 --- a/test/Transport/Mock/MockTransportTest.cs +++ b/test/Transport/Mock/MockTransportTest.cs @@ -68,6 +68,7 @@ namespace Apache.NMS.ActiveMQ.Test public async Task OnCommand(ITransport transport, Command command) { Tracer.DebugFormat("MockTransportTest::OnCommand - " + command); + await Task.CompletedTask; } } @@ -91,12 +92,14 @@ namespace Apache.NMS.ActiveMQ.Test { Tracer.DebugFormat("MockTransportTest::OnCommand - " + command); received.Add(command); + await Task.CompletedTask; } public async Task OnOutgoingCommand(ITransport transport, Command command) { Tracer.DebugFormat("MockTransportTest::OnOutgoingCommand - " + command); sent.Add(command); + await Task.CompletedTask; } [SetUp] diff --git a/test/Transport/Tcp/TcpFaultyTransportTest.cs b/test/Transport/Tcp/TcpFaultyTransportTest.cs index 6a27e7b..3c4f46f 100644 --- a/test/Transport/Tcp/TcpFaultyTransportTest.cs +++ b/test/Transport/Tcp/TcpFaultyTransportTest.cs @@ -53,11 +53,14 @@ namespace Apache.NMS.ActiveMQ.Test public async Task OnPreProcessCommand(ITransport transport, Command command) { this.preProcessorFired = true; + await Task.CompletedTask; } public async Task OnPostProcessCommand(ITransport transport, Command command) { this.postProcessorFired = true; + await Task.CompletedTask; + } [Test, Sequential] diff --git a/test/Transport/failover/FailoverTransactionTest.cs b/test/Transport/failover/FailoverTransactionTest.cs index 248451e..0f0f6c1 100644 --- a/test/Transport/failover/FailoverTransactionTest.cs +++ b/test/Transport/failover/FailoverTransactionTest.cs @@ -370,6 +370,7 @@ namespace Apache.NMS.ActiveMQ.Test tcpTransport.Close(); } } + await Task.CompletedTask; } } } diff --git a/test/Transport/failover/FailoverTransportTest.cs b/test/Transport/failover/FailoverTransportTest.cs index 6aa2e04..ec3cc67 100644 --- a/test/Transport/failover/FailoverTransportTest.cs +++ b/test/Transport/failover/FailoverTransportTest.cs @@ -62,12 +62,14 @@ namespace Apache.NMS.ActiveMQ.Test { Tracer.DebugFormat("Test: Received Command from Transport: {0}", command); received.Add(command); + await Task.CompletedTask; } private async Task OnOutgoingCommand(ITransport transport, Command command) { Tracer.DebugFormat("FailoverTransportTest::OnOutgoingCommand - {0}", command); sent.Add(command); + await Task.CompletedTask; } private void OnResumed(ITransport sender)
