Skip to content

Commit

Permalink
updated robotlegs and signals libraries to current (1.4.0 and 0.7 res…
Browse files Browse the repository at this point in the history
…pectively). Removed ASUnit as primary unit test framework. Prefer the CI/Ant options with FlexUnit. Moved all of the build dependencies to build/libs and deleted libs.?
  • Loading branch information
joelhooks committed Nov 7, 2010
1 parent 9594b40 commit d2f1772
Show file tree
Hide file tree
Showing 24 changed files with 136 additions and 81 deletions.
15 changes: 15 additions & 0 deletions build.properties
Expand Up @@ -15,6 +15,21 @@ output.dir=${basedir}/bin
docs.dir=${basedir}/docs
output.swc=${output.dir}/${project.name.versioned}.swc

#build locations
asdoc.loc=${FLEX_HOME}/bin/asdoc
main.src.loc=${basedir}/src
test.src.loc=${basedir}/test
doc.loc=${basedir}/doc
lib.loc=${basedir}/build/libs
bin.loc=${basedir}/bin
report.loc=${basedir}/report
dist.loc=${basedir}/dist
template.loc=${basedir}/build/templates

flex.config=${FLEX_HOME}/frameworks/flex-config.xml
flex.lib=${FLEX_HOME}/frameworks/libs
flextask.jar=${FLEX_HOME}/ant/lib/flexTasks.jar

# Project links
as3signals.project.link=http://github.com/joelhooks/signals-extensions-CommandSignal

55 changes: 43 additions & 12 deletions build.xml
@@ -1,39 +1,70 @@
<project name="signals-extension-SignalsCommandMap" basedir="." default="swc">
<project name="signals-extension-SignalsCommandMap" basedir="." default="test">

<!-- Set up a prefix for all environment variables. -->
<property environment="env."/>
<fail unless="env.FLEX_HOME" message="FLEX_HOME needs to be defined as an environment variable or in the Ant build." />
<!-- Copy Flex SDK location from environment variable. This can be set manually instead. -->
<property name="FLEX_HOME" value="${env.FLEX_HOME}" />
<property file="build.properties"/>
<taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks.jar"/>

<target name="swc" depends="" description="Compile AS3 code into a SWC">
<target name="compile" description="Compile AS3 code into a SWC">
<echo>Using Flex SDK at: ${FLEX_HOME}</echo>

<java jar="${FLEX_HOME}/lib/compc.jar" dir="." fork="true" failonerror="true">
<arg value="+flexlib=${FLEX_HOME}/frameworks" />
<arg value="-incremental=true" />

<arg value="-source-path+=${src.dir}" />

<!-- Include all classes in this path. -->
<arg value="-include-sources=${src.dir}/${package.dir}" />

<!-- Link in classes from swc library (only those used). -->
<arg value="-library-path+=${libs.dir}" />

<arg value="-output=${output.swc}" />
</java>

</target>

<target name="clean-asdoc">
<delete dir="${docs.dir}" failOnError="false" includeEmptyDirs="true"/>
<mkdir dir="${docs.dir}"/>
</target>


<!-- Run Unit Tests -->
<target name="test" depends="compile">
<echo>[test] Running Unit Tests</echo>
<!-- Compile TestRunner.mxml as a SWF -->
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="${test.src.loc}/SignalCommandMapTest.mxml"/>
<arg value="-source-path=${main.src.loc}"/>
<!-- Flash those sweet legs. Blink and you'll miss 'em. -->
<arg value="-output=${bin.loc}/TestRunner.swf"/>
<arg value="-default-size=200,200"/>
<arg value="-default-background-color=0x000000"/>
<!-- Include classes from SWCs in this folder, but only the ones we use. -->
<arg value="-library-path+=${lib.loc}"/>
<!-- So true. -->
<arg value="-incremental=true"/>
<arg value="-verbose-stacktraces=true"/>
<arg value="-headless-server=true"/>
</java>
<!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
<flexunit swf="bin/TestRunner.swf" toDir="${report.loc}" haltonfailure="true" verbose="true" localTrusted="true"/>
<!-- Generate readable JUnit-style reports -->
<junitreport todir="${report.loc}">
<fileset dir="${report.loc}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${report.loc}/html"/>
</junitreport>
<echo>[test] Finished running Unit Tests</echo>
</target>

<!-- Build Documentation -->
<target name="asdoc" depends="swc,clean-asdoc" description="Create API docs for ${project.title}">
<target name="asdoc" depends="compile,clean-asdoc" description="Create API docs for ${project.title}">
<echo>Generating ASDOC documentation...</echo>
<tstamp>
<format property="docgen.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
Expand All @@ -49,5 +80,5 @@
</java>
<echo>ASDOC documentation generated successfully</echo>
</target>

