activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r832191 - /activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs
Date Mon, 02 Nov 2009 23:29:08 GMT
Author: tabish
Date: Mon Nov  2 23:29:07 2009
New Revision: 832191

URL: http://svn.apache.org/viewvc?rev=832191&view=rev
Log:
* NMSTestSupport.cs: 

Add function to get the configured URI string.

Modified:
    activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs

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=832191&r1=832190&r2=832191&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 Nov  2
23:29:07 2009
@@ -96,6 +96,47 @@
         }
 
         /// <summary>
+        /// Return the configured URI String.  This function loads the connection 
+        /// settings from the configuration file.
+        /// </summary>
+        /// <returns></returns>
+        protected string GetConfiguredConnectionURI()
+        {
+            Uri brokerUri = null;
+            string[] paths = GetConfigSearchPaths();
+            string connectionConfigFileName = GetConnectionConfigFileName();
+            bool configFound = false;
+
+            foreach(string path in paths)
+            {
+                string fullpath = Path.Combine(path, connectionConfigFileName);
+                Tracer.Debug("\tScanning folder: " + path);
+
+                if(File.Exists(fullpath))
+                {
+                    Tracer.Debug("\tAssembly found!");
+                    connectionConfigFileName = fullpath;
+                    configFound = true;
+                    break;
+                }
+            }
+
+            Assert.IsTrue(configFound, "Connection configuration file does not exist.");
+            XmlDocument configDoc = new XmlDocument();
+
+            configDoc.Load(connectionConfigFileName);
+            XmlElement uriNode = (XmlElement) configDoc.SelectSingleNode(String.Format("/configuration/{0}",
GetNameTestURI()));
+
+            if(null != uriNode)
+            {
+                // Replace any environment variables embedded inside the string.
+                brokerUri = new Uri(ReplaceEnvVar(uriNode.GetAttribute("value")));
+            }
+
+			return brokerUri.ToString();
+        }
+		
+        /// <summary>
         /// Create the NMS Factory that can create NMS Connections.  This function loads
the
         /// connection settings from the configuration file.
         /// </summary>



Mime
View raw message