[mapguide-commits] r8377 - in trunk/MgDev/UnitTest/WebTier: . Java Java/src Java/src/org Java/src/org/osgeo Java/src/org/osgeo/mapguide Java/src/org/osgeo/mapguide/test Java/src/org/osgeo/mapguide/test/common Java/src/org/osgeo/mapguide/test/operations Java/src/org/osgeo/mapguide/test/platform

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Oct 2 11:33:49 PDT 2014


Author: jng
Date: 2014-10-02 11:33:49 -0700 (Thu, 02 Oct 2014)
New Revision: 8377

Added:
   trunk/MgDev/UnitTest/WebTier/Java/
   trunk/MgDev/UnitTest/WebTier/Java/build.xml
   trunk/MgDev/UnitTest/WebTier/Java/src/
   trunk/MgDev/UnitTest/WebTier/Java/src/org/
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/ApiTypes.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/CommonTests.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Console.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/MapGuideTestExecutorCollection.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/MapGuideTests.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/PlatformFactory.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Program.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/Assert.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/AssertException.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/IExternalTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/IPlatformFactory.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestExecutor.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestExecutorCollection.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestLogger.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/MutableInteger.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/SqliteDb.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestExecutorCollectionBase.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestLoggerFile.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestResult.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/operations/
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/operations/IWebLayoutCreator.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/BatchPropertyCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderMemoryConstructorTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderStringConstructorTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderTestData.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ClassDefinitionCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CoordinateCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurvePolygonCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveRingCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveSegmentCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveStringCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/FeatureCommandCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/FeatureSchemaCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/GeomBuild.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/GeometryCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/IntCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/LineStringCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/LinearRingCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/MapCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/PropertyCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/PropertyDefinitionCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/StringCollectionTest.java
   trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/StringPropertyCollectionTest.java
Log:
#2307: Add first cut of Java test runner. This implements the platform external tests ported over from the .net runner.

