flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1453338 - in /flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test: AMDTestBase.java ASTestBase.java FlexJSTestBase.java ITestBase.java MXMLTestBase.java TestBase.java
Date Wed, 06 Mar 2013 14:14:26 GMT
Author: mschmalle
Date: Wed Mar  6 14:14:25 2013
New Revision: 1453338

URL: http://svn.apache.org/r1453338
Log:
Flex:FalconJx
- Changed tests add source, libraries and namespaces to accept the Lists, this way its all
encapsulated.
- Took those deps methods out of public api.
- Made addDependencies() protected so a subclass could change how the test can add dependencies
during a fileNode compile.

Modified:
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ITestBase.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java?rev=1453338&r1=1453337&r2=1453338&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/AMDTestBase.java
Wed Mar  6 14:14:25 2013
@@ -20,6 +20,7 @@
 package org.apache.flex.compiler.internal.test;
 
 import java.io.File;
+import java.util.List;
 
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.driver.js.amd.AMDBackend;
@@ -78,20 +79,20 @@ public abstract class AMDTestBase extend
     abstract protected String getTypeUnderTest();
 
     @Override
-    public void addLibraries()
+    protected void addLibraries(List<File> libraries)
     {
         libraries.add(new File(FilenameNormalization.normalize(env.FPSDK
                 + "/11.1/playerglobal.swc")));
 
-        super.addLibraries();
+        super.addLibraries(libraries);
     }
 
     @Override
-    public void addSourcePaths()
+    protected void addSourcePaths(List<File> sourcePaths)
     {
         sourcePaths.add(new File(FilenameNormalization.normalize(projectPath)));
 
-        super.addSourcePaths();
+        super.addSourcePaths(sourcePaths);
     }
 
     @Override

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java?rev=1453338&r1=1453337&r2=1453338&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java
Wed Mar  6 14:14:25 2013
@@ -1,6 +1,7 @@
 package org.apache.flex.compiler.internal.test;
 
 import java.io.File;
+import java.util.List;
 
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.driver.as.ASBackend;
@@ -31,7 +32,7 @@ public class ASTestBase extends TestBase
     }
 
     @Override
-    public void addLibraries()
+    protected void addLibraries(List<File> libraries)
     {
         libraries.add(new File(FilenameNormalization.normalize(env.FPSDK
                 + "/11.1/playerglobal.swc")));
@@ -40,7 +41,7 @@ public class ASTestBase extends TestBase
         libraries.add(new File(FilenameNormalization.normalize(env.SDK
                 + "/frameworks/libs/spark.swc")));
 
-        super.addLibraries();
+        super.addLibraries(libraries);
     }
 
     @Override

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java?rev=1453338&r1=1453337&r2=1453338&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
Wed Mar  6 14:14:25 2013
@@ -1,9 +1,11 @@
 package org.apache.flex.compiler.internal.test;
 
 import java.io.File;
+import java.util.List;
 
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSBackend;
+import org.apache.flex.compiler.mxml.IMXMLNamespaceMapping;
 import org.apache.flex.compiler.mxml.MXMLNamespaceMapping;
 import org.apache.flex.utils.FilenameNormalization;
 import org.junit.Ignore;
@@ -30,7 +32,7 @@ public class FlexJSTestBase extends Test
     }
 
     @Override
-    public void addLibraries()
+    protected void addLibraries(List<File> libraries)
     {
         libraries.add(new File(FilenameNormalization.normalize(env.FPSDK
                 + "/11.1/playerglobal.swc")));
@@ -40,11 +42,11 @@ public class FlexJSTestBase extends Test
                 + "\\frameworks\\libs\\rpc.swc")));
         libraries.add(new File(asjsRoot + "frameworks/as/libs/FlexJSUI.swc"));
 
-        super.addLibraries();
+        super.addLibraries(libraries);
     }
 
     @Override
-    public void addNamespaceMappings()
+    protected void addNamespaceMappings(List<IMXMLNamespaceMapping> namespaceMappings)
     {
         namespaceMappings
                 .add(new MXMLNamespaceMapping(
@@ -52,15 +54,15 @@ public class FlexJSTestBase extends Test
                                 asjsRoot + "frameworks/as/basic-manifest.xml")
                                 .getAbsolutePath()));
 
-        super.addNamespaceMappings();
+        super.addNamespaceMappings(namespaceMappings);
     }
 
     @Override