</project>
Binary file added build/libs/SwiftSuspenders-v1.5.1.swc
Binary file not shown.
Binary file added build/libs/as3-signals-v0.7.swc
Binary file not shown.
Binary file added build/libs/flexUnitTasks.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/libs/hamcrest-1.0.2.swc
Binary file not shown.
Binary file added build/libs/robotlegs-framework-v1.4.0.swc
Binary file not shown.
Binary file removed libs/as3-signals-v0.6.swc
Binary file not shown.
Binary file removed libs/asunit4-alpha.swc
Binary file not shown.
Binary file removed libs/robotlegs-framework-v1.1.0b7.swc
Binary file not shown.
25 changes: 25 additions & 0 deletions test/SignalCommandMapTest.mxml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:fu="http://www.adobe.com/2009/flexUnitUIRunner"
creationComplete="onCreationComplete()"
width="200" height="200"
backgroundColor="#000000" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Script>
<![CDATA[
import org.flexunit.internals.TraceListener;
import org.flexunit.listeners.CIListener;
import org.flexunit.runner.FlexUnitCore;
import org.robotlegs.test.suites.SignalCommandMapTestSuite;
private var core:FlexUnitCore;
private function onCreationComplete():void
{
core = new FlexUnitCore();
core.addListener(new CIListener());
core.addListener(new TraceListener());
core.run(SignalCommandMapTestSuite);
}
]]>
</mx:Script>
</mx:Application>
19 changes: 0 additions & 19 deletions test/SignalCommandMapTestRunner.as

This file was deleted.

23 changes: 12 additions & 11 deletions test/org/robotlegs/base/SignalCommandMapTests.as
@@ -1,14 +1,15 @@
package org.robotlegs.base
{
import asunit.asserts.*;

import mx.collections.ArrayCollection;

import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertFalse;
import org.flexunit.asserts.assertTrue;
import org.osflash.signals.ISignal;
import org.robotlegs.adapters.SwiftSuspendersInjector;
import org.robotlegs.core.IInjector;
import org.robotlegs.core.ISignalCommandMap;
import org.robotlegs.test.support.*;
import org.robotlegs.test.support.TestXMLPropertySignal;

public class SignalCommandMapTests
{
Expand Down Expand Up @@ -137,7 +138,7 @@ package org.robotlegs.base
var signal:ISignal = signalCommandMap.mapSignalClass(TestCommandPropertySignal, TestNoPropertiesCommand);
var signalTwo:ISignal = injector.instantiate(SignalInjecteeTestClass).signal;

assertSame(signal, signalTwo);
assertEquals(signal, signalTwo);
}

[Test]
Expand All @@ -146,7 +147,7 @@ package org.robotlegs.base
var signalOne:ISignal = signalCommandMap.mapSignalClass(TestCommandPropertySignal, TestNoPropertiesCommand);
var signalTwo:ISignal = signalCommandMap.mapSignalClass(TestCommandPropertySignal, TestOnePropertyCommand);

assertSame(signalOne, signalTwo);
assertEquals(signalOne, signalTwo);
}

[Test]
Expand Down Expand Up @@ -189,30 +190,30 @@ package org.robotlegs.base

assertTrue(prop.wasExecuted);
}

[Test]
public function uint_signal_value_properly_injected_into_command():void
{
var prop:TestCommandProperty = new TestCommandProperty();
var i:uint = 3;
var signal:TestUintPropertySignal = new TestUintPropertySignal();
signalCommandMap.mapSignal(signal, TestUintPropertyCommand);

signal.dispatch(i,prop);

assertTrue(prop.wasExecuted);
}

