Author: jgomes
Date: Mon Aug 11 11:10:07 2008
New Revision: 684857

URL: http://svn.apache.org/viewvc?rev=684857&view=rev
Log:
Refactored string comparison to support .NET 1.1 methods.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nant.build
    
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs
    activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nant.build
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nant.build?rev=684857&r1=684856&r2=684857&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nant.build (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nant.build Mon Aug 11 
11:10:07 2008
@@ -87,21 +87,16 @@
       <include name="${Apache.NMS.Test.dll}"/>
       <include name="${Apache.NMS.Test.pdb}"/>
       <include name="${Apache.NMS.Test.xml}"/>
+      <include name="${nunit.dll}"/>
     </fileset>
 
     <fileset id="install.filenames">
       <include name="${project.name}.dll"/>
-      <include name="${project.name}.xml"/>
-      <include name="${project.name}.Test.dll"/>
-      <include name="${project.name}.Test.xml"/>
       <include name="nmsprovider-*.config"/>
     </fileset>
 
     <fileset id="deploy.filenames">
       <include name="${project.name}.dll"/>
-      <include name="${project.name}.xml"/>
-      <include name="${project.name}.Test.dll"/>
-      <include name="${project.name}.Test.xml"/>
       <include name="nmsprovider-*.config"/>
     </fileset>
   </target>

Modified: 
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs?rev=684857&r1=684856&r2=684857&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs 
(original)
+++ 
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs 
Mon Aug 11 11:10:07 2008
@@ -66,22 +66,22 @@
                        IDestination destination = null;
                        DestinationType destinationType = defaultType;
 
-                       if(destinationName.StartsWith(QueuePrefix, 
StringComparison.CurrentCultureIgnoreCase))
+                       if(0 == String.Compare(destinationName.Substring(0, 
QueuePrefix.Length), QueuePrefix, false))
                        {
                                destinationType = DestinationType.Queue;
                                destinationName = 
destinationName.Substring(QueuePrefix.Length);
                        }
-                       else if(destinationName.StartsWith(TopicPrefix, 
StringComparison.CurrentCultureIgnoreCase))
+                       else if(0 == 
String.Compare(destinationName.Substring(0, TopicPrefix.Length), TopicPrefix, 
false))
                        {
                                destinationType = DestinationType.Topic;
                                destinationName = 
destinationName.Substring(TopicPrefix.Length);
                        }
-                       else if(destinationName.StartsWith(TempQueuePrefix, 
StringComparison.CurrentCultureIgnoreCase))
+                       else if(0 == 
String.Compare(destinationName.Substring(0, TempQueuePrefix.Length), 
TempQueuePrefix, false))
                        {
                                destinationType = 
DestinationType.TemporaryQueue;
                                destinationName = 
destinationName.Substring(TempQueuePrefix.Length);
                        }
-                       else if(destinationName.StartsWith(TempTopicPrefix, 
StringComparison.CurrentCultureIgnoreCase))
+                       else if(0 == 
String.Compare(destinationName.Substring(0, TempTopicPrefix.Length), 
TempTopicPrefix, false))
                        {
                                destinationType = 
DestinationType.TemporaryTopic;
                                destinationName = 
destinationName.Substring(TempTopicPrefix.Length);

Modified: 
activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs?rev=684857&r1=684856&r2=684857&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs 
(original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs 
Mon Aug 11 11:10:07 2008
@@ -38,7 +38,6 @@
 
                public NMSTestSupport()
                {
-                       clientId = "NMSUnitTests";
                }
 
                [SetUp]
@@ -112,28 +111,9 @@
                        {
                                brokerUri = new 
Uri(uriNode.GetAttribute("value"));
                                factoryParams = GetFactoryParams(uriNode);
-       
-                               XmlElement userNameNode = (XmlElement) 
uriNode.SelectSingleNode("userName");
-
-                               if(null != userNameNode)
-                               {
-                                       userName = 
userNameNode.GetAttribute("value");
-                               }
-                               else
-                               {
-                                       userName = "guest";
-                               }
-
-                               XmlElement passWordNode = (XmlElement) 
uriNode.SelectSingleNode("passWord");
-
-                               if(null != passWordNode)
-                               {
-                                       passWord = 
passWordNode.GetAttribute("value");
-                               }
-                               else
-                               {
-                                       passWord = "guest";
-                               }
+                               clientId = GetNodeValueAttribute(uriNode, 
"clientId", "NMSTestClientId");
+                               userName = GetNodeValueAttribute(uriNode, 
"userName", "guest");
+                               passWord = GetNodeValueAttribute(uriNode, 
"passWord", "guest");
 
                                if(null == factoryParams)
                                {
@@ -193,6 +173,23 @@
                        return null;
                }
 
+               protected static string GetNodeValueAttribute(XmlElement 
parentNode, string nodeName, string dflt)
+               {
+                       XmlElement node = (XmlElement) 
parentNode.SelectSingleNode(nodeName);
+                       string val;
+
+                       if(null != node)
+                       {
+                               val = node.GetAttribute("value");
+                       }
+                       else
+                       {
+                               val = dflt;
+                       }
+
+                       return val;
+               }
+
                /// <summary>
                /// Create a new connection to the broker.
                /// </summary>


Reply via email to