You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2012/12/08 05:54:29 UTC

svn commit: r1418603 - in /incubator/flex/falcon/trunk/compiler.tests: .classpath unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java

Author: aharui
Date: Sat Dec  8 04:54:28 2012
New Revision: 1418603

URL: http://svn.apache.org/viewvc?rev=1418603&view=rev
Log:
rewrite nodebasetests to read unittest.properties to determine FLEX_HOME and PLAYERGLOBAL_HOME values.  If file doesn't exist, defaults to where the copy.sdk target copies the SDK (../compiler/generated/dist/sdk)

Modified:
    incubator/flex/falcon/trunk/compiler.tests/.classpath
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java

Modified: incubator/flex/falcon/trunk/compiler.tests/.classpath
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/.classpath?rev=1418603&r1=1418602&r2=1418603&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/.classpath (original)
+++ incubator/flex/falcon/trunk/compiler.tests/.classpath Sat Dec  8 04:54:28 2012
@@ -8,5 +8,6 @@
 	<classpathentry kind="lib" path="/compiler/lib/commons-io.jar"/>
 	<classpathentry kind="src" path="/compiler"/>
 	<classpathentry kind="lib" path="/compiler/lib/guava.jar"/>
+	<classpathentry kind="lib" path="/compiler/generated/classes"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java?rev=1418603&r1=1418602&r2=1418603&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java Sat Dec  8 04:54:28 2012
@@ -21,11 +21,14 @@ package org.apache.flex.compiler.interna
 
 import java.io.BufferedWriter;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Properties;
 
 import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.projects.FlexProjectConfigurator;
@@ -46,14 +49,29 @@ import org.junit.Test;
  */
 public class MXMLNodeBaseTests
 {
-	private static final String SDK = System.getProperty("FLEX_HOME") == null ? 
-											FilenameNormalization.normalize("../compiler/generated/dist/sdk") :
-											System.getProperty("FLEX_HOME");
-	private static final String FPSDK = System.getProperty("PLAYERGLOBAL_HOME") == null ? 
-											FilenameNormalization.normalize("../compiler/generated/dist/sdk/frameworks/libs/player") :
-											System.getProperty("PLAYERGLOBAL_HOME");
+	private static String SDK;
+	private static String FPSDK;	
+	private static boolean pathsSet = false;
+	private static void setPaths()
+	{
+		Properties p = new Properties();
+		try {
+			p.load(new FileInputStream( new File("unittest.properties")));
+			SDK = p.getProperty("FLEX_HOME",
+					FilenameNormalization.normalize("../compiler/generated/dist/sdk"));
+			FPSDK = p.getProperty("PLAYERGLOBAL_HOME",
+					FilenameNormalization.normalize("../compiler/generated/dist/sdk/frameworks/libs/player"));
+		} catch (FileNotFoundException e) {
+			SDK = FilenameNormalization.normalize("../compiler/generated/dist/sdk");
+			FPSDK = FilenameNormalization.normalize("../compiler/generated/dist/sdk/frameworks/libs/player");
+		} catch (IOException e) {
+			SDK = FilenameNormalization.normalize("../compiler/generated/dist/sdk");
+			FPSDK = FilenameNormalization.normalize("../compiler/generated/dist/sdk/frameworks/libs/player");
+		}
+		
+		pathsSet = true;
+	}
 	
-
 	protected static Workspace workspace = new Workspace();
 	
 	protected FlexProject project;
@@ -79,6 +97,9 @@ public class MXMLNodeBaseTests
 	{
 		project = new FlexProject(workspace);
 		FlexProjectConfigurator.configure(project);
+
+		if (!pathsSet)
+			setPaths();
 		
 		String tempDir = FilenameNormalization.normalize("temp"); // ensure this exists