[mapguide-commits] r5429 - in sandbox/maestro-3.0: MaestroAPITestRunner MaestroAPITests OSGeo.MapGuide.MaestroAPI/Services OSGeo.MapGuide.MaestroAPI.Native

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Dec 1 09:01:33 EST 2010


Author: jng
Date: 2010-12-01 06:01:32 -0800 (Wed, 01 Dec 2010)
New Revision: 5429

Modified:
   sandbox/maestro-3.0/MaestroAPITestRunner/
   sandbox/maestro-3.0/MaestroAPITestRunner/App.config
   sandbox/maestro-3.0/MaestroAPITestRunner/MaestroAPITestRunner.csproj
   sandbox/maestro-3.0/MaestroAPITests/RuntimeMapTests.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/Utility.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Services/IMappingService.cs
Log:
3.0 sandbox changes:
 - Remove RenderDynamicOverlay API from IMappingService as the native side has different revisions making a consistent wrapper difficult.
 - Activate the use of the Stream wrapper for MgByteReader in the Native impl as testing has shown no adverse effects.


Property changes on: sandbox/maestro-3.0/MaestroAPITestRunner
___________________________________________________________________
Modified: svn:ignore
   - obj
bin
*.user

   + obj
bin
*.user
Setup


Modified: sandbox/maestro-3.0/MaestroAPITestRunner/App.config
===================================================================
--- sandbox/maestro-3.0/MaestroAPITestRunner/App.config	2010-12-01 13:47:43 UTC (rev 5428)
+++ sandbox/maestro-3.0/MaestroAPITestRunner/App.config	2010-12-01 14:01:32 UTC (rev 5429)
@@ -8,7 +8,7 @@
     <runtime>
         <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <dependentAssembly>
-                <assemblyIdentity name="MapGuideDotNetApi" />
+                <assemblyIdentity name="MapGuideDotNetApi" publicKeyToken="f526c48929fda856" />
 
                 <codeBase version="1.0.0.1" href="MapGuideDotNetApi-2.2.dll"/>
 

Modified: sandbox/maestro-3.0/MaestroAPITestRunner/MaestroAPITestRunner.csproj
===================================================================
--- sandbox/maestro-3.0/MaestroAPITestRunner/MaestroAPITestRunner.csproj	2010-12-01 13:47:43 UTC (rev 5428)
+++ sandbox/maestro-3.0/MaestroAPITestRunner/MaestroAPITestRunner.csproj	2010-12-01 14:01:32 UTC (rev 5429)
@@ -74,11 +74,6 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
-  <ItemGroup>
-    <Content Include="ConnectionProviders.xml">
-      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-    </Content>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
@@ -87,4 +82,7 @@
   <Target Name="AfterBuild">
   </Target>
   -->
+  <PropertyGroup>
+    <PostBuildEvent>IF EXIST "$(ProjectDir)Setup" XCOPY /Y /I "$(ProjectDir)Setup\*.*" "$(ProjectDir)$(OutDir)"</PostBuildEvent>
+  </PropertyGroup>
 </Project>
\ No newline at end of file

Modified: sandbox/maestro-3.0/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- sandbox/maestro-3.0/MaestroAPITests/RuntimeMapTests.cs	2010-12-01 13:47:43 UTC (rev 5428)
+++ sandbox/maestro-3.0/MaestroAPITests/RuntimeMapTests.cs	2010-12-01 14:01:32 UTC (rev 5429)
@@ -323,7 +323,7 @@
             map.Save();
 
             //Render default
