Behold Vilya, Ring of Air and repository for our game and virtual worldly

extensions to the distributed environment provided by Narya.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@1 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2006-06-23 17:58:11 +00:00
commit a4df87e52f
317 changed files with 45818 additions and 0 deletions
+115
View File
@@ -0,0 +1,115 @@
<!-- build configuration -->
<project name="vilya tests" default="compile" basedir=".">
<!-- things you may want to change -->
<property name="junit.fork" value="true"/>
<!-- things you probably don't want to change -->
<property name="test.dir" value="."/>
<property name="src.dir" value="src/java"/>
<property name="deploy.dir" value="dist"/>
<!-- declare our classpath -->
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="vilya.classes.dir" value="../${deploy.dir}/classes"/>
<path id="classpath">
<pathelement location="${classes.dir}"/>
<pathelement location="${vilya.classes.dir}"/>
<fileset dir="../lib" includes="**/*.jar"/>
</path>
<!-- generates additional methods for distributed object classes -->
<target name="gendobj" depends="prepare">
<taskdef name="dobj"
classname="com.threerings.presents.tools.GenDObjectTask"
classpathref="classpath"/>
<!-- make sure the dobject class files are all compiled -->
<javac srcdir="src/java" destdir="${classes.dir}"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.4" target="1.4">
<classpath refid="classpath"/>
<include name="**/*Object.java"/>
</javac>
<!-- now generate the associated files -->
<dobj classpathref="classpath">
<fileset dir="src/java" includes="**/*Object.java"/>
</dobj>
</target>
<!-- generates marshaller and dispatcher classes for all invocation -->
<!-- service declarations -->
<target name="genservice">
<taskdef name="service" classpathref="classpath"
classname="com.threerings.presents.tools.GenServiceTask"/>
<!-- make sure the service class files are all compiled -->
<javac srcdir="src/java" destdir="${classes.dir}"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.5" target="1.5">
<classpath refid="classpath"/>
<include name="**/*Service.java"/>
<exclude name="**/InvocationService.java"/>
</javac>
<!-- now generate the associated files -->
<service header="lib/SOURCE_HEADER" classpathref="classpath">
<fileset dir="src/java" includes="**/*Service.java"/>
</service>
</target>
<!-- generates sender and decoder classes for all invocation -->
<!-- receiver declarations -->
<target name="genreceiver">
<taskdef name="receiver" classpathref="classpath"
classname="com.threerings.presents.tools.GenReceiverTask"/>
<!-- make sure the receiver class files are all compiled -->
<javac srcdir="src/java" destdir="${classes.dir}"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.5" target="1.5">
<classpath refid="classpath"/>
<include name="**/*Receiver.java"/>
</javac>
<!-- now generate the associated files -->
<receiver header="lib/SOURCE_HEADER" classpathref="classpath">
<fileset dir="src/java" includes="**/*Receiver.java"/>
</receiver>
</target>
<!-- prepares the application directories -->
<target name="prepare">
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${classes.dir}"/>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" includes="**/*.properties"/>
</copy>
<copy todir="${classes.dir}/rsrc">
<fileset dir="rsrc" includes="**/*"/>
</copy>
</target>
<!-- cleans out the installed application -->
<target name="clean">
<delete dir="${deploy.dir}"/>
</target>
<!-- build the java class files -->
<target name="compile" depends="prepare">
<javac srcdir="${src.dir}" destdir="${classes.dir}"
debug="on" optimize="off" deprecation="off">
<classpath refid="classpath"/>
</javac>
</target>
<!-- run the tests -->
<target name="test" depends="compile" description="Run the tests.">
<junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
<classpath refid="classpath"/>
<sysproperty key="test_dir" value="${test.dir}"/>
<sysproperty key="resource_dir" value="${test.dir}/rsrc"/>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${src.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- test spot scene parser -->
<scene name="Test Scene" version="42" defaultEntranceId="3">
<portal portalId="1" x="1" y="25" orient="3" name="East portal"
targetSceneName="East scene" targetPortalName="West portal"/>
<portal portalId="2" x="25" y="1" orient="5" name="North portal"
targetSceneName="North scene" targetPortalName="South portal"/>
</scene>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- test scene parser -->
<scene name="Test Scene" version="42">
<neighbor>Some neighbor</neighbor>
<neighbor>Some other neighbor</neighbor>
<neighbor>Yet another neighbor</neighbor>
</scene>
@@ -0,0 +1,127 @@
//
// $Id: TestClient.java 3381 2005-03-03 19:36:34Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.parlor;
import com.threerings.util.Name;
import com.threerings.presents.client.*;
import com.threerings.presents.net.*;
import com.threerings.crowd.client.*;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.util.CrowdContext;
import com.threerings.parlor.Log;
import com.threerings.parlor.client.*;
import com.threerings.parlor.game.client.*;
import com.threerings.parlor.game.data.*;
import com.threerings.parlor.util.ParlorContext;
public class TestClient extends com.threerings.crowd.client.TestClient
implements InvitationHandler, InvitationResponseObserver
{
public TestClient (String username)
{
super(username);
// create the handles on our various services
_pardtr = new ParlorDirector(_ctx);
// register ourselves as the invitation handler
_pardtr.setInvitationHandler(this);
}
public void clientDidLogon (Client client)
{
// we intentionally don't call super()
Log.info("Client did logon [client=" + client + "].");
// get a casted reference to our body object
_body = (BodyObject)client.getClientObject();
// if we're the inviter, do some inviting
if (_body.username.equals("inviter")) {
// send the invitation
TestConfig config = new TestConfig();
_pardtr.invite(new Name("invitee"), config, this);
}
}
public void invitationReceived (Invitation invite)
{
Log.info("Invitation received [invite=" + invite + "].");
// accept the invitation. we're game...
invite.accept();
}
public void invitationCancelled (Invitation invite)
{
Log.info("Invitation cancelled [invite=" + invite + "].");
}
public void invitationAccepted (Invitation invite)
{
Log.info("Invitation accepted [invite=" + invite + "].");
}
public void invitationRefused (Invitation invite, String message)
{
Log.info("Invitation refused [invite=" + invite +
", message=" + message + "].");
}
public void invitationCountered (Invitation invite, GameConfig config)
{
Log.info("Invitation countered [invite=" + invite +
", config=" + config + "].");
}
protected CrowdContext createContext ()
{
return (_ctx = new ParlorContextImpl());
}
public static void main (String[] args)
{
// create our test client
TestClient tclient = new TestClient(
System.getProperty("username", "test"));
// start it running
tclient.run();
}
protected class ParlorContextImpl
extends com.threerings.crowd.client.TestClient.CrowdContextImpl
implements ParlorContext
{
public ParlorDirector getParlorDirector ()
{
return _pardtr;
}
}
protected ParlorContext _ctx;
protected ParlorDirector _pardtr;
protected BodyObject _body;
}
@@ -0,0 +1,57 @@
//
// $Id: TestConfig.java 4193 2006-06-13 23:06:48Z ray $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.parlor;
import com.threerings.parlor.game.client.GameConfigurator;
import com.threerings.parlor.game.data.GameConfig;
public class TestConfig extends GameConfig
{
/** The foozle parameter. */
public int foozle;
public GameConfigurator createConfigurator ()
{
return null;
}
public Class getControllerClass ()
{
return TestController.class;
}
public String getBundleName ()
{
return "test";
}
public String getManagerClassName ()
{
return "com.threerings.parlor.test.TestManager";
}
protected void toString (StringBuilder buf)
{
super.toString(buf);
buf.append(", foozle=").append(foozle);
}
}
@@ -0,0 +1,35 @@
//
// $Id: TestController.java 3440 2005-03-30 01:09:30Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.parlor;
import com.threerings.crowd.client.PlaceView;
import com.threerings.crowd.util.CrowdContext;
import com.threerings.parlor.game.client.GameController;
public class TestController extends GameController
{
public PlaceView createPlaceView (CrowdContext ctx)
{
// nothing doing
return null;
}
}
@@ -0,0 +1,29 @@
//
// $Id: TestManager.java 3381 2005-03-03 19:36:34Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.parlor;
import com.threerings.parlor.game.server.GameManager;
public class TestManager extends GameManager
{
// nothing doing
}
@@ -0,0 +1,61 @@
//
// $Id: TestServer.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.parlor;
import com.threerings.crowd.server.CrowdServer;
import com.threerings.parlor.Log;
import com.threerings.parlor.server.ParlorManager;
/**
* A test server for the Parlor services.
*/
public class TestServer extends CrowdServer
{
/** The parlor manager in operation on this server. */
public static ParlorManager parmgr = new ParlorManager();
/** Initializes the Parlor test server. */
public void init ()
throws Exception
{
super.init();
// initialize our parlor manager
parmgr.init(invmgr, plreg);
Log.info("Parlor server initialized.");
}
/** Main entry point for test server. */
public static void main (String[] args)
{
TestServer server = new TestServer();
try {
server.init();
server.run();
} catch (Exception e) {
Log.warning("Unable to initialize server.");
Log.logStackTrace(e);
}
}
}
@@ -0,0 +1,59 @@
//
// $Id: DummyClientSceneRepository.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.whirled;
import java.io.IOException;
import com.threerings.whirled.Log;
import com.threerings.whirled.client.persist.SceneRepository;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.util.NoSuchSceneException;
/**
* The dummy scene repository just pretends to load and store scenes, but
* in fact it just creates new blank scenes when requested to load a scene
* and does nothing when requested to save one.
*/
public class DummyClientSceneRepository implements SceneRepository
{
// documentation inherited
public SceneModel loadSceneModel (int sceneId)
throws IOException, NoSuchSceneException
{
Log.info("Creating dummy scene model [id=" + sceneId + "].");
return new SceneModel();
}
// documentation inherited
public void storeSceneModel (SceneModel model)
throws IOException
{
// nothing doing
}
// documentation inherited
public void deleteSceneModel (int sceneId)
throws IOException
{
// nothing doing
}
}
@@ -0,0 +1,115 @@
//
// $Id: TestClient.java 3355 2005-02-17 01:54:54Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.whirled;
import com.threerings.presents.client.Client;
import com.threerings.crowd.Log;
import com.threerings.crowd.client.*;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.util.CrowdContext;
import com.threerings.whirled.client.SceneDirector;
import com.threerings.whirled.client.persist.SceneRepository;
import com.threerings.whirled.data.Scene;
import com.threerings.whirled.data.SceneImpl;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.util.SceneFactory;
import com.threerings.whirled.util.WhirledContext;
public class TestClient extends com.threerings.crowd.client.TestClient
implements LocationObserver
{
public TestClient (String username)
{
super(username);
// create the handles for our various services
_screp = new DummyClientSceneRepository();
SceneFactory sfact = new SceneFactory() {
public Scene createScene (SceneModel model, PlaceConfig config) {
return new SceneImpl(model, config);
}
};
_scdir = new SceneDirector(_ctx, _locdir, _screp, sfact);
// we want to know about location changes
_locdir.addLocationObserver(this);
}
public void clientDidLogon (Client client)
{
// we specifically do not call super()
Log.info("Client did logon [client=" + client + "].");
// request to move to scene 0
_ctx.getSceneDirector().moveTo(0);
}
public boolean locationMayChange (int placeId)
{
// we're easy
return true;
}
public void locationDidChange (PlaceObject place)
{
Log.info("At new location [plobj=" + place +
", scene=" + _scdir.getScene() + "].");
}
public void locationChangeFailed (int placeId, String reason)
{
Log.warning("Location change failed [plid=" + placeId +
", reason=" + reason + "].");
}
protected CrowdContext createContext ()
{
return (_ctx = new WhirledContextImpl());
}
public static void main (String[] args)
{
// create our test client
TestClient tclient = new TestClient("test");
// start it running
tclient.run();
}
protected class WhirledContextImpl
extends com.threerings.crowd.client.TestClient.CrowdContextImpl
implements WhirledContext
{
public SceneDirector getSceneDirector ()
{
return _scdir;
}
}
protected WhirledContext _ctx;
protected SceneDirector _scdir;
protected SceneRepository _screp;
}
@@ -0,0 +1,38 @@
//
// $Id: TestConfig.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.whirled;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.whirled.server.SceneManager;
public class TestConfig extends PlaceConfig
{
public Class getControllerClass ()
{
return TestController.class;
}
public String getManagerClassName ()
{
return SceneManager.class.getName();
}
}
@@ -0,0 +1,34 @@
//
// $Id: TestController.java 3440 2005-03-30 01:09:30Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.whirled;
import com.threerings.crowd.client.*;
import com.threerings.crowd.util.CrowdContext;
public class TestController extends PlaceController
{
protected PlaceView createPlaceView (CrowdContext ctx)
{
// nothing doing
return null;
}
}
@@ -0,0 +1,74 @@
//
// $Id: SpotSceneParserTest.java 4143 2006-05-23 23:22:20Z ray $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.whirled.spot.tools.xml;
import com.samskivert.test.TestUtil;
import junit.framework.Test;
import junit.framework.TestCase;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.spot.data.Location;
import com.threerings.whirled.tools.xml.SceneParser;
import com.threerings.stage.data.StageLocation;
public class SpotSceneParserTest extends TestCase
{
public SpotSceneParserTest ()
{
super(SpotSceneParserTest.class.getName());
}
public void runTest ()
{
try {
SceneParser parser = new SceneParser("scene");
parser.registerAuxRuleSet(new SpotSceneRuleSet() {
protected Location createLocation () {
return new StageLocation(); // breaks package, but ok
}
});
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
SceneModel scene = parser.parseScene(tspath);
System.out.println("Parsed " + scene + ".");
} catch (Exception e) {
e.printStackTrace();
fail("Test threw exception");
}
}
public static Test suite ()
{
return new SpotSceneParserTest();
}
public static void main (String[] args)
{
SpotSceneParserTest test = new SpotSceneParserTest();
test.runTest();
}
protected static final String TEST_SCENE_PATH =
"rsrc/whirled/spot/tools/xml/scene.xml";
}
@@ -0,0 +1,65 @@
//
// $Id: SceneParserTest.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.whirled.tools.xml;
import com.samskivert.test.TestUtil;
import junit.framework.Test;
import junit.framework.TestCase;
import com.threerings.whirled.data.SceneModel;
public class SceneParserTest extends TestCase
{
public SceneParserTest ()
{
super(SceneParserTest.class.getName());
}
public void runTest ()
{
try {
SceneParser parser = new SceneParser("scene");
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
SceneModel scene = parser.parseScene(tspath);
System.out.println("Parsed " + scene + ".");
} catch (Exception e) {
e.printStackTrace();
fail("Test threw exception");
}
}
public static Test suite ()
{
return new SceneParserTest();
}
public static void main (String[] args)
{
SceneParserTest test = new SceneParserTest();
test.runTest();
}
protected static final String TEST_SCENE_PATH =
"rsrc/whirled/tools/xml/scene.xml";
}