You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2005/10/17 20:46:16 UTC

svn commit: r325957 - in /ibatis/trunk/cs/mapper: IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ResourcesTest.cs IBatisNet.Common.Test/bin/Debug/OctopusService.dll IBatisNet.Common/Utilities/Resources.cs

Author: gbayon
Date: Mon Oct 17 11:46:00 2005
New Revision: 325957

URL: http://svn.apache.org/viewcvs?rev=325957&view=rev
Log:
- Fixed IBATISNET-103

Added:
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/bin/Debug/OctopusService.dll   (with props)
Modified:
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ResourcesTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ResourcesTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ResourcesTest.cs?rev=325957&r1=325956&r2=325957&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ResourcesTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ResourcesTest.cs Mon Oct 17 11:46:00 2005
@@ -42,12 +42,27 @@
 		{
 			XmlDocument doc = null;
 
-			doc = Resources.GetEmbeddedResourceAsXmlDocument("properties.xml, IBatisNet.Common.Test");
+			doc = Resources.GetEmbeddedResourceAsXmlDocument("IBatisNet.Common.Test.properties.xml, IBatisNet.Common.Test");
 
 			Assert.IsNotNull(doc);
 			Assert.IsTrue(doc.HasChildNodes);
 			Assert.AreEqual(doc.ChildNodes.Count,2);
 			Assert.AreEqual(doc.SelectNodes("/settings/add").Count, 4);
+		}
+
+		/// <summary>
+		/// Test loading Embedded Resource
+		/// </summary>
+		[Test] 
+		public void TestEmbeddedResourceWhenNamespaceDiffersFromAssemblyName() 
+		{
+			XmlDocument doc = null;
+
+			doc = Resources.GetEmbeddedResourceAsXmlDocument("CompanyName.ProductName.Maps.ISCard.xml, OctopusService");
+
+			Assert.IsNotNull(doc);
+			Assert.IsTrue(doc.HasChildNodes);
+			Assert.AreEqual(doc.ChildNodes.Count,2);
 		}
 		#endregion
 

Added: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/bin/Debug/OctopusService.dll
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/bin/Debug/OctopusService.dll?rev=325957&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/bin/Debug/OctopusService.dll
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs?rev=325957&r1=325956&r2=325957&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs Mon Oct 17 11:46:00 2005
@@ -405,12 +405,13 @@
 			if (fileInfo.IsAssemblyQualified)
 			{
 				Assembly assembly = Assembly.LoadWithPartialName (fileInfo.AssemblyName);
-//				foreach(string fileName in assembly.GetManifestResourceNames() ) 
-//				{
-//					Console.WriteLine(fileName);
-//				}
 
 				Stream stream = assembly.GetManifestResourceStream(fileInfo.ResourceFileName);
+				// JIRA - IBATISNET-103 
+				if (stream == null)
+				{
+					stream = assembly.GetManifestResourceStream(fileInfo.FileName);
+				}
 				if (stream != null)
 				{
 					try
@@ -537,10 +538,7 @@
 			/// </summary>
 			public string ResourceFileName
 			{
-				get
-				{
-					return AssemblyName+"."+FileName;
-				}
+				get { return AssemblyName+"."+FileName; }
 			}
 
 			/// <summary>
@@ -548,10 +546,7 @@
 			/// </summary>
 			public string OriginalFileName
 			{
-				get
-				{
-					return _originalFileName;
-				}
+				get { return _originalFileName; }
 			}
 
 			/// <summary>
@@ -559,10 +554,7 @@
 			/// </summary>
 			public string FileName
 			{
-				get
-				{
-					return _unresolvedFileName;
-				}
+				get { return _unresolvedFileName; }
 			}
 
 			/// <summary>
@@ -570,10 +562,7 @@
 			/// </summary>
 			public string AssemblyName
 			{
-				get
-				{
-					return _unresolvedAssemblyName;
-				}
+				get { return _unresolvedAssemblyName; }
 			}
 
 			/// <summary>