incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From espensko...@apache.org
Subject svn commit: r1374298 - in /incubator/flex/whiteboard/espenskogen/classloader: ./ src/ src/main/ src/main/flex/ src/main/resources/ src/test/ src/test/flex/ src/test/flex/util/
Date Fri, 17 Aug 2012 14:55:06 GMT
Author: espenskogen
Date: Fri Aug 17 14:55:05 2012
New Revision: 1374298

URL: http://svn.apache.org/viewvc?rev=1374298&view=rev
Log:
FLEX-33085 - Beginning of class loader api for Flex

Added:
    incubator/flex/whiteboard/espenskogen/classloader/
    incubator/flex/whiteboard/espenskogen/classloader/pom.xml
    incubator/flex/whiteboard/espenskogen/classloader/src/
    incubator/flex/whiteboard/espenskogen/classloader/src/main/
    incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/
    incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoader.as
    incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoaderEvent.as
    incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwcClassLoader.as
    incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwfClassLoader.as
    incubator/flex/whiteboard/espenskogen/classloader/src/main/resources/
    incubator/flex/whiteboard/espenskogen/classloader/src/test/
    incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/
    incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/ClassLoaderTest.as
    incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/MockClass.as
    incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcClassLoaderTest.as
    incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcExtractorTest.as
    incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwfClassLoaderTest.as
    incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/util/
    incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/util/SwcExtractorTest.as

