activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgo...@apache.org
Subject svn commit: r724811 - in /activemq/activemq-dotnet/Apache.NMS/trunk: src/main/csharp/ISession.cs src/test/csharp/TempDestinationDeletionTest.cs vs2008-nms-test.csproj
Date Tue, 09 Dec 2008 18:36:51 GMT
Author: jgomes
Date: Tue Dec  9 10:36:51 2008
New Revision: 724811

URL: http://svn.apache.org/viewvc?rev=724811&view=rev
Log:
Add support in ISession to delete destinations, both temporary and standard.  This allows
for deterministic deletion of destinations without having to close a connection to get temporary
destinations to be deleted.
Fixes [AMQNET-129,123]. (See https://issues.apache.org/activemq/browse/AMQNET-129,123)

Added:
    activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/TempDestinationDeletionTest.cs
Modified:
    activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/ISession.cs
    activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/ISession.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/ISession.cs?rev=724811&r1=724810&r2=724811&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/ISession.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/ISession.cs Tue Dec  9 10:36:51
2008
@@ -80,6 +80,11 @@
 		/// </summary>
 		ITemporaryTopic CreateTemporaryTopic();
 
+		/// <summary>
+		/// Delete a destination (Queue, Topic, Temp Queue, Temp Topic).
+		/// </summary>
+		void DeleteDestination(IDestination destination);
+
 		// Factory methods to create messages
 
 		/// <summary>

Added: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/TempDestinationDeletionTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/TempDestinationDeletionTest.cs?rev=724811&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/TempDestinationDeletionTest.cs
(added)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/TempDestinationDeletionTest.cs
Tue Dec  9 10:36:51 2008
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Apache.NMS.Util;
+using NUnit.Framework;
+using NUnit.Framework.Extensions;
+using System.Threading;
+
+namespace Apache.NMS.Test
+{
+	[TestFixture]
+	public class TempDestinationTests : NMSTestSupport
+	{
+		protected const string QUEUE_DESTINATION_NAME = "queue://AutoDeleteQueue";
+		protected const string TOPIC_DESTINATION_NAME = "topic://AutoDeleteTopic";
+		protected const string TEMP_QUEUE_DESTINATION_NAME = "temp-queue://AutoDeleteTempQueue";
+		protected const string TEMP_TOPIC_DESTINATION_NAME = "temp-topic://AutoDeleteTempTopic";
+		protected const string TEST_CLIENT_ID = "TempDestinationClientId";
+
+#if !NET_1_1
+		[RowTest]
+		[Row(true, QUEUE_DESTINATION_NAME)]
+		[Row(false, QUEUE_DESTINATION_NAME)]
+		[Row(true, TOPIC_DESTINATION_NAME)]
+		[Row(false, TOPIC_DESTINATION_NAME)]
+
+		[Row(true, TEMP_QUEUE_DESTINATION_NAME)]
+		[Row(false, TEMP_QUEUE_DESTINATION_NAME)]
+		[Row(true, TEMP_TOPIC_DESTINATION_NAME)]
+		[Row(false, TEMP_TOPIC_DESTINATION_NAME)]
+#endif
+		public void TempDestinationDeletionTest(bool persistent, string destinationName)
+		{
+			using(IConnection connection1 = CreateConnection(TEST_CLIENT_ID))
+			{
+				connection1.Start();
+				using(ISession session = connection1.CreateSession(AcknowledgementMode.AutoAcknowledge))
+				{
+					const int MaxNumDestinations = 100;
+
+					for(int index = 1; index <= MaxNumDestinations; index++)
+					{
+						IDestination destination = SessionUtil.GetDestination(session, destinationName);
+
+						using(IMessageProducer producer = session.CreateProducer(destination))
+						using(IMessageConsumer consumer = session.CreateConsumer(destination))
+						{
+							producer.Persistent = persistent;
+
+							IMessage request = session.CreateTextMessage("Hello World, Just Passing Through!");
+
+							request.NMSType = "TEMP_MSG";
+							producer.Send(request);
+							IMessage receivedMsg = consumer.Receive();
+							Assert.AreEqual(receivedMsg.NMSType, "TEMP_MSG");
+						}
+
+						session.DeleteDestination(destination);
+					}
+				}
+			}
+		}
+	}
+}

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj?rev=724811&r1=724810&r2=724811&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj Tue Dec  9 10:36:51 2008
@@ -66,6 +66,7 @@
       <HintPath>lib\NUnit\net-3.5\nunit.framework.extensions.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
@@ -94,6 +95,8 @@
     <Compile Include="src\test\csharp\MessageTest.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="src\test\csharp\MessageSelectorTest.cs" />
+    <Compile Include="src\test\csharp\TempDestinationDeletionTest.cs" />
     <Compile Include="src\test\csharp\TextMessage.cs">
       <SubType>Code</SubType>
     </Compile>



Mime
View raw message