[Test]
public function int_signal_value_properly_injected_into_command():void
{
var prop:TestCommandProperty = new TestCommandProperty();
var i:int = 3;
var signal:TestIntPropertySignal = new TestIntPropertySignal();
signalCommandMap.mapSignal(signal, TestIntPropertyCommand);

signal.dispatch(i,prop);

assertTrue(prop.wasExecuted);
}
}
Expand Down
3 changes: 1 addition & 2 deletions test/org/robotlegs/mvcs/SignalCommandTests.as
@@ -1,7 +1,6 @@
package org.robotlegs.mvcs
{
import asunit.asserts.assertTrue;

import org.flexunit.asserts.assertTrue;
import org.robotlegs.adapters.SwiftSuspendersInjector;
import org.robotlegs.base.SignalCommandMap;
import org.robotlegs.core.IInjector;
Expand Down
32 changes: 17 additions & 15 deletions test/org/robotlegs/mvcs/SignalContextTests.as
@@ -1,18 +1,20 @@
package org.robotlegs.mvcs
{
import flash.display.Sprite;
import flash.events.Event;
import asunit.asserts.*;

import org.robotlegs.core.IInjector;
import org.robotlegs.core.ISignalCommandMap;
import flash.display.Sprite;
import flash.events.Event;

import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertTrue;
import org.robotlegs.core.IInjector;
import org.robotlegs.core.ISignalCommandMap;
import org.robotlegs.core.ISignalContext;
import org.robotlegs.test.support.SignalContextWithAccessibleInjector;
import org.robotlegs.test.support.SignalInjecteeTestClass;
import org.robotlegs.test.support.TestCommandPropertySignal;
import org.robotlegs.test.support.TestOnePropertyCommand;
import org.robotlegs.test.support.SignalContextWithAccessibleInjector;
import org.robotlegs.test.support.SignalInjecteeTestClass;
import org.robotlegs.test.support.TestCommandPropertySignal;
import org.robotlegs.test.support.TestOnePropertyCommand;

public class SignalContextTests
public class SignalContextTests
{
private var signalContext:ISignalContext;

Expand All @@ -33,23 +35,23 @@ public class SignalContextTests
{
assertTrue( signalContext.signalCommandMap is ISignalCommandMap );
}

[Test]
public function contextView_roundtrips_through_constructor():void
{
var contextView:Sprite = new Sprite();
signalContext = new SignalContext(contextView);

assertEquals(contextView, SignalContext(signalContext).contextView);
}

[Test]
public function autoStartup_in_constructor_creates_listener_for_ADDED_TO_STAGE_on_contextView():void
{
var contextView:Sprite = new Sprite();
var autoStartup:Boolean = false;
var autoStartup:Boolean = true;
signalContext = new SignalContext(contextView, autoStartup);

assertTrue(contextView.hasEventListener(Event.ADDED_TO_STAGE));
}

Expand Down
Expand Up @@ -5,6 +5,7 @@ package org.robotlegs.test.suites
import org.robotlegs.mvcs.SignalContextTests;

[Suite]
[RunWith("org.flexunit.runners.Suite")]
public class SignalCommandMapTestSuite
{
public var _signalContextTests:SignalContextTests;
Expand Down
@@ -1,9 +1,9 @@
package org.robotlegs.test.support
{
import org.robotlegs.core.IInjector;
import org.robotlegs.mvcs.SignalContext;
import org.robotlegs.core.IInjector;
import org.robotlegs.mvcs.SignalContext;

public class SignalContextWithAccessibleInjector extends SignalContext
public class SignalContextWithAccessibleInjector extends SignalContext
{
public function SignalContextWithAccessibleInjector()
{
Expand Down
@@ -1,10 +1,10 @@
package org.robotlegs.test.support
{
import mx.collections.ArrayCollection;
import mx.collections.ArrayCollection;

import org.osflash.signals.Signal;
import org.osflash.signals.Signal;

public class TestArrayCollectionPropertySignal extends Signal
public class TestArrayCollectionPropertySignal extends Signal
{
public function TestArrayCollectionPropertySignal()
{
Expand Down
10 changes: 5 additions & 5 deletions test/org/robotlegs/test/support/TestCommandPropertySignal.as
@@ -1,14 +1,14 @@
package org.robotlegs.test.support
{
import org.osflash.signals.Signal;
public class TestCommandPropertySignal extends Signal
import org.osflash.signals.Signal;

public class TestCommandPropertySignal extends Signal
{

public function TestCommandPropertySignal()
{
super(TestCommandProperty);
}

}
}
6 changes: 3 additions & 3 deletions test/org/robotlegs/test/support/TestIntPropertySignal.as
@@ -1,8 +1,8 @@
package org.robotlegs.test.support
{
import org.osflash.signals.Signal;
public class TestIntPropertySignal extends Signal
import org.osflash.signals.Signal;

public class TestIntPropertySignal extends Signal
{
public function TestIntPropertySignal()
{
Expand Down
10 changes: 5 additions & 5 deletions test/org/robotlegs/test/support/TestTwoPropertySignal.as
@@ -1,14 +1,14 @@
package org.robotlegs.test.support
{
import org.osflash.signals.Signal;
public class TestTwoPropertySignal extends Signal
import org.osflash.signals.Signal;

public class TestTwoPropertySignal extends Signal
{

public function TestTwoPropertySignal()
{
super(TestCommandProperty, TestCommandProperty2);
}

}
}

0 comments on commit d2f1772

Please sign in to comment.