[mapguide-commits] r5639 - in trunk/Tools/Maestro/MaestroAPITests:
. UserTestData
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Mar 18 19:52:52 EDT 2011
Author: jng
Date: 2011-03-18 16:52:52 -0700 (Fri, 18 Mar 2011)
New Revision: 5639
Added:
trunk/Tools/Maestro/MaestroAPITests/UserTestData/NASA_WMS_config_doc.xml
Modified:
trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs
trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj
Log:
Add WMS configuration unit test
Modified: trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs 2011-03-18 23:38:17 UTC (rev 5638)
+++ trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs 2011-03-18 23:52:52 UTC (rev 5639)
@@ -25,6 +25,7 @@
using OSGeo.MapGuide.MaestroAPI.SchemaOverrides;
using OSGeo.MapGuide.ObjectModels.Common;
using System.IO;
+using System.Drawing;
namespace MaestroAPITests
{
@@ -136,11 +137,71 @@
{
}
+
+ [Test]
+ public void TestWmsLoad()
+ {
+ var conf = ConfigurationDocument.LoadXml(File.ReadAllText("UserTestData\\NASA_WMS_config_doc.xml")) as WmsConfigurationDocument;
+ Assert.NotNull(conf);
+ }
[Test]
public void TestWmsSaveLoad()
{
+ var conf = new WmsConfigurationDocument();
+ var schema = new FeatureSchema("WMS", "");
+ var cls = new ClassDefinition("NASAWMSGlobalPan", "");
+ cls.AddProperty(new DataPropertyDefinition("Id", "")
+ {
+ DataType = DataPropertyType.String,
+ Length = 256,
+ IsNullable = false
+ }, true);
+ cls.AddProperty(new RasterPropertyDefinition("Image", "")
+ {
+ DefaultImageXSize = 800,
+ DefaultImageYSize = 800
+ });
+
+ schema.AddClass(cls);
+ conf.AddSchema(schema);
+
+ var item = new RasterWmsItem(cls.Name, "Image");
+ item.ImageFormat = RasterWmsItem.WmsImageFormat.PNG;
+ item.IsTransparent = true;
+ item.BackgroundColor = ColorTranslator.FromHtml("#FFFFFF");
+ item.Time = "current";
+ item.ElevationDimension = "0";
+ item.SpatialContextName = "EPSG:4326";
+
+ for (int i = 0; i < 5; i++)
+ {
+ item.AddLayer(new WmsLayerDefinition("Layer" + i));
+ }
+
+ conf.AddRasterItem(item);
+
+ string path = "WmsConfigTest.xml";
+ File.WriteAllText(path, conf.ToXml());
+
+ conf = null;
+ string xml = File.ReadAllText(path);
+ conf = ConfigurationDocument.LoadXml(xml) as WmsConfigurationDocument;
+ Assert.NotNull(conf);
+
+ Assert.AreEqual(1, conf.RasterOverrides.Length);
+
+ var ritem = conf.RasterOverrides[0];
+
+ Assert.AreEqual(item.ImageFormat, ritem.ImageFormat);
+ Assert.AreEqual(item.IsTransparent, ritem.IsTransparent);
+ Assert.AreEqual(item.BackgroundColor, ritem.BackgroundColor);
+ Assert.AreEqual(item.Time, ritem.Time);
+ Assert.AreEqual(item.ElevationDimension, ritem.ElevationDimension);
+ Assert.AreEqual(item.SpatialContextName, ritem.SpatialContextName);
+
+ Assert.AreEqual(5, item.Layers.Length);
}
}
}
Modified: trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj 2011-03-18 23:38:17 UTC (rev 5638)
+++ trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj 2011-03-18 23:52:52 UTC (rev 5639)
@@ -585,6 +585,9 @@
<Content Include="TestData\Wms\Sheboygan_CityLimits_Layer_Header.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="UserTestData\NASA_WMS_config_doc.xml">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="UserTestData\odbc_example_config.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Added: trunk/Tools/Maestro/MaestroAPITests/UserTestData/NASA_WMS_config_doc.xml
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/UserTestData/NASA_WMS_config_doc.xml (rev 0)
+++ trunk/Tools/Maestro/MaestroAPITests/UserTestData/NASA_WMS_config_doc.xml 2011-03-18 23:52:52 UTC (rev 5639)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This configuration document is from the Fdo WMS notes (http://trac.osgeo.org/fdo/wiki/FdoWmsNotes) -->
+<fdo:DataStore xmlns:fdo="http://fdo.osgeo.org/schemas" xmlns:gml="http://www.opengis.net/gml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://fdo.osgeo.org/schemas" xsi:schemaLocation="http://fdo.osgeo.org/schemas FdoDocument.xsd">
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://fdo.osgeo.org/schemas/feature/WMS" xmlns:fdo="http://fdo.osgeo.org/schemas" xmlns:WMS="http://fdo.osgeo.org/schemas/feature/WMS" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:element name="NASAWMSGlobalPan" type="WMS:NASAWMSGlobalPanType" abstract="false" substitutionGroup="gml:_Feature">
+ <xs:key name="NASAWMSGlobalPanKey">
+ <xs:selector xpath=".//NASAWMSGlobalPan"/>
+ <xs:field xpath="Id"/>
+ </xs:key>
+ </xs:element>
+ <xs:complexType name="NASAWMSGlobalPanType" abstract="false">
+ <xs:complexContent>
+ <xs:extension base="gml:AbstractFeatureType">
+ <xs:sequence>
+ <xs:element name="Id">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="256"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="Image" type="fdo:RasterPropertyType" fdo:defaultImageXSize="800" fdo:defaultImageYSize="600">
+ <xs:annotation>
+ <xs:appinfo source="http://fdo.osgeo.org/schemas">
+ <fdo:DefaultDataModel organization="Row" bitsPerPixel="32" tileSizeX="100" tileSizeY="100"/>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:schema>
+ <SchemaMapping provider="OSGeo.WMS.3.1" name="WMS" xmlns="http://fdowms.osgeo.org/schemas">
+ <complexType name="NASAWMSGlobalPanType">
+ <RasterDefinition name="Image">
+ <Format>PNG</Format>
+ <Transparent>true</Transparent>
+ <BackgroundColor>0xFFFFFF</BackgroundColor>
+ <Time>current</Time>
+ <Elevation>0</Elevation>
+ <SpatialContext>EPSG:4326</SpatialContext>
+ <Layer name="global_mosaic">
+ <Style/>
+ </Layer>
+ </RasterDefinition>
+ </complexType>
+ </SchemaMapping>
+</fdo:DataStore>
More information about the mapguide-commits
mailing list