activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgo...@apache.org
Subject svn commit: r1450481 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk: ./ src/main/csharp/ src/main/csharp/State/ src/main/csharp/Transport/ src/test/csharp/ src/test/csharp/Commands/ src/test/csharp/OpenWire/ src/test/csharp/Transactions/
Date Tue, 26 Feb 2013 22:13:03 GMT
Author: jgomes
Date: Tue Feb 26 22:13:02 2013
New Revision: 1450481

URL: http://svn.apache.org/r1450481
Log:
Fix for AMQNET-415. Throw an InvalidClientIDException if the login credentials are incorrect when using a failover protocol connection.  Added matching unit test.
Unit Test cleanup: Standardized the destination naming convention to prefix names with "TEST.".

Added:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/InvalidCredentialsTest.cs
      - copied, changed from r1445294, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/IndividualAckTest.cs
Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nmsprovider-test.config
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQNET366Test.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQQueueTransactionTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQRedeliveryPolicyTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQTopicTransactionTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/MessageCompressionTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/ExclusiveConsumerTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSSessionRecoverTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/MaxInactivityDurationTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueConsumerPriorityTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/RollbackRedeliveryTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transactions/RecoveryFileLoggerTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq-test.csproj

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nmsprovider-test.config
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nmsprovider-test.config?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nmsprovider-test.config (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nmsprovider-test.config Tue Feb 26 22:13:02 2013
@@ -28,4 +28,20 @@
 		<userName value="guest"/>
 		<passWord value="guest"/>
 	</openWireURI>
+
+  <InvalidCredentials-BogusUser value="activemq:failover:tcp://${activemqhost}:61616">
+    <factoryParams>
+      <param type="string" value="InvalidCredentialsTestClient"/>
+    </factoryParams>
+    <userName value="BogusUser"/>
+    <passWord value="BogusPassword"/>
+  </InvalidCredentials-BogusUser>
+
+  <InvalidCredentials-AuthenticUser value="activemq:failover:tcp://${activemqhost}:61616">
+    <factoryParams>
+      <param type="string" value="InvalidCredentialsTestClient"/>
+    </factoryParams>
+    <userName value="system"/>
+    <passWord value="manager"/>
+  </InvalidCredentials-AuthenticUser>
 </configuration>

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs Tue Feb 26 22:13:02 2013
@@ -90,11 +90,7 @@ namespace Apache.NMS.ActiveMQ
 			this.brokerUri = connectionUri;
 			this.clientIdGenerator = clientIdGenerator;
 
-			this.transport = transport;
-			this.transport.Command = new CommandHandler(OnCommand);
-			this.transport.Exception = new ExceptionHandler(OnTransportException);
-			this.transport.Interrupted = new InterruptedHandler(OnTransportInterrupted);
-			this.transport.Resumed = new ResumedHandler(OnTransportResumed);
+			SetTransport(transport);
 
 			ConnectionId id = new ConnectionId();
 			id.Value = CONNECTION_ID_GENERATOR.GenerateId();
@@ -412,6 +408,15 @@ namespace Apache.NMS.ActiveMQ
 
 		#endregion
 
+		private void SetTransport(ITransport newTransport)
+		{
+			this.transport = newTransport;
+			this.transport.Command = new CommandHandler(OnCommand);
+			this.transport.Exception = new ExceptionHandler(OnTransportException);
+			this.transport.Interrupted = new InterruptedHandler(OnTransportInterrupted);
+			this.transport.Resumed = new ResumedHandler(OnTransportResumed);
+		}
+
 		/// <summary>
 		/// Starts asynchronous message delivery of incoming messages for this connection.
 		/// Synchronous delivery is unaffected.
@@ -496,35 +501,35 @@ namespace Apache.NMS.ActiveMQ
 			}
 		}
 
-		internal void addDispatcher( ConsumerId id, IDispatcher dispatcher )
+		internal void addDispatcher(ConsumerId id, IDispatcher dispatcher)
 		{
 			if(!this.closing.Value)
 			{
-				this.dispatchers.Add( id, dispatcher );
+				this.dispatchers.Add(id, dispatcher);
 			}
 		}
 
-		internal void removeDispatcher( ConsumerId id )
+		internal void removeDispatcher(ConsumerId id)
 		{
 			if(!this.closing.Value)
 			{
-				this.dispatchers.Remove( id );
+				this.dispatchers.Remove(id);
 			}
 		}
 
-		internal void addProducer( ProducerId id, MessageProducer producer )
+		internal void addProducer(ProducerId id, MessageProducer producer)
 		{
 			if(!this.closing.Value)
 			{
-				this.producers.Add( id, producer );
+				this.producers.Add(id, producer);
 			}
 		}
 
-		internal void removeProducer( ProducerId id )
+		internal void removeProducer(ProducerId id)
 		{
 			if(!this.closing.Value)
 			{
-				this.producers.Remove( id );
+				this.producers.Remove(id);
 			}
 		}
 
@@ -640,35 +645,35 @@ namespace Apache.NMS.ActiveMQ
 			disposed = true;
 		}
 
-        public void PurgeTempDestinations()
-        {
-            if (this.tempDests == null || this.tempDests.Count == 0)
-            {
-                return;
-            }
-
-            lock(this.tempDests.SyncRoot)
-            {
-                Object[] keys = new Object[this.tempDests.Count];
-                this.tempDests.Keys.CopyTo(keys, 0);
-                foreach(ActiveMQTempDestination dest in keys)
-                {
-                    String localConnectionId = info.ConnectionId == null ? "" : info.ConnectionId.ToString();
-                    if (dest.PhysicalName.Contains(localConnectionId))
-                    {
-                        try
-                        {
-                            DeleteTemporaryDestination(dest);
-                        }
-                        catch
-                        {
-                            // The destination may still be in use in which case its
-                            // ok that it is not deleted now.
-                        }
-                    }
-                }
-            }
-        }
+		public void PurgeTempDestinations()
+		{
+			if(this.tempDests == null || this.tempDests.Count == 0)
+			{
+				return;
+			}
+
+			lock(this.tempDests.SyncRoot)
+			{
+				Object[] keys = new Object[this.tempDests.Count];
+				this.tempDests.Keys.CopyTo(keys, 0);
+				foreach(ActiveMQTempDestination dest in keys)
+				{
+					String localConnectionId = info.ConnectionId == null ? "" : info.ConnectionId.ToString();
+					if(dest.PhysicalName.Contains(localConnectionId))
+					{
+						try
+						{
+							DeleteTemporaryDestination(dest);
+						}
+						catch
+						{
+							// The destination may still be in use in which case its
+							// ok that it is not deleted now.
+						}
+					}
+				}
+			}
+		}
 
 		// Implementation methods
 
@@ -696,16 +701,16 @@ namespace Apache.NMS.ActiveMQ
 				Response response = transport.Request(command, requestTimeout);
 				if(response is ExceptionResponse)
 				{
-					ExceptionResponse exceptionResponse = (ExceptionResponse)response;
-                    Exception exception = CreateExceptionFromBrokerError(exceptionResponse.Exception);
+					ExceptionResponse exceptionResponse = (ExceptionResponse) response;
+					Exception exception = CreateExceptionFromBrokerError(exceptionResponse.Exception);
 					throw exception;
 				}
 				return response;
 			}
-            catch(NMSException)
-            {
-                throw;
-            }
+			catch(NMSException)
+			{
+				throw;
+			}
 			catch(Exception ex)
 			{
 				throw NMSExceptionSupport.Create(ex);
@@ -738,10 +743,10 @@ namespace Apache.NMS.ActiveMQ
 					if(connected.Value)
 					{
 						transport.Oneway(command);
-						if (Tracer.IsDebugEnabled)
+						if(Tracer.IsDebugEnabled)
 						{
-							Tracer.DebugFormat("Connection[{0}]: Oneway command sent to broker: {1}", 
-								               this.ConnectionId, command);
+							Tracer.DebugFormat("Connection[{0}]: Oneway command sent to broker: {1}",
+											   this.ConnectionId, command);
 						}
 					}
 				}