Added: incubator/flex/whiteboard/espenskogen/classloader/pom.xml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/pom.xml?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/pom.xml (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/pom.xml Fri Aug 17 14:55:05 2012
@@ -0,0 +1,604 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+
+
+    <groupId>classLoaderLib</groupId>
+    <artifactId>classLoaderLib</artifactId>
+    <version>1.0</version>
+
+    <properties>
+        <flexmojos.version>4.0-RC1</flexmojos.version>
+    </properties>
+    <dependencies>
+        <!-- Flex -->
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>datavisualization</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>datavisualization</artifactId>
+            <type>rb.swc</type>
+            <classifier>en_US</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>flash-integration</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>flash-integration</artifactId>
+            <type>rb.swc</type>
+            <classifier>en_US</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>flex</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>framework</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>framework</artifactId>
+            <type>rb.swc</type>
+            <classifier>en_US</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>osmf</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>osmf</artifactId>
+            <type>rb.swc</type>
+            <classifier>en_US</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>playerglobal</artifactId>
+            <type>swc</type>
+            <classifier>10.0</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>playerglobal</artifactId>
+            <type>rb.swc</type>
+            <classifier>en_US</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>rpc</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>rpc</artifactId>
+            <type>rb.swc</type>
+            <classifier>en_US</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>spark</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>spark</artifactId>
+            <type>rb.swc</type>
+            <classifier>en_US</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>sparkskins</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>textLayout</artifactId>
+            <type>swc</type>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>textLayout</artifactId>
+            <type>rb.swc</type>
+            <classifier>en_US</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>com.adobe.flex.framework</groupId>
+            <artifactId>utilities</artifactId>
+            <type>swc</type>
+        </dependency>
+
+    </dependencies>
+
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>datavisualization</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>framework</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>osmf</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>rpc</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>spark</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>sparkskins</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>textLayout</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>datavisualization</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <classifier>en_US</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>flash-integration</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>merged</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>flash-integration</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <classifier>en_US</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>flex</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>framework</artifactId>
+                <version>4.1.0.16076</version>
+                <type>zip</type>
+                <classifier>configs</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>framework</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <classifier>en_US</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>osmf</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <classifier>en_US</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>playerglobal</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <classifier>10.0</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>playerglobal</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <classifier>en_US</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>playerglobal</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>rpc</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <classifier>en_US</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>spark</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <classifier>en_US</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>textLayout</artifactId>
+                <version>4.1.0.16076</version>
+                <type>rb.swc</type>
+                <classifier>en_US</classifier>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flex.framework</groupId>
+                <artifactId>utilities</artifactId>
+                <version>4.1.0.16076</version>
+                <type>swc</type>
+                <scope>external</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.adobe.flexunit</groupId>
+                <artifactId>flexunit</artifactId>
+                <version>4.1.0_RC2</version>
+                <type>swc</type>
+            </dependency>
+            <dependency>
+                <groupId>com.digitalprimates.fluint</groupId>
+                <artifactId>fluint</artifactId>
+                <version>1.2</version>
+                <type>swc</type>
+            </dependency>
+            <dependency>
+                <groupId>org.fluint</groupId>
+                <artifactId>fluint-extensions</artifactId>
+                <version>4.1.0</version>
+                <type>swc</type>
+            </dependency>
+            <dependency>
+                <groupId>hamcrest-as3</groupId>
+                <artifactId>hamcrest-as3</artifactId>
+                <version>1.1.3</version>
+                <type>swc</type>
+            </dependency>
+            <dependency>
+                <groupId>mockolate</groupId>
+                <artifactId>mockolate</artifactId>
+                <version>0.11.0</version>
+                <type>swc</type>
+                <classifier>flex</classifier>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+
+        <extensions>
+            <extension>
+                <groupId>org.sonatype.flexmojos</groupId>
+                <artifactId>flexmojos-maven-plugin</artifactId>
+                <version>${flexmojos.version}</version>
+            </extension>
+        </extensions>
+
+        <sourceDirectory>${project.basedir}/src/main/flex</sourceDirectory>
+        <testSourceDirectory>${project.basedir}/src/test/flex</testSourceDirectory>
+
+        <plugins>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>buildnumber-maven-plugin</artifactId>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-release-plugin</artifactId>
+            </plugin>
+
+        </plugins>
+
+        <pluginManagement>
+            <plugins>
+
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>buildnumber-maven-plugin</artifactId>
+                    <version>1.0</version>
+                    <executions>
+                        <execution>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>create</goal>
+                            </goals>
+                            <configuration>
+                                <providerImplementations>
+                                    <svn>javasvn</svn>
+                                </providerImplementations>
+                                <buildNumberPropertyName>build.revision</buildNumberPropertyName>
+                                <timestampPropertyName>build.timestamp</timestampPropertyName>
+                                <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
+                                <revisionOnScmFailure>LOCAL</revisionOnScmFailure>
+                            </configuration>
+                        </execution>
+                    </executions>
+                </plugin>
+
+                <plugin>
+                    <groupId>com.google.code.maven-replacer-plugin</groupId>
+                    <artifactId>maven-replacer-plugin</artifactId>
+                    <version>1.4.1</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.sonatype.flexmojos</groupId>
+                    <artifactId>flexmojos-maven-plugin</artifactId>
+                    <version>${flexmojos.version}</version>
+                    <inherited>true</inherited>
+                    <configuration>
+                        <accessible>true</accessible>
+                        <strict>true</strict>
+                        <debug>${flex.debug}</debug>
+                        <keepAllTypeSelectors>true</keepAllTypeSelectors>
+                        <targetPlayer>10.1</targetPlayer>
+
+                        <localesCompiled>
+                            <locale>en_US</locale>
+                        </localesCompiled>
+
+                        <dumpConfigAttach>false</dumpConfigAttach>
+                        <storepass/>
+                        <headlessServer>true</headlessServer>
+                        <verboseStacktraces>true</verboseStacktraces>
+                        <coverage>false</coverage>
+                        <testTimeout>20000</testTimeout>
+
+                        <compilerWarnings>
+                            <warn-no-constructor>false</warn-no-constructor>
+                        </compilerWarnings>
+
+                        <rslUrls>
+                            <rsl>{artifactId}-{version}.{extension}</rsl>
+                        </rslUrls>
+
+                        <fonts>
+                            <managers>
+                                <manager>flash.fonts.AFEFontManager</manager>
+                                <manager>flash.fonts.JREFontManager</manager>
+                                <manager>flash.fonts.BatikFontManager</manager>
+                                <manager>flash.fonts.CFFFontManager</manager>
+                            </managers>
+                        </fonts>
+                    </configuration>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.sonatype.flexmojos</groupId>
+                            <artifactId>flexmojos-threadlocaltoolkit-wrapper</artifactId>
+                            <version>${flexmojos.version}</version>
+                        </dependency>
+                        <dependency>
+                            <groupId>com.adobe.flex</groupId>
+                            <artifactId>compiler</artifactId>
+                            <version>${flex.version}</version>
+                            <type>pom</type>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+
+                <plugin>
+                    <artifactId>maven-clean-plugin</artifactId>
+                    <inherited>true</inherited>
+                    <executions>
+                        <execution>
+                            <id>clean-idea-test-runner</id>
+                            <phase>process-test-classes</phase>
+                            <goals>
+                                <goal>clean</goal>
+                            </goals>
+                            <configuration>
+                                <excludeDefaultDirectories>true</excludeDefaultDirectories>
+                                <filesets>
+                                    <fileset>
+                                        <directory>${project.build.testSourceDirectory}</directory>
+                                        <includes>
+                                            <include>FlexUnitApplication.mxml</include>
+                                            <include>FlexUnitCompilerApplication.mxml</include>
+                                        </includes>
+                                    </fileset>
+                                    <fileset>
+                                        <directory>${project.build.testOutputDirectory}</directory>
+                                        <includes>
+                                            <include>_flexunit.swf</include>
+                                        </includes>
+                                    </fileset>
+                                </filesets>
+                            </configuration>
+                        </execution>
+                    </executions>
+
+                    <configuration>
+                        <filesets>
+                            <fileset>
+                                <directory>${project.build.testSourceDirectory}</directory>
+                                <includes>
+                                    <include>FlexUnitApplication.mxml</include>
+                                    <include>FlexUnitCompilerApplication.mxml</include>
+                                </includes>
+                            </fileset>
+                        </filesets>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <artifactId>maven-assembly-plugin</artifactId>
+                    <version>2.2.2</version>
+                </plugin>
+
+                <plugin>
+                    <artifactId>maven-release-plugin</artifactId>
+                    <version>2.2.1</version>
+                    <configuration>
+                        <scmCommentPrefix>CFPE1-74</scmCommentPrefix>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>com.adobe.ac</groupId>
+                    <artifactId>flex-pmd-cpd-maven-plugin</artifactId>
+                    <version>1.2</version>
+                    <executions>
+                        <execution>
+                            <phase>package</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                    <configuration>
+                        <minimumTokenCount>250</minimumTokenCount>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>com.adobe.ac</groupId>
+                    <artifactId>flex-pmd-metrics-maven-plugin</artifactId>
+                    <version>1.2</version>
+                    <executions>
+                        <execution>
+                            <phase>package</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+
+                <plugin>
+                    <groupId>com.adobe.ac</groupId>
+                    <artifactId>flex-pmd-maven-plugin</artifactId>
+                    <version>1.2</version>
+                    <executions>
+                        <execution>
+                            <phase>package</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+
+                    <configuration>
+                        <url>http://subversion.ny.jpmorgan.com/svn/repos/CFPE/Common/trunk/PMDRules/Flexpmd.xml</url>
+                    </configuration>
+                </plugin>
+
+            </plugins>
+        </pluginManagement>
+
+    </build>
+
+    <scm>
+        <connection>scm:svn:https://svn.apache.org/repos/asf/incubator/flex/whiteboard/espenskogen/</connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/incubator/flex/whiteboard/espenskogen
+        </developerConnection>
+        <url>scm:svn:https://svn.apache.org/repos/asf/incubator/flex/whiteboard/espenskogen</url>
+    </scm>
+
+
+    <repositories>
+        <repository>
+            <id>sonatype</id>
+            <name>Sonatype FlexGroup</name>
+            <url>https://repository.sonatype.org/content/groups/flexgroup/</url>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>always</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </releases>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+
+
+        <repository>
+            <id>internal</id>
+            <name>JPM CFP Public</name>
+            <url>http://devash-ecfpwb01.svr.us.jpmchase.net:4143/nexus/content/groups/public</url>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>always</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+
+    </repositories>
+
+
+</project>
\ No newline at end of file

Added: incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoader.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoader.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoader.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoader.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,408 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader
+{
+    import flash.display.MovieClip;
+    import flash.errors.IllegalOperationError;
+    import flash.events.EventDispatcher;
+    import flash.system.ApplicationDomain;
+    import flash.utils.ByteArray;
+
+    import mx.core.BitmapAsset;
+    import mx.core.SoundAsset;
+    import mx.core.SpriteAsset;
+    import mx.logging.ILogger;
+    import mx.logging.Log;
+
+    [Event(name="loaded", type="com.jpmorgan.ib.cfpe.classloader.ClassLoaderEvent")]
+    [Event(name="error", type="com.jpmorgan.ib.cfpe.classloader.ClassLoaderEvent")]
+    [Event(name="unloaded", type="com.jpmorgan.ib.cfpe.classloader.ClassLoaderEvent")]
+
+    /**
+     * Abstract base class for ClassLoaders.
+     *
+     * <p>Provides a Java style class loader hierarchy for dynamically loading Flex classes.</p>
+     * <p>Sub classes should implement <code>findClass</code>, <code>loadContainer</code> and <code>unloadContainer</code> at a minimum</p>
+     * @see http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/ClassLoader.html
+     */
+    public class ClassLoader extends EventDispatcher
+    {
+        /**
+         * The parent class loader
+         */
+        public function get parent():ClassLoader
+        {
+            return _parent;
+        }
+
+
+        /**
+         * Domain for the class loader
+         */
+        public function get domain():ApplicationDomain
+        {
+            return _domain;
+        }
+
+
+        /**
+         * Has the dependency been loaded
+         */
+        public function get loaded():Boolean
+        {
+            return _loaded;
+        }
+
+
+        /**
+         * Constructor
+         */
+        public function ClassLoader(parent:ClassLoader = null, domain:ApplicationDomain = null)
+        {
+            if (parent)
+            {
+                _parent = parent;
+            }
+
+            if (domain)
+            {
+                this._domain = domain;
+            }
+            else if (parent)
+            {
+                this._domain = _parent._domain;
+            }
+            else
+            {
+                this._domain = new ApplicationDomain(ApplicationDomain.currentDomain);
+            }
+
+        }
+
+
+        /* PUBLIC */
+
+
+        /**
+         *  Load the classes from there container e.g. SWF/SWC etc
+         */
+        public function load():void
+        {
+            loadContainer();
+        }
+
+
+        /**
+         *  unload the classes from there container e.g. SWF/SWC etc
+         */
+        public function unload():void
+        {
+            unloadContainer();
+        }
+
+
+        /**
+         * Return a class definition
+         *
+         * <p>Because Flex Loaders are asynchronous, this method must be called after the ClassLoader as finished loading the class container e.g. SWF/SWC etc from a call to load()</p>
+         *
+         * @throws ReferenceError
+         */
+        public function getClass(name:String):Class
+        {
+            var result:Class
+
+            try
+            {
+                result = Class(lookupDefinition(name));
+            }
+            catch (error:ReferenceError)
+            {
+                throw new ReferenceError("Class definition '" + name + "' not found");
+            }
+
+            if (!result)
+            {
+                throw new ReferenceError("Class definition '" + name + "' not found");
+            }
+
+            return result;
+        }
+
+
+        /**
+         * Return a function definition
+         *
+         * <p>Because Flex Loaders are asynchronous, this method must be called after the ClassLoader as finished loading the class container e.g. SWF/SWC etc from a call to load()</p>
+         *
+         * @throws ReferenceError
+         */
+        public function getFunction(name:String):Function
+        {
+            var result:Function;
+
+            try
+            {
+                result = lookupDefinition(name) as Function;
+            }
+            catch (error:ReferenceError)
+            {
+                if (error.message != "")
+                {
+                    throw new ReferenceError("Function definition '" + name + "' not found in '" + error.message + "'");
+                }
+                else
+                {
+                    throw new ReferenceError("Function definition '" + name + "' not found");
+                }
+            }
+
+            return result;
+        }
+
+
+        /**
+         * Return a namespace definition
+         *
+         * <p>Because Flex Loaders are asynchronous, this method must be called after the ClassLoader as finished loading the class container e.g. SWF/SWC etc from a call to load()</p>
+         *
+         * @throws ReferenceError
+         */
+        public function getNamespace(name:String):Namespace
+        {
+            var result:Namespace;
+
+            try
+            {
+                result = Namespace(lookupDefinition(name));
+            }
+            catch (error:ReferenceError)
+            {
+                throw new ReferenceError("Namespace definition '" + name + "' not found");
+            }
+
+            if (!result)
+            {
+                throw new ReferenceError("Namespace definition '" + name + "' not found");
+            }
+
+            return result;
+        }
+
+
+        /**
+         * Return a bitmap asset, from an embedded JPG, GIF or PNG
+         *
+         * <p>Because Flex Loaders are asynchronous, this method must be called after the ClassLoader as finished loading the class container e.g. SWF/SWC etc from a call to load()</p>
+         *
+         * @throws ReferenceError
+         * @throws TypeError
+         */
+        public function getBitmapAsset(name:String):BitmapAsset
+        {
+            const LoadedBitmapAssetClass:Class = getClass(name);
+            var bitmapAsset:BitmapAsset;
+
+            try
+            {
+                bitmapAsset = new LoadedBitmapAssetClass();
+                return bitmapAsset;
+            }
+            catch (error:Error)
+            {
+                throw new TypeError(name + " is not a Bitmap Asset");
+            }
+
+            return null;
+        }
+
+
+        /**
+         * Return a sprite asset, from an embedded SVG image
+         *
+         * <p>Because Flex Loaders are asynchronous, this method must be called after the ClassLoader as finished loading the class container e.g. SWF/SWC etc from a call to load()</p>
+         *
+         * @throws ReferenceError
+         * @throws TypeError
+         */
+        public function getSpriteAsset(name:String):SpriteAsset
+        {
+            const LoadedSpriteAssetClass:Class = getClass(name);
+            var spriteAsset:SpriteAsset;
+
+            try
+            {
+                spriteAsset = new LoadedSpriteAssetClass();
+                return spriteAsset;
+            }
+            catch (error:Error)
+            {
+                throw new TypeError(name + " is not a Sprite Asset");
+            }
+
+            return null;
+        }
+
+
+        /**
+         * Return a sound asset, from an embedded MP3
+         *
+         * <p>Because Flex Loaders are asynchronous, this method must be called after the ClassLoader as finished loading the class container e.g. SWF/SWC etc from a call to load()</p>
+         *
+         * @throws ReferenceError
+         * @throws TypeError
+         */
+        public function getSoundAsset(name:String):SoundAsset
+        {
+            const LoadedSoundAssetClass:Class = getClass(name);
+            var soundAsset:SoundAsset;
+
+            try
+            {
+                soundAsset = new LoadedSoundAssetClass();
+                return soundAsset;
+            }
+            catch (error:Error)
+            {
+                throw new TypeError(name + " is not a Sound Asset");
+            }
+
+            return null;
+        }
+
+
+        /**
+         * Return a Movie Clip asset, from an embedded SWF
+         *
+         * <p>Because Flex Loaders are asynchronous, this method must be called after the ClassLoader as finished loading the class container e.g. SWF/SWC etc from a call to load()</p>
+         *
+         * @throws ReferenceError
+         * @throws TypeError
+         */
+        public function getMovieClipAsset(name:String):MovieClip
+        {
+            const LoadedMovieClipClass:Class = getClass(name);
+            var moveClip:MovieClip;
+
+            try
+            {
+                moveClip = new LoadedMovieClipClass();
+                return moveClip;
+            }
+            catch (error:Error)
+            {
+                throw new TypeError(name + " is not a MovieClip Asset");
+            }
+
+            return null;
+        }
+
+
+        /**
+         * Return a ByteArray asset, from an embedded binary asset
+         *
+         * <p>Because Flex Loaders are asynchronous, this method must be called after the ClassLoader as finished loading the class container e.g. SWF/SWC etc from a call to load()</p>
+         *
+         * @throws ReferenceError
+         * @throws TypeError
+         */
+        public function getByteArrayAsset(name:String):ByteArray
+        {
+            const LoadedByteArrayAssetClass:Class = getClass(name);
+            var byteArrayAsset:ByteArray;
+
+            try
+            {
+                byteArrayAsset = new LoadedByteArrayAssetClass();
+                return byteArrayAsset;
+            }
+            catch (error:Error)
+            {
+                throw new TypeError(name + " is not a ByteArray Asset");
+            }
+
+            return null;
+        }
+
+
+        /* PROTECTED */
+
+
+        protected var _parent:ClassLoader;
+
+        protected var _domain:ApplicationDomain
+
+        protected var _loaded:Boolean = false;
+
+
+        /**
+         * Load the classes from there container e.g. SWF/SWC etc
+         */
+        protected function loadContainer():void
+        {
+            throw new IllegalOperationError("Must be overridden");
+        }
+
+
+        /**
+         *  UnLoad the classes from there container e.g. SWF/SWC etc
+         */
+        protected function unloadContainer():void
+        {
+            throw new IllegalOperationError("Must be overridden");
+        }
+
+
+        /**
+         * Find a definition form the container, and return it
+         *
+         * @throws ReferenceError
+         */
+        protected function findDefinition(name:String):Object
+        {
+            throw new IllegalOperationError("Must be overridden");
+        }
+
+
+        /* PRIVATE */
+
+        private static const logger:ILogger = Log.getLogger("com.jpmorgan.ib.cfpe.classloader.ClassLoader");
+
+        /**
+         * Lookup the definition form the ClassLoader hierarchy
+         */
+        private function lookupDefinition(name:String):Object
+        {
+            var definition:Object;
+
+            if (_domain && _domain.hasDefinition(name))
+            {
+                definition = _domain.getDefinition(name);
+            }
+            else
+            {
+                try
+                {
+                    if (_parent)
+                    {
+                        definition = _parent.getClass(name);
+                    }
+                }
+                catch (error:ReferenceError)
+                {
+                    definition = findDefinition(name);
+                }
+            }
+
+            if (!_parent)
+            {
+                definition = findDefinition(name);
+            }
+
+            logger.info("lookupDefinition: Looked up definition for {0}: {1}", name, definition);
+
+            return definition;
+        }
+    }
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoaderEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoaderEvent.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoaderEvent.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/ClassLoaderEvent.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,39 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader
+{
+import flash.events.Event;
+
+/**
+ * Class Loader Events
+ */
+public class ClassLoaderEvent extends Event
+{
+    public static var CLASS_CONTAINER_LOADED:String = "loaded";
+    public static var CLASS_CONTAINER_ERROR:String = "error";
+    public static var CLASS_CONTAINER_UNLOADED:String = "unloaded";
+
+
+    public var msg:String;
+
+    /**
+     * Constructor
+     */
+    public function ClassLoaderEvent(type:String, msg:String = "")
+    {
+        super(type);
+
+        this.msg = msg;
+    }
+
+
+    /**
+     * Clone for re-dispatch
+     */
+    override public function clone():Event
+    {
+        return new ClassLoaderEvent(this.type, this.msg);
+    }
+}
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwcClassLoader.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwcClassLoader.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwcClassLoader.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwcClassLoader.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,193 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader
+{
+import com.jpmorgan.ib.cfpe.classloader.util.SwcExtractor;
+
+import flash.display.Loader;
+import flash.events.Event;
+import flash.events.IOErrorEvent;
+import flash.events.SecurityErrorEvent;
+import flash.net.URLLoader;
+import flash.net.URLLoaderDataFormat;
+import flash.net.URLRequest;
+import flash.system.ApplicationDomain;
+import flash.system.LoaderContext;
+import flash.utils.ByteArray;
+
+/**
+ * Implements a Class Loader which loads Classes within a SWC container from a URL
+ *
+ * <p>When using Embedded assets in the SWC for use with getBitmapAsset, getSoundAsset etc; it is advisable to
+ * explicitly remove the resource file asset from the SWC, to avoid storing the asset twice i.e. once for the file
+ * and once of the Asset class wrapping the file.</p>
+ */
+public class SwcClassLoader extends ClassLoader
+{
+    /**
+     * Constructor
+     */
+    public function SwcClassLoader(swcURL:String, parent:ClassLoader = null, domain:ApplicationDomain = null)
+    {
+        super(parent, domain);
+
+        this._swcURL = swcURL;
+    }
+
+
+    /* PUBLIC */
+
+    protected var loader:URLLoader;
+
+    protected var _swcURL:String;
+
+    /**
+     * Load the classes from SWF
+     */
+    override protected function loadContainer():void
+    {
+        loader = new URLLoader();
+        loader.dataFormat = URLLoaderDataFormat.BINARY;
+        loader.addEventListener(Event.COMPLETE, completeHandler);
+        loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
+        loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+
+        libraryLoader = new Loader();
+        libraryLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, libraryLoadCompleteHandler);
+        libraryLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
+        libraryLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+        libraryLoader.contentLoaderInfo.addEventListener(Event.UNLOAD, unloadHandler);
+
+        // Load the SWC
+        const request:URLRequest = new URLRequest(_swcURL);
+        loader.load(request);
+    }
+
+
+    /**
+     *  UnLoad the classes from there container e.g. SWF/SWC etc
+     */
+    override protected function unloadContainer():void
+    {
+        if (_domain)
+        {
+            _domain = null;
+        }
+
+        if (loader)
+        {
+            loader.removeEventListener(Event.COMPLETE, completeHandler);
+            loader.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
+            loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+
+            loader = null;
+        }
+
+
+        if (libraryLoader)
+        {
+            libraryLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, libraryLoadCompleteHandler);
+            libraryLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
+            libraryLoader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+
+            libraryLoader.unloadAndStop(true);
+            libraryLoader = null;
+        }
+    }
+
+
+    /**
+     * Find a class form the SWF, and return it
+     *
+     * @throws ReferenceError
+     */
+    override protected function findDefinition(name:String):Object
+    {
+        try
+        {
+            return libraryLoader.contentLoaderInfo.applicationDomain.getDefinition(name);
+        }
+        catch (error:Error)
+        {
+            throw new ReferenceError(_swcURL);
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Handle load complete
+     *
+     * @param event
+     */
+    protected function completeHandler(event:Event):void
+    {
+        // Extract SWF library
+        const extractor:SwcExtractor = new SwcExtractor(loader.data);
+        const swfData:ByteArray = extractor.extract("library.swf");
+
+        // Load the SWF
+        const context:LoaderContext = new LoaderContext(false, _domain);
+        libraryLoader.loadBytes(swfData, context);
+    }
+
+
+    /**
+     * Handle library load complete
+     *
+     * @param event
+     */
+    protected function libraryLoadCompleteHandler(event:Event):void
+    {
+        _loaded = true;
+
+        dispatchEvent(new ClassLoaderEvent(ClassLoaderEvent.CLASS_CONTAINER_LOADED));
+    }
+
+
+
+    /**
+     * Handle error
+     *
+     * @param event
+     */
+    protected function ioErrorHandler(event:IOErrorEvent):void
+    {
+        dispatchEvent(new ClassLoaderEvent(ClassLoaderEvent.CLASS_CONTAINER_ERROR, event.text));
+    }
+
+    /**
+     * Handle error
+     *
+     * @param event
+     */
+    protected function securityErrorHandler(event:SecurityErrorEvent):void
+    {
+        dispatchEvent(new ClassLoaderEvent(ClassLoaderEvent.CLASS_CONTAINER_ERROR, event.text));
+    }
+
+
+    /* PRIVATE */
+
+    private var libraryLoader:Loader;
+
+
+
+    /**
+     * Handle unload
+     *
+     * @param event
+     */
+    private function unloadHandler(event:Event):void
+    {
+        dispatchEvent(new ClassLoaderEvent(ClassLoaderEvent.CLASS_CONTAINER_UNLOADED));
+
+        if (libraryLoader)
+        {
+            libraryLoader.removeEventListener(Event.UNLOAD, unloadHandler);
+        }
+    }
+}
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwfClassLoader.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwfClassLoader.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwfClassLoader.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/main/flex/SwfClassLoader.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,147 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader
+{
+import flash.display.Loader;
+import flash.events.Event;
+import flash.events.IOErrorEvent;
+import flash.events.SecurityErrorEvent;
+import flash.net.URLRequest;
+import flash.system.ApplicationDomain;
+import flash.system.LoaderContext;
+
+/**
+ * Implements a Class Loader which loads Classes within a SWF container from a URL
+ */
+public class SwfClassLoader extends ClassLoader
+{
+    /**
+     * Constructor
+     */
+    public function SwfClassLoader(swfURL:String, parent:ClassLoader = null, domain:ApplicationDomain = null)
+    {
+        super(parent, domain);
+
+        this.swfURL = swfURL;
+    }
+
+
+    /* PUBLIC */
+
+
+    /**
+     * Load the classes from SWF
+     */
+    override protected function loadContainer():void
+    {
+        loader = new Loader();
+        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
+        loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
+        loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+        loader.contentLoaderInfo.addEventListener(Event.UNLOAD, unloadHandler);
+
+        const request:URLRequest = new URLRequest(swfURL);
+        const context:LoaderContext = new LoaderContext(false, _domain);
+
+        loader.load(request, context);
+    }
+
+
+    /**
+     *  UnLoad the classes from their container e.g. SWF/SWC etc
+     */
+    override protected function unloadContainer():void
+    {
+        if (_domain)
+        {
+            _domain = null;
+        }
+
+        if (loader)
+        {
+            loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, completeHandler);
+            loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
+            loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
+
+            loader.unloadAndStop(true);
+            loader = null;
+        }
+    }
+
+
+    /**
+     * Find a class form the SWF, and return it
+     *
+     * @throws ReferenceError
+     */
+    override protected function findDefinition(name:String):Object
+    {
+        try
+        {
+            return loader.contentLoaderInfo.applicationDomain.getDefinition(name);
+        }
+        catch (error:Error)
+        {
+            throw new ReferenceError(swfURL);
+        }
+
+        return null;
+    }
+
+
+    /* PRIVATE */
+
+    private var loader:Loader;
+
+    private var swfURL:String;
+
+    /**
+     * Handle load complete
+     *
+     * @param event
+     */
+    private function completeHandler(event:Event):void
+    {
+        _loaded = true;
+
+        dispatchEvent(new ClassLoaderEvent(ClassLoaderEvent.CLASS_CONTAINER_LOADED));
+    }
+
+    /**
+     * Handle load error
+     *
+     * @param event
+     */
+    private function ioErrorHandler(event:IOErrorEvent):void
+    {
+        dispatchEvent(new ClassLoaderEvent(ClassLoaderEvent.CLASS_CONTAINER_ERROR, event.text));
+    }
+
+    /**
+     * Handle load security error
+     *
+     * @param event
+     */
+    private function securityErrorHandler(event:SecurityErrorEvent):void
+    {
+        dispatchEvent(new ClassLoaderEvent(ClassLoaderEvent.CLASS_CONTAINER_ERROR, event.text));
+    }
+
+
+    /**
+     * Handle unload
+     *
+     * @param event
+     */
+    private function unloadHandler(event:Event):void
+    {
+        dispatchEvent(new ClassLoaderEvent(ClassLoaderEvent.CLASS_CONTAINER_UNLOADED));
+
+        if (loader)
+        {
+            loader.removeEventListener(Event.UNLOAD, unloadHandler);
+        }
+    }
+}
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/ClassLoaderTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/ClassLoaderTest.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/ClassLoaderTest.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/ClassLoaderTest.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,93 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader
+{
+import flash.system.ApplicationDomain;
+
+import org.flexunit.asserts.assertEquals;
+import org.flexunit.asserts.assertNotNull;
+import org.flexunit.asserts.assertNull;
+
+/**
+ * Tests for ClassLoader
+ */
+public class ClassLoaderTest
+{
+    /**
+     * Constructor
+     */
+    public function ClassLoaderTest()
+    {
+    }
+
+    [Before]
+    public function setUp():void
+    {
+
+    }
+
+    [After]
+    public function tearDown():void
+    {
+
+    }
+
+
+    /* TESTS */
+
+    [Test(expects="flash.errors.IllegalOperationError")]
+    public function testAbstractLoad():void
+    {
+        const classLoader:ClassLoader = new ClassLoader();
+        classLoader.load();
+    }
+
+    [Test]
+    public function testDefaultConstructor():void
+    {
+        const classLoader:ClassLoader = new MockClassLoader();
+
+        assertNull(classLoader.parent);
+    }
+
+    [Test]
+    public function testConstructorWithParent():void
+    {
+        const parent:ClassLoader = new MockClassLoader();
+        const classLoader:ClassLoader = new MockClassLoader(parent);
+
+        assertEquals(classLoader.parent, parent);
+    }
+
+
+    [Test]
+    public function testConstructorWithDomain():void
+    {
+        const domain:ApplicationDomain = new ApplicationDomain();
+        const classLoader:ClassLoader = new MockClassLoader(null, domain);
+
+        assertEquals(MockClassLoader(classLoader).domain, domain);
+    }
+
+
+    [Test(expects="ReferenceError")]
+    public function testLoadMissingClass():void
+    {
+        const classLoader:ClassLoader = new MockClassLoader();
+
+        classLoader.getClass("SomeClass");
+    }
+
+
+    [Test]
+    public function testLoadFoundClass():void
+    {
+        const classLoader:ClassLoader = new MockClassLoader();
+
+        const theClass:Class = classLoader.getClass("com.jpmorgan.ib.cfpe.classloader.MockClass");
+
+        assertNotNull(theClass);
+    }
+}
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/MockClass.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/MockClass.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/MockClass.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/MockClass.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,18 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader
+{
+/**
+ *  Mock Class to load
+ */
+public class MockClass
+{
+    /**
+     * Constructor
+     */
+    public function MockClass()
+    {
+    }
+}
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcClassLoaderTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcClassLoaderTest.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcClassLoaderTest.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcClassLoaderTest.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,154 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader
+{
+import flash.utils.getTimer;
+
+import mx.core.BitmapAsset;
+
+import org.flexunit.asserts.assertEquals;
+import org.flexunit.async.Async;
+
+/**
+ *  SwcClassLoader Tests
+ */
+public class SwcClassLoaderTest
+{
+    /**
+     * Constructor
+     */
+    public function SwcClassLoaderTest()
+    {
+    }
+
+    [Before]
+    public function setUp():void
+    {
+
+    }
+
+    [After]
+    public function tearDown():void
+    {
+        classLoader.unload();
+        classLoader = null;
+    }
+
+
+    /* TESTS */
+
+
+    [Test(async)]
+    public function testConstructWithMissingSWF():void
+    {
+        classLoader = new SwcClassLoader("dependencies/nowhere.swc");
+        classLoader.load();
+        Async.proceedOnEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_ERROR);
+    }
+
+    [Test(async)]
+    public function testConstructWithSWF():void
+    {
+        classLoader = new SwcClassLoader("dependencies/RuntimeClass.swc");
+        classLoader.load();
+        Async.proceedOnEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, 10000);
+    }
+
+
+    [Test(async)]
+    public function testLoadClass():void
+    {
+        classLoader = new SwcClassLoader("dependencies/RuntimeClass.swc");
+        const tickCount:int = getTimer();
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const time:int = getTimer() - tickCount;
+                    trace(time);
+                    const RuntimeClass:Class = classLoader.getClass("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeClass");
+                    const runtimeClass:Object = new RuntimeClass();
+
+                    assertEquals(runtimeClass.toString(), "RuntimeClass");
+                }, 10000
+        );
+    }
+
+
+    [Test(async, expects="ReferenceError")]
+    public function testClassNotFound():void
+    {
+        classLoader = new SwcClassLoader("dependencies/RuntimeClass.swc");
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const RuntimeClass:Class = classLoader.getClass("NoClassCalledThis");
+                }, 10000
+        );
+    }
+
+
+    [Test(expects="ReferenceError")]
+    public function testClassNotLoaded():void
+    {
+        classLoader = new SwcClassLoader("dependencies/RuntimeClass.swc");
+        const RuntimeClass:Class = classLoader.getClass("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeClass");
+    }
+
+
+    [Test(async)]
+    public function testLoadFunction():void
+    {
+        classLoader = new SwcClassLoader("dependencies/RuntimeClass.swc");
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const runtimeFunction:Function = classLoader.getFunction("com.jpmorgan.ib.cfpe.classloader.runtime.runtimeFunction");
+                    const result:String = runtimeFunction();
+
+                    assertEquals("Hello!", result);
+                }, 10000
+        );
+    }
+
+
+    [Test(async)]
+    public function testLoadNamespace():void
+    {
+        classLoader = new SwcClassLoader("dependencies/RuntimeClass.swc");
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const runtimenamespace:Namespace = classLoader.getNamespace("com.jpmorgan.ib.cfpe.classloader.runtime.runtimenamespace");
+
+                    assertEquals("someURL", runtimenamespace.uri);
+                }, 10000
+        );
+    }
+
+
+    [Test(async)]
+    public function testLoadBitmapAsset():void
+    {
+        classLoader = new SwcClassLoader("dependencies/RuntimeClass.swc");
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const bitmapAsset:BitmapAsset = classLoader.getBitmapAsset("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeAssets_RuntimeBitmapAsset");
+
+                    assertEquals(0xFFFFFF, bitmapAsset.bitmapData.getPixel(10, 10));
+                }, 10000
+        );
+    }
+
+
+    /* PRIVATE */
+
+    private var classLoader:ClassLoader;
+}
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcExtractorTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcExtractorTest.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcExtractorTest.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwcExtractorTest.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,78 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader.util
+{
+import flash.events.Event;
+import flash.net.URLLoader;
+import flash.net.URLLoaderDataFormat;
+import flash.net.URLRequest;
+import flash.utils.ByteArray;
+
+import org.flexunit.asserts.assertTrue;
+import org.flexunit.async.Async;
+
+/**
+ * SwcExtractor Tests
+ */
+public class SwcExtractorTest
+{
+    /**
+     * Constructor
+     */
+    public function SwcExtractorTest()
+    {
+    }
+
+    /**
+     * Tried to use an Async BeforeClass here, to load the swcData, but could not hold
+     * the test execution until after the loader has loaded
+     */
+
+    /* TESTS */
+
+
+    [Test]
+    public function testMe():void
+    {
+        assertTrue(true);
+    }
+
+
+    [Test(async)]
+    public function testExtractLibrary():void
+    {
+        const loader:URLLoader = new URLLoader();
+        loader.dataFormat = URLLoaderDataFormat.BINARY;
+        loader.load(new URLRequest("dependencies/RuntimeClass.swc"));
+
+        Async.handleEvent(this, loader, Event.COMPLETE, function ():void
+        {
+            const swcExtractor:SwcExtractor = new SwcExtractor(ByteArray(loader.data));
+
+            const swfData:ByteArray = swcExtractor.extract("library.swf");
+        });
+    }
+
+
+    [Test(async)]
+    public function testExtractCatalog():void
+    {
+        const loader:URLLoader = new URLLoader();
+        loader.dataFormat = URLLoaderDataFormat.BINARY;
+        loader.load(new URLRequest("dependencies/RuntimeClass.swc"));
+
+        Async.handleEvent(this, loader, Event.COMPLETE, function ():void
+        {
+            const swcExtractor:SwcExtractor = new SwcExtractor(ByteArray(loader.data));
+
+            const swfData:ByteArray = swcExtractor.extract("catalog.xml");
+        });
+
+    }
+
+
+    /* PRIVATE */
+
+}
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwfClassLoaderTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwfClassLoaderTest.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwfClassLoaderTest.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/SwfClassLoaderTest.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,137 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader
+{
+import flash.system.ApplicationDomain;
+
+import mx.core.BitmapAsset;
+
+import org.flexunit.asserts.assertEquals;
+import org.flexunit.asserts.assertFalse;
+import org.flexunit.async.Async;
+
+/**
+ * Tests for SwfClassLoader
+ */
+public class SwfClassLoaderTest
+{
+    /**
+     * Constructor
+     */
+    public function SwfClassLoaderTest()
+    {
+    }
+
+    [Before]
+    public function setUp():void
+    {
+
+    }
+
+    [After]
+    public function tearDown():void
+    {
+        classLoader.unload();
+        classLoader = null;
+    }
+
+
+    /* TESTS */
+    [Test(async)]
+    public function testConstructWithMissingSWF():void
+    {
+        classLoader = new SwfClassLoader("dependencies/nowhere.swf");
+        classLoader.load();
+        Async.proceedOnEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_ERROR);
+    }
+
+    [Test(async)]
+    public function testConstructWithSWF():void
+    {
+        classLoader = new SwfClassLoader("dependencies/RuntimeClass.swf");
+        classLoader.load();
+        Async.proceedOnEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, 10000);
+    }
+
+
+    [Test(async)]
+    public function testLoadClass():void
+    {
+        classLoader = new SwfClassLoader("dependencies/RuntimeClass.swf");
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const RuntimeClass:Class = classLoader.getClass("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeClass");
+                    const runtimeClass:Object = new RuntimeClass();
+
+                    assertEquals(runtimeClass.toString(), "RuntimeClass");
+                }, 10000
+        );
+    }
+
+
+    [Test(async)]
+    public function testLoadImportedClass():void
+    {
+        classLoader = new SwfClassLoader("dependencies/RuntimeClass.swf");
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const RuntimeImportedClass:Class = classLoader.getClass("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeImportedClass");
+
+                    const runtimeImportedClass:Object = new RuntimeImportedClass();
+                    assertEquals(runtimeImportedClass.toString(), "RuntimeImportedClass");
+                }, 10000
+        );
+    }
+
+
+    [Test(async, expects="ReferenceError")]
+    public function testUnloadClassContainer():void
+    {
+        assertFalse(ApplicationDomain.currentDomain.hasDefinition("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeClass"));
+
+        classLoader = new SwfClassLoader("dependencies/RuntimeClass.swf");
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const RuntimeClass:Class = classLoader.getClass("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeClass");
+                    classLoader.unload();
+
+                }, 10000
+        );
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_UNLOADED, function ():void
+                {
+                    const RuntimeClass:Class = classLoader.getClass("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeClass");
+                }, 10000
+        );
+    }
+
+
+    [Test(async)]
+    public function testLoadBitmapAsset():void
+    {
+        classLoader = new SwfClassLoader("dependencies/RuntimeClass.swf");
+        classLoader.load();
+
+        Async.handleEvent(this, classLoader, ClassLoaderEvent.CLASS_CONTAINER_LOADED, function ():void
+                {
+                    const bitmapAsset:BitmapAsset = classLoader.getBitmapAsset("com.jpmorgan.ib.cfpe.classloader.runtime.RuntimeAssets_RuntimeBitmapAsset");
+
+                    assertEquals(0xFFFFFF, bitmapAsset.bitmapData.getPixel(10, 10));
+                }, 10000
+        );
+    }
+
+
+    /* PRIVATE */
+
+    private var classLoader:ClassLoader;
+
+}
+}