-            using (var stream = mapSvc.RenderDynamicOverlay(map, null, "PNG")) //mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
+            using (var stream = mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
             {
                 using (var ms = new MemoryStream())
                 using (var ms2 = new MemoryStream())
@@ -352,7 +352,7 @@
             map.Save();
 
             //Render again
-            using (var stream = mapSvc.RenderDynamicOverlay(map, null, "PNG")) //mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
+            using (var stream = mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
             {
                 using (var ms = new MemoryStream())
                 using (var ms2 = new MemoryStream())
@@ -382,7 +382,7 @@
             map.Save();
 
             //Render again
-            using (var stream = mapSvc.RenderDynamicOverlay(map, null, "PNG")) //mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
+            using (var stream = mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
             {
                 using (var ms = new MemoryStream())
                 using (var ms2 = new MemoryStream())
@@ -438,7 +438,7 @@
             map.Save();
 
             //Render default
-            using (var stream = mapSvc.RenderDynamicOverlay(map, null, "PNG")) //mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
+            using (var stream = mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
             {
                 using (var ms = new MemoryStream())
                 using (var ms2 = new MemoryStream())
@@ -467,7 +467,7 @@
             map.Save();
             
             //Render again
-            using (var stream = mapSvc.RenderDynamicOverlay(map, null, "PNG")) //mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
+            using (var stream = mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
             {
                 using (var ms = new MemoryStream())
                 using (var ms2 = new MemoryStream())
@@ -497,7 +497,7 @@
             map.Save();
 
             //Render again
-            using (var stream = mapSvc.RenderDynamicOverlay(map, null, "PNG")) //mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
+            using (var stream = mapSvc.RenderRuntimeMap(map.ResourceID, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, "PNG"))
             {
                 using (var ms = new MemoryStream())
                 using (var ms2 = new MemoryStream())
@@ -520,6 +520,31 @@
             }
         }
 
+        public virtual void TestResourceEvents()
+        {
+            bool deleteCalled = false;
+            bool updateCalled = false;
+            bool insertCalled = false;
+
+            var conn = CreateTestConnection();
+            conn.ResourceService.ResourceAdded += (s, e) => { insertCalled = true; };
+            conn.ResourceService.ResourceDeleted += (s, e) => { deleteCalled = true; };
+            conn.ResourceService.ResourceUpdated += (s, e) => { updateCalled = true; };
+
+            //This should raise ResourceAdded
+            conn.ResourceService.SetResourceXmlData("Library://UnitTests/ResourceEvents/Test.LayerDefinition", File.OpenRead("TestData/MappingService/UT_Rail.ldf"));
+
+            //This should raise ResourceUpdated
+            conn.ResourceService.SetResourceXmlData("Library://UnitTests/ResourceEvents/Test.LayerDefinition", File.OpenRead("TestData/MappingService/UT_Rail.ldf"));
+
+            //This should raise ResourceDeleted
+            conn.ResourceService.DeleteResource("Library://UnitTests/ResourceEvents/Test.LayerDefinition");
+
+            Assert.IsTrue(deleteCalled);
+            Assert.IsTrue(updateCalled);
+            Assert.IsTrue(insertCalled);
+        }
+
         public virtual void TestLargeMapCreatePerformance()
         {
             //Create a 200 layer, 50 group map. This is not part of the benchmark
@@ -575,8 +600,7 @@
         }
     }
 
-    [TestFixture(Ignore = true)]
-    //[TestFixture]
+    [TestFixture]
     public class HttpRuntimeMapTests : RuntimeMapTests
     {
         protected override IServerConnection CreateTestConnection()
@@ -588,6 +612,12 @@
         }
 
         [Test]
+        public override void TestResourceEvents()
+        {
+            base.TestResourceEvents();
+        }
+
+        [Test]
         public override void TestCreate()
         {
             base.TestCreate();
@@ -618,8 +648,7 @@
         }
     }
 
-    //[TestFixture(Ignore = true)]
-    [TestFixture]
+    [TestFixture(Ignore = true)]
     public class LocalRuntimeMapTests : RuntimeMapTests
     {
         protected override IServerConnection CreateTestConnection()

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Services/IMappingService.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Services/IMappingService.cs	2010-12-01 13:47:43 UTC (rev 5428)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Services/IMappingService.cs	2010-12-01 14:01:32 UTC (rev 5429)
@@ -55,9 +55,9 @@
         /// <returns></returns>
         RuntimeMap OpenMap(string runtimeMapResourceId);
 
-        System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format);
+        //System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format);
 
-        System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, bool keepSelection);
+        //System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, bool keepSelection);
 
         /// <summary>
         /// Renders the runtime map.

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs	2010-12-01 13:47:43 UTC (rev 5428)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs	2010-12-01 14:01:32 UTC (rev 5429)
@@ -70,7 +70,9 @@
 
         public override long Length
         {
-            get { return _reader.GetLength(); }
+            //NOTE: MgByteReader only returns remaining length! Should we
+            //be keeping track of position and adding on this value?
+            get { return _reader.GetLength(); } 
         }
 
         public override bool CanRewind

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/Utility.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/Utility.cs	2010-12-01 13:47:43 UTC (rev 5428)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Native/Utility.cs	2010-12-01 14:01:32 UTC (rev 5429)
@@ -67,7 +67,6 @@
         /// <returns>A read-only <see cref="System.IO.Stream"/> that wraps the underlying <see cref="OSGeo.MapGuide.MgByteReader"/></returns>
         public static System.IO.Stream MgStreamToNetStream(object source, System.Reflection.MethodInfo mi, object[] args)
         {
-            /*
             try
             {
                 //How can we work around invalidating MgByteReader when it's passed as a parameter?
@@ -84,8 +83,7 @@
                 else
                     throw;
             }
-             */
-            
+            /* 
             try
             {
                 OSGeo.MapGuide.MgByteReader rd = (OSGeo.MapGuide.MgByteReader)mi.Invoke(source, args);
@@ -106,7 +104,7 @@
                     throw tex.InnerException;
                 else
                     throw;
-            }
+            }*/
         }
 
         /// <summary>



More information about the mapguide-commits mailing list