[mapguide-commits] r8391 - in trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test: . common platform/operations/resource
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Oct 7 02:26:41 PDT 2014
Author: jng
Date: 2014-10-07 02:26:41 -0700 (Tue, 07 Oct 2014)
New Revision: 8391
Modified:
trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Program.java
trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java
trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/operations/resource/ApplyResourcePackage.java
Log:
#2307: Linux fixes. A potential defect in ApplyResourcePackage has been exposed by this test suite. Will need further testing to confirm. In the meantime, we'll auto-fail all calls to ApplyResourcePackage.
Modified: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Program.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Program.java 2014-10-06 16:10:23 UTC (rev 8390)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/Program.java 2014-10-07 09:26:41 UTC (rev 8391)
@@ -3,6 +3,7 @@
import java.io.*;
import java.util.*;
import java.util.logging.Logger;
+import java.util.logging.LogManager;
import java.util.logging.Level;
import org.osgeo.mapguide.*;
import org.osgeo.mapguide.test.common.*;
@@ -14,6 +15,8 @@
public static void main(String[] args) {
try {
+ System.out.println("Working Directory is: " + System.getProperty("user.dir"));
+ LogManager.getLogManager().reset(); //Needed for Linux
Logger.getLogger("com.almworks.sqlite4java").setLevel(Level.OFF);
if (args.length >= 1 && args.length <= 2) {
String webConfigPath = args[0];
Modified: 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 2014-10-06 16:10:23 UTC (rev 8390)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java 2014-10-07 09:26:41 UTC (rev 8391)
@@ -147,11 +147,12 @@
{
if (path != null)
{
+ String normPath = GetPath(path);
if (bCheck)
{
- if (FileExists(path))
+ if (FileExists(normPath))
{
- MgByteSource source = new MgByteSource(path);
+ MgByteSource source = new MgByteSource(normPath);
MgByteReader reader = source.getReader();
return reader;
}
@@ -159,7 +160,7 @@
}
else
{
- MgByteSource source = new MgByteSource(path);
+ MgByteSource source = new MgByteSource(normPath);
MgByteReader reader = source.getReader();
return reader;
}
@@ -317,16 +318,19 @@
public static String GetPath(String dbPath)
{
- if (IsNullOrEmpty(dbPath))
- return new File(".").getPath();
- else
- return dbPath;
- /*
- if (Path.IsPathRooted(dbPath))
- return dbPath.Replace("\\", "/");
- else
- return Path.Combine(GetAssemblyPath(), dbPath).Replace("\\", "/");
- */
+ try {
+ if (IsNullOrEmpty(dbPath)) {
+ return new File(".").getPath();
+ } else {
+ File f = new File(dbPath.replace("\\", "/"));
+ if (f.isAbsolute())
+ return f.getPath();
+ else
+ return new File(System.getProperty("user.dir"), dbPath.replace("\\","/")).getCanonicalPath();
+ }
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
}
public static Object SpecialDataHandling(String operation, Object resultData, String mimeType)
Modified: trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/operations/resource/ApplyResourcePackage.java
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/operations/resource/ApplyResourcePackage.java 2014-10-06 16:10:23 UTC (rev 8390)
+++ trunk/MgDev/UnitTest/WebTier/Java/src/org/osgeo/mapguide/test/platform/operations/resource/ApplyResourcePackage.java 2014-10-07 09:26:41 UTC (rev 8391)
@@ -25,12 +25,16 @@
if (param.get("PACKAGE") != null)
packagePath = param.get("PACKAGE");
- //Console.WriteLine("\t\tPackage Path: " + packagePath);
- MgByteReader reader = CommonUtility.GetByteReaderFromPath(packagePath, false);
+ if (System.getProperty("os.name").toLowerCase().contains("win")) {
+ //Console.WriteLine("\t\tPackage Path: " + packagePath);
+ MgByteReader reader = CommonUtility.GetByteReaderFromPath(packagePath, false);
- _resourceService.applyResourcePackage(reader);
+ _resourceService.applyResourcePackage(reader);
- return TestResult.Ok();
+ return TestResult.Ok();
+ } else {
+ throw new RuntimeException("FIXME: ApplyResourcePackage will kill the mgserver on invalid package files");
+ }
}
catch (MgException ex)
{
More information about the mapguide-commits
mailing list