@@ -798,6 +803,12 @@ namespace Apache.NMS.ActiveMQ
 								{
 									if(null != transport)
 									{
+										// Make sure the transport is started.
+										if(!this.transport.IsStarted)
+										{
+											this.transport.Start();
+										}
+
 										// Send the connection and see if an ack/nak is returned.
 										Response response = transport.Request(this.info, this.RequestTimeout);
 										if(!(response is ExceptionResponse))
@@ -809,27 +820,32 @@ namespace Apache.NMS.ActiveMQ
 													new SessionId(info.ConnectionId, -1),
 													Interlocked.Increment(ref this.consumerIdCounter));
 												this.advisoryConsumer = new AdvisoryConsumer(this, id);
-                                            }
+											}
 										}
-                                        else
-                                        {
+										else
+										{
 											ExceptionResponse error = response as ExceptionResponse;
-                                            NMSException exception = CreateExceptionFromBrokerError(error.Exception);
-                                            if(exception is InvalidClientIDException)
-                                            {
-                                                // This is non-recoverable
-                                                throw exception;
-                                            }
-                                        }
+											NMSException exception = CreateExceptionFromBrokerError(error.Exception);
+											if(exception is InvalidClientIDException)
+											{
+												// This is non-recoverable.
+												// Shutdown the transport connection, and re-create it, but don't start it.
+												// It will be started if the connection is re-attempted.
+												this.transport.Stop();
+												ITransport newTransport = TransportFactory.CreateTransport(this.brokerUri);
+												SetTransport(newTransport);
+												throw exception;
+											}
+										}
 									}
 								}
-                                catch(BrokerException)
-                                {
-                                    // We Swallow the generic version and throw ConnectionClosedException
-                                }
+								catch(BrokerException)
+								{
+									// We Swallow the generic version and throw ConnectionClosedException
+								}
 								catch(NMSException)
 								{
-                                    throw;
+									throw;
 								}
 							}
 						}
@@ -866,19 +882,19 @@ namespace Apache.NMS.ActiveMQ
 			if(command.IsMessageDispatch)
 			{
 				WaitForTransportInterruptionProcessingToComplete();
-				DispatchMessage((MessageDispatch)command);
+				DispatchMessage((MessageDispatch) command);
 			}
 			else if(command.IsKeepAliveInfo)
 			{
-				OnKeepAliveCommand(commandTransport, (KeepAliveInfo)command);
+				OnKeepAliveCommand(commandTransport, (KeepAliveInfo) command);
 			}
 			else if(command.IsWireFormatInfo)
 			{
-				this.brokerWireFormatInfo = (WireFormatInfo)command;
+				this.brokerWireFormatInfo = (WireFormatInfo) command;
 			}
 			else if(command.IsBrokerInfo)
 			{
-				this.brokerInfo = (BrokerInfo)command;
+				this.brokerInfo = (BrokerInfo) command;
 				this.brokerInfoReceived.countDown();
 			}
 			else if(command.IsShutdownInfo)
@@ -893,7 +909,7 @@ namespace Apache.NMS.ActiveMQ
 			}
 			else if(command.IsProducerAck)
 			{
-				ProducerAck ack = (ProducerAck)command as ProducerAck;
+				ProducerAck ack = (ProducerAck) command as ProducerAck;
 				if(ack.ProducerId != null)
 				{
 					MessageProducer producer = producers[ack.ProducerId] as MessageProducer;
@@ -901,8 +917,8 @@ namespace Apache.NMS.ActiveMQ
 					{
 						if(Tracer.IsDebugEnabled)
 						{
-							Tracer.DebugFormat("Connection[{0}]: Received a new ProducerAck -> ", 
-							                   this.ConnectionId, ack);
+							Tracer.DebugFormat("Connection[{0}]: Received a new ProducerAck -> ",
+											   this.ConnectionId, ack);
 						}
 
 						producer.OnProducerAck(ack);
@@ -913,7 +929,7 @@ namespace Apache.NMS.ActiveMQ
 			{
 				if(!closing.Value && !closed.Value)
 				{
-					ConnectionError connectionError = (ConnectionError)command;
+					ConnectionError connectionError = (ConnectionError) command;
 					BrokerError brokerError = connectionError.Exception;
 					string message = "Broker connection error.";
 					string cause = "";
@@ -943,7 +959,7 @@ namespace Apache.NMS.ActiveMQ
 			{
 				if(dispatchers.Contains(dispatch.ConsumerId))
 				{
-					IDispatcher dispatcher = (IDispatcher)dispatchers[dispatch.ConsumerId];
+					IDispatcher dispatcher = (IDispatcher) dispatchers[dispatch.ConsumerId];
 
 					// Can be null when a consumer has sent a MessagePull and there was
 					// no available message at the broker to dispatch or when signalled
@@ -961,14 +977,14 @@ namespace Apache.NMS.ActiveMQ
 				}
 			}
 
-            Tracer.ErrorFormat("Connection[{0}]: No such consumer active: {1}", this.ConnectionId, dispatch.ConsumerId);
+			Tracer.ErrorFormat("Connection[{0}]: No such consumer active: {1}", this.ConnectionId, dispatch.ConsumerId);
 		}
 
 		protected void OnKeepAliveCommand(ITransport commandTransport, KeepAliveInfo info)
 		{
 			try
 			{
-				if (connected.Value)
+				if(connected.Value)
 				{
 					info.ResponseRequired = false;
 					transport.Oneway(info);
@@ -993,7 +1009,7 @@ namespace Apache.NMS.ActiveMQ
 					{
 						error = NMSExceptionSupport.Create(error);
 					}
-					NMSException e = (NMSException)error;
+					NMSException e = (NMSException) error;
 
 					// Called in another thread so that processing can continue
 					// here, ensures no lock contention.
@@ -1216,7 +1232,7 @@ namespace Apache.NMS.ActiveMQ
 			DestinationInfo command = new DestinationInfo();
 			command.ConnectionId = this.ConnectionId;
 			command.OperationType = DestinationInfo.REMOVE_OPERATION_TYPE; // 1 is remove
-			command.Destination = (ActiveMQDestination)destination;
+			command.Destination = (ActiveMQDestination) destination;
 
 			this.Oneway(command);
 		}
@@ -1229,7 +1245,7 @@ namespace Apache.NMS.ActiveMQ
 				if(!closed.Value && cdl.Remaining > 0)
 				{
 					Tracer.WarnFormat("Connection[{0}]: Dispatch paused, waiting for outstanding dispatch interruption " +
-					                  "processing ({1}) to complete..", this.ConnectionId, cdl.Remaining);
+									  "processing ({1}) to complete..", this.ConnectionId, cdl.Remaining);
 					cdl.await(TimeSpan.FromSeconds(10));
 				}
 
@@ -1272,7 +1288,7 @@ namespace Apache.NMS.ActiveMQ
 					if(Tracer.IsDebugEnabled)
 					{
 						Tracer.DebugFormat("Connection[{0}]: notified failover transport ({1})" +
-									 	   " of interruption completion.", this.ConnectionId, failoverTransport);
+										   " of interruption completion.", this.ConnectionId, failoverTransport);
 					}
 				}
 			}
@@ -1288,7 +1304,7 @@ namespace Apache.NMS.ActiveMQ
 				if(Tracer.IsDebugEnabled)
 				{
 					Tracer.DebugFormat("Connection[{0}]: notified failover transport ({1})" +
-								 	   " of pending interruption processing.", this.ConnectionId, failoverTransport);
+									   " of pending interruption processing.", this.ConnectionId, failoverTransport);
 				}
 			}
 		}
@@ -1345,55 +1361,72 @@ namespace Apache.NMS.ActiveMQ
 			}
 		}
 