Added: incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/util/SwcExtractorTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/util/SwcExtractorTest.as?rev=1374298&view=auto
==============================================================================
--- incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/util/SwcExtractorTest.as (added)
+++ incubator/flex/whiteboard/espenskogen/classloader/src/test/flex/util/SwcExtractorTest.as Fri Aug 17 14:55:05 2012
@@ -0,0 +1,78 @@
+/**
+ *  CFPE
+ */
+package com.jpmorgan.ib.cfpe.classloader.util
+{
+import flash.events.Event;
+import flash.net.URLLoader;
+import flash.net.URLLoaderDataFormat;
+import flash.net.URLRequest;
+import flash.utils.ByteArray;
+
+import org.flexunit.asserts.assertTrue;
+import org.flexunit.async.Async;
+
+/**
+ * SwcExtractor Tests
+ */
+public class SwcExtractorTest
+{
+    /**
+     * Constructor
+     */
+    public function SwcExtractorTest()
+    {
+    }
+
+    /**
+     * Tried to use an Async BeforeClass here, to load the swcData, but could not hold
+     * the test execution until after the loader has loaded
+     */
+
+    /* TESTS */
+
+
+    [Test]
+    public function testMe():void
+    {
+        assertTrue(true);
+    }
+
+
+    [Test(async)]
+    public function testExtractLibrary():void
+    {
+        const loader:URLLoader = new URLLoader();
+        loader.dataFormat = URLLoaderDataFormat.BINARY;
+        loader.load(new URLRequest("dependencies/RuntimeClass.swc"));
+
+        Async.handleEvent(this, loader, Event.COMPLETE, function ():void
+        {
+            const swcExtractor:SwcExtractor = new SwcExtractor(ByteArray(loader.data));
+
+            const swfData:ByteArray = swcExtractor.extract("library.swf");
+        });
+    }
+
+
+    [Test(async)]
+    public function testExtractCatalog():void
+    {
+        const loader:URLLoader = new URLLoader();
+        loader.dataFormat = URLLoaderDataFormat.BINARY;
+        loader.load(new URLRequest("dependencies/RuntimeClass.swc"));
+
+        Async.handleEvent(this, loader, Event.COMPLETE, function ():void
+        {
+            const swcExtractor:SwcExtractor = new SwcExtractor(ByteArray(loader.data));
+
+            const swfData:ByteArray = swcExtractor.extract("catalog.xml");
+        });
+
+    }
+
+
+    /* PRIVATE */
+
+}
+}



Mime
View raw message