Files
narya/tests/src/java/com/threerings/presents/server/TestServer.java
T
Michael Bayne 99a0730696 First pass at moving all of Narya test stuff into the tests directory.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@598 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-11-08 02:07:36 +00:00

63 lines
1.8 KiB
Java

//
// $Id: TestServer.java,v 1.7 2001/11/08 02:07:36 mdb Exp $
package com.threerings.presents.server;
import com.threerings.presents.Log;
import com.threerings.presents.dobj.*;
public class TestServer extends PresentsServer
{
/** The namespace used for server config properties. */
public static final String CONFIG_KEY = "test";
public static TestObject testobj;
public void init ()
throws Exception
{
super.init();
// bind the crowd server config into the namespace
config.bindProperties(CONFIG_KEY, CONFIG_PATH, true);
// register our invocation service providers
registerProviders(config.getValue(PROVIDERS_KEY, (String[])null));
// create a test object
Subscriber sub = new Subscriber()
{
public void objectAvailable (DObject object)
{
testobj = (TestObject)object;
}
public void requestFailed (int oid, ObjectAccessException cause)
{
Log.warning("Unable to create test object " +
"[error=" + cause + "].");
}
};
omgr.createObject(TestObject.class, sub);
}
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);
}
}
// the path to the config file
protected final static String CONFIG_PATH =
"rsrc/config/presents/test/server";
// the config key for our list of invocation provider mappings
protected final static String PROVIDERS_KEY = CONFIG_KEY + ".providers";
}