-        private NMSException CreateExceptionFromBrokerError(BrokerError brokerError)
-        {
-            if(String.IsNullOrEmpty(brokerError.ExceptionClass))
-            {
-                return new BrokerException(brokerError);
-            }
-
-            NMSException exception = null;
-            String name = brokerError.ExceptionClass;
-            String message = brokerError.Message;
-
-            // We only create instances of exceptions from the NMS API
-            Assembly nmsAssembly = Assembly.GetAssembly(typeof(NMSException));
-
-            // First try and see if its one we populated ourselves in which case
-            // it will have the correct namespace and exception name.
-            Type exceptionType = nmsAssembly.GetType(name, false, true);
-
-            // Exceptions from the broker don't have the same namespace, so we
-            // trim that and try using the NMS namespace to see if we can get an
-            // NMSException based version of the same type.  We have to convert
-            // the JMS preficed exceptions to NMS also.
-            if(exceptionType == null && !name.StartsWith("Apache.NMS") && name.Contains("."))
-            {
-                int pos = name.LastIndexOf(".");
-                name = name.Substring(pos + 1);
-                name = name.Replace("JMS", "NMS");
-                name = "Apache.NMS." + name;
-
-                exceptionType = nmsAssembly.GetType(name, false, true);
-            }
-
-            if(exceptionType != null)
-            {
-                object[] args = null;
-                if(!String.IsNullOrEmpty(message))
-                {
-                    args = new object[1];
-                    args[0] = message;
-                }
-
-                exception = Activator.CreateInstance(exceptionType, args) as NMSException;
-            }
-            else
-            {
-                exception = new BrokerException(brokerError);
-            }
+		private NMSException CreateExceptionFromBrokerError(BrokerError brokerError)
+		{
+			String exceptionClassName = brokerError.ExceptionClass;
+
+			if(String.IsNullOrEmpty(exceptionClassName))
+			{
+				return new BrokerException(brokerError);
+			}
+
+			NMSException exception = null;
+			String message = brokerError.Message;
 
-            return exception;
-        }
+			// We only create instances of exceptions from the NMS API
+			Assembly nmsAssembly = Assembly.GetAssembly(typeof(NMSException));
+
+			// First try and see if it's one we populated ourselves in which case
+			// it will have the correct namespace and exception name.
+			Type exceptionType = nmsAssembly.GetType(exceptionClassName, false, true);
+
+			// Exceptions from the broker don't have the same namespace, so we
+			// trim that and try using the NMS namespace to see if we can get an
+			// NMSException based version of the same type.  We have to convert
+			// the JMS prefixed exceptions to NMS also.
+			if(null == exceptionType)
+			{
+				if(exceptionClassName.StartsWith("java.lang.SecurityException"))
+				{
+					exceptionClassName = "Apache.NMS.InvalidClientIDException";
+				}
+				else if(!exceptionClassName.StartsWith("Apache.NMS"))
+				{
+					string transformClassName;
+
+					if(exceptionClassName.Contains("."))
+					{
+						int pos = exceptionClassName.LastIndexOf(".");
+						transformClassName = exceptionClassName.Substring(pos + 1).Replace("JMS", "NMS");
+					}
+					else
+					{
+						transformClassName = exceptionClassName;
+					}
+
+					exceptionClassName = "Apache.NMS." + transformClassName;
+				}
+
+				exceptionType = nmsAssembly.GetType(exceptionClassName, false, true);
+			}
+
+			if(exceptionType != null)
+			{
+				object[] args = null;
+				if(!String.IsNullOrEmpty(message))
+				{
+					args = new object[1];
+					args[0] = message;
+				}
+
+				exception = Activator.CreateInstance(exceptionType, args) as NMSException;
+			}
+			else
+			{
+				exception = new BrokerException(brokerError);
+			}
+
+			return exception;
+		}
 	}
 }

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs Tue Feb 26 22:13:02 2013
@@ -134,8 +134,6 @@ namespace Apache.NMS.ActiveMQ
                     connection.DefaultClientId = this.clientId;
                 }
 
