First stab at test code to run a thane bureau - not yet runnable
* New directory tests/src/as with port of java test client * New build target "abclib" to create a library of the test classes specified in etc/asc_files.txt * New target to compile TestClientMain.as against testslib.abc and another to run it. (This proposes the naming convention of *Main.as for "main" thane code and main-*.abc for the compiled code) git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5058 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.threerings.bureau.client {
|
||||
|
||||
public class TestClient extends BureauClient
|
||||
{
|
||||
public function TestClient (token :String, bureauId :String)
|
||||
{
|
||||
super(token, bureauId);
|
||||
}
|
||||
|
||||
protected override function createDirector () :BureauDirector
|
||||
{
|
||||
return new TestDirector(_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
import com.threerings.bureau.client.Agent;
|
||||
import com.threerings.bureau.client.BureauDirector;
|
||||
import com.threerings.bureau.Log;
|
||||
import com.threerings.bureau.data.AgentObject;
|
||||
import com.threerings.bureau.util.BureauContext;
|
||||
|
||||
class TestAgent extends Agent
|
||||
{
|
||||
public override function start () :void
|
||||
{
|
||||
Log.info("Starting agent " + _agentObj.getOid());
|
||||
}
|
||||
|
||||
public override function stop () :void
|
||||
{
|
||||
Log.info("Stopping agent " + _agentObj.getOid());
|
||||
}
|
||||
}
|
||||
|
||||
class TestDirector extends BureauDirector
|
||||
{
|
||||
public function TestDirector (ctx :BureauContext)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
// just use our test agent exclusively - in the real world, the agent created would depend
|
||||
// on the object's type and/or properties
|
||||
protected override function createAgent (agentObj :AgentObject) :Agent
|
||||
{
|
||||
return new TestAgent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user