Added: trunk/MgDev/UnitTest/WebTier/Java/build.xml
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/build.xml	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/build.xml	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="MgUnitTest" default="dist" basedir=".">
+  <description>MgUnitTest project file</description>
+
+  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
+
+  <!-- set global properties for this build -->
+  <property name="src" location="src" />
+  <property name="build" location="build" />
+  <property name="dist"  location="dist" />
+  <property name="classpath" location="lib" />
+
+  <property name="build.target" location="64" />
+  <property name="binsrc.web" location="../../../Web/bin/release64" />
+  <property name="jarsrc.web" location="../../../Web/src/WEB-INF/lib" />
+  <property name="mapguide.res.src" location="../../../Common/MapGuideCommon/Resources/mapguide_en.res" />
+  <property name="mapguide.config.src" location="../../../Web/src/webconfig.ini" />
+  <property name="mapguide.res" location="${dist}/Resources/mapguide_en.res" />
+  <property name="mapguide.config" location="${dist}/webconfig.ini" />
+  <property name="mapguide.dictpath" location="../../../Oem/CsMap/Dictionaries" />
+  <property name="unittest.logpath" location="${dist}/unittest.log" />
+
+  <path id="master-classpath">
+    <fileset dir="${classpath}">
+      <include name="*.jar" />
+    </fileset>
+  </path>
+
+  <target name="init">
+    <!-- Create the time stamp -->
+    <tstamp/>
+    <!-- Create the build directory structure used by compile -->
+    <mkdir dir="${build}"/>
+    <!-- Copy required jars and dlls -->
+    <copy todir="${classpath}">
+      <fileset dir="${jarsrc.web}">
+        <include name="**/MapGuideApiEx.jar" />
+      </fileset>
+    </copy>
+    <condition property="binsrc.web" value="../../../Web/bin/release">
+      <equals arg1="${build.target}" arg2="32" />
+    </condition>
+    <condition property="binsrc.web" value="../../../Web/bin/release64">
+      <equals arg1="${build.target}" arg2="64" />
+    </condition>
+    <echo message="Copying dlls from ${binsrc.web}" />
+    <copy todir="${classpath}">
+      <fileset dir="${binsrc.web}">
+        <include name="**/Mg*.dll" />
+        <include name="**/ACE.dll" />
+        <include name="**/GEOS.dll" />
+        <include name="**/lib_json.dll" />
+        <include name="**/MapGuideJavaApiEx.dll" />
+        <include name="**/xerces-c_3_1mg.dll" />
+      </fileset>
+    </copy>
+  </target>
+
+  <target name="compile" depends="init"
+        description="compile the source " >
+    <!-- Compile the java code from ${src} into ${build} referencing our MapGuide API jar -->
+    <javac srcdir="${src}" destdir="${build}" includeantruntime="false">
+      <classpath>
+        <pathelement path="${classpath}" />
+        <fileset dir="${classpath}">
+          <include name="**/MapGuideApiEx.jar" />
+        </fileset>
+      </classpath>
+    </javac>
+  </target>
+
+  <target name="dist" depends="compile"
+        description="generate the distribution" >
+    <!-- Create the distribution directory -->
+    <mkdir dir="${dist}"/>
+
+    <!-- Make the unit test jar ensuring the MapGuide API jar reference is intact -->
+    <jar jarfile="${dist}/MgUnitTest.jar">
+      <fileset dir="${build}" />
+      <manifest>
+        <attribute name="Main-Class" value="org.osgeo.mapguide.test.Program" />
+        <attribute name="Class-Path" value="MapGuideApiEx.jar" />
+      </manifest>
+    </jar>
+
+    <copy todir="${dist}">
+      <fileset dir="${classpath}">
+        <include name="**/*" />
+      </fileset>
+    </copy>
+
+    <copy file="${mapguide.res.src}" tofile="${mapguide.res}" />
+
+    <!-- write webconfig.ini -->
+    <inifile dest="${mapguide.config}">
+      <set section="GeneralProperties" property="DefaultMessageLocale" value="en" />
+      <set section="GeneralProperties" property="LogsPath" value="${dist}/Logs" />
+      <set section="GeneralProperties" property="MentorDictionaryPath" value="${mapguide.dictpath}" />
+      <set section="GeneralProperties" property="ResourcesPath" value="${dist}/Resources" />
+      <set section="GeneralProperties" property="TcpIpMtu" value="1460" />
+      <set section="GeneralProperties" property="TempPath" value="${dist}/Temp" />
+      <set section="GeneralProperties" property="FailoverRetryTime" value="1" />
+
+      <set section="AdministrativeConnectionProperties" property="MaxConnections" value="2" />
+      <set section="AdministrativeConnectionProperties" property="Port" value="2810" />
+
+      <set section="ClientConnectionProperties" property="MaxConnections" value="12" />
+      <set section="ClientConnectionProperties" property="Port" value="2811" />
+
+      <set section="SiteConnectionProperties" property="IpAddress" value="127.0.0.1" />
+      <set section="SiteConnectionProperties" property="MaxConnections" value="6" />
+      <set section="SiteConnectionProperties" property="Port" value="2812" />
+
+      <set section="AgentProperties" property="DebugPause" value="0" />
+      <set section="AgentProperties" property="DisableAuthoring" value="0" />
+      <set section="AgentProperties" property="DisableWfs" value="0" />
+      <set section="AgentProperties" property="DisableWms" value="0" />
+      <set section="AgentProperties" property="ErrorLogEnabled" value="0" />
+      <set section="AgentProperties" property="ErrorLogFilename" value="Error.log" />
+      <set section="AgentProperties" property="RequestLogEnabled" value="0" />
+      <set section="AgentProperties" property="RequestLogFilename" value="Request.log" />
+
+      <set section="OgcProperties" property="WfsPassword" value="wfs" />
+      <set section="OgcProperties" property="WmsPassword" value="wms" />
+      <set section="OgcProperties" property="CITEWfsEnabled" value="0" />
+      <set section="OgcProperties" property="CITEWmsEnabled" value="0" />
+    </inifile>
+  </target>
+
+  <target name="check" depends="dist">
+    <exec executable="java" dir="${dist}">
+      <arg line="-jar MgUnitTest.jar ${mapguide.config} ${unittest.logpath}" />
+      <env key="MENTOR_DICTIONARY_PATH" value="${mapguide.dictpath}" />
+    </exec>
+  </target>
+
+  <target name="clean"
+        description="clean up" >
+    <!-- Delete the ${build} and ${dist} directory trees -->
+    <delete dir="${build}"/>
+    <delete dir="${dist}"/>
+    <delete dir="${classpath}"/>
+  </target>
+</project>
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/ApiTypes.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/ApiTypes.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/ApiTypes.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,7 @@
+package org.osgeo.mapguide.test;
+
+public class ApiTypes
+{
+    public static final String Platform = "Api";
+    public static final String Http = "Http";
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/CommonTests.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/CommonTests.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/CommonTests.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,66 @@
+package org.osgeo.mapguide.test;
+
+import java.util.*;
+
+import org.osgeo.mapguide.test.common.*;
+import org.osgeo.mapguide.test.platform.*;
+
+public class CommonTests
+{
+    public static int Execute(IPlatformFactory factory, ITestLogger logger, MutableInteger testsRun) {
+        int failures = 0;
+        Vector<IExternalTest> tests = new Vector<IExternalTest>();
+
+        //--------------- BEGIN Test Registration -----------------//
+        tests.add(new ByteReaderTest());
+        tests.add(new ByteReaderMemoryConstructorTest());
+        tests.add(new ByteReaderStringConstructorTest());
+        tests.add(new BatchPropertyCollectionTest());
+        tests.add(new ClassDefinitionCollectionTest());
+        tests.add(new CoordinateCollectionTest());
+        tests.add(new CurvePolygonCollectionTest());
+        tests.add(new CurveRingCollectionTest());
+        tests.add(new CurveSegmentCollectionTest());
+        tests.add(new CurveStringCollectionTest());
+        tests.add(new FeatureCommandCollectionTest());
+        tests.add(new FeatureSchemaCollectionTest());
+        tests.add(new GeometryCollectionTest());
+        tests.add(new IntCollectionTest());
+        tests.add(new LinearRingCollectionTest());
+        tests.add(new LineStringCollectionTest());
+        tests.add(new MapCollectionTest());
+        tests.add(new PropertyCollectionTest());
+        tests.add(new PropertyDefinitionCollectionTest());
+        tests.add(new StringCollectionTest());
+        tests.add(new StringPropertyCollectionTest());
+        //--------------- END Test Registration -------------------//
+
+        for (IExternalTest test : tests)
+        {
+            try
+            {
+                String clsName = CommonUtility.GetTypeName(test);
+                logger.WriteLine("****** Executing platform test: " + clsName + " *********");
+                Console.WriteLine("Executing external platform test: " + clsName);
+                test.Execute(factory, logger);
+            }
+            catch (AssertException ex)
+            {
+                logger.WriteLine("Assertion failure: " + ex.getMessage());
+                Console.WriteLine("Assertion failure: " + ex.getMessage());
+                failures++;
+            }
+            catch (Exception ex)
+            {
+                logger.WriteLine("General failure: " + CommonUtility.ExceptionToString(ex));
+                Console.WriteLine("General failure: " + CommonUtility.ExceptionToString(ex));
+                failures++;
+            }
+            finally
+            {
+                testsRun.increment();
+            }
+        }
+        return failures;
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Console.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Console.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Console.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,25 @@
+package org.osgeo.mapguide.test;
+
+// .net console shim
+public class Console
+{
+    public static void Write(String message)
+    {
+        System.out.print(message);
+    }
+
+    public static void Write(String format, Object ... args)
+    {
+        Write(String.format(format, args));
+    }
+
+    public static void WriteLine(String message)
+    {
+        System.out.println(message);
+    }
+
+    public static void WriteLine(String format, Object ... args)
+    {
+        WriteLine(String.format(format, args));
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/MapGuideTestExecutorCollection.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/MapGuideTestExecutorCollection.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/MapGuideTestExecutorCollection.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,445 @@
+package org.osgeo.mapguide.test;
+
+import java.io.*;
+import java.util.*;
+
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+import org.osgeo.mapguide.test.operations.*;
+
+public class MapGuideTestExecutorCollection extends TestExecutorCollectionBase
+{
+  private HashMap<String, ITestExecutor> _executors;
+
+  private MgUserInformation _userInfo;
+  private MgSiteConnection _conn;
+
+  public MapGuideTestExecutorCollection(MgUserInformation userInfo, MgSiteConnection conn)
+  {
+      _userInfo = userInfo;
+      _conn = conn;
+      _executors = new HashMap<String, ITestExecutor>();
+  }
+
+  protected void SetupExecutors(String dbPath)
+  {
+      //NOTE: We can't share the SqliteVm instance among our executor Objects as this messes up query results
+      //we must be able to re-create a new SqliteVm for each executor, so we pass down the db path
+
+      MgResourceService resSvc = (MgResourceService)_conn.createService(MgServiceType.ResourceService);
+      MgFeatureService featSvc = (MgFeatureService)_conn.createService(MgServiceType.FeatureService);
+      MgDrawingService drawSvc = (MgDrawingService)_conn.createService(MgServiceType.DrawingService);
+
+      /*
+      MgSite site = _conn.GetSite();
+      MgServerAdmin admin = new MgServerAdmin();
+      admin.Open(_userInfo);
+      MgWebLayoutCreator wlCreator = new MgWebLayoutCreator(resSvc);
+      MgMapCreator creator = new MgMapCreator(_conn, resSvc);
+      MgSessionCreator sessionCreator = new MgSessionCreator(_conn);
+      MgApplySession sessionApply = new MgApplySession(_userInfo);
+      MgSession session = new MgSession();
+
+      //Resource Service
+      _executors.put("ApplyResourcePackage".toUpperCase(), new ApplyResourcePackage(resSvc, dbPath));
+      _executors.put("ChangeResourceOwner".toUpperCase(), new ChangeResourceOwner(resSvc, dbPath));
+      _executors.put("CopyResource".toUpperCase(), new CopyResource(resSvc, dbPath));
+      _executors.put("DeleteResource".toUpperCase(), new DeleteResource(resSvc, dbPath));
+      _executors.put("DeleteResourceData".toUpperCase(), new DeleteResourceData(resSvc, dbPath));
+      _executors.put("EnumerateResourceData".toUpperCase(), new EnumerateResourceData(resSvc, dbPath));
+      _executors.put("EnumerateResourceReferences".toUpperCase(), new EnumerateResourceReferences(resSvc, dbPath));
+      _executors.put("EnumerateResources".toUpperCase(), new EnumerateResources(resSvc, dbPath));
+      _executors.put("GetRepositoryContent".toUpperCase(), new GetRepositoryContent(resSvc, dbPath));
+      _executors.put("GetRepositoryHeader".toUpperCase(), new GetRepositoryHeader(resSvc, dbPath));
+      _executors.put("GetResourceContent".toUpperCase(), new GetResourceContent(resSvc, dbPath));
+      _executors.put("GetResourceData".toUpperCase(), new GetResourceData(resSvc, dbPath));
+      _executors.put("GetResourceHeader".toUpperCase(), new GetResourceHeader(resSvc, dbPath));
+      _executors.put("InheritPermissionsFrom".toUpperCase(), new InheritPermissionsFrom(resSvc, dbPath));
+      _executors.put("MoveResource".toUpperCase(), new MoveResource(resSvc, dbPath));
+      _executors.put("RenameResourceData".toUpperCase(), new RenameResourceData(resSvc, dbPath));
+      _executors.put("SetResource".toUpperCase(), new SetResource(resSvc, dbPath));
+      _executors.put("SetResourceData".toUpperCase(), new SetResourceData(resSvc, dbPath));
+      _executors.put("UpdateRepository".toUpperCase(), new UpdateRepository(resSvc, dbPath));
+
+      //Feature Service
+      _executors.put("DescribeFeatureSchema".toUpperCase(), new DescribeFeatureSchema(featSvc, dbPath));
+      _executors.put("ExecuteSqlQuery".toUpperCase(), new ExecuteSqlQuery(featSvc, dbPath));
+      _executors.put("GetClasses".toUpperCase(), new GetClasses(featSvc, dbPath));
+      _executors.put("GetConnectionPropertyValues".toUpperCase(), new GetConnectionPropertyValues(featSvc, dbPath));
+      _executors.put("GetFeatureProviders".toUpperCase(), new GetFeatureProviders(featSvc, dbPath));
+      _executors.put("GetLongTransactions".toUpperCase(), new GetLongTransactions(featSvc, dbPath));
+      _executors.put("GetProviderCapabilities".toUpperCase(), new GetProviderCapabilities(featSvc, dbPath));
+      _executors.put("GetSchemas".toUpperCase(), new GetSchemas(featSvc, dbPath));
+      _executors.put("GetSpatialContexts".toUpperCase(), new GetSpatialContexts(featSvc, dbPath));
+      _executors.put("SelectAggregates".toUpperCase(), new SelectAggregates(featSvc, dbPath));
+      _executors.put("SelectFeatures".toUpperCase(), new SelectFeatures(featSvc, dbPath));
+      _executors.put("SetLongTransaction".toUpperCase(), new SetLongTransaction(featSvc, dbPath, sessionCreator, sessionApply));
+      _executors.put("TestConnection".toUpperCase(), new TestConnection(featSvc, dbPath));
+
+      //Map and Layers
+      _executors.put("AddLayerGroup".toUpperCase(), new AddLayerGroup(resSvc, dbPath, creator));
+      _executors.put("AddLayer".toUpperCase(), new AddLayer(resSvc, dbPath, creator));
+      _executors.put("GetCoordinateSystem".toUpperCase(), new GetCoordinateSystem(resSvc, dbPath, creator));
+      _executors.put("GetDataExtent".toUpperCase(), new GetDataExtent(resSvc, dbPath, creator));
+      _executors.put("GetDisplayInLegend".toUpperCase(), new GetDisplayInLegend(resSvc, dbPath, creator));
+      _executors.put("GetLayerFeatureClass".toUpperCase(), new GetLayerFeatureClass(resSvc, dbPath, creator));
+      _executors.put("GetLayerFeatureSource".toUpperCase(), new GetLayerFeatureSource(resSvc, dbPath, creator));
+      _executors.put("GetLayerDefinition".toUpperCase(), new GetLayerDefinition(resSvc, dbPath, creator));
+      _executors.put("GetGroups".toUpperCase(), new GetGroups(resSvc, dbPath, creator));
+      _executors.put("GetLayers".toUpperCase(), new GetLayers(resSvc, dbPath, creator));
+      _executors.put("GetLayerVisibility".toUpperCase(), new GetLayerVisibility(resSvc, dbPath, creator));
+      _executors.put("GetLegendLabel".toUpperCase(), new GetLegendLabel(resSvc, dbPath, creator));
+      _executors.put("GetMapExtent".toUpperCase(), new GetMapExtent(resSvc, dbPath, creator));
+      _executors.put("GetMapName".toUpperCase(), new GetMapName(resSvc, dbPath, creator));
+      _executors.put("GetViewCenter".toUpperCase(), new GetViewCenter(resSvc, dbPath, creator));
+      _executors.put("GetViewScale".toUpperCase(), new GetViewScale(resSvc, dbPath, creator));
+      _executors.put("HideGroup".toUpperCase(), new HideGroup(resSvc, dbPath, creator));
+      _executors.put("IsLayerVisible".toUpperCase(), new IsLayerVisible(resSvc, dbPath, creator));
+      _executors.put("LayerExists".toUpperCase(), new LayerExists(resSvc, dbPath, creator));
+      _executors.put("RemoveGroup".toUpperCase(), new RemoveGroup(resSvc, dbPath, creator));
+      _executors.put("ShowGroup".toUpperCase(), new ShowGroup(resSvc, dbPath, creator));
+
+      //Drawing Service
+      _executors.put("DescribeDrawing".toUpperCase(), new DescribeDrawing(drawSvc, dbPath));
+      _executors.put("GetDrawing".toUpperCase(), new GetDrawing(drawSvc, dbPath));
+      _executors.put("EnumerateDrawingLayers".toUpperCase(), new EnumerateDrawingLayers(drawSvc, dbPath));
+      _executors.put("GetDrawingLayer".toUpperCase(), new GetDrawingLayer(drawSvc, dbPath));
+      _executors.put("GetDrawingSection".toUpperCase(), new GetDrawingSection(drawSvc, dbPath));
+      _executors.put("EnumerateDrawingSections".toUpperCase(), new EnumerateDrawingSections(drawSvc, dbPath));
+      _executors.put("EnumerateDrawingSectionResources".toUpperCase(), new EnumerateDrawingSectionResources(drawSvc, dbPath));
+      _executors.put("GetDrawingSectionResource".toUpperCase(), new GetDrawingSectionResource(drawSvc, dbPath));
+
+      //Mapping Service
+
+      //Rendering Service
+
+      //Server Admin
+      _executors.put("Offline".toUpperCase(), new Offline(admin, dbPath));
+      _executors.put("Online".toUpperCase(), new Online(admin, dbPath));
+      _executors.put("GetLog".toUpperCase(), new GetLog(admin, dbPath));
+      _executors.put("GetLogByDate".toUpperCase(), new GetLogByDate(admin, dbPath));
+      _executors.put("ClearLog".toUpperCase(), new ClearLog(admin, dbPath));
+      _executors.put("DeleteLog".toUpperCase(), new DeleteLog(admin, dbPath));
+      _executors.put("RenameLog".toUpperCase(), new RenameLog(admin, dbPath));
+      _executors.put("EnumeratePackages".toUpperCase(), new EnumeratePackages(admin, dbPath));
+      _executors.put("DeletePackage".toUpperCase(), new DeletePackage(admin, dbPath));
+      _executors.put("LoadPackage".toUpperCase(), new LoadPackage(admin, dbPath));
+      _executors.put("GetPackageStatus".toUpperCase(), new GetPackageStatus(admin, dbPath));
+      _executors.put("GetPackageLog".toUpperCase(), new GetPackageLog(admin, dbPath));
+
+      //Site Service
+      _executors.put("CreateSession".toUpperCase(), new CreateSession(site, dbPath, session));
+      _executors.put("DestroySession".toUpperCase(), new DestroySession(site, dbPath));
+      _executors.put("GetUserForSession".toUpperCase(), new GetUserForSession(site, dbPath, session));
+      _executors.put("EnumerateUsers".toUpperCase(), new EnumerateUsers(site, dbPath));
+      _executors.put("AddUser".toUpperCase(), new AddUser(site, dbPath));
+      _executors.put("UpdateUser".toUpperCase(), new UpdateUser(site, dbPath));
+      _executors.put("DeleteUsers".toUpperCase(), new DeleteUsers(site, dbPath));
+      _executors.put("GrantRoleMembershipsToUsers".toUpperCase(), new GrantRoleMembershipsToUsers(site, dbPath));
+      _executors.put("RevokeRoleMembershipsFromUsers".toUpperCase(), new RevokeRoleMembershipsFromUsers(site, dbPath));
+      _executors.put("GrantGroupMembershipsToUsers".toUpperCase(), new GrantGroupMembershipsToUsers(site, dbPath));
+      _executors.put("RevokeGroupMembershipsFromUsers".toUpperCase(), new RevokeGroupMembershipsFromUsers(site, dbPath));
+      _executors.put("EnumerateGroups".toUpperCase(), new EnumerateGroups(site, dbPath));
+      _executors.put("EnumerateGroups2".toUpperCase(), new EnumerateGroups2(site, dbPath));
+      _executors.put("EnumerateRoles2".toUpperCase(), new EnumerateRoles2(site, dbPath));
+      _executors.put("AddGroup".toUpperCase(), new AddGroup(site, dbPath));
+      _executors.put("UpdateGroup".toUpperCase(), new UpdateGroup(site, dbPath));
+      _executors.put("DeleteGroups".toUpperCase(), new DeleteGroups(site, dbPath));
+      _executors.put("GrantRoleMembershipsToGroups".toUpperCase(), new GrantRoleMembershipsToGroups(site, dbPath));
+      _executors.put("RevokeRoleMembershipsFromGroups".toUpperCase(), new RevokeRoleMembershipsFromGroups(site, dbPath));
+      _executors.put("EnumerateRoles".toUpperCase(), new EnumerateRoles(site, dbPath));
+      _executors.put("EnumerateServers".toUpperCase(), new EnumerateServers(site, dbPath));
+      _executors.put("AddServer".toUpperCase(), new AddServer(site, dbPath));
+      _executors.put("UpdateServer".toUpperCase(), new UpdateServer(site, dbPath));
+      _executors.put("RemoveServer".toUpperCase(), new RemoveServer(site, dbPath));
+
+      //Web Layout
+      _executors.put("WL_GetTitle".toUpperCase(), new WL_GetTitle(wlCreator, dbPath));
+      _executors.put("WL_GetMapDefinition".toUpperCase(), new WL_GetMapDefinition(wlCreator, dbPath));
+      _executors.put("WL_GetScale".toUpperCase(), new WL_GetScale(wlCreator, dbPath));
+      _executors.put("WL_GetCenter".toUpperCase(), new WL_GetCenter(wlCreator, dbPath));
+      _executors.put("WL_ShowToolbar".toUpperCase(), new WL_ShowToolbar(wlCreator, dbPath));
+      _executors.put("WL_ShowStatusbar".toUpperCase(), new WL_ShowStatusbar(wlCreator, dbPath));
+      _executors.put("WL_ShowTaskpane".toUpperCase(), new WL_ShowTaskpane(wlCreator, dbPath));
+      _executors.put("WL_ShowTaskbar".toUpperCase(), new WL_ShowTaskbar(wlCreator, dbPath));
+      _executors.put("WL_ShowLegend".toUpperCase(), new WL_ShowLegend(wlCreator, dbPath));
+      _executors.put("WL_ShowProperties".toUpperCase(), new WL_ShowProperties(wlCreator, dbPath));
+      _executors.put("WL_GetTaskPaneWidth".toUpperCase(), new WL_GetTaskPaneWidth(wlCreator, dbPath));
+      _executors.put("WL_GetInformationPaneWidth".toUpperCase(), new WL_GetInformationPaneWidth(wlCreator, dbPath));
+      _executors.put("WL_GetInitialTaskUrl".toUpperCase(), new WL_GetInitialTaskUrl(wlCreator, dbPath));
+      _executors.put("WL_ShowContextMenu".toUpperCase(), new WL_ShowContextMenu(wlCreator, dbPath));
+      _executors.put("WL_TestUiItem".toUpperCase(), new WL_TestUiItem(wlCreator, dbPath));
+      _executors.put("WL_HomeTooltip".toUpperCase(), new WL_HomeTooltip(wlCreator, dbPath));
+      _executors.put("WL_HomeDescription".toUpperCase(), new WL_HomeDescription(wlCreator, dbPath));
+      _executors.put("WL_BackTooltip".toUpperCase(), new WL_BackTooltip(wlCreator, dbPath));
+      _executors.put("WL_BackDescription".toUpperCase(), new WL_BackDescription(wlCreator, dbPath));
+      _executors.put("WL_ForwardTooltip".toUpperCase(), new WL_ForwardTooltip(wlCreator, dbPath));
+      _executors.put("WL_ForwardDescription".toUpperCase(), new WL_ForwardDescription(wlCreator, dbPath));
+      _executors.put("WL_TasksName".toUpperCase(), new WL_TasksName(wlCreator, dbPath));
+      _executors.put("WL_TasksTooltip".toUpperCase(), new WL_TasksTooltip(wlCreator, dbPath));
+      _executors.put("WL_TasksDescription".toUpperCase(), new WL_TasksDescription(wlCreator, dbPath));
+
+      */
+  }
+
+  /*
+  class MgWebLayoutCreator : IWebLayoutCreator
+  {
+      private MgResourceService _resSvc;
+      private MgWebLayout _wl;
+
+      public MgWebLayoutCreator(MgResourceService resSvc)
+      {
+          _resSvc = resSvc;
+      }
+
+      public MgWebLayout CreateWebLayout(MgResourceIdentifier resId)
+      {
+          if (_wl != null)
+              return _wl;
+
+          _wl = new MgWebLayout(_resSvc, resId);
+          return _wl;
+      }
+  }
+
+  class MgMapCreator : IMapCreator
+  {
+      private MgSiteConnection _siteConn;
+      private MgMap _map;
+      private MgResourceService _resSvc;
+
+      public MgMapCreator(MgSiteConnection siteConn, MgResourceService resSvc)
+      {
+          _siteConn = siteConn;
+          _resSvc = resSvc;
+      }
+
+      public MgMapBase CreateMap(MgResourceIdentifier resId)
+      {
+          //The test suite relies on the same map and not a new one
+          //re-created on each test of that particular test suite
+          if (_map != null)
+              return _map;
+
+          _map = new MgMap(_siteConn);
+          _map.Create(resId, resId.GetName());
+          return _map;
+      }
+
+      public MgLayerBase CreateLayer(MgResourceIdentifier resId)
+      {
+          return new MgLayer(resId, _resSvc);
+      }
+  }
+
+  class MgSessionCreator : ISessionCreator
+  {
+      private MgSiteConnection _siteConn;
+
+      public MgSessionCreator(MgSiteConnection siteConn)
+      {
+          _siteConn = siteConn;
+      }
+
+      public String CreateSession()
+      {
+          var site = _siteConn.GetSite();
+          return site.CreateSession();
+      }
+  }
+
+  class MgApplySession : IApplySession
+  {
+      private MgUserInformation _userInfo;
+
+      public MgApplySession(MgUserInformation userInfo)
+      {
+          _userInfo = userInfo;
+      }
+
+      public void SetSessionId(String sessionId)
+      {
+          _userInfo.SetMgSessionId(sessionId);
+      }
+  }
+
+  class MgSession : IMapGuideSession
+  {
+      public String SessionID
+      {
+          get;
+          set;
+      }
+  }
+  */
+  public ITestExecutor GetTestExecutor(String opName)
+  {
+      if (_executors.containsKey(opName))
+          return _executors.get(opName);
+      throw new RuntimeException("Executor for " + opName + " not found");
+  }
+
+  public int ValidateRequest(SqliteDb db, String testName, int paramSetId, String operation, TestResult actualResult, ITestLogger logger)
+  {
+      int exitStatus = 0;
+      /*
+      String outcome = "pass";
+      SqliteVm vm = new SqliteVm(db, false);
+
+      Object expectedResult = null;
+
+      //If we have an exception we need to remove the stack trace because different line numbers will fail the test
+      Object resultData = CommonUtility.RemoveStackTraceFromResult(actualResult.ResultData);
+      //Get the mime type based on the content type in the result
+      String mimeType = actualResult.ContentType;
+      //If we have exception message we need to remove any parts that may contain system dependent information
+      //Ex. file paths
+      resultData = CommonUtility.ProcessExceptionMessage(resultData);
+      //Get the file extension that will be used for a dump
+      String actualExtension = CommonUtility.GetExtensionFromMimeType(mimeType);
+
+      //If we have an ALWAYSPASS parameter defined for the operation then skip the whole validation process
+      //This parameter should only be used for clean up operations that are no related with the tests
+      if (vm.Execute("Select ParamValue from Params where ParamName=\"ALWAYSPASS\" and ParamSet={0}", paramSetId) != Sqlite.Row)
+      {
+          //TestName is Test_[ServiceType]
+          String type = testName.SubString(testName.IndexOf("_") + 1);
+          String filePath = CommonUtility.GetPath(String.Format("../../TestData/{0}/DumpFiles/{0}ApiTest", type));
+          String fileName = String.Format("{0}_{1}.{2}", filePath, paramSetId, actualExtension);
+
+          if (this.TestExecutionMode == "dump")
+          {
+              //File.WriteAllText(fileName, resultData);
+              throw new NotImplementedException("The .net test runner does not support dumping of test results. Please use the PHP test runner for this purpose");
+          }
+          else
+          {
+              //This section is special case handling for the operations that return different data after each call
+              resultData = CommonUtility.SpecialDataHandling(operation, resultData, mimeType);
+
+              if (this.TestExecutionMode == "validate" || this.TestExecutionMode == "show")
+              {   
+                  String resultContent = "";
+
+                  //Get the sample result and the expected content type from the database
+                  int status = vm.Execute("Select Result, ContentType from ApiTestResults where ParamSet={0}", paramSetId);
+                  String expectedContentType = vm.GetString("ContentType");
+                  String expectedExtension = CommonUtility.GetExtensionFromMimeType(expectedContentType);
+                  SqliteGcBlob blob = vm.GetBlob("Result");
+
+                  byte[] b = blob.Read();
+                  if (b != null)
+                  {
+                      if (expectedExtension == "xml" || expectedExtension == "txt" || expectedExtension == "html")
+                          expectedResult = Encoding.UTF8.GetString(b);
+                      else
+                          expectedResult = b;
+                  }
+                  else
+                  {
+                      if (expectedExtension == "xml" || expectedExtension == "txt" || expectedExtension == "html")
+                          expectedResult = String.Empty;
+                      else
+                          expectedResult = null;
+                  }
+                  String strExpectedResult = expectedResult as String;
+                  //If we are validating from a file then get the contents of that file
+                  //File names should be prefixed with "@@" to distinguish them from BLOB data
+                  if (strExpectedResult != null && strExpectedResult.StartsWith("@@"))
+                  {
+                      String sampleDataFile = strExpectedResult.SubString(2);
+                      sampleDataFile = CommonUtility.GetPath(sampleDataFile);
+                      expectedResult = File.ReadAllText(sampleDataFile);
+                  }
+
+                  if (this.TestExecutionMode == "validate")
+                  {
+                      bool bEqual = false;
+                      byte[] bExpected = expectedResult as byte[];
+                      byte[] bActual = resultData as byte[];
+                      String strResultData = resultData as String;
+
+                      //FIXME: We're not processing DWF content properly to do this check properly. So just
+                      //pass these for now
+                      if (operation == "GETDRAWINGLAYER" || operation == "GETDRAWINGSECTION")
+                      {
+                          bEqual = true;
+                      }
+                      else
+                      {
+                          if (strExpectedResult != null && strResultData != null)
+                          {
+                              //Normalize line endings on LF before comparsion (in case the SQLite GUI recorded CRLFs)
+                              String normStrResultData = strResultData.Replace("\r\n", "\n");
+                              String normStrExpectedResult = strExpectedResult.Replace("\r\n", "\n");
+
+                              bEqual = normStrResultData.Equals(normStrExpectedResult, StringComparison.InvariantCultureIgnoreCase);
+                          }
+                          else if (bExpected != null && bActual != null)
+                          {
+                              bEqual = CommonUtility.ByteArraysEqual(bExpected, bActual, operation, testName);
+                          }
+                          else
+                          {
+                              System.Diagnostics.Debug.WriteLine(String.Format("[MgTestRunner]: {0} - {1} - Encountered disparate data types between expected and actual results. Expecting test failure :(", testName, operation));
+                          }
+                      }
+                      //If the results are different and special validation fails then the operation failed ->mark it red
+                      if (!bEqual && !CommonUtility.SpecialValidation(operation, resultData, expectedResult))
+                      {
+                          outcome = "fail";
+                          exitStatus = 1;
+
+                          if (expectedExtension != "xml" && expectedExtension != "html" && expectedExtension != "txt")
+                          {
+                              expectedResult = "Unable to display binary data";
+                          }
+
+                          if (actualExtension != "xml" && actualExtension != "html" && actualExtension != "txt")
+                          {
+                              resultData = "Unable to display binary data";
+                          }
+                      }
+                  }
+                  else
+                  {
+                      throw new NotImplementedException("The .net test runner does not support the given test execution mode (" + this.TestExecutionMode + "). Please use the PHP test runner for this purpose");
+                  }
+              }
+          }
+      }
+
+      if (outcome == "fail")
+      {
+          Console.WriteLine("****{0} {1} {2} failed.\n", testName, paramSetId, operation);
+          String str = String.Format("\n****ACTUAL RESULT****\n{0}\n****EXPECTED RESULT****\n{1}\n********\n\n\n", resultData, expectedResult);
+          //Console.WriteLine(str);
+          //Console.WriteLine("<FAIL>");
+          logger.Write(str);
+      }
+
+      vm.SqlFinalize();
+      vm = null;
+      */
+      return exitStatus;
+  }
+
+  public void Cleanup()
+  {
+      for (ITestExecutor exec : _executors.values())
+      {
+        try {
+          exec.close();
+        } catch (IOException ex) {
+
+        }
+      }
+      _executors.clear();
+  }
+
+  public String getApiType()
+  {
+      return ApiTypes.Platform;
+  }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/MapGuideTests.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/MapGuideTests.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/MapGuideTests.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,40 @@
+package org.osgeo.mapguide.test;
+
+import java.util.*;
+
+import org.osgeo.mapguide.test.common.*;
+
+public class MapGuideTests
+{
+    public static int Execute(IPlatformFactory factory, ITestLogger logger, MutableInteger testsRun) {
+        int failures = 0;
+        Vector<IExternalTest> tests = new Vector<IExternalTest>();
+        for (IExternalTest test : tests)
+        {
+            try
+            {
+                String clsName = CommonUtility.GetTypeName(test);
+                logger.WriteLine("****** Executing MapGuide test: " + clsName + " *********");
+                Console.WriteLine("Executing external MapGuide test: " + clsName);
+                test.Execute(factory, logger);
+            }
+            catch (AssertException ex)
+            {
+                logger.WriteLine("Assertion failure: " + ex.getMessage());
+                Console.WriteLine("Assertion failure: " + ex.getMessage());
+                failures++;
+            }
+            catch (Exception ex)
+            {
+                logger.WriteLine("General failure: " + CommonUtility.ExceptionToString(ex));
+                Console.WriteLine("General failure: " + CommonUtility.ExceptionToString(ex));
+                failures++;
+            }
+            finally
+            {
+                testsRun.increment();
+            }
+        }
+        return failures;
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/PlatformFactory.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/PlatformFactory.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/PlatformFactory.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,30 @@
+package org.osgeo.mapguide.test;
+
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class PlatformFactory implements IPlatformFactory
+{
+    private MgSiteConnection _siteConn;
+
+    public PlatformFactory(MgSiteConnection siteConn)
+    {
+        _siteConn = siteConn;
+    }
+
+    public MgService createService(int serviceType)
+    {
+        return _siteConn.createService(serviceType);
+    }
+
+    public MgMapBase createMap()
+    {
+        return new MgMap(_siteConn);
+    }
+
+    public MgLayerBase createLayer(MgResourceIdentifier resId)
+    {
+        MgResourceService resSvc = (MgResourceService)_siteConn.createService(MgServiceType.ResourceService);
+        return new MgLayer(resId, resSvc);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Program.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Program.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Program.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,77 @@
+package org.osgeo.mapguide.test;
+
+import java.io.*;
+import java.util.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class Program
+{
+    static MgUserInformation userInfo;
+    static MgSiteConnection siteConn;
+
+    public static void main(String[] args) {
+        try {
+            if (args.length >= 1 && args.length <= 2) {
+                String webConfigPath = args[0];
+                String logFile = "UnitTests.log";
+                if (args.length == 2)
+                    logFile = args[1];
+                
+                int failures = 0;
+                try (ITestLogger logger = new TestLoggerFile(logFile)) {
+                    logger.WriteLine(String.format("Run started: %s", new Date().toString()));
+                    MapGuideJavaApiEx.MgInitializeWebTier(webConfigPath);
+                    Console.WriteLine("MapGuide Initialized. Running tests");
+
+                    userInfo = new MgUserInformation("Administrator", "admin");
+                    siteConn = new MgSiteConnection();
+                    siteConn.open(userInfo);
+
+                    IPlatformFactory factory = new PlatformFactory(siteConn);
+
+                    MutableInteger testsRun = new MutableInteger(0);
+                    boolean isEnterprise = false;
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/ResourceService/ResourceServiceTest.dump", testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/DrawingService/DrawingServiceTest.dump", testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/FeatureService/FeatureServiceTest.dump", testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/SiteService/SiteServiceTest.dump", testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/MappingService/MappingServiceTest.dump", testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/ServerAdmin/ServerAdminTest.dump", testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/MapLayer/MapLayerTest.dump", testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/WebLayout/WebLayoutTest.dump", testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/Unicode/UnicodeTest.dump", testsRun, logger, isEnterprise);
+                    //Run auxillary tests not part of the SQLite-defined suite
+                    failures += CommonTests.Execute(factory, logger, testsRun);
+                    failures += MapGuideTests.Execute(factory, logger, testsRun);
+                    logger.WriteLine("\n\nTests failed/run: %d/%d", failures, testsRun.getValue());
+                    Console.Write("\n\nTests failed/run: %d/%d\n", failures, testsRun.getValue());
+                    logger.WriteLine(String.format("Run ended: %s", new Date().toString()));
+                }
+                System.exit(failures);
+            } else {
+                System.out.println("Usage: java -jar MgUnitTest.jar <webconfig.ini path> [test log path]");
+                System.exit(1);
+            }
+        } catch (Exception ex) {
+            System.err.println(CommonUtility.ExceptionToString(ex));
+            System.exit(1);
+        }
+    }
+
+    private static int ExecuteTest(String apiType, String dumpFile, MutableInteger testsRun, ITestLogger logger, boolean isEnterprise) {
+        ITestExecutorCollection exec = null;
+        if (apiType.equals(ApiTypes.Platform))
+            exec = new MapGuideTestExecutorCollection(userInfo, siteConn);
+
+        int ret = 0;
+        if (exec != null)
+        {
+            //"validate" is currently the only test execution mode supported
+            exec.Initialize("validate", dumpFile);
+            ret += exec.Execute(testsRun, logger, isEnterprise);
+            exec.Cleanup();
+        }
+        return ret;
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/Assert.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/Assert.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/Assert.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,91 @@
+package org.osgeo.mapguide.test.common;
+
+public class Assert
+{
+    public static void AreBytesEqual(byte[] expected, byte[] actual)
+    {
+        byte[] a = expected;
+        byte[] b = actual;
+        if (a.length != b.length)
+            throw new AssertException("Expected byte array size of " + a.length + ", got size of: " + b.length);
+
+        for (int i = 0; i < a.length; i++)
+        {
+            if (a[i] != b[i])
+                throw new AssertException("Byte number " + (i + 1) + " in expected byte array does not match byte in actual byte array");
+        }
+    }
+
+    public static void AreEqual(long expected, long actual) {
+        if (expected != actual)
+        {
+            throw new AssertException("Expected: " + expected + ", got: " + actual);
+        }
+    }
+    
+    public static void AreEqual(float expected, float actual) {
+        if (expected != actual)
+        {
+            throw new AssertException("Expected: " + expected + ", got: " + actual);
+        }
+    }
+
+    public static void AreEqual(double expected, double actual) {
+        if (expected != actual)
+        {
+            throw new AssertException("Expected: " + expected + ", got: " + actual);
+        }
+    }
+
+    public static void AreEqual(Object expected, Object actual)
+    {
+        if (expected instanceof byte[] && actual instanceof byte[])
+        {
+            AreBytesEqual((byte[])expected, (byte[])actual);
+        }
+        else if (!expected.equals(actual))
+        {
+            throw new AssertException("Expected: " + expected + ", got: " + actual);
+        }
+    }
+
+    public static void Fail(String message) {
+        throw new AssertException(message);
+    }
+
+    public static void Greater(Comparable value, Comparable against)
+    {
+        if (value.compareTo(against) <= 0)
+            throw new AssertException(value + " is not greater than " + against);
+    }
+
+    public static void IsNull(Object obj)
+    {
+        if (obj != null)
+            throw new AssertException("Reference is not null");
+    }
+
+    public static void IsTrue(boolean condition)
+    {
+        if (!condition)
+            throw new AssertException("Condition evaluated to false. Expected: true");
+    }
+
+    public static void IsTrue(boolean condition, String message)
+    {
+        if (!condition)
+            throw new AssertException(message);
+    }
+
+    public static void IsFalse(boolean condition)
+    {
+        if (condition)
+            throw new AssertException("Condition evaluated to true. Expected: false");
+    }
+
+    public static void IsNaN(double value)
+    {
+        if (!Double.isNaN(value))
+            throw new AssertException("Double is a number. Expected: NaN");
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/AssertException.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/AssertException.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/AssertException.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,8 @@
+package org.osgeo.mapguide.test.common;
+
+public class AssertException extends RuntimeException
+{
+    public AssertException(String message) {
+        super(message);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,57 @@
+package org.osgeo.mapguide.test.common;
+
+import java.io.*;
+import java.nio.file.*;
+
+public class CommonUtility
+{
+    public static String GetTypeName(Object o) {
+        Class cls = o.getClass();
+        String name = cls.getName();
+        if (name.lastIndexOf('.') > 0) {
+            name = name.substring(name.lastIndexOf('.') + 1); // Map$Entry
+            name = name.replace('$', '.');      // Map.Entry
+        }
+        return name;
+    }
+
+    public static void DeleteFile(String path) {
+        try {
+            Files.deleteIfExists(Paths.get(path));
+        } catch (IOException ex) {
+
+        }
+    }
+
+    public static byte[] ReadAllBytes(String path) {
+        try {
+            return Files.readAllBytes(Paths.get(path));
+        } catch (IOException ex) {
+            return null;
+        }
+    }
+
+    public static String GetTempFileName() {
+        try {
+            Path p = Files.createTempFile(null, null);
+            return p.toString();
+        } catch (IOException ex) {
+            return null;
+        }
+    }
+
+    public static boolean IsNullOrEmpty(String str) {
+        return str == null || str.length() == 0;
+    }
+
+    public static String ExceptionToString(Exception ex) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(ex.toString() + "\n");
+        sb.append(ex.getMessage() + "\n");
+        StackTraceElement[] items = ex.getStackTrace();
+        for (StackTraceElement item : items) {
+            sb.append("\t" + item.toString() + "\n");
+        }
+        return sb.toString();
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/IExternalTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/IExternalTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/IExternalTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,6 @@
+package org.osgeo.mapguide.test.common;
+
+public interface IExternalTest
+{
+    void Execute(IPlatformFactory factory, ITestLogger logger);
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/IPlatformFactory.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/IPlatformFactory.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/IPlatformFactory.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,10 @@
+package org.osgeo.mapguide.test.common;
+
+import org.osgeo.mapguide.*;
+
+public interface IPlatformFactory
+{
+    MgService createService(int serviceType);
+    MgMapBase createMap();
+    MgLayerBase createLayer(MgResourceIdentifier resId);
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestExecutor.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestExecutor.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestExecutor.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,10 @@
+package org.osgeo.mapguide.test.common;
+
+public interface ITestExecutor extends java.io.Closeable
+{
+    String getApi();
+
+    String getOperationName();
+
+    TestResult Execute(int paramSetId);
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestExecutorCollection.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestExecutorCollection.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestExecutorCollection.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,54 @@
+package org.osgeo.mapguide.test.common;
+
+public interface ITestExecutorCollection
+{
+    /// <summary>
+    /// Initializes this collection of test executors
+    /// </summary>
+    /// <param name="testExecutionMode"></param>
+    /// <param name="dumpFile"></param>
+    void Initialize(String testExecutionMode, String dumpFile);
+
+    /// <summary>
+    /// Gets the dump file path
+    /// </summary>
+    String getDumpFile();
+
+    /// <summary>
+    /// Gets the test execution mode
+    /// </summary>
+    String getTestExecutionMode();
+
+    /// <summary>
+    /// Gets the test executor of the specified operation name
+    /// </summary>
+    /// <param name="opName"></param>
+    /// <returns></returns>
+    ITestExecutor GetTestExecutor(String opName);
+
+    /// <summary>
+    /// Executes the test suite as defined in the dump file
+    /// </summary>
+    /// <param name="testsRun"></param>
+    /// <param name="logger"></param>
+    /// <param name="isEnterprise"></param>
+    /// <returns></returns>
+    int Execute(MutableInteger testsRun, ITestLogger logger, boolean isEnterprise);
+
+    /// <summary>
+    /// Validates a test execution result
+    /// </summary>
+    /// <param name="db"></param>
+    /// <param name="testName"></param>
+    /// <param name="paramSetId"></param>
+    /// <param name="operation"></param>
+    /// <param name="actualResult"></param>
+    /// <param name="logger"></param>
+    /// <returns></returns>
+    int ValidateRequest(SqliteDb db, String testName, int paramSetId, String operation, TestResult actualResult, ITestLogger logger);
+
+    /// <summary>
+    /// Performs necessary cleanup
+    /// </summary>
+    void Cleanup();
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestLogger.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestLogger.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/ITestLogger.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,9 @@
+package org.osgeo.mapguide.test.common;
+
+import java.io.*;
+
+public interface ITestLogger extends Closeable
+{
+    void Write(String format, Object ... args);
+    void WriteLine(String format, Object ... args);
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/MutableInteger.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/MutableInteger.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/MutableInteger.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,22 @@
+package org.osgeo.mapguide.test.common;
+
+public class MutableInteger
+{
+    private int _value;
+
+    public MutableInteger(int value) {
+        _value = value;
+    }
+
+    public int increment() {
+        _value++;
+        return _value;
+    }
+
+    public int decrement() {
+        _value--;
+        return _value;
+    }
+
+    public int getValue() { return _value; }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/SqliteDb.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/SqliteDb.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/SqliteDb.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,6 @@
+package org.osgeo.mapguide.test.common;
+
+public class SqliteDb
+{
+    
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestExecutorCollectionBase.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestExecutorCollectionBase.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestExecutorCollectionBase.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,74 @@
+package org.osgeo.mapguide.test.common;
+
+public abstract class TestExecutorCollectionBase implements ITestExecutorCollection
+{
+    public String TestExecutionMode;
+    public String DumpFile;
+
+    public String getTestExecutionMode() { return this.TestExecutionMode; }
+    public String getDumpFile() { return this.DumpFile; }
+
+    public abstract String getApiType();
+
+    public void Initialize(String testExecutionMode, String dumpFile)
+    {
+        this.TestExecutionMode = testExecutionMode;
+        this.DumpFile = dumpFile;
+    }
+
+    protected abstract void SetupExecutors(String dbPath);
+
+    public int Execute(MutableInteger testsRun, ITestLogger logger, boolean isEnterprise)
+    {
+        int exitStatus = 0;
+        /*
+        String dbPath = CommonUtility.GetDbPath(this.DumpFile);
+        String dbName = CommonUtility.GetPath(dbPath);
+
+        if (File.Exists(dbName))
+        {
+            var db = new SqliteDb();
+            db.Open(dbName);
+
+            var vm = new SqliteVm(db, true);
+
+            int status = vm.Execute("Select TestName, TestType from TestCase where TestType=\"{0}\" order by ExecuteSequence", this.ApiType);
+
+            //NOTE: We can't share the SqliteVm instance among our executor objects as this messes up query results
+            //we must be able to re-create a new SqliteVm for each executor, so we pass down the db path
+            SetupExecutors(dbName);
+
+            while (status == Sqlite.Row)
+            {
+                String testName = vm.GetString("TestName");
+                String testType = vm.GetString("TestType");
+
+                Console.WriteLine("Executing {0} test: {1}", testType, testName);
+                using (var run = new TestExecutionRun(dbPath, this))
+                {
+                    try
+                    {
+                        exitStatus += run.RunTests(testName, logger, ref testsRun);
+                    }
+                    catch (Exception ex)
+                    {
+                        Console.WriteLine(CommonUtility.ExceptionToString(ex));
+                        exitStatus += 1;
+                    }
+                }
+                status = vm.NextRow();
+            }
+            vm.SqlFinalize();
+            vm = null;
+            db = null;
+        }
+        */
+        return exitStatus;
+    }
+
+    public abstract ITestExecutor GetTestExecutor(String opName);
+
+    public abstract int ValidateRequest(SqliteDb db, String testName, int paramSetId, String operation, TestResult actualResult, ITestLogger logger);
+    
+    public abstract void Cleanup();
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestLoggerFile.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestLoggerFile.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestLoggerFile.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,48 @@
+package org.osgeo.mapguide.test.common;
+
+import java.io.*;
+
+public class TestLoggerFile implements ITestLogger
+{
+    private Writer sw;
+
+    public TestLoggerFile(String file)
+    {
+        try {
+            sw = new PrintWriter(file, "UTF-8");
+        } catch (IOException ex) {
+
+        }
+    }
+
+    public void Write(String format, Object ... args)
+    {
+        try {
+            sw.write(String.format(format, args));
+        } catch (IOException ex) {
+
+        }
+    }
+
+    public void WriteLine(String format, Object ... args)
+    {
+        try {
+            sw.write(String.format(format, args) + "\n");
+        } catch (IOException ex) {
+
+        }
+    }
+
+    public void close()
+    {
+        if (sw != null)
+        {
+            try {
+                sw.close();
+            } catch (IOException ex) {
+
+            }
+            sw = null;
+        }
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestResult.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestResult.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/TestResult.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,102 @@
+package org.osgeo.mapguide.test.common;
+
+import java.util.UUID;
+
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.*;
+
+public class TestResult
+{
+    public Object ResultData;
+
+    public String ContentType;
+
+    public String HttpStatusCode;
+
+    public TestResult()
+    {
+        this.ResultData = "";
+        this.ContentType = "";
+        this.HttpStatusCode = "";
+    }
+
+    public TestResult(String resultData)
+    {
+        this.ResultData = resultData;
+        this.ContentType = "";
+        this.HttpStatusCode = "";
+    }
+
+    public TestResult(String resultData, String contentType)
+    {
+        this.ResultData = resultData;
+        this.ContentType = contentType;
+        this.HttpStatusCode = "";
+    }
+
+    public TestResult(String resultData, String contentType, String statusCode)
+    {
+        this.ResultData = resultData;
+        this.ContentType = contentType;
+        this.HttpStatusCode = statusCode;
+    }
+
+    public static TestResult FromByteReader(MgByteReader byteReader)
+    {
+        return FromByteReader(byteReader, "");
+    }
+
+    public static TestResult FromByteReader(MgByteReader byteReader, String operation)
+    {
+        try
+        {
+            TestResult res = new TestResult();
+            if (byteReader != null)
+            {
+                res.ContentType = byteReader.getMimeType();
+                if (res.ContentType.equals(MgMimeType.Html) ||
+                    res.ContentType.equals(MgMimeType.Json) ||
+                    res.ContentType.equals(MgMimeType.Kml) ||
+                    res.ContentType.equals(MgMimeType.Text) ||
+                    res.ContentType.equals(MgMimeType.Xml))
+                {
+                    res.ResultData = byteReader.toString();
+                }
+                else
+                {
+                    MgByteSink sink = new MgByteSink(byteReader);
+                    String path = operation + UUID.randomUUID().toString() + "Result.bin";
+                    if (CommonUtility.IsNullOrEmpty(operation))
+                        path = CommonUtility.GetTempFileName();
+                    sink.toFile(path);
+                    res.ResultData = CommonUtility.ReadAllBytes(path);
+                    if (CommonUtility.IsNullOrEmpty(operation))
+                        CommonUtility.DeleteFile(path);
+                    else
+                        System.out.println(String.format("[MgUnitTest]: Check out %s if binary comparison results are strange", path));
+                    /*
+                    byte[] bytes = new byte[byteReader.GetLength()];
+                    byteReader.Read(bytes, bytes.Length);
+                    res.ResultData = bytes;
+                    */
+                }
+            }
+            return res;
+        }
+        catch (MgException ex)
+        {
+            return FromMgException(ex);
+        }
+    }
+
+    public static TestResult FromMgException(MgException ex)
+    {
+        //Need to be lowercase to satisfy a PHP-ism. Ugh!
+        return new TestResult(CommonUtility.GetTypeName(ex).toLowerCase(), "text/plain");
+    }
+
+    public static TestResult FromException(Exception ex)
+    {
+        return new TestResult(ex.getMessage(), "text/plain");
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/operations/IWebLayoutCreator.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/operations/IWebLayoutCreator.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/operations/IWebLayoutCreator.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,8 @@
+package org.osgeo.mapguide.test.operations;
+
+import org.osgeo.mapguide.*;
+
+public interface IWebLayoutCreator
+{
+    MgWebLayout CreateWebLayout(MgResourceIdentifier resId);
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/BatchPropertyCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/BatchPropertyCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/BatchPropertyCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,42 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class BatchPropertyCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgPropertyCollection coll1 = new MgPropertyCollection();
+        MgDoubleProperty dblProp = new MgDoubleProperty("DoubleProp", 1.1111);
+        coll1.addItem(dblProp);
+
+        MgPropertyCollection coll2 = new MgPropertyCollection();
+        MgInt32Property intProp = new MgInt32Property("IntProp", 1);
+        coll2.addItem(intProp);
+
+        MgPropertyCollection coll3 = new MgPropertyCollection();
+        MgSingleProperty single = new MgSingleProperty("SingleProp", (float)2.2222);
+        coll3.addItem(single);
+
+        MgBatchPropertyCollection coll = new MgBatchPropertyCollection();
+        coll.addItem(coll1);
+        coll.addItem(coll2);
+
+        Assert.AreEqual(2, coll.getCount());
+        Assert.AreEqual(MgPropertyType.Double, coll.getItem(0).getItem(0).getPropertyType());
+        Assert.AreEqual(MgPropertyType.Int32, coll.getItem(1).getItem(0).getPropertyType());
+
+        coll.setItem(1, coll3);
+
+        String str = "";
+        //for (MgPropertyCollection c : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgPropertyCollection c = coll.getItem(i);
+            str = str + ".getItem(" + c.getItem(0).getName() + ")";
+        }
+        Assert.AreEqual(".getItem(DoubleProp).getItem(SingleProp)", str);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderMemoryConstructorTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderMemoryConstructorTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderMemoryConstructorTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,36 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class ByteReaderMemoryConstructorTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        ByteReaderTestData.Init();
+        int nBytes = ByteReaderTestData.nBytes;
+        byte[] testBytes = ByteReaderTestData.testBytes;
+        String outfileName = ByteReaderTestData.outfileName;
+
+        byte[] buf = new byte[nBytes];
+        MgByteReader reader = new MgByteReader(testBytes, nBytes, "png");
+        Assert.AreEqual(nBytes, reader.getLength());
+        reader.read(buf, nBytes);
+        Assert.AreEqual(buf, testBytes);
+        Assert.AreEqual(0, reader.getLength());
+        reader.rewind();
+        Assert.AreEqual(nBytes, reader.getLength());
+
+        reader.toFile(outfileName);
+
+        try {
+            FileInputStream fp = new FileInputStream(outfileName);
+            fp.read(buf, 0, nBytes);
+            Assert.AreEqual(buf, testBytes);
+            fp.close();
+        } catch (Exception ex) {
+            Assert.Fail(CommonUtility.ExceptionToString(ex));
+        }
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderStringConstructorTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderStringConstructorTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderStringConstructorTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,21 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class ByteReaderStringConstructorTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        ByteReaderTestData.Init();
+        String testString = ByteReaderTestData.testString;
+        MgByteReader reader = new MgByteReader(testString, "text/html");
+        Assert.AreEqual(testString.length(), reader.getLength());
+        String buf = reader.toString();
+        Assert.AreEqual(testString, buf);
+        Assert.AreEqual(testString.length(), reader.getLength());
+        reader.rewind();
+        Assert.AreEqual(testString.length(), reader.getLength());
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,42 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class ByteReaderTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        ByteReaderTestData.Init();
+        int nBytes = ByteReaderTestData.nBytes;
+        int nBlocks = ByteReaderTestData.nBlocks;
+        byte[] testBytes = ByteReaderTestData.testBytes;
+        String infileName = ByteReaderTestData.infileName;
+        String outfileName = ByteReaderTestData.outfileName;
+        byte[] buf = new byte[nBytes];
+        MgByteReader reader = new MgByteReader(infileName, "png", false);
+        Assert.AreEqual(nBlocks * nBytes, reader.getLength());
+        reader.read(buf, nBytes);
+        Assert.AreEqual(buf, testBytes);
+        Assert.AreEqual((nBlocks - 1) * nBytes, reader.getLength());
+        reader.rewind();
+        Assert.AreEqual(nBlocks * nBytes, reader.getLength());
+        reader.toFile(outfileName);
+        reader.rewind();
+
+        try {
+            byte[] buf2 = new byte[nBytes];
+            FileInputStream fp = new FileInputStream(outfileName);
+            for (int j = 0; j < nBlocks; j++)
+            {
+                fp.read(buf2, 0, nBytes);
+                reader.read(buf, nBytes);
+                Assert.AreEqual(buf, buf2);
+            }
+            fp.close();
+        } catch (Exception ex) {
+            Assert.Fail(CommonUtility.ExceptionToString(ex));
+        }
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderTestData.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderTestData.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ByteReaderTestData.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,42 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class ByteReaderTestData
+{
+    public static byte[] testBytes;
+    public static int nBytes = 32768;
+    public static int nBlocks = 256;
+    public static String testString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+    public static String infileName;
+    public static String outfileName;
+    private static boolean bFirstTime = true;
+
+    public static void Init()
+    {
+        if (bFirstTime)
+        {
+            infileName = CommonUtility.GetTempFileName();
+            outfileName = CommonUtility.GetTempFileName();
+            testBytes = new byte[nBytes];
+            for (int i = 0; i < nBytes; i++)
+            {
+                testBytes[i] = (byte)(i % 255);
+            }
+
+            try {
+                FileOutputStream fp = new FileOutputStream(infileName);
+                for (int j = 0; j < nBlocks; j++)
+                {
+                    fp.write(testBytes, 0, nBytes);
+                }
+                fp.close();
+            } catch (Exception ex) {
+                Assert.Fail(CommonUtility.ExceptionToString(ex));
+            }
+
+            bFirstTime = false;
+        }
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ClassDefinitionCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ClassDefinitionCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/ClassDefinitionCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,180 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import java.util.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class ClassDefinitionCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgClassDefinition class1 = new MgClassDefinition();
+        class1.setName("class1");
+
+        MgClassDefinition class2 = new MgClassDefinition();
+        class2.setName("class2");
+
+        MgClassDefinition class3 = new MgClassDefinition();
+        class3.setName("class3");
+
+        MgClassDefinitionCollection coll = new MgClassDefinitionCollection();
+        coll.insert(0, class3);
+        coll.insert(0, class2);
+        coll.insert(0, class1);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.AreEqual("class2", coll.getItem(1).getName());
+
+        MgClassDefinition tmp = coll.getItem(0);
+        coll.setItem(0, coll.getItem(1));
+        coll.setItem(1, coll.getItem(2));
+        coll.setItem(2, tmp);
+
+        String str = "";
+        for (MgClassDefinition def : coll)
+        {
+            str = str + ".getItem(" + def.getName() + ")";
+        }
+        Assert.AreEqual(".getItem(class2).getItem(class3).getItem(class1)", str);
+
+        MgFeatureSchema parent = new MgFeatureSchema("Parent", "");
+        MgClassDefinitionCollection items = parent.getClasses();
+        MgClassDefinition item1 = new MgClassDefinition(); item1.setName("Item1");
+        MgClassDefinition item2 = new MgClassDefinition(); item2.setName("Item2");
+        MgClassDefinition item3 = new MgClassDefinition(); item3.setName("Item3");
+        MgClassDefinition item4 = new MgClassDefinition(); item4.setName("Item4");
+
+        //Items inserted the MapGuide API way
+        items.addItem(item1);
+        items.addItem(item2);
+        items.addItem(item3);
+
+        Assert.IsTrue(items.getCount() == 3, "Expected 3 items");
+        Assert.IsTrue(!items.isEmpty(), "Expected non-empty item collection");
+
+        int i = 0;
+        //Looping the classic way
+        for (i = 0; i < items.getCount(); i++) {
+            switch (i){
+                case 0:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+        }
+
+        //Looping the iterative way
+        i = 0;
+        for (MgClassDefinition item : items) {
+            String itemName = item.getName();
+            switch (i){
+                case 0:
+                    Assert.IsTrue(itemName.equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(itemName.equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(itemName.equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+            i++;
+        }
+
+        items.clear();
+        Assert.IsTrue(items.getCount() == 0, "Expected empty item collection");
+        Assert.IsTrue(items.isEmpty(), "Expected empty item collection");
+
+        //Now test through java.util.Collection facade
+        Collection<MgClassDefinition> facade = items;
+        //add()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //contains()
+        Assert.IsTrue(facade.contains(item1), "item1 should exist");
+        Assert.IsTrue(facade.contains(item2), "item2 should exist");
+        Assert.IsTrue(facade.contains(item3), "item3 should exist");
+
+        ArrayList<MgClassDefinition> testCollection = new ArrayList<MgClassDefinition>();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+
+        //containsAll()
+        Assert.IsTrue(facade.containsAll(testCollection), "All items in test collection should match");
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item4);
+        Assert.IsTrue(!facade.containsAll(testCollection), "Should not have matched test collection");
+
+        facade.clear();
+        Assert.IsTrue(facade.size() == 0, "Expected 0 items");
+        Assert.IsTrue(facade.isEmpty(), "Expected empty item collection");
+
+        //addAll()
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.addAll(testCollection), "Expected addAll() success");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //remove()
+        Assert.IsTrue(!facade.remove(item4), "Expected remove() of non-existent item to return false");
+        Assert.IsTrue(!facade.remove(new MgFeatureSchema()), "Expected remove() of different type to return false");
+        Assert.IsTrue(facade.remove(item2), "Expected remove() of item2 to return true");
+
+        //removeAll()
+        testCollection.remove(item2);
+        Assert.IsTrue(facade.removeAll(testCollection), "Expected removeAll() to succeed");
+
+        //retainAll()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 schemas");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty schema collection");
+
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.retainAll(testCollection), "Expected retainAll() to succeed");
+        Assert.IsTrue(facade.contains(item1), "Expected item1 to exist");
+        Assert.IsTrue(!facade.contains(item2), "Expected item2 to not exist");
+        Assert.IsTrue(facade.contains(item3), "Expected item3 to exist");
+
+        //toArray()
+        Object[] itemArray = facade.toArray();
+        Assert.IsTrue(itemArray != null, "Expected non-null item array");
+        Assert.IsTrue(itemArray.length == 2, "Expected 2 item array");
+        for (Object o : itemArray) {
+            Assert.IsTrue(o instanceof MgClassDefinition, "Expected item to be MgClassDefinition");
+        }
+        MgClassDefinition[] fitems = facade.toArray(new MgClassDefinition[0]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new MgClassDefinition[1]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new MgClassDefinition[3]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 3, "Expected 3 item array");
+        Assert.IsTrue(fitems[0] != null, "Expected non-null item #1");
+        Assert.IsTrue(fitems[1] != null, "Expected non-null item #2");
+        Assert.IsTrue(fitems[2] == null, "Expected null item #3");
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CoordinateCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CoordinateCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CoordinateCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class CoordinateCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgGeometryFactory gf = new MgGeometryFactory();
+        MgCoordinate c1 = gf.createCoordinateXY(1.0, 1.0);
+        MgCoordinate c2 = gf.createCoordinateXY(2.0, 2.0);
+        MgCoordinate c3 = gf.createCoordinateXY(3.0, 3.0);
+        MgCoordinate c4 = gf.createCoordinateXY(4.0, 4.0);
+
+        MgCoordinateCollection coll = new MgCoordinateCollection();
+        coll.add(c1);
+        coll.insert(1, c2);
+        coll.add(c3);
+        coll.add(c4);
+
+        Assert.AreEqual(4, coll.getCount());
+        Assert.AreEqual(1.0, coll.getItem(0).getX());
+        coll.setItem(3, coll.getItem(2));
+        Assert.AreEqual(3.0, coll.getItem(3).getX());
+
+        double sum = 0.0;
+        //for (MgCoordinate coord : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgCoordinate coord = coll.getItem(i);
+            sum += coord.getX();
+        }
+        Assert.AreEqual(9.0, sum);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurvePolygonCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurvePolygonCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurvePolygonCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class CurvePolygonCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        GeomBuild build = new GeomBuild();
+        MgCurvePolygon geom1 = build.createCurvePolygon(2.0, 5);
+        MgCurvePolygon geom2 = build.createCurvePolygon(12.0, 5);
+        MgCurvePolygon geom3 = build.createCurvePolygon(2.0, 5);
+
+        MgCurvePolygonCollection coll = new MgCurvePolygonCollection();
+        coll.add(geom1);
+        coll.add(geom2);
+        coll.add(geom3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.IsTrue(geom1.equals(coll.getItem(0)));
+        Assert.IsTrue(coll.getItem(0).equals(coll.getItem(2)));
+        Assert.IsFalse(coll.getItem(0).equals(coll.getItem(1)));
+        coll.setItem(0, coll.getItem(1));
+        Assert.IsTrue(coll.getItem(0).equals(coll.getItem(1)));
+
+        double width = 0.0;
+        //for (MgCurvePolygon geom : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgCurvePolygon geom = coll.getItem(i);
+            width += geom.envelope().getWidth();
+        }
+        Assert.AreEqual(geom1.envelope().getWidth() * 3.0, width);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveRingCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveRingCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveRingCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class CurveRingCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        GeomBuild build = new GeomBuild();
+        MgCurveRing geom1 = build.createCurveRing(2.0);
+        MgCurveRing geom2 = build.createCurveRing(12.0);
+        MgCurveRing geom3 = build.createCurveRing(2.0);
+
+        MgCurveRingCollection coll = new MgCurveRingCollection();
+        coll.add(geom1);
+        coll.add(geom2);
+        coll.add(geom3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.IsTrue(geom1.envelope().contains(coll.getItem(0).envelope()));
+        Assert.IsTrue(coll.getItem(0).envelope().contains(coll.getItem(2).envelope()));
+        Assert.IsFalse(coll.getItem(0).envelope().contains(coll.getItem(1).envelope()));
+        coll.setItem(0, coll.getItem(1));
+        Assert.IsTrue(coll.getItem(0).envelope().contains(coll.getItem(1).envelope()));
+
+        double width = 0.0;
+        //for (MgCurveRing geom : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgCurveRing geom = coll.getItem(i);
+            width += geom.envelope().getWidth();
+        }
+        Assert.AreEqual(geom1.envelope().getWidth() * 3.0, width);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveSegmentCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveSegmentCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveSegmentCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class CurveSegmentCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        GeomBuild build = new GeomBuild();
+        MgArcSegment geom1 = build.createArcSegment(2.0);
+        MgArcSegment geom2 = build.createArcSegment(12.0);
+        MgArcSegment geom3 = build.createArcSegment(2.0);
+
+        MgCurveSegmentCollection coll = new MgCurveSegmentCollection();
+        coll.add(geom1);
+        coll.add(geom2);
+        coll.add(geom3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.IsTrue(geom1.envelope().contains(coll.getItem(0).envelope()));
+        Assert.IsTrue(coll.getItem(0).envelope().contains(coll.getItem(2).envelope()));
+        Assert.IsFalse(coll.getItem(0).envelope().contains(coll.getItem(1).envelope()));
+        coll.setItem(0, coll.getItem(1));
+        Assert.IsTrue(coll.getItem(0).envelope().contains(coll.getItem(1).envelope()));
+
+        double width = 0.0;
+        //for (MgCurveSegment geom : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgCurveSegment geom = coll.getItem(i);
+            width += geom.envelope().getWidth();
+        }
+        Assert.AreEqual(geom1.envelope().getWidth() * 3.0, width);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveStringCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveStringCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/CurveStringCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class CurveStringCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        GeomBuild build = new GeomBuild();
+        MgCurveString geom1 = build.createCurveString(2.0);
+        MgCurveString geom2 = build.createCurveString(12.0);
+        MgCurveString geom3 = build.createCurveString(2.0);
+
+        MgCurveStringCollection coll = new MgCurveStringCollection();
+        coll.add(geom1);
+        coll.add(geom2);
+        coll.add(geom3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.IsTrue(geom1.equals(coll.getItem(0)));
+        Assert.IsTrue(coll.getItem(0).equals(coll.getItem(2)));
+        Assert.IsFalse(coll.getItem(0).equals(coll.getItem(1)));
+        coll.setItem(0, coll.getItem(1));
+        Assert.IsTrue(coll.getItem(0).equals(coll.getItem(1)));
+
+        double width = 0.0;
+        //for (MgCurveString geom : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgCurveString geom = coll.getItem(i);
+            width += geom.envelope().getWidth();
+        }
+        Assert.AreEqual(geom1.envelope().getWidth() * 3.0, width);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/FeatureCommandCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/FeatureCommandCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/FeatureCommandCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,36 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class FeatureCommandCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgPropertyCollection propVals = new MgPropertyCollection();
+        MgInt32Property prop = new MgInt32Property("prop", 1);
+        propVals.addItem(prop);
+        MgUpdateFeatures update = new MgUpdateFeatures("class2", propVals, "where cat < dog");
+        MgInsertFeatures insert = new MgInsertFeatures("class3", propVals);
+        MgDeleteFeatures del = new MgDeleteFeatures("class1", "where cat > dog");
+
+        MgFeatureCommandCollection coll = new MgFeatureCommandCollection();
+        coll.add(update);
+        coll.add(insert);
+        coll.add(del);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.AreEqual(MgFeatureCommandType.DeleteFeatures, coll.getItem(2).getCommandType());
+        coll.setItem(0, coll.getItem(1));
+
+        String txt = "";
+        //for (MgFeatureCommand cmd : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgFeatureCommand cmd = coll.getItem(i);
+            txt += "[" + cmd.getCommandType() + "]";
+        }
+        Assert.AreEqual("[0][0][2]", txt);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/FeatureSchemaCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/FeatureSchemaCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/FeatureSchemaCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,170 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import java.util.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class FeatureSchemaCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgFeatureSchema schema1 = new MgFeatureSchema("schema1", "desc1");
+        MgFeatureSchema schema2 = new MgFeatureSchema("schema2", "desc2");
+        MgFeatureSchema schema3 = new MgFeatureSchema("schema3", "desc3");
+
+        MgFeatureSchemaCollection coll = new MgFeatureSchemaCollection();
+        coll.add(schema1);
+        coll.add(schema2);
+        coll.add(schema3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.AreEqual("schema3", coll.getItem(2).getName());
+        coll.setItem(0, coll.getItem(2));
+
+        String txt = "";
+        for (MgFeatureSchema schema : coll)
+        {
+            txt += "[" + schema.getName() + "]";
+        }
+        Assert.AreEqual("[schema3][schema2][schema3]", txt);
+
+        MgFeatureSchemaCollection items = new MgFeatureSchemaCollection();
+        MgFeatureSchema item1 = new MgFeatureSchema("Item1", "");
+        MgFeatureSchema item2 = new MgFeatureSchema("Item2", "");
+        MgFeatureSchema item3 = new MgFeatureSchema("Item3", "");
+        MgFeatureSchema item4 = new MgFeatureSchema("Item4", "");
+
+        //Items inserted the MapGuide API way
+        items.addItem(item1);
+        items.addItem(item2);
+        items.addItem(item3);
+
+        Assert.IsTrue(items.getCount() == 3, "Expected 3 items");
+        Assert.IsTrue(!items.isEmpty(), "Expected non-empty item collection");
+
+        int i = 0;
+        //Looping the classic way
+        for (i = 0; i < items.getCount(); i++) {
+            switch (i){
+                case 0:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+        }
+
+        //Looping the iterative way
+        i = 0;
+        for (MgFeatureSchema item : items) {
+            String itemName = item.getName();
+            switch (i){
+                case 0:
+                    Assert.IsTrue(itemName.equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(itemName.equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(itemName.equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+            i++;
+        }
+
+        items.clear();
+        Assert.IsTrue(items.getCount() == 0, "Expected empty item collection");
+        Assert.IsTrue(items.isEmpty(), "Expected empty item collection");
+
+        //Now test through java.util.Collection facade
+        Collection<MgFeatureSchema> facade = items;
+        //add()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //contains()
+        Assert.IsTrue(facade.contains(item1), "item1 should exist");
+        Assert.IsTrue(facade.contains(item2), "item2 should exist");
+        Assert.IsTrue(facade.contains(item3), "item3 should exist");
+
+        ArrayList<MgFeatureSchema> testCollection = new ArrayList<MgFeatureSchema>();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+
+        //containsAll()
+        Assert.IsTrue(facade.containsAll(testCollection), "All items in test collection should match");
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item4);
+        Assert.IsTrue(!facade.containsAll(testCollection), "Should not have matched test collection");
+
+        facade.clear();
+        Assert.IsTrue(facade.size() == 0, "Expected 0 items");
+        Assert.IsTrue(facade.isEmpty(), "Expected empty item collection");
+
+        //addAll()
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.addAll(testCollection), "Expected addAll() success");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //remove()
+        Assert.IsTrue(!facade.remove(item4), "Expected remove() of non-existent item to return false");
+        Assert.IsTrue(!facade.remove(new MgClassDefinition()), "Expected remove() of different type to return false");
+        Assert.IsTrue(facade.remove(item2), "Expected remove() of item2 to return true");
+
+        //removeAll()
+        testCollection.remove(item2);
+        Assert.IsTrue(facade.removeAll(testCollection), "Expected removeAll() to succeed");
+
+        //retainAll()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 schemas");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty schema collection");
+
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.retainAll(testCollection), "Expected retainAll() to succeed");
+        Assert.IsTrue(facade.contains(item1), "Expected item1 to exist");
+        Assert.IsTrue(!facade.contains(item2), "Expected item2 to not exist");
+        Assert.IsTrue(facade.contains(item3), "Expected item3 to exist");
+
+        //toArray()
+        Object[] itemArray = facade.toArray();
+        Assert.IsTrue(itemArray != null, "Expected non-null item array");
+        Assert.IsTrue(itemArray.length == 2, "Expected 2 item array");
+        for (Object o : itemArray) {
+            Assert.IsTrue(o instanceof MgFeatureSchema, "Expected item to be MgFeatureSchema");
+        }
+        MgFeatureSchema[] fitems = facade.toArray(new MgFeatureSchema[0]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new MgFeatureSchema[1]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new MgFeatureSchema[3]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 3, "Expected 3 item array");
+        Assert.IsTrue(fitems[0] != null, "Expected non-null item #1");
+        Assert.IsTrue(fitems[1] != null, "Expected non-null item #2");
+        Assert.IsTrue(fitems[2] == null, "Expected null item #3");
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/GeomBuild.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/GeomBuild.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/GeomBuild.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,336 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class GeomBuild
+{
+    private MgGeometryFactory factory = new MgGeometryFactory();
+
+    public MgPoint createPoint()
+    {
+        MgCoordinate coord = factory.createCoordinateXYZ(5.0, 3.0, 2.0);
+        return factory.createPoint(coord);
+    }
+
+    public MgLineString createLineString(double offset)
+    {
+        MgCoordinateCollection coordCol = new MgCoordinateCollection();
+
+        MgCoordinate coord1 = factory.createCoordinateXY(offset + 0.0, 1.0);
+        MgCoordinate coord2 = factory.createCoordinateXY(offset + 2.0, 3.0);
+        MgCoordinate coord3 = factory.createCoordinateXY(offset + 4.0, 5.0);
+
+        coordCol.add(coord1);
+        coordCol.add(coord2);
+        coordCol.add(coord3);
+
+        return factory.createLineString(coordCol);
+    }
+
+
+
+    public MgLinearRing createLinearRing(double offset)
+    {
+        MgCoordinate oCoord1 = factory.createCoordinateXY(0.0, offset);
+        MgCoordinate oCoord2 = factory.createCoordinateXY(5.0, offset);
+        MgCoordinate oCoord3 = factory.createCoordinateXY(5.0, offset + 5.0);
+        MgCoordinate oCoord4 = factory.createCoordinateXY(0.0, offset + 5.0);
+        MgCoordinate oCoord5 = factory.createCoordinateXY(0.0, offset);
+
+        MgCoordinateCollection outerRingCoord = new MgCoordinateCollection();
+        outerRingCoord.add(oCoord1);
+        outerRingCoord.add(oCoord2);
+        outerRingCoord.add(oCoord3);
+        outerRingCoord.add(oCoord4);
+        outerRingCoord.add(oCoord5);
+
+        return factory.createLinearRing(outerRingCoord);
+    }
+
+
+    public MgPolygon createPolygon(double offset)
+    {
+
+
+        // OuterRing
+        MgCoordinate oCoord1 = factory.createCoordinateXY(offset + 0.0, 0.0);
+        MgCoordinate oCoord2 = factory.createCoordinateXY(offset + 5.0, 0.0);
+        MgCoordinate oCoord3 = factory.createCoordinateXY(offset + 5.0, 5.0);
+        MgCoordinate oCoord4 = factory.createCoordinateXY(offset + 0.0, 5.0);
+        MgCoordinate oCoord5 = factory.createCoordinateXY(offset + 0.0, 0.0);
+
+        MgCoordinateCollection outerRingCoord = new MgCoordinateCollection();
+        outerRingCoord.add(oCoord1);
+        outerRingCoord.add(oCoord2);
+        outerRingCoord.add(oCoord3);
+        outerRingCoord.add(oCoord4);
+        outerRingCoord.add(oCoord5);
+
+        // Inner Ring1
+        MgCoordinate i1Coord1 = factory.createCoordinateXY(offset + 1.0, 1.0);
+        MgCoordinate i1Coord2 = factory.createCoordinateXY(offset + 2.0, 1.0);
+        MgCoordinate i1Coord3 = factory.createCoordinateXY(offset + 2.0, 2.0);
+        MgCoordinate i1Coord4 = factory.createCoordinateXY(offset + 1.0, 1.0);
+
+        MgCoordinateCollection inner1RingCoord = new MgCoordinateCollection();
+        inner1RingCoord.add(i1Coord1);
+        inner1RingCoord.add(i1Coord2);
+        inner1RingCoord.add(i1Coord3);
+        inner1RingCoord.add(i1Coord4);
+
+        // Inner Ring2
+        MgCoordinate i2Coord1 = factory.createCoordinateXY(offset + 3.0, 3.0);
+        MgCoordinate i2Coord2 = factory.createCoordinateXY(offset + 4.0, 3.0);
+        MgCoordinate i2Coord3 = factory.createCoordinateXY(offset + 4.0, 4.0);
+        MgCoordinate i2Coord4 = factory.createCoordinateXY(offset + 3.0, 3.0);
+
+        MgCoordinateCollection inner2RingCoord = new MgCoordinateCollection();
+        inner2RingCoord.add(i2Coord1);
+        inner2RingCoord.add(i2Coord2);
+        inner2RingCoord.add(i2Coord3);
+        inner2RingCoord.add(i2Coord4);
+
+        MgLinearRing extRing = factory.createLinearRing(outerRingCoord);
+        MgLinearRing intRing1 = factory.createLinearRing(inner1RingCoord);
+        MgLinearRing intRing2 = factory.createLinearRing(inner2RingCoord);
+
+        MgLinearRingCollection intRings = new MgLinearRingCollection();
+        intRings.add(intRing1);
+        intRings.add(intRing2);
+
+        return factory.createPolygon(extRing, intRings);
+    }
+
+
+    public MgCurveString createCurveString(double offset)
+    {
+
+
+        // create and return a curvestring consisting of
+        // one circulararc segment and one linearstring segment
+
+        // arcseg  = (0,0), (0,1), (1,2)
+        // lineseg = (1,2), (3,0), (3,2)
+
+        // ArcSegment
+        MgCoordinate startPos = factory.createCoordinateXY(offset + 0.0, offset + 0.0);
+        MgCoordinate midPos = factory.createCoordinateXY(offset + 0.0, offset + 1.0);
+        MgCoordinate endPos = factory.createCoordinateXY(offset + 1.0, offset + 2.0);
+        MgArcSegment arcSeg = factory.createArcSegment(startPos, endPos, midPos);
+
+        // Linear Segment
+        MgCoordinateCollection points = new MgCoordinateCollection();
+        MgCoordinate pt1 = factory.createCoordinateXY(offset + 1.0, offset + 2.0);
+        MgCoordinate pt2 = factory.createCoordinateXY(offset + 3.0, offset + 0.0);
+        MgCoordinate pt3 = factory.createCoordinateXY(offset + 3.0, offset + 2.0);
+        points.add(pt1);
+        points.add(pt2);
+        points.add(pt3);
+        MgLinearSegment lineSeg = factory.createLinearSegment(points);
+
+        // CurveSegment
+        MgCurveSegmentCollection curveSegs = new MgCurveSegmentCollection();
+        curveSegs.add(arcSeg);
+        curveSegs.add(lineSeg);
+
+        return factory.createCurveString(curveSegs);
+    }
+
+
+    public MgCurveRing createCurveRing(double offset)
+    {
+        // Ring is a closed entity.
+        // create and return a ring consisting of
+        // one circulararc segment and one linearstring segment
+
+        // arcseg  = (0,0), (0,1), (1,2)
+        // lineseg = (1,2), (0,0)
+
+
+
+        // ArcSegment
+        MgCoordinate startPos = factory.createCoordinateXY(offset + 0.0, offset + 0.0);
+        MgCoordinate midPos = factory.createCoordinateXY(offset + 0.0, offset + 1.0);
+        MgCoordinate endPos = factory.createCoordinateXY(offset + 1.0, offset + 2.0);
+        MgArcSegment arcSeg = factory.createArcSegment(startPos, endPos, midPos);
+
+        // Linear Segment
+        MgCoordinateCollection points = new MgCoordinateCollection();
+        MgCoordinate fromPt = factory.createCoordinateXY(offset + 1.0, offset + 2.0);
+        MgCoordinate toPt = factory.createCoordinateXY(offset + 0.0, offset + 0.0);
+        points.add(fromPt);
+        points.add(toPt);
+        MgLinearSegment lineSeg = factory.createLinearSegment(points);
+
+        // Curve Segment
+        MgCurveSegmentCollection curveSegs = new MgCurveSegmentCollection();
+        curveSegs.add(arcSeg);
+        curveSegs.add(lineSeg);
+
+        return factory.createCurveRing(curveSegs);
+    }
+
+
+    public MgCurvePolygon createCurvePolygon(double offset, int increment)
+    {
+
+
+        MgCurveRing extRing = createCurveRing(offset + increment);
+
+        MgCurveRingCollection intRings = new MgCurveRingCollection();
+
+        MgCurveRing ring1 = createCurveRing(offset + 2 * increment);
+        MgCurveRing ring2 = createCurveRing(offset + 3 * increment);
+
+        intRings.add(ring1);
+        intRings.add(ring2);
+
+        return factory.createCurvePolygon(extRing, intRings);
+    }
+
+
+    public MgMultiPoint createMultiPoint()
+    {
+
+
+        MgCoordinate coord1 = factory.createCoordinateXYZ(1.0, 2.0, 3.0);
+        MgPoint point1 = factory.createPoint(coord1);
+
+        MgCoordinate coord2 = factory.createCoordinateXYZ(4.0, 5.0, 6.0);
+        MgPoint point2 = factory.createPoint(coord2);
+
+        MgCoordinate coord3 = factory.createCoordinateXYZ(7.0, 8.0, 9.0);
+        MgPoint point3 = factory.createPoint(coord3);
+
+        MgPointCollection pnts = new MgPointCollection();
+        pnts.add(point1);
+        pnts.add(point2);
+        pnts.add(point3);
+
+        return factory.createMultiPoint(pnts);
+    }
+
+
+    public MgMultiLineString createMultiLineString()
+    {
+
+
+        MgCoordinate coord1 = factory.createCoordinateXYZ(0.0, 1.0, 2.0);
+        MgCoordinate coord2 = factory.createCoordinateXYZ(3.0, 4.0, 5.0);
+        MgCoordinate coord3 = factory.createCoordinateXYZ(6.0, 7.0, 8.0);
+
+        MgCoordinateCollection coordColA = new MgCoordinateCollection();
+        coordColA.add(coord1);
+        coordColA.add(coord2);
+        coordColA.add(coord3);
+
+        MgCoordinate coord4 = factory.createCoordinateXYZ(9.0, 10.0, 11.0);
+        MgCoordinate coord5 = factory.createCoordinateXYZ(12.0, 13.0, 14.0);
+        MgCoordinate coord6 = factory.createCoordinateXYZ(15.0, 16.0, 17.0);
+
+        MgCoordinateCollection coordColB = new MgCoordinateCollection();
+        coordColB.add(coord4);
+        coordColB.add(coord5);
+        coordColB.add(coord6);
+
+        MgLineString lineString1 = factory.createLineString(coordColA);
+        MgLineString lineString2 = factory.createLineString(coordColB);
+
+        MgLineStringCollection lineStrings = new MgLineStringCollection();
+        lineStrings.add(lineString1);
+        lineStrings.add(lineString2);
+
+        return factory.createMultiLineString(lineStrings);
+    }
+
+
+    public MgMultiPolygon createMultiPolygon()
+    {
+
+
+        MgPolygon polygon1 = createPolygon(0.0);
+        MgPolygon polygon2 = createPolygon(0.0);
+
+        MgPolygonCollection polygons = new MgPolygonCollection();
+        polygons.add(polygon1);
+        polygons.add(polygon2);
+
+        return factory.createMultiPolygon(polygons);
+    }
+
+
+    MgMultiCurveString createMultiCurveString()
+    {
+
+
+        MgCurveString curveString1 = createCurveString(100);
+        MgCurveString curveString2 = createCurveString(200);
+        MgCurveString curveString3 = createCurveString(300);
+
+        MgCurveStringCollection curveStrings = new MgCurveStringCollection();
+        curveStrings.add(curveString1);
+        curveStrings.add(curveString2);
+        curveStrings.add(curveString3);
+
+        return factory.createMultiCurveString(curveStrings);
+    }
+
+
+    public MgMultiCurvePolygon createMultiCurvePolygon(int numCurvePolys, double offset)
+    {
+
+
+        MgCurvePolygonCollection curvePolys = new MgCurvePolygonCollection();
+        for (int i = 0; i < numCurvePolys; i++)
+        {
+            MgCurvePolygon curvePoly = createCurvePolygon(i + offset, 1);
+            curvePolys.add(curvePoly);
+        }
+
+        return factory.createMultiCurvePolygon(curvePolys);
+    }
+
+
+    public MgMultiGeometry createMultiGeometry()
+    {
+
+
+        MgGeometryCollection geometries = new MgGeometryCollection();
+        MgGeometry geometry = null;
+
+        // CurvePolygon
+        geometry = (MgGeometry)createCurvePolygon(0, 1);
+        geometries.add(geometry);
+
+        // CurveString
+        // Not doing CurveString because of some unfixed defect.
+        // It may be the same one that sometimes affects MultiPolygon.
+        geometry = (MgGeometry)createCurveString(100);
+        geometries.add(geometry);
+
+        // LineString
+        geometry = (MgGeometry)createLineString(1.0);
+        geometries.add(geometry);
+
+        // Point
+        geometry = (MgGeometry)createPoint();
+        geometries.add(geometry);
+
+        // Polygon
+        geometry = createPolygon(0.0);
+        geometries.add(geometry);
+
+        // Make MultiGeometry from the many geometries collected above.
+        return factory.createMultiGeometry(geometries);
+    }
+
+    public MgArcSegment createArcSegment(double offset)
+    {
+        MgCoordinate startPos = factory.createCoordinateXY(offset + 0.0, offset + 0.0);
+        MgCoordinate midPos = factory.createCoordinateXY(offset + 0.0, offset + 1.0);
+        MgCoordinate endPos = factory.createCoordinateXY(offset + 1.0, offset + 2.0);
+        return factory.createArcSegment(startPos, endPos, midPos);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/GeometryCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/GeometryCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/GeometryCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class GeometryCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgWktReaderWriter wkt = new MgWktReaderWriter();
+        MgPoint geom1 = (MgPoint)wkt.read("POINT XY (1.0 1.0)");
+        MgPoint geom2 = (MgPoint)wkt.read("POINT XY (2.0 2.0)");
+        MgPoint geom3 = (MgPoint)wkt.read("POINT XY (1.0 1.0)");
+
+        MgGeometryCollection coll = new MgGeometryCollection();
+        coll.add(geom1);
+        coll.add(geom2);
+        coll.add(geom3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.IsTrue(geom1.equals(coll.getItem(0)));
+        Assert.IsTrue(coll.getItem(0).equals(coll.getItem(2)));
+        Assert.IsFalse(coll.getItem(0).equals(coll.getItem(1)));
+        coll.setItem(0, coll.getItem(1));
+        Assert.IsTrue(coll.getItem(0).equals(coll.getItem(1)));
+
+        double x = 0.0;
+        //for (MgGeometry geom : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgGeometry geom = coll.getItem(i);
+            x += ((MgPoint)geom).getCoordinate().getX();
+        }
+        Assert.AreEqual(5.0, x);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/IntCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/IntCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/IntCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,28 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class IntCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgIntCollection coll = new MgIntCollection();
+        coll.addItem(10);
+        coll.addItem(20);
+        coll.addItem(30);
+        coll.addItem(40);
+        coll.addItem(50);
+        Assert.AreEqual(20, coll.getItem(1));
+        Assert.AreEqual(30, coll.getItem(2));
+        Assert.AreEqual(5, coll.getCount());
+
+        int j = 0;
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            j += coll.getItem(i);
+        }
+        Assert.AreEqual(150, j);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/LineStringCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/LineStringCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/LineStringCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class LineStringCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        GeomBuild build = new GeomBuild();
+        MgLineString geom1 = build.createLineString(5.0);
+        MgLineString geom2 = build.createLineString(11.0);
+        MgLineString geom3 = build.createLineString(5.0);
+
+        MgLineStringCollection coll = new MgLineStringCollection();
+        coll.add(geom1);
+        coll.add(geom2);
+        coll.add(geom3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.IsTrue(geom1.equals(coll.getItem(0)));
+        Assert.IsTrue(coll.getItem(0).equals(coll.getItem(2)));
+        Assert.IsFalse(coll.getItem(0).equals(coll.getItem(1)));
+        coll.setItem(0, coll.getItem(1));
+        Assert.IsTrue(coll.getItem(0).equals(coll.getItem(1)));
+
+        double width = 0.0;
+        //for (MgLineString geom : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgLineString geom = coll.getItem(i);
+            width += geom.envelope().getWidth();
+        }
+        Assert.AreEqual(geom1.envelope().getWidth() * 3.0, width);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/LinearRingCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/LinearRingCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/LinearRingCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class LinearRingCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        GeomBuild build = new GeomBuild();
+        MgLinearRing geom1 = build.createLinearRing(1.0);
+        MgLinearRing geom2 = build.createLinearRing(5.0);
+        MgLinearRing geom3 = build.createLinearRing(1.0);
+
+        MgLinearRingCollection coll = new MgLinearRingCollection();
+        coll.add(geom1);
+        coll.add(geom2);
+        coll.add(geom3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.IsTrue(geom1.envelope().contains(coll.getItem(0).envelope()));
+        Assert.IsTrue(coll.getItem(0).envelope().contains(coll.getItem(2).envelope()));
+        Assert.IsFalse(coll.getItem(0).envelope().contains(coll.getItem(1).envelope()));
+        coll.setItem(0, coll.getItem(1));
+        Assert.IsTrue(coll.getItem(0).envelope().contains(coll.getItem(1).envelope()));
+
+        double width = 0.0;
+        //for (MgLinearRing geom : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgLinearRing geom = coll.getItem(i);
+            width += geom.envelope().getWidth();
+        }
+        Assert.AreEqual(geom1.envelope().getWidth() * 3.0, width);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/MapCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/MapCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/MapCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,41 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class MapCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        String coordsys = "GEOGCS[\"LL84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]";
+        MgEnvelope env = new MgEnvelope(10, 10, 20, 20);
+        MgMapBase map1 = factory.createMap();
+        map1.create(coordsys, env, "map1");
+        MgMapBase map2 = factory.createMap();
+        map2.create(coordsys, env, "map2");
+        MgMapBase map3 = factory.createMap();
+        map3.create(coordsys, env, "map3");
+        MgMapBase map4 = factory.createMap();
+        map4.create(coordsys, env, "map4");
+
+        MgMapCollection coll = new MgMapCollection();
+        coll.add(map1);
+        coll.insert(1, map2);
+        coll.add(map3);
+
+        Assert.AreEqual(3, coll.getCount());
+        Assert.AreEqual(coll.getItem(2).getName(), "map3");
+
+        coll.setItem(1, map4);
+
+        String txt = "";
+        //for (MgMapBase map : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgMapBase map = coll.getItem(i);
+            txt += "[" + map.getName() + "]";
+        }
+        Assert.AreEqual("[map1][map4][map3]", txt);
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/PropertyCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/PropertyCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/PropertyCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,191 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import java.util.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class PropertyCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgPropertyCollection coll = new MgPropertyCollection();
+        MgDoubleProperty dblProp = new MgDoubleProperty("DoubleProp", 1.1111);
+        MgInt32Property intProp = new MgInt32Property("IntProp", 1);
+        MgDateTime dateTime = new MgDateTime((short)2006, (short)9, (short)21);
+        MgDateTimeProperty dateProp = new MgDateTimeProperty("DateProp", dateTime);
+        MgSingleProperty single = new MgSingleProperty("SingleProp", (float)2.2222);
+        coll.add(dblProp);
+        coll.add(intProp);
+        coll.add(dateProp);
+        coll.setItem(2, single);
+
+        MgProperty prop1 = coll.getItem(0);
+        MgProperty prop2 = coll.getItem(1);
+        MgProperty prop3 = coll.getItem(2);
+        Assert.AreEqual(1.1111, ((MgDoubleProperty)prop1).getValue());
+        Assert.AreEqual(MgPropertyType.Double, prop1.getPropertyType());
+        Assert.AreEqual(MgPropertyType.Int32, prop2.getPropertyType());
+        Assert.AreEqual(MgPropertyType.Single, prop3.getPropertyType());
+        Assert.AreEqual((float)2.2222, ((MgSingleProperty)prop3).getValue());
+        Assert.AreEqual(3, coll.getCount());
+
+        Assert.AreEqual(MgPropertyType.Double, prop1.getPropertyType());
+
+        String str = "";
+        for (MgProperty prop : coll)
+        {
+            str = str + "[" + prop.getName() + "]";
+        }
+        Assert.AreEqual("[DoubleProp][IntProp][SingleProp]", str);
+
+        MgPropertyCollection items = new MgPropertyCollection();
+        MgProperty item1 = new MgStringProperty("Item1", "Hello World");
+        MgProperty item2 = new MgInt32Property("Item2", 42);
+        MgProperty item3 = new MgBooleanProperty("Item3", false);
+        MgProperty item4 = new MgByteProperty("Item4", (short)4);
+
+        //Items inserted the MapGuide API way
+        items.addItem(item1);
+        items.addItem(item2);
+        items.addItem(item3);
+
+        Assert.IsTrue(items.getCount() == 3, "Expected 3 items");
+        Assert.IsTrue(!items.isEmpty(), "Expected non-empty item collection");
+
+        int i = 0;
+        //Looping the classic way
+        for (i = 0; i < items.getCount(); i++) {
+            switch (i){
+                case 0:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+        }
+
+        //Looping the iterative way
+        i = 0;
+        for (MgProperty item : items) {
+            String itemName = item.getName();
+            switch (i){
+                case 0:
+                    Assert.IsTrue(itemName.equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(itemName.equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(itemName.equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+            i++;
+        }
+
+        items.clear();
+        Assert.IsTrue(items.getCount() == 0, "Expected empty item collection");
+        Assert.IsTrue(items.isEmpty(), "Expected empty item collection");
+
+        //Now test through java.util.Collection facade
+        Collection<MgProperty> facade = items;
+        //add()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //contains()
+        Assert.IsTrue(facade.contains(item1), "item1 should exist");
+        Assert.IsTrue(facade.contains(item2), "item2 should exist");
+        Assert.IsTrue(facade.contains(item3), "item3 should exist");
+
+        ArrayList<MgProperty> testCollection = new ArrayList<MgProperty>();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+
+        //containsAll()
+        Assert.IsTrue(facade.containsAll(testCollection), "All items in test collection should match");
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item4);
+        Assert.IsTrue(!facade.containsAll(testCollection), "Should not have matched test collection");
+
+        facade.clear();
+        Assert.IsTrue(facade.size() == 0, "Expected 0 items");
+        Assert.IsTrue(facade.isEmpty(), "Expected empty item collection");
+
+        //addAll()
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.addAll(testCollection), "Expected addAll() success");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //remove()
+        Assert.IsTrue(!facade.remove(item4), "Expected remove() of non-existent item to return false");
+        Assert.IsTrue(!facade.remove(new MgClassDefinition()), "Expected remove() of different type to return false");
+        Assert.IsTrue(facade.remove(item2), "Expected remove() of item2 to return true");
+
+        //removeAll()
+        testCollection.remove(item2);
+        Assert.IsTrue(facade.removeAll(testCollection), "Expected removeAll() to succeed");
+
+        //retainAll()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 schemas");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty schema collection");
+
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.retainAll(testCollection), "Expected retainAll() to succeed");
+        Assert.IsTrue(facade.contains(item1), "Expected item1 to exist");
+        Assert.IsTrue(!facade.contains(item2), "Expected item2 to not exist");
+        Assert.IsTrue(facade.contains(item3), "Expected item3 to exist");
+
+        //toArray()
+        Object[] itemArray = facade.toArray();
+        Assert.IsTrue(itemArray != null, "Expected non-null item array");
+        Assert.IsTrue(itemArray.length == 2, "Expected 2 item array");
+        i = 0;
+        for (Object o : itemArray) {
+            Assert.IsTrue(o instanceof MgProperty, "Expected item to be MgProperty");
+            switch(i) {
+                case 0:
+                    Assert.IsTrue(o instanceof MgStringProperty, "Expected item to be MgStringProperty");
+                    break;
+                case 1:
+                    Assert.IsTrue(o instanceof MgBooleanProperty, "Expected item to be MgBooleanProperty");
+                    break;
+            }
+            i++;
+        }
+
+        MgProperty[] fitems = facade.toArray(new MgProperty[0]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new MgProperty[1]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new MgProperty[3]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 3, "Expected 3 item array");
+        Assert.IsTrue(fitems[0] != null, "Expected non-null item #1");
+        Assert.IsTrue(fitems[1] != null, "Expected non-null item #2");
+        Assert.IsTrue(fitems[2] == null, "Expected null item #3");
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/PropertyDefinitionCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/PropertyDefinitionCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/PropertyDefinitionCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,178 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import java.util.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class PropertyDefinitionCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgDataPropertyDefinition def1 = new MgDataPropertyDefinition("def1");
+        MgDataPropertyDefinition def2 = new MgDataPropertyDefinition("def2");
+        MgDataPropertyDefinition def3 = new MgDataPropertyDefinition("def3");
+        MgDataPropertyDefinition def4 = new MgDataPropertyDefinition("def4");
+
+        MgPropertyDefinitionCollection coll = new MgPropertyDefinitionCollection();
+        coll.add(def1);
+        coll.add(def2);
+        coll.insert(2, def4);
+        coll.insert(2, def3);
+
+        Assert.AreEqual(4, coll.getCount());
+        Assert.AreEqual("def1", coll.getItem(0).getName());
+
+        MgPropertyDefinition tmp = coll.getItem(0);
+        coll.remove(def1);
+        Assert.AreEqual(3, coll.getCount());
+        coll.insert(0, tmp);
+
+        String txt = "";
+        for (MgPropertyDefinition def : coll)
+        {
+            txt += ".getItem(" + def.getName() + ")";
+        }
+        Assert.AreEqual(".getItem(def1).getItem(def2).getItem(def3).getItem(def4)", txt);
+
+        MgClassDefinition parent = new MgClassDefinition();
+        parent.setName("Parent");
+        MgPropertyDefinitionCollection items = parent.getProperties();
+        MgPropertyDefinition item1 = new MgDataPropertyDefinition("Item1");
+        MgPropertyDefinition item2 = new MgDataPropertyDefinition("Item2");
+        MgPropertyDefinition item3 = new MgDataPropertyDefinition("Item3");
+        MgPropertyDefinition item4 = new MgDataPropertyDefinition("Item4");
+
+        //Items inserted the MapGuide API way
+        items.addItem(item1);
+        items.addItem(item2);
+        items.addItem(item3);
+
+        Assert.IsTrue(items.getCount() == 3, "Expected 3 items");
+        Assert.IsTrue(!items.isEmpty(), "Expected non-empty item collection");
+
+        int i = 0;
+        //Looping the classic way
+        for (i = 0; i < items.getCount(); i++) {
+            switch (i){
+                case 0:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(items.getItem(i).getName().equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+        }
+
+        //Looping the iterative way
+        i = 0;
+        for (MgPropertyDefinition item : items) {
+            String itemName = item.getName();
+            switch (i){
+                case 0:
+                    Assert.IsTrue(itemName.equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(itemName.equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(itemName.equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+            i++;
+        }
+
+        items.clear();
+        Assert.IsTrue(items.getCount() == 0, "Expected empty item collection");
+        Assert.IsTrue(items.isEmpty(), "Expected empty item collection");
+
+        //Now test through java.util.Collection facade
+        Collection<MgPropertyDefinition> facade = items;
+        //add()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //contains()
+        Assert.IsTrue(facade.contains(item1), "item1 should exist");
+        Assert.IsTrue(facade.contains(item2), "item2 should exist");
+        Assert.IsTrue(facade.contains(item3), "item3 should exist");
+
+        ArrayList<MgPropertyDefinition> testCollection = new ArrayList<MgPropertyDefinition>();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+
+        //containsAll()
+        Assert.IsTrue(facade.containsAll(testCollection), "All items in test collection should match");
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item4);
+        Assert.IsTrue(!facade.containsAll(testCollection), "Should not have matched test collection");
+
+        facade.clear();
+        Assert.IsTrue(facade.size() == 0, "Expected 0 items");
+        Assert.IsTrue(facade.isEmpty(), "Expected empty item collection");
+
+        //addAll()
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.addAll(testCollection), "Expected addAll() success");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //remove()
+        Assert.IsTrue(!facade.remove(item4), "Expected remove() of non-existent item to return false");
+        Assert.IsTrue(!facade.remove(new MgFeatureSchema()), "Expected remove() of different type to return false");
+        Assert.IsTrue(facade.remove(item2), "Expected remove() of item2 to return true");
+
+        //removeAll()
+        testCollection.remove(item2);
+        Assert.IsTrue(facade.removeAll(testCollection), "Expected removeAll() to succeed");
+
+        //retainAll()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 schemas");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty schema collection");
+
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.retainAll(testCollection), "Expected retainAll() to succeed");
+        Assert.IsTrue(facade.contains(item1), "Expected item1 to exist");
+        Assert.IsTrue(!facade.contains(item2), "Expected item2 to not exist");
+        Assert.IsTrue(facade.contains(item3), "Expected item3 to exist");
+
+        //toArray()
+        Object[] itemArray = facade.toArray();
+        Assert.IsTrue(itemArray != null, "Expected non-null item array");
+        Assert.IsTrue(itemArray.length == 2, "Expected 2 item array");
+        for (Object o : itemArray) {
+            Assert.IsTrue(o instanceof MgPropertyDefinition, "Expected item to be MgPropertyDefinition");
+        }
+        MgPropertyDefinition[] fitems = facade.toArray(new MgPropertyDefinition[0]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new MgPropertyDefinition[1]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new MgPropertyDefinition[3]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 3, "Expected 3 item array");
+        Assert.IsTrue(fitems[0] != null, "Expected non-null item #1");
+        Assert.IsTrue(fitems[1] != null, "Expected non-null item #2");
+        Assert.IsTrue(fitems[2] == null, "Expected null item #3");
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/StringCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/StringCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/StringCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,172 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import java.util.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class StringCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        Vector<String> strColl = new Vector<String>();
+        strColl.add("string1");
+        strColl.add("string2");
+        strColl.add("string3");
+        strColl.add("string3");
+
+        MgStringCollection coll1 = new MgStringCollection();
+        coll1.add("Hello");
+
+        MgStringCollection coll2 = new MgStringCollection();
+        for (String str : strColl) {
+            coll2.add(str);
+        }
+        Assert.AreEqual(4, coll2.getCount());
+        MgStringCollection coll3 = coll2;
+        Assert.AreEqual(4, coll3.getCount());
+        for (int i = 0; i < 4; i++)
+        {
+            Assert.AreEqual(strColl.get(i), coll2.getItem(i));
+            Assert.AreEqual(strColl.get(i), coll3.getItem(i));
+        }
+
+        MgStringCollection items = new MgStringCollection();
+        String item1 = "Item1";
+        String item2 = "Item2";
+        String item3 = "Item3";
+        String item4 = "Item4";
+
+        //Items inserted the MapGuide API way
+        items.addItem(item1);
+        items.addItem(item2);
+        items.addItem(item3);
+
+        Assert.IsTrue(items.getCount() == 3, "Expected 3 items");
+        Assert.IsTrue(!items.isEmpty(), "Expected non-empty item collection");
+
+        int i = 0;
+        //Looping the classic way
+        for (i = 0; i < items.getCount(); i++) {
+            switch (i){
+                case 0:
+                    Assert.IsTrue(items.getItem(i).equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(items.getItem(i).equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(items.getItem(i).equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+        }
+
+        //Looping the iterative way
+        i = 0;
+        for (String item : items) {
+            String itemName = item;
+            switch (i){
+                case 0:
+                    Assert.IsTrue(itemName.equals("Item1"), "Expected item #" + (i+1) + " to be Item1");
+                    break;
+                case 1:
+                    Assert.IsTrue(itemName.equals("Item2"), "Expected item #" + (i+1) + " to be Item2");
+                    break;
+                case 2:
+                    Assert.IsTrue(itemName.equals("Item3"), "Expected item #" + (i+1) + " to be Item3");
+                    break;
+            }
+            i++;
+        }
+
+        items.clear();
+        Assert.IsTrue(items.getCount() == 0, "Expected empty item collection");
+        Assert.IsTrue(items.isEmpty(), "Expected empty item collection");
+
+        //Now test through java.util.Collection facade
+        Collection<String> facade = items;
+        //add()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //contains()
+        Assert.IsTrue(facade.contains(item1), "item1 should exist");
+        Assert.IsTrue(facade.contains(item2), "item2 should exist");
+        Assert.IsTrue(facade.contains(item3), "item3 should exist");
+
+        ArrayList<String> testCollection = new ArrayList<String>();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+
+        //containsAll()
+        Assert.IsTrue(facade.containsAll(testCollection), "All items in test collection should match");
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item4);
+        Assert.IsTrue(!facade.containsAll(testCollection), "Should not have matched test collection");
+
+        facade.clear();
+        Assert.IsTrue(facade.size() == 0, "Expected 0 items");
+        Assert.IsTrue(facade.isEmpty(), "Expected empty item collection");
+
+        //addAll()
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item2);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.addAll(testCollection), "Expected addAll() success");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 items");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty item collection");
+
+        //remove()
+        Assert.IsTrue(!facade.remove(item4), "Expected remove() of non-existent item to return false");
+        Assert.IsTrue(!facade.remove(new MgClassDefinition()), "Expected remove() of different type to return false");
+        Assert.IsTrue(facade.remove(item2), "Expected remove() of item2 to return true");
+
+        //removeAll()
+        testCollection.remove(item2);
+        Assert.IsTrue(facade.removeAll(testCollection), "Expected removeAll() to succeed");
+
+        //retainAll()
+        Assert.IsTrue(facade.add(item1), "Could not add item1 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item2), "Could not add item2 the java.util.Collection way");
+        Assert.IsTrue(facade.add(item3), "Could not add item3 the java.util.Collection way");
+        Assert.IsTrue(facade.size() == 3, "Expected 3 schemas");
+        Assert.IsTrue(!facade.isEmpty(), "Expected non-empty schema collection");
+
+        testCollection.clear();
+        testCollection.add(item1);
+        testCollection.add(item3);
+        Assert.IsTrue(facade.retainAll(testCollection), "Expected retainAll() to succeed");
+        Assert.IsTrue(facade.contains(item1), "Expected item1 to exist");
+        Assert.IsTrue(!facade.contains(item2), "Expected item2 to not exist");
+        Assert.IsTrue(facade.contains(item3), "Expected item3 to exist");
+
+        //toArray()
+        Object[] itemArray = facade.toArray();
+        Assert.IsTrue(itemArray != null, "Expected non-null item array");
+        Assert.IsTrue(itemArray.length == 2, "Expected 2 item array");
+        for (Object o : itemArray) {
+            Assert.IsTrue(o instanceof String, "Expected item to be String");
+        }
+        String[] fitems = facade.toArray(new String[0]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new String[1]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 2, "Expected 2 item array");
+
+        fitems = facade.toArray(new String[3]);
+        Assert.IsTrue(fitems != null, "Expected non-null item array");
+        Assert.IsTrue(fitems.length == 3, "Expected 3 item array");
+        Assert.IsTrue(fitems[0] != null, "Expected non-null item #1");
+        Assert.IsTrue(fitems[1] != null, "Expected non-null item #2");
+        Assert.IsTrue(fitems[2] == null, "Expected null item #3");
+    }
+}
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/StringPropertyCollectionTest.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/StringPropertyCollectionTest.java	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/StringPropertyCollectionTest.java	2014-10-02 18:33:49 UTC (rev 8377)
@@ -0,0 +1,37 @@
+package org.osgeo.mapguide.test.platform;
+
+import java.io.*;
+import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.common.*;
+
+public class StringPropertyCollectionTest implements IExternalTest
+{
+    public void Execute(IPlatformFactory factory, ITestLogger logger)
+    {
+        MgStringProperty prop1 = new MgStringProperty("prop1", "val1");
+        MgStringProperty prop2 = new MgStringProperty("prop2", "val2");
+        MgStringProperty prop3 = new MgStringProperty("prop3", "val3");
+        MgStringProperty prop4 = new MgStringProperty("prop4", "val4");
+
+        MgStringPropertyCollection coll = new MgStringPropertyCollection();
+        coll.add(prop1);
+        coll.add(prop2);
+        coll.remove(prop3);
+        coll.remove(coll.getItem(1));
+        Assert.AreEqual(1, coll.getCount());
+        coll.add(prop3);
+        coll.setItem(1, prop2);
+        coll.insert(2, prop3);
+        Assert.AreEqual(2, coll.indexOf(prop3));
+        coll.add(prop4);
+
+        String txt = "";
+        //for (MgStringProperty prop : coll)
+        for (int i = 0; i < coll.getCount(); i++)
+        {
+            MgStringProperty prop = coll.getItem(i);
+            txt += ".getItem(" + prop.getName() + ")";
+        }
+        Assert.AreEqual(".getItem(prop1).getItem(prop2).getItem(prop3).getItem(prop4)", txt);
+    }
+}
\ No newline at end of file



More information about the mapguide-commits mailing list