-    public void addSourcePaths()
+    protected void addSourcePaths(List<File> sourcePaths)
     {
         sourcePaths.add(new File(asjsRoot + "examples/FlexJSTest_again"));
 
-        super.addSourcePaths();
+        super.addSourcePaths(sourcePaths);
     }
 
     @Override

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ITestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ITestBase.java?rev=1453338&r1=1453337&r2=1453338&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ITestBase.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ITestBase.java
Wed Mar  6 14:14:25 2013
@@ -1,12 +1,25 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
 package org.apache.flex.compiler.internal.test;
 
 public interface ITestBase
 {
 
-    void addLibraries();
-
-    void addNamespaceMappings();
-
-    void addSourcePaths();
-
 }

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java?rev=1453338&r1=1453337&r2=1453338&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java
Wed Mar  6 14:14:25 2013
@@ -1,9 +1,11 @@
 package org.apache.flex.compiler.internal.test;
 
 import java.io.File;
+import java.util.List;
 
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.driver.mxml.MXMLBackend;
+import org.apache.flex.compiler.mxml.IMXMLNamespaceMapping;
 import org.apache.flex.compiler.mxml.MXMLNamespaceMapping;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLNode;
@@ -29,7 +31,7 @@ public class MXMLTestBase extends TestBa
     }
 
     @Override
-    public void addLibraries()
+    protected void addLibraries(List<File> libraries)
     {
         libraries.add(new File(FilenameNormalization.normalize(env.FPSDK
                 + "/11.1/playerglobal.swc")));
@@ -40,11 +42,11 @@ public class MXMLTestBase extends TestBa
         libraries.add(new File(FilenameNormalization.normalize(env.SDK
                 + "/frameworks/libs/spark.swc")));
 
-        super.addLibraries();
+        super.addLibraries(libraries);
     }
 
     @Override
-    public void addNamespaceMappings()
+    protected void addNamespaceMappings(List<IMXMLNamespaceMapping> namespaceMappings)
     {
         namespaceMappings
                 .add(new MXMLNamespaceMapping("http://ns.adobe.com/mxml/2009",
@@ -57,7 +59,7 @@ public class MXMLTestBase extends TestBa
                 "library://ns.adobe.com/flex/spark", new File(env.SDK,
                         "frameworks/spark-manifest.xml").getAbsolutePath()));
 
-        super.addNamespaceMappings();
+        super.addNamespaceMappings(namespaceMappings);
     }
 
     @Override

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java?rev=1453338&r1=1453337&r2=1453338&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
Wed Mar  6 14:14:25 2013
@@ -1,3 +1,22 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
 package org.apache.flex.compiler.internal.test;
 
 import static org.hamcrest.core.Is.is;
@@ -26,6 +45,7 @@ import org.apache.flex.compiler.internal
 import org.apache.flex.compiler.internal.workspaces.Workspace;
 import org.apache.flex.compiler.mxml.IMXMLNamespaceMapping;
 import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
@@ -63,9 +83,9 @@ public class TestBase implements ITestBa
 
     protected File tempDir;
 
-    protected List<File> sourcePaths = new ArrayList<File>();
-    protected List<File> libraries = new ArrayList<File>();
-    protected List<IMXMLNamespaceMapping> namespaceMappings = new ArrayList<IMXMLNamespaceMapping>();
+    private List<File> sourcePaths = new ArrayList<File>();
+    private List<File> libraries = new ArrayList<File>();
+    private List<IMXMLNamespaceMapping> namespaceMappings = new ArrayList<IMXMLNamespaceMapping>();
 
     @Before
     public void setUp()
@@ -231,31 +251,36 @@ public class TestBase implements ITestBa
         return tempASFile;
     }
 
-    private void addDependencies()
-    {
-        addSourcePaths();
-        addLibraries();
-        addNamespaceMappings();
+    /**
+     * Overridable setup of dependencies, default adds source, libraries and
+     * namepsaces.
+     * <p>
+     * The test will then set the dependencies on the current
+     * {@link ICompilerProject}.
+     */
+    protected void addDependencies()
+    {
+        addSourcePaths(sourcePaths);
+        addLibraries(libraries);
+        addNamespaceMappings(namespaceMappings);
 
         project.setSourcePath(sourcePaths);
         project.setLibraries(libraries);
         project.setNamespaceMappings(namespaceMappings);
     }
 
-    @Override
-    public void addLibraries()
+    protected void addLibraries(List<File> libraries)
     {
     }
 
-    @Override
-    public void addNamespaceMappings()
+    protected void addSourcePaths(List<File> sourcePaths)
     {
+        sourcePaths.add(tempDir);
     }
 
-    @Override
-    public void addSourcePaths()
+    protected void addNamespaceMappings(
+            List<IMXMLNamespaceMapping> namespaceMappings)
     {
-        sourcePaths.add(tempDir);
     }
 
     protected String getCodeFromFile(String fileName, boolean isJS,



Mime
View raw message