-                connection.ITransport.Start();
-
                 return connection;
             }
             catch(NMSException e)

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs Tue Feb 26 22:13:02 2013
@@ -73,22 +73,27 @@ namespace Apache.NMS.ActiveMQ.State
 
 		public void addTransactionState(TransactionId id)
 		{
-			checkShutdown();
-			transactions.Add(id, new TransactionState(id));
+			checkShutdown();
+			TransactionState transactionState = new TransactionState(id);
+
+			if(transactions.ContainsKey(id))
+			{
+				transactions[id] = transactionState;
+			}
+			else
+			{
+				transactions.Add(id, transactionState);
+			}
 		}
 
 		public TransactionState this[TransactionId id]
 		{
 			get
-			{
-				TransactionState state;
-
-				if(transactions.TryGetValue(id, out state))
-				{
-					return state;
-				}
-
-				return null;
+			{
+				TransactionState state = null;
+
+				transactions.TryGetValue(id, out state);
+				return state;
 			}
 		}
 
@@ -100,50 +105,65 @@ namespace Apache.NMS.ActiveMQ.State
 		public SessionState this[SessionId id]
 		{
 			get
-			{
-				SessionState sessionState;
-
-				if(sessions.TryGetValue(id, out sessionState))
-				{
-					return sessionState;
-				}
-
-#if DEBUG
-				// Useful for dignosing missing session ids
-				string sessionList = string.Empty;
-				foreach(SessionId sessionId in sessions.Keys)
-				{
-					sessionList += sessionId.ToString() + "\n";
+			{
+				SessionState sessionState = null;
+
+				sessions.TryGetValue(id, out sessionState);
+
+#if DEBUG
+				if(null == sessionState)
+				{
+					// Useful for dignosing missing session ids
+					string sessionList = string.Empty;
+					foreach(SessionId sessionId in sessions.Keys)
+					{
+						sessionList += sessionId.ToString() + "\n";
+					}
+
+					System.Diagnostics.Debug.Assert(false,
+						string.Format("Session '{0}' did not exist in the sessions collection.\n\nSessions:-\n{1}", id, sessionList));
 				}
-
-				System.Diagnostics.Debug.Assert(false,
-					string.Format("Session '{0}' did not exist in the sessions collection.\n\nSessions:-\n{1}", id, sessionList));
-#endif
-				return null;
+#endif
+				return sessionState;
 			}
 		}
 
 		public TransactionState removeTransactionState(TransactionId id)
 		{
-			TransactionState ret = null;
+			TransactionState ret = null;
+
+			if(transactions.TryGetValue(id, out ret))
+			{
+				transactions.Remove(id);
+			}
 
-			transactions.TryGetValue(id, out ret);
-			transactions.Remove(id);
 			return ret;
 		}
 
 		public void addSession(SessionInfo info)
 		{
-			checkShutdown();
-			sessions.Add(info.SessionId, new SessionState(info));
+			checkShutdown();
+			SessionState sessionState = new SessionState(info);
+
+			if(sessions.ContainsKey(info.SessionId))
+			{
+				sessions[info.SessionId] = sessionState;
+			}
+			else
+			{
+				sessions.Add(info.SessionId, sessionState);
+			}
 		}
 
 		public SessionState removeSession(SessionId id)
 		{
-			SessionState ret = null;
+			SessionState ret = null;
+
+			if(sessions.TryGetValue(id, out ret))
+			{
+				sessions.Remove(id);
+			}
 
-			sessions.TryGetValue(id, out ret);
-			sessions.Remove(id);
 			return ret;
 		}
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs Tue Feb 26 22:13:02 2013
@@ -505,11 +505,21 @@ namespace Apache.NMS.ActiveMQ.State
         }
 
         public override Response processAddConnection(ConnectionInfo info)
-        {
+        {
             if(info != null)
-            {
-                connectionStates.Add(info.ConnectionId, new ConnectionState(info));
+            {
+				ConnectionState connState = new ConnectionState(info);
+
+				if(connectionStates.ContainsKey(info.ConnectionId))
+				{
+					connectionStates[info.ConnectionId] = connState;
+				}
+				else
+				{
+					connectionStates.Add(info.ConnectionId, connState);
+				}
             }
+
             return TRACKED_RESPONSE_MARKER;
         }
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs Tue Feb 26 22:13:02 2013
@@ -41,32 +41,59 @@ namespace Apache.NMS.ActiveMQ.State
 
 		public void addProducer(ProducerInfo info)
 		{
-			checkShutdown();
-			producers.Add(info.ProducerId, new ProducerState(info));
+			checkShutdown();
+			ProducerState producerState = new ProducerState(info);
+
+			if(producers.ContainsKey(info.ProducerId))
+			{
+				producers[info.ProducerId] = producerState;
+			}
+			else
+			{
+				producers.Add(info.ProducerId, producerState);
+			}
 		}
 
 		public ProducerState removeProducer(ProducerId id)
-		{
-			ProducerState ret = producers[id];
-			producers.Remove(id);
-            if (ret.TransactionState != null)
-            {
-                ret.TransactionState.AddProducer(ret);
-            }
+		{
+			ProducerState ret = null;
+
+			if(producers.TryGetValue(id, out ret))
+			{
+				producers.Remove(id);
+				if(null != ret && ret.TransactionState != null)
+				{
+					ret.TransactionState.AddProducer(ret);
+				}
+			}
 
 			return ret;
 		}
 
 		public void addConsumer(ConsumerInfo info)
 		{
-			checkShutdown();
-			consumers.Add(info.ConsumerId, new ConsumerState(info));
+			checkShutdown();
+			ConsumerState consumerState = new ConsumerState(info);
+
+			if(consumers.ContainsKey(info.ConsumerId))
+			{
+				consumers.Add(info.ConsumerId, consumerState);
+			}
+			else
+			{
+				consumers.Add(info.ConsumerId, consumerState);
+			}
 		}
 
 		public ConsumerState removeConsumer(ConsumerId id)
-		{
-			ConsumerState ret = consumers[id];
-			consumers.Remove(id);
+		{
+			ConsumerState ret = null;
+
+			if(consumers.TryGetValue(id, out ret))
+			{
+				consumers.Remove(id);
+			}
+
 			return ret;
 		}
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs Tue Feb 26 22:13:02 2013
@@ -217,6 +217,22 @@ namespace Apache.NMS.ActiveMQ.State
 			{
 				return _dictionary.Remove(v);
 			}
-		}
+		}
+
+		public bool ContainsKey(TKey k)
+		{
+			lock(((ICollection) _dictionary).SyncRoot)
+			{
+				return _dictionary.ContainsKey(k);
+			}
+		}
+
+		public bool ContainsValue(TValue v)
+		{
+			lock(((ICollection) _dictionary).SyncRoot)
+			{
+				return _dictionary.ContainsValue(v);
+			}
+		}
 	}
 }

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs Tue Feb 26 22:13:02 2013
@@ -83,8 +83,15 @@ namespace Apache.NMS.ActiveMQ.State
 		}
 
         public void AddProducer(ProducerState producer)
-        {
-            this.producers.Add(producer.Info.ProducerId, producer);
+        {
+			if(this.producers.ContainsKey(producer.Info.ProducerId))
+			{
+				this.producers[producer.Info.ProducerId] = producer;
+			}
+			else
+			{
+				this.producers.Add(producer.Info.ProducerId, producer);
+			}
         }
 
         public AtomicCollection<ProducerState> ProducerStates

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs Tue Feb 26 22:13:02 2013
@@ -93,7 +93,7 @@ namespace Apache.NMS.ActiveMQ.Transport
 			: base(next)
 		{
 			this.instanceId = ++id;
-			Tracer.Debug("Creating Inactivity Monitor: " + instanceId);
+			Tracer.DebugFormat("Creating Inactivity Monitor: {0}", instanceId);
 		}
 
 		~InactivityMonitor()
@@ -305,7 +305,7 @@ namespace Apache.NMS.ActiveMQ.Transport
 		{
 			if(failed.CompareAndSet(false, true) && !this.disposing)
 			{
-				Tracer.Debug("Exception received in the Inactivity Monitor: " + command.ToString());
+				Tracer.DebugFormat("Exception received in the Inactivity Monitor: {0}", command.Message);
 				StopMonitorThreads();
 				base.OnException(sender, command);
 			}

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQNET366Test.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQNET366Test.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQNET366Test.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQNET366Test.cs Tue Feb 26 22:13:02 2013
@@ -49,7 +49,7 @@ namespace Apache.NMS.ActiveMQ.Test
             using (connection = factory.CreateConnection())
             using (ISession session = connection.CreateSession())
             {
-                IDestination destination = SessionUtil.GetDestination(session, "queue://test.test.in");
+                IDestination destination = SessionUtil.GetDestination(session, "queue://TEST.test.in");
                 using (IMessageConsumer consumer = session.CreateConsumer(destination))
                 {
                     Connection amqConnection = connection as Connection;

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQQueueTransactionTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQQueueTransactionTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQQueueTransactionTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQQueueTransactionTest.cs Tue Feb 26 22:13:02 2013
@@ -42,7 +42,7 @@ namespace Apache.NMS.ActiveMQ.Test
 
         protected override String DestinationName
         {
-            get { return "AMQQueueTransactionTestDestination"; }
+            get { return "TEST.AMQQueueTransactionTestDestination"; }
         }
 
     }

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQRedeliveryPolicyTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQRedeliveryPolicyTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQRedeliveryPolicyTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQRedeliveryPolicyTest.cs Tue Feb 26 22:13:02 2013
@@ -26,7 +26,7 @@ namespace Apache.NMS.ActiveMQ.Test
     [TestFixture]
     public class AMQRedeliveryPolicyTest : NMSTestSupport
     {
-        private const string DESTINATION_NAME = "RedeliveryPolicyTestDest";
+        private const string DESTINATION_NAME = "TEST.RedeliveryPolicyTestDest";
 
         [Test]
         public void TestExponentialRedeliveryPolicyDelaysDeliveryOnRollback()

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQTopicTransactionTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQTopicTransactionTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQTopicTransactionTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQTopicTransactionTest.cs Tue Feb 26 22:13:02 2013
@@ -24,7 +24,7 @@ namespace Apache.NMS.ActiveMQ.Test
     public class AMQTopicTransactionTest : AMQTransactionTestSupport
     {
         public const String CLIENT_ID = "TopicTransactionTest";
-        public const String DESTINATION_NAME = "AMQTopicTransactionTestDestination";
+        public const String DESTINATION_NAME = "TEST.AMQTopicTransactionTestDestination";
         public const String SUBSCRIPTION_NAME = "TopicTransactionTest";
 
         protected override bool Topic

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs Tue Feb 26 22:13:02 2013
@@ -42,8 +42,8 @@ namespace Apache.NMS.ActiveMQ.Test.Comma
         {
             this.nmsMessageID = "testid";
             this.nmsCorrelationID = "testcorrelationid";
-            this.nmsDestination = new ActiveMQTopic("test.topic");
-            this.nmsReplyTo = new ActiveMQTempTopic("test.replyto.topic:001");
+            this.nmsDestination = new ActiveMQTopic("TEST.test.topic");
+            this.nmsReplyTo = new ActiveMQTempTopic("TEST.test.replyto.topic:001");
             this.nmsDeliveryMode = MsgDeliveryMode.NonPersistent;
             this.nmsRedelivered = true;
             this.nmsType = "test type";

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/MessageCompressionTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/MessageCompressionTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/MessageCompressionTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/MessageCompressionTest.cs Tue Feb 26 22:13:02 2013
@@ -28,7 +28,7 @@ namespace Apache.NMS.ActiveMQ.Test
     public class MessageCompressionTest : NMSTestSupport
     {
         protected static string TEST_CLIENT_ID = "MessageCompressionTestClientId";
-        protected static string DESTINATION_NAME = "MessageCompressionTestDest";
+        protected static string DESTINATION_NAME = "TEST.MessageCompressionTestDest";
         
         // The following text should compress well
         private const string TEXT = "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs Tue Feb 26 22:13:02 2013
@@ -62,7 +62,7 @@ namespace Apache.NMS.ActiveMQ.Test
         public override void SetUp()
         {
             this.oldTracer = Tracer.Trace;
-            this.nonExistantPath = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Guid.NewGuid();
+            this.nonExistantPath = Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString());
 
             base.SetUp();
 
@@ -81,7 +81,7 @@ namespace Apache.NMS.ActiveMQ.Test
 
         protected void OnException(Exception ex)
         {
-            Tracer.Debug("Test Driver received Error Notification: " + ex.Message);
+            Tracer.DebugFormat("Test Driver received Error Notification: {0}", ex.Message);
         }
 
         #region Database Utility Methods

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/ExclusiveConsumerTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/ExclusiveConsumerTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/ExclusiveConsumerTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/ExclusiveConsumerTest.cs Tue Feb 26 22:13:02 2013
@@ -26,7 +26,7 @@ namespace Apache.NMS.ActiveMQ.Test
     [TestFixture]   
     public class ExclusiveConsumerTest : NMSTestSupport
     {
-        protected static string DESTINATION_NAME = "ExclusiveConsumerTestDestination";
+        protected static string DESTINATION_NAME = "TEST.ExclusiveConsumerTestDestination";
         protected static string TEST_CLIENT_ID = "ExclusiveConsumerTestClientId";
         
         private IConnection createConnection(bool start) 

Copied: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/InvalidCredentialsTest.cs (from r1445294, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/IndividualAckTest.cs)
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/InvalidCredentialsTest.cs?p2=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/InvalidCredentialsTest.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/IndividualAckTest.cs&r1=1445294&r2=1450481&rev=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/IndividualAckTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/InvalidCredentialsTest.cs Tue Feb 26 22:13:02 2013
@@ -21,244 +21,46 @@ using NUnit.Framework;
 
 namespace Apache.NMS.ActiveMQ.Test
 {
-    [TestFixture]
-    public class IndividualAckTest : NMSTestSupport
-    {
-        private IConnection connection;
-
-        [SetUp]
-        public override void SetUp()
-        {
-            base.SetUp();
-
-            connection = CreateConnection();
-            connection.Start();
-        }
-
-        [TearDown]
-        public override void TearDown()
-        {
-            connection.Close();
-            base.TearDown();
-        }
-
-        [Test]
-        public void TestAckedMessageAreConsumed()
-        {
-            ISession session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-            ITemporaryQueue queue = session.CreateTemporaryQueue();
-            IMessageProducer producer = session.CreateProducer(queue);
-            producer.Send(session.CreateTextMessage("Hello"));
-
-            // Consume the message...
-            IMessageConsumer consumer = session.CreateConsumer(queue);
-            IMessage msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-            Assert.IsNotNull(msg);
-            msg.Acknowledge();
-
-            // Reset the session.
-            session.Close();
-            session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-
-            // Attempt to Consume the message...
-            consumer = session.CreateConsumer(queue);
-            msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-            Assert.IsNull(msg);
-
-            session.Close();
-        }
-
-        [Test]
-        public void TestLastMessageAcked()
-        {
-            ISession session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-            ITemporaryQueue queue = session.CreateTemporaryQueue();
-            IMessageProducer producer = session.CreateProducer(queue);
-            ITextMessage msg1 = session.CreateTextMessage("msg1" + Guid.NewGuid().ToString());
-            ITextMessage msg2 = session.CreateTextMessage("msg2" + Guid.NewGuid().ToString());
-            ITextMessage msg3 = session.CreateTextMessage("msg3" + Guid.NewGuid().ToString());
-            producer.Send(msg1);
-            producer.Send(msg2);
-            producer.Send(msg3);
-
-            // Consume the message...
-            IMessageConsumer consumer = session.CreateConsumer(queue);
-            ITextMessage ackmsg = consumer.Receive(TimeSpan.FromMilliseconds(1000)) as ITextMessage;
-            Assert.IsNotNull(ackmsg);
-            Assert.AreEqual(msg1.Text,ackmsg.Text);
-            ackmsg = consumer.Receive(TimeSpan.FromMilliseconds(1000)) as ITextMessage;
-            Assert.IsNotNull(ackmsg);
-            Assert.AreEqual(msg2.Text,ackmsg.Text);
-            ackmsg = consumer.Receive(TimeSpan.FromMilliseconds(1000)) as ITextMessage;
-            Assert.IsNotNull(ackmsg);
-            Assert.AreEqual(msg3.Text,ackmsg.Text);
-            ackmsg.Acknowledge();
-
-            // Reset the session.
-            session.Close();
-            session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-
-            // Attempt to Consume the message...
-            consumer = session.CreateConsumer(queue);
-            ackmsg = consumer.Receive(TimeSpan.FromMilliseconds(1000)) as ITextMessage;
-            Assert.IsNotNull(ackmsg);
-            Assert.AreEqual(msg1.Text,ackmsg.Text);
-            ackmsg = consumer.Receive(TimeSpan.FromMilliseconds(1000)) as ITextMessage;
-            Assert.IsNotNull(ackmsg);
-            Assert.AreEqual(msg2.Text,ackmsg.Text);
-            IMessage msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-            Assert.IsNull(msg);
-            session.Close();
-        }
-
-        [Test]
-        public void TestUnAckedMessageAreNotConsumedOnSessionClose()
-        {
-            ISession session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-            ITemporaryQueue queue = session.CreateTemporaryQueue();
-            IMessageProducer producer = session.CreateProducer(queue);
-            producer.Send(session.CreateTextMessage("Hello"));
-
-            // Consume the message...
-            IMessageConsumer consumer = session.CreateConsumer(queue);
-            IMessage msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-            Assert.IsNotNull(msg);
-            // Don't ack the message.
-
-            // Reset the session.  This should cause the unacknowledged message to be re-delivered.
-            session.Close();
-            session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-
-            // Attempt to Consume the message...
-            consumer = session.CreateConsumer(queue);
-            msg = consumer.Receive(TimeSpan.FromMilliseconds(2000));
-            Assert.IsNotNull(msg);
-            msg.Acknowledge();
+	[TestFixture]
+	public class InvalidCredentialsTest : NMSTestSupport
+	{
+		private IConnection connection;
 
-            session.Close();
-        }
+		[SetUp]
+		public override void SetUp()
+		{
+			base.SetUp();
+		}
+
+		[TearDown]
+		public override void TearDown()
+		{
+			base.TearDown();
+		}
 
-        [Test]
-	    public void TestIndividualAcknowledgeMultiMessages_AcknowledgeFirstTest()
+		// Maximum time to run is 20 seconds.
+		[Test, Timeout(20000)]
+		public void TestRestartInvalidCredentialsWithFailover()
 		{
-            ISession session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
+			string connectionURI = "activemq:failover:tcp://${activemqhost}:61616";
+			ConnectionFactory factory = new ConnectionFactory(NMSTestSupport.ReplaceEnvVar(connectionURI));
 
-            // Push 2 messages to queue
-            ITemporaryQueue queue = session.CreateTemporaryQueue();
-            IMessageProducer producer = session.CreateProducer(queue);
-
-            ITextMessage msg = session.CreateTextMessage("test 1");
-            producer.Send(msg, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
-			msg = session.CreateTextMessage("test 2");
-            producer.Send(msg, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
-            producer.Close();
-
-            IMessageConsumer consumer = session.CreateConsumer(queue);
-
-            // Read the first message
-            ITextMessage fetchedMessage1 = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(2000));
-            Assert.IsNotNull(fetchedMessage1);
-            Assert.AreEqual("test 1", fetchedMessage1.Text);
-
-			// Read the second message
-			ITextMessage fetchedMessage2 = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(2000));
-            Assert.IsNotNull(fetchedMessage2);
-            Assert.AreEqual("test 2", fetchedMessage2.Text);
-
-            // Acknowledge first message
-            fetchedMessage1.Acknowledge();
-
-            consumer.Close();
-
-            // Read first message a second time
-            consumer = session.CreateConsumer(queue);
-            fetchedMessage1 = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(2000));
-            Assert.IsNotNull(fetchedMessage1);
-            Assert.AreEqual("test 2", fetchedMessage1.Text);
-
-            // Try to read second message a second time
-            fetchedMessage2 = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(2000));
-            Assert.IsNull(fetchedMessage2);
-            consumer.Close();
-	    }
-
-        [Test]
-        public void TestManyMessageAckedAfterMessageConsumption()
-        {
-            int messageCount = 20;
-            IMessage msg;
-
-            ISession session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-            ITemporaryQueue queue = session.CreateTemporaryQueue();
-            IMessageProducer producer = session.CreateProducer(queue);
-            for(int i = 0; i < messageCount; i++)
-            {
-                msg = session.CreateTextMessage("msg" + i);
-                producer.Send(msg);
-            }
-
-            // Consume the message...
-            IMessageConsumer consumer = session.CreateConsumer(queue);
-            for(int i = 0; i < messageCount; i++)
-            {
-                msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-                Assert.IsNotNull(msg);
-                msg.Acknowledge();
-            }
-            msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-            Assert.IsNull(msg);
-
-            // Reset the session.
-            session.Close();
-            session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-
-            // Attempt to Consume the message...
-            consumer = session.CreateConsumer(queue);
-            msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-            Assert.IsNull(msg);
-            session.Close();
-        }
-
-        [Test]
-        public void TestManyMessageAckedAfterAllConsumption()
-        {
-            int messageCount = 20;
-            IMessage msg;
-
-            ISession session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-            ITemporaryQueue queue = session.CreateTemporaryQueue();
-            IMessageProducer producer = session.CreateProducer(queue);
-            for(int i = 0; i < messageCount; i++)
-            {
-                msg = session.CreateTextMessage("msg" + i);
-                producer.Send(msg);
-            }
-
-            // Consume the message...
-            IMessageConsumer consumer = session.CreateConsumer(queue);
-            IMessage[] consumedMessages = new IMessage[messageCount];
-            for(int i = 0; i < messageCount; i++)
-            {
-                msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-                Assert.IsNotNull(msg);
-                consumedMessages[i] = msg;
-            }
-            for(int i = 0; i < messageCount; i++)
-            {
-                consumedMessages[i].Acknowledge();
-            }
-            msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-            Assert.IsNull(msg);
-
-            // Reset the session.
-            session.Close();
-            session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge);
-
-            // Attempt to Consume the message...
-            consumer = session.CreateConsumer(queue);
-            msg = consumer.Receive(TimeSpan.FromMilliseconds(1000));
-            Assert.IsNull(msg);
-            session.Close();
-        }
-    }
+			// To run this test successfully, the broker must have secure login enabled.
+			// This test will attempt to login to the server using invalid credentials.
+			// It should not connect, and should not go into failover retry loop.
+			// It will then attempt to login with correct credentials, and it should be succcessful on second attempt.
+			Assert.IsTrue(CreateNMSFactory("InvalidCredentials-BogusUser"));
+			using(IConnection connection = CreateConnection())
+			{
+				Assert.Throws(typeof(InvalidClientIDException), () => { connection.Start(); }, "You may not have enabled credential login on the broker.  Credentials must be enabled for this test to pass.");
+			}
+
+			// Now connect with a valid user account.
+			Assert.IsTrue(CreateNMSFactory("InvalidCredentials-AuthenticUser"));
+			using(IConnection connection = CreateConnection())
+			{
+				Assert.DoesNotThrow(() => { connection.Start(); }, "You may not have set the InvalidCredentials-AuthenticUser node in the nmsprovider-test.config file.");
+			}
+		}
+	}
 }

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs Tue Feb 26 22:13:02 2013
@@ -34,7 +34,7 @@ namespace Apache.NMS.ActiveMQ.Test
     [TestFixture]
     public class MessageConsumerTest : NMSTestSupport
     {
-        protected static string DESTINATION_NAME = "queue://MessageConsumerTestDestination";
+        protected static string DESTINATION_NAME = "queue://TEST.MessageConsumerTestDestination";
         protected static string TEST_CLIENT_ID = "MessageConsumerTestClientId";
 
         private CountDownLatch doneLatch;
@@ -209,7 +209,7 @@ namespace Apache.NMS.ActiveMQ.Test
                         {
                             producer.DeliveryMode = deliveryMode;
 
-                            string msgText = "ExpiredMessage:" + Guid.NewGuid().ToString();
+                            string msgText = string.Format("ExpiredMessage: {0}", Guid.NewGuid().ToString());
 
                             ActiveMQTextMessage msg = session.CreateTextMessage(msgText) as ActiveMQTextMessage;
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSSessionRecoverTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSSessionRecoverTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSSessionRecoverTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSSessionRecoverTest.cs Tue Feb 26 22:13:02 2013
@@ -58,42 +58,42 @@ namespace Apache.NMS.ActiveMQ.Test
         [Test]
         public void TestQueueSynchRecover()
         {
-            destination = new ActiveMQQueue("Queue-" + DateTime.Now.Ticks);
+            destination = new ActiveMQQueue("TEST.Queue-" + DateTime.Now.Ticks);
             DoTestSynchRecover();
         }
 
         [Test]
         public void TestQueueAsynchRecover()
         {
-            destination = new ActiveMQQueue("Queue-" + DateTime.Now.Ticks);
+			destination = new ActiveMQQueue("TEST.Queue-" + DateTime.Now.Ticks);
             DoTestAsynchRecover();
         }
 
         [Test]
         public void TestTopicSynchRecover()
         {
-            destination = new ActiveMQTopic("Topic-" + DateTime.Now.Ticks);
+			destination = new ActiveMQTopic("TEST.Topic-" + DateTime.Now.Ticks);
             DoTestSynchRecover();
         }
 
         [Test]
         public void TestTopicAsynchRecover()
         {
-            destination = new ActiveMQTopic("Topic-" + DateTime.Now.Ticks);
+			destination = new ActiveMQTopic("TEST.Topic-" + DateTime.Now.Ticks);
             DoTestAsynchRecover();
         }
 
         [Test]
         public void TestQueueAsynchRecoverWithAutoAck()
         {
-            destination = new ActiveMQQueue("Queue-" + DateTime.Now.Ticks);
+			destination = new ActiveMQQueue("TEST.Queue-" + DateTime.Now.Ticks);
             DoTestAsynchRecoverWithAutoAck();
         }
 
         [Test]
         public void TestTopicAsynchRecoverWithAutoAck()
         {
-            destination = new ActiveMQTopic("Topic-" + DateTime.Now.Ticks);
+			destination = new ActiveMQTopic("TEST.Topic-" + DateTime.Now.Ticks);
             DoTestAsynchRecoverWithAutoAck();
         }
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/MaxInactivityDurationTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/MaxInactivityDurationTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/MaxInactivityDurationTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/MaxInactivityDurationTest.cs Tue Feb 26 22:13:02 2013
@@ -27,7 +27,7 @@ namespace Apache.NMS.ActiveMQ.Test
 	[TestFixture]
 	public class MaxInactivityDurationTest : NMSTestSupport
 	{
-		protected static string DESTINATION_NAME = "TestMaxInactivityDuration";
+		protected static string DESTINATION_NAME = "TEST.MaxInactivityDuration";
 		protected static string CORRELATION_ID = "MaxInactivityCorrelationID";
 
 		[Test]
@@ -100,7 +100,7 @@ namespace Apache.NMS.ActiveMQ.Test
 				{
 					using(ISession session = connection.CreateSession())
 					{
-						IDestination destination = SessionUtil.GetDestination(session, "topic://NMSResourceLeak.TestTopic");
+						IDestination destination = SessionUtil.GetDestination(session, "topic://TEST.NMSResourceLeak");
 						using(IMessageConsumer consumer = session.CreateConsumer(destination))
 						{
 							connection.Start();

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs Tue Feb 26 22:13:02 2013
@@ -26,7 +26,7 @@ namespace Apache.NMS.ActiveMQ.Test
 	[TestFixture]
 	public class PrefetchSizeZeroTest : NMSTestSupport
 	{	
-        protected static string DESTINATION_NAME = "TestPrefetchSizeZero";
+        protected static string DESTINATION_NAME = "TEST.PrefetchSizeZero";
 			
 		[Test]
 		public void TestZeroPrefetchSize()

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs Tue Feb 26 22:13:02 2013
@@ -36,7 +36,7 @@ namespace Apache.NMS.ActiveMQ.Test
 			{
 				using (ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
 				{
-                    IDestination destination = session.GetQueue("TestReceiveBrowseReceive");
+                    IDestination destination = session.GetQueue("TEST.ReceiveBrowseReceive");
 					IMessageProducer producer = session.CreateProducer(destination);
 					IMessageConsumer consumer = session.CreateConsumer(destination);
 					connection.Start();
@@ -152,7 +152,7 @@ namespace Apache.NMS.ActiveMQ.Test
 			{
 				using (ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
 				{
-                    IDestination destination = session.GetQueue("TestBrowseReceive");
+                    IDestination destination = session.GetQueue("TEST.BrowseReceive");
 
 					connection.Start();
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueConsumerPriorityTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueConsumerPriorityTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueConsumerPriorityTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueConsumerPriorityTest.cs Tue Feb 26 22:13:02 2013
@@ -26,7 +26,7 @@ namespace Apache.NMS.ActiveMQ.Test
     [TestFixture]
     public class QueueConsumerPriorityTest : NMSTestSupport
     {
-        protected static string DESTINATION_NAME = "QueueConsumerPriorityTestDestination";
+        protected static string DESTINATION_NAME = "TEST.QueueConsumerPriority";
         protected static string TEST_CLIENT_ID = "QueueConsumerPriorityTestClientId";
         protected static int MSG_COUNT = 50;
         

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/RollbackRedeliveryTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/RollbackRedeliveryTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/RollbackRedeliveryTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/RollbackRedeliveryTest.cs Tue Feb 26 22:13:02 2013
@@ -27,11 +27,10 @@ namespace Apache.NMS.ActiveMQ.Test
     [TestFixture]
     public class RollbackRedeliveryTest : NMSTestSupport
     {
-        protected static string DESTINATION_NAME = "TestDestination";
+        protected static string DESTINATION_NAME = "TEST.RollbackDelivery";
         protected static string TEST_CLIENT_ID = "RollbackRedeliveryTestId";
 
         private const int nbMessages = 10;
-        private const String destinationName = "RollbackRedeliveryTestDestination";
 
         private IConnection connection;
 
@@ -48,7 +47,7 @@ namespace Apache.NMS.ActiveMQ.Test
             connection.Start();
 
             Session session = connection.CreateSession() as Session;
-            IQueue queue = session.GetQueue(destinationName);
+            IQueue queue = session.GetQueue(DESTINATION_NAME);
             session.DeleteDestination(queue);
         }
 
@@ -92,11 +91,11 @@ namespace Apache.NMS.ActiveMQ.Test
 
             if(interleaveProducer)
             {
-                PopulateDestinationWithInterleavedProducer(nbMessages, destinationName);
+                PopulateDestinationWithInterleavedProducer(nbMessages, DESTINATION_NAME);
             }
             else
             {
-                PopulateDestination(nbMessages, destinationName);
+                PopulateDestination(nbMessages, DESTINATION_NAME);
             }
 
             // Consume messages and Rollback transactions
@@ -107,7 +106,7 @@ namespace Apache.NMS.ActiveMQ.Test
                 while(received < nbMessages)
                 {
                     ISession session = connection.CreateSession(AcknowledgementMode.Transactional);
-                    IDestination destination = session.GetQueue(destinationName);
+                    IDestination destination = session.GetQueue(DESTINATION_NAME);
                     IMessageConsumer consumer = session.CreateConsumer(destination);
                     ITextMessage msg = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(6000000));
 
@@ -138,14 +137,14 @@ namespace Apache.NMS.ActiveMQ.Test
         {
 	        connection.Start();
 
-	        PopulateDestinationWithInterleavedProducer(nbMessages, destinationName);
+	        PopulateDestinationWithInterleavedProducer(nbMessages, DESTINATION_NAME);
 
 	        // Consume messages and Rollback transactions
 	        {
 	            int received = 0;
                 IDictionary rolledback = Hashtable.Synchronized(new Hashtable());
 	            ISession session = connection.CreateSession(AcknowledgementMode.Transactional);
-	            IDestination destination = session.GetQueue(destinationName);
+	            IDestination destination = session.GetQueue(DESTINATION_NAME);
 	            IMessageConsumer consumer = session.CreateConsumer(destination);
 
                 while(received < nbMessages)
@@ -176,14 +175,14 @@ namespace Apache.NMS.ActiveMQ.Test
         {
 	        connection.Start();
 
-	        PopulateDestination(nbMessages, destinationName);
+	        PopulateDestination(nbMessages, DESTINATION_NAME);
 
 	        // Consume messages and Rollback transactions
 	        {
                 int received = 0;
                 IDictionary rolledback = Hashtable.Synchronized(new Hashtable());
 	            ISession session = connection.CreateSession(AcknowledgementMode.Transactional);
-	            IDestination destination = session.GetQueue(destinationName);
+	            IDestination destination = session.GetQueue(DESTINATION_NAME);
 
                 while(received < nbMessages)
                 {
@@ -218,13 +217,13 @@ namespace Apache.NMS.ActiveMQ.Test
 
             connection.Start();
 
-            PopulateDestination(1, destinationName);
+            PopulateDestination(1, DESTINATION_NAME);
 
             // Consume messages and Rollback transactions
             {
                 int received = 0;
                 ISession session = connection.CreateSession(AcknowledgementMode.Transactional);
-                IDestination destination = session.GetQueue(destinationName);
+                IDestination destination = session.GetQueue(DESTINATION_NAME);
 
                 IMessageConsumer consumer = session.CreateConsumer(destination);
                 ITextMessage msg = null;
@@ -261,7 +260,7 @@ namespace Apache.NMS.ActiveMQ.Test
 
             connection.Start();
 
-            PopulateDestination(1, destinationName);
+            PopulateDestination(1, DESTINATION_NAME);
 
             // Consume messages and Rollback transactions
             {
@@ -275,7 +274,7 @@ namespace Apache.NMS.ActiveMQ.Test
                 while(received <= connection.RedeliveryPolicy.MaximumRedeliveries)
                 {
                     session = connection.CreateSession(AcknowledgementMode.Transactional);
-                    destination = session.GetQueue(destinationName);
+                    destination = session.GetQueue(DESTINATION_NAME);
                     consumer = session.CreateConsumer(destination);
                     msg = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(6000000));
                     Assert.IsNotNull(msg);
@@ -293,7 +292,7 @@ namespace Apache.NMS.ActiveMQ.Test
                 }
 
                 session = connection.CreateSession(AcknowledgementMode.Transactional);
-                destination = session.GetQueue(destinationName);
+                destination = session.GetQueue(DESTINATION_NAME);
                 consumer = session.CreateConsumer(destination);
                 msg = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(6000));
                 Assert.IsNull(msg);
@@ -306,7 +305,7 @@ namespace Apache.NMS.ActiveMQ.Test
             const int numMessages = 1;
             connection.Start();
 
-            PopulateDestination(numMessages, destinationName);
+            PopulateDestination(numMessages, DESTINATION_NAME);
 
             {
                 int received = 0;
@@ -315,7 +314,7 @@ namespace Apache.NMS.ActiveMQ.Test
                 while(received < maxRetries)
                 {
                     ISession session = connection.CreateSession(AcknowledgementMode.Transactional);
-                    IDestination destination = session.GetQueue(destinationName);
+                    IDestination destination = session.GetQueue(DESTINATION_NAME);
 
                     IMessageConsumer consumer = session.CreateConsumer(destination);
                     ITextMessage msg = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(2000));
@@ -341,7 +340,7 @@ namespace Apache.NMS.ActiveMQ.Test
             (connection as Connection).PrefetchPolicy.SetAll(0);
             connection.Start();
 
-            PopulateDestination(numMessages, destinationName);
+            PopulateDestination(numMessages, DESTINATION_NAME);
 
             {
                 int received = 0;
@@ -350,7 +349,7 @@ namespace Apache.NMS.ActiveMQ.Test
                 while(received < maxRetries)
                 {
                     ISession session = connection.CreateSession(AcknowledgementMode.Transactional);
-                    IDestination destination = session.GetQueue(destinationName);
+                    IDestination destination = session.GetQueue(DESTINATION_NAME);
 
                     IMessageConsumer consumer = session.CreateConsumer(destination);
                     ITextMessage msg = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(2000));
@@ -372,7 +371,7 @@ namespace Apache.NMS.ActiveMQ.Test
         private void ConsumeMessage(int deliveryCount)
         {
             ISession session = connection.CreateSession(AcknowledgementMode.Transactional);
-            IDestination destination = session.GetQueue(destinationName);
+            IDestination destination = session.GetQueue(DESTINATION_NAME);
             IMessageConsumer consumer = session.CreateConsumer(destination);
             ITextMessage msg = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(1000));
             Assert.IsNotNull(msg);
@@ -387,7 +386,7 @@ namespace Apache.NMS.ActiveMQ.Test
         {
             const int numMessages = 1;
 
-            PopulateDestination(numMessages, destinationName);
+            PopulateDestination(numMessages, DESTINATION_NAME);
             connection.Close();
 
             {
@@ -400,7 +399,7 @@ namespace Apache.NMS.ActiveMQ.Test
                     connection = CreateConnection();
                     connection.Start();
                     ISession session = connection.CreateSession(AcknowledgementMode.Transactional);
-                    IDestination destination = session.GetQueue(destinationName);
+                    IDestination destination = session.GetQueue(DESTINATION_NAME);
 
                     IMessageConsumer consumer = session.CreateConsumer(destination);
                     ITextMessage msg = (ITextMessage) consumer.Receive(TimeSpan.FromMilliseconds(2000));

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transactions/RecoveryFileLoggerTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transactions/RecoveryFileLoggerTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transactions/RecoveryFileLoggerTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transactions/RecoveryFileLoggerTest.cs Tue Feb 26 22:13:02 2013
@@ -29,7 +29,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
     [TestFixture]
     public class RecoveryFileLoggerTest
     {
-        private Guid rmId;
+        private string rmId;
         private string nonExistantPath;
         private string autoCreatePath;
         private string nonDefaultLogLocation;
@@ -37,10 +37,10 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
         [SetUp]
         public void SetUp()
         {
-            this.rmId = Guid.NewGuid();
-            this.nonExistantPath = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Guid.NewGuid();
-            this.nonDefaultLogLocation = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Guid.NewGuid();
-            this.autoCreatePath = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Guid.NewGuid();
+            this.rmId = Guid.NewGuid().ToString();
+            this.nonExistantPath = Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString());
+			this.nonDefaultLogLocation = Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString());
+			this.autoCreatePath = Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString());
 
             Directory.CreateDirectory(nonDefaultLogLocation);
         }
@@ -61,7 +61,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
         {
             RecoveryFileLogger logger = new RecoveryFileLogger();
 
-            logger.Initialize(rmId.ToString());
+            logger.Initialize(rmId);
 
             Assert.AreEqual(Directory.GetCurrentDirectory(), logger.Location);
         }
@@ -72,7 +72,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
             RecoveryFileLogger logger = new RecoveryFileLogger();
 
             logger.Location = nonDefaultLogLocation;
-            logger.Initialize(rmId.ToString());
+            logger.Initialize(rmId);
 
             Assert.AreEqual(nonDefaultLogLocation, logger.Location);
         }
@@ -86,7 +86,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
 
             logger.AutoCreateLocation = true;
             logger.Location = autoCreatePath;
-            logger.Initialize(rmId.ToString());
+            logger.Initialize(rmId);
 
             Assert.IsTrue(Directory.Exists(autoCreatePath));
             Assert.AreEqual(autoCreatePath, logger.Location);
@@ -102,7 +102,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
 
             try
             {
-                logger.Initialize(rmId.ToString());
+                logger.Initialize(rmId);
                 Assert.Fail("Should have detected an invalid dir and thrown an exception");
             }
             catch
@@ -116,7 +116,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
             RecoveryFileLogger logger = new RecoveryFileLogger();
 
             logger.Location = nonDefaultLogLocation;
-            logger.Initialize(rmId.ToString());
+            logger.Initialize(rmId);
 
             Assert.IsTrue(logger.GetRecoverables().Length == 0);
         }
@@ -137,7 +137,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
             gen.NextBytes(recoveryData);
 
             logger.Location = nonDefaultLogLocation;
-            logger.Initialize(rmId.ToString());
+            logger.Initialize(rmId);
 
             XATransactionId xid = new XATransactionId();
             xid.GlobalTransactionId = globalId;
@@ -145,7 +145,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
 
             logger.LogRecoveryInfo(xid, recoveryData);
 
-            Assert.IsTrue(File.Exists(logger.Location + Path.DirectorySeparatorChar + rmId.ToString() + ".bin"),
+            Assert.IsTrue(File.Exists(Path.Combine(logger.Location, rmId + ".bin")),
                           "Recovery File was not created");
         }
 
@@ -165,7 +165,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
             gen.NextBytes(recoveryData);
 
             logger.Location = nonDefaultLogLocation;
-            logger.Initialize(rmId.ToString());
+            logger.Initialize(rmId);
 
             XATransactionId xid = new XATransactionId();
             xid.GlobalTransactionId = globalId;
@@ -173,7 +173,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
 
             logger.LogRecoveryInfo(xid, recoveryData);
 
-            Assert.IsTrue(File.Exists(logger.Location + Path.DirectorySeparatorChar + rmId.ToString() + ".bin"),
+            Assert.IsTrue(File.Exists(Path.Combine(logger.Location, rmId + ".bin")),
                           "Recovery File was not created");
             Assert.IsTrue(logger.GetRecoverables().Length == 1,
                           "Did not recover the logged record.");
@@ -202,7 +202,7 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
             gen.NextBytes(recoveryData);
 
             logger.Location = nonDefaultLogLocation;
-            logger.Initialize(rmId.ToString());
+            logger.Initialize(rmId);
 
             XATransactionId xid = new XATransactionId();
             xid.GlobalTransactionId = globalId;
@@ -210,12 +210,12 @@ namespace Apache.NMS.ActiveMQ.Test.Trans
 
             logger.LogRecoveryInfo(xid, recoveryData);
 
-            Assert.IsTrue(File.Exists(logger.Location + Path.DirectorySeparatorChar + rmId.ToString() + ".bin"),
+            Assert.IsTrue(File.Exists(Path.Combine(logger.Location, rmId + ".bin")),
                           "Recovery File was not created");
 
             logger.Purge();
 
-            Assert.IsFalse(File.Exists(logger.Location + Path.DirectorySeparatorChar + rmId.ToString() + ".bin"),
+            Assert.IsFalse(File.Exists(Path.Combine(logger.Location, rmId + ".bin")),
                           "Recovery File was not created");
         }
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs Tue Feb 26 22:13:02 2013
@@ -24,7 +24,7 @@ namespace Apache.NMS.ActiveMQ.Test
 	[TestFixture]
 	public class VirtualTopicTest : NMSTestSupport
 	{
-		protected static string DESTINATION_NAME = "TestDestination";
+		protected static string DESTINATION_NAME = "TEST.VTopicDestination";
 		protected static string PRODUCER_DESTINATION_NAME = "VirtualTopic." + DESTINATION_NAME;
 		protected static string CONSUMER_A_DESTINATION_NAME = "Consumer.A." + PRODUCER_DESTINATION_NAME;
 		protected static string CONSUMER_B_DESTINATION_NAME = "Consumer.B." + PRODUCER_DESTINATION_NAME;

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq-test.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq-test.csproj?rev=1450481&r1=1450480&r2=1450481&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq-test.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq-test.csproj Tue Feb 26 22:13:02 2013
@@ -79,6 +79,7 @@
     <Compile Include="src\test\csharp\CommonAssemblyInfo.cs" />
     <Compile Include="src\test\csharp\ConnectionFactoryTest.cs" />
     <Compile Include="src\test\csharp\ConnectionMetaDataTest.cs" />
+    <Compile Include="src\test\csharp\InvalidCredentialsTest.cs" />
     <Compile Include="src\test\csharp\DtcBasicTransactionsTest.cs" />
     <Compile Include="src\test\csharp\DtcConsumerTransactionsTest.cs" />
     <Compile Include="src\test\csharp\DtcProducerTransactionsTest.cs" />



Mime
View raw message