[mapguide-commits] r8012 - in trunk/Tools/Maestro: MaestroAPITests MaestroAPITests/UserTestData OSGeo.MapGuide.MaestroAPI/Mapping
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Apr 7 03:37:27 PDT 2014
Author: jng
Date: 2014-04-07 03:37:27 -0700 (Mon, 07 Apr 2014)
New Revision: 8012
Added:
trunk/Tools/Maestro/MaestroAPITests/UserTestData/TestDuplicateLayerIds.xml
Modified:
trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj
trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
Log:
#2398: Fix RuntimeMap creation failure on duplicate Layer Definition IDs. Patch by johngalambos. Reviewed by me with unit test included.
Modified: trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj 2014-04-07 10:21:55 UTC (rev 8011)
+++ trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj 2014-04-07 10:37:27 UTC (rev 8012)
@@ -562,6 +562,9 @@
<Content Include="UserTestData\1896.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="UserTestData\TestDuplicateLayerIds.xml">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="UserTestData\GeoRestConfig.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Modified: trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs 2014-04-07 10:21:55 UTC (rev 8011)
+++ trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs 2014-04-07 10:37:27 UTC (rev 8012)
@@ -102,6 +102,7 @@
resSvc.SetResourceXmlData("Library://UnitTests/Maps/Sheboygan.MapDefinition", File.OpenRead("TestData/MappingService/UT_Sheboygan.mdf"));
resSvc.SetResourceXmlData("Library://UnitTests/Maps/SheboyganTiled.MapDefinition", File.OpenRead("UserTestData/TestTiledMap.xml"));
+ resSvc.SetResourceXmlData("Library://UnitTests/Maps/DuplicateLayerIds.MapDefinition", File.OpenRead("UserTestData/TestDuplicateLayerIds.xml"));
resSvc.SetResourceXmlData("Library://UnitTests/Layers/HydrographicPolygons.LayerDefinition", File.OpenRead("TestData/MappingService/UT_HydrographicPolygons.ldf"));
resSvc.SetResourceXmlData("Library://UnitTests/Layers/Rail.LayerDefinition", File.OpenRead("TestData/MappingService/UT_Rail.ldf"));
@@ -1129,6 +1130,22 @@
Assert.IsTrue(insertCalled);
}
+ public virtual void TestCaseDuplicateLayerIds()
+ {
+ try
+ {
+ IServerConnection conn = CreateTestConnection();
+ IMappingService mapSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
+ string mapdefinition = "Library://UnitTests/Maps/DuplicateLayerIds.MapDefinition";
+ IMapDefinition mdef = (IMapDefinition)conn.ResourceService.GetResource(mapdefinition);
+ RuntimeMap rtm = mapSvc.CreateMap(mdef); // Create new runtime map
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.ToString());
+ }
+ }
+
public virtual void TestLargeMapCreatePerformance()
{
TestMapCreate(50, 10);
@@ -1303,6 +1320,12 @@
}
[Test]
+ public override void TestCaseDuplicateLayerIds()
+ {
+ base.TestCaseDuplicateLayerIds();
+ }
+
+ [Test]
public void TestCreateRuntimeMapRequest()
{
if (_conn.SiteVersion < new Version(2, 6))
@@ -1684,6 +1707,12 @@
{
base.TestMapAddDwfLayer();
}
+
+ [Test]
+ public override void TestCaseDuplicateLayerIds()
+ {
+ base.TestCaseDuplicateLayerIds();
+ }
}
[TestFixture]
@@ -1783,6 +1812,12 @@
base.TestMapManipulation3();
}
+ [Test]
+ public override void TestCaseDuplicateLayerIds()
+ {
+ base.TestCaseDuplicateLayerIds();
+ }
+
/*
[Test]
public override void TestLargeMapCreatePerformance()
Added: trunk/Tools/Maestro/MaestroAPITests/UserTestData/TestDuplicateLayerIds.xml
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/UserTestData/TestDuplicateLayerIds.xml (rev 0)
+++ trunk/Tools/Maestro/MaestroAPITests/UserTestData/TestDuplicateLayerIds.xml 2014-04-07 10:37:27 UTC (rev 8012)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="MapDefinition-1.0.0.xsd">
+ <Name>New Map</Name>
+ <CoordinateSystem>GEOGCS["WGS84 Lat/Long's, Degrees, -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]</CoordinateSystem>
+ <Extents>
+ <MinX>-87.770746109180749</MinX>
+ <MaxX>-87.6957605384125</MaxX>
+ <MinY>43.686899685828813</MinY>
+ <MaxY>43.805498742206247</MaxY>
+ </Extents>
+ <BackgroundColor>ffffffff</BackgroundColor>
+ <BaseMapDefinition>
+ <FiniteDisplayScale>100</FiniteDisplayScale>
+ <FiniteDisplayScale>5427</FiniteDisplayScale>
+ <FiniteDisplayScale>10753</FiniteDisplayScale>
+ <FiniteDisplayScale>16080</FiniteDisplayScale>
+ <FiniteDisplayScale>21407</FiniteDisplayScale>
+ <FiniteDisplayScale>26733</FiniteDisplayScale>
+ <FiniteDisplayScale>32060</FiniteDisplayScale>
+ <FiniteDisplayScale>37387</FiniteDisplayScale>
+ <FiniteDisplayScale>42713</FiniteDisplayScale>
+ <FiniteDisplayScale>48040</FiniteDisplayScale>
+ <FiniteDisplayScale>53367</FiniteDisplayScale>
+ <FiniteDisplayScale>58693</FiniteDisplayScale>
+ <FiniteDisplayScale>64020</FiniteDisplayScale>
+ <FiniteDisplayScale>69347</FiniteDisplayScale>
+ <FiniteDisplayScale>80000</FiniteDisplayScale>
+ <BaseMapLayerGroup>
+ <Name>Base Layer Group</Name>
+ <Visible>true</Visible>
+ <ShowInLegend>true</ShowInLegend>
+ <ExpandInLegend>true</ExpandInLegend>
+ <LegendLabel>Base Layer Group</LegendLabel>
+ <BaseMapLayer>
+ <Name>Rail</Name>
+ <ResourceId>Library://UnitTests/Layers/Rail.LayerDefinition</ResourceId>
+ <Selectable>true</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Rail</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ </BaseMapLayer>
+ <BaseMapLayer>
+ <Name>Parcels</Name>
+ <ResourceId>Library://UnitTests/Layers/Parcels.LayerDefinition</ResourceId>
+ <Selectable>true</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Parcels</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ </BaseMapLayer>
+ <BaseMapLayer>
+ <Name>HydrographicPolygons</Name>
+ <ResourceId>Library://UnitTests/Layers/Parcels.LayerDefinition</ResourceId>
+ <Selectable>true</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Parcels2</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ </BaseMapLayer>
+ </BaseMapLayerGroup>
+ </BaseMapDefinition>
+</MapDefinition>
\ No newline at end of file
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2014-04-07 10:21:55 UTC (rev 8011)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2014-04-07 10:37:27 UTC (rev 8012)
@@ -19,19 +19,17 @@
#endregion
using System;
using System.Collections.Generic;
-using System.Text;
+using System.Diagnostics;
+using System.Drawing;
+using System.Linq;
+using OSGeo.MapGuide.MaestroAPI.Commands;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using OSGeo.MapGuide.MaestroAPI.Serialization;
using OSGeo.MapGuide.MaestroAPI.Services;
-using OSGeo.MapGuide.ObjectModels.Common;
-using OSGeo.MapGuide.ObjectModels.MapDefinition;
using OSGeo.MapGuide.ObjectModels;
-using OSGeo.MapGuide.MaestroAPI.Serialization;
-using OSGeo.MapGuide.MaestroAPI.Resource;
-using System.ComponentModel;
+using OSGeo.MapGuide.ObjectModels.Common;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
-using System.Diagnostics;
-using OSGeo.MapGuide.MaestroAPI.Commands;
-using OSGeo.MapGuide.MaestroAPI.Exceptions;
-using System.Drawing;
+using OSGeo.MapGuide.ObjectModels.MapDefinition;
namespace OSGeo.MapGuide.MaestroAPI.Mapping
{
@@ -282,7 +280,7 @@
if (_getRes != null)
{
Debug.WriteLine("[RuntimeMap.ctor]: Batching layer requests"); //NOXLATE
- var res = _getRes.Execute(GetLayerIds(mdf));
+ var res = _getRes.Execute(GetLayerIds(mdf).Distinct());
//Pre-populate layer def cache so GetLayerDefinition() returns these
//instead of making a new request
foreach (var key in res.Keys)
More information about the mapguide-commits
mailing list