Brought the tests back into the land of compilability.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3355 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TestClient.java,v 1.16 2004/08/27 02:21:02 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -22,17 +22,20 @@
|
||||
package com.threerings.presents.client;
|
||||
|
||||
import com.samskivert.util.Queue;
|
||||
import com.samskivert.util.RunQueue;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.data.TestObject;
|
||||
import com.threerings.presents.dobj.*;
|
||||
import com.threerings.presents.net.*;
|
||||
import com.threerings.presents.server.TestObject;
|
||||
|
||||
/**
|
||||
* A standalone test client.
|
||||
*/
|
||||
public class TestClient
|
||||
implements Client.Invoker, SessionObserver, Subscriber, EventListener,
|
||||
implements RunQueue, SessionObserver, Subscriber, EventListener,
|
||||
TestService.TestFuncListener, TestService.TestOidListener,
|
||||
TestReceiver
|
||||
{
|
||||
@@ -41,14 +44,21 @@ public class TestClient
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public void invokeLater (Runnable run)
|
||||
public void postRunnable (Runnable run)
|
||||
{
|
||||
// queue it on up
|
||||
_queue.append(run);
|
||||
}
|
||||
|
||||
public boolean isDispatchThread ()
|
||||
{
|
||||
return _main == Thread.currentThread();
|
||||
}
|
||||
|
||||
public void run ()
|
||||
{
|
||||
_main = Thread.currentThread();
|
||||
|
||||
// loop over our queue, running the runnables
|
||||
while (true) {
|
||||
Runnable run = (Runnable)_queue.get();
|
||||
@@ -140,7 +150,7 @@ public class TestClient
|
||||
{
|
||||
TestClient tclient = new TestClient();
|
||||
UsernamePasswordCreds creds =
|
||||
new UsernamePasswordCreds("test", "test");
|
||||
new UsernamePasswordCreds(new Name("test"), "test");
|
||||
Client client = new Client(creds, tclient);
|
||||
tclient.setClient(client);
|
||||
client.addClientObserver(tclient);
|
||||
@@ -150,6 +160,7 @@ public class TestClient
|
||||
tclient.run();
|
||||
}
|
||||
|
||||
protected Thread _main;
|
||||
protected Queue _queue = new Queue();
|
||||
protected Client _client;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// 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.presents.data;
|
||||
|
||||
import com.threerings.presents.dobj.*;
|
||||
|
||||
/**
|
||||
* A test distributed object.
|
||||
*/
|
||||
public class TestObject extends DObject
|
||||
{
|
||||
// AUTO-GENERATED: FIELDS START
|
||||
/** The field name of the <code>foo</code> field. */
|
||||
public static final String FOO = "foo";
|
||||
|
||||
/** The field name of the <code>bar</code> field. */
|
||||
public static final String BAR = "bar";
|
||||
|
||||
/** The field name of the <code>ints</code> field. */
|
||||
public static final String INTS = "ints";
|
||||
|
||||
/** The field name of the <code>strings</code> field. */
|
||||
public static final String STRINGS = "strings";
|
||||
|
||||
/** The field name of the <code>list</code> field. */
|
||||
public static final String LIST = "list";
|
||||
// AUTO-GENERATED: FIELDS END
|
||||
|
||||
public int foo;
|
||||
|
||||
public String bar;
|
||||
|
||||
public int[] ints = new int[5];
|
||||
|
||||
public String[] strings = new String[5];
|
||||
|
||||
public OidList list = new OidList();
|
||||
|
||||
// AUTO-GENERATED: METHODS START
|
||||
/**
|
||||
* Requests that the <code>foo</code> field be set to the
|
||||
* specified value. The local value will be updated immediately and an
|
||||
* event will be propagated through the system to notify all listeners
|
||||
* that the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setFoo (int value)
|
||||
{
|
||||
int ovalue = this.foo;
|
||||
requestAttributeChange(
|
||||
FOO, new Integer(value), new Integer(ovalue));
|
||||
this.foo = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>bar</code> field be set to the
|
||||
* specified value. The local value will be updated immediately and an
|
||||
* event will be propagated through the system to notify all listeners
|
||||
* that the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setBar (String value)
|
||||
{
|
||||
String ovalue = this.bar;
|
||||
requestAttributeChange(
|
||||
BAR, value, ovalue);
|
||||
this.bar = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>ints</code> field be set to the
|
||||
* specified value. The local value will be updated immediately and an
|
||||
* event will be propagated through the system to notify all listeners
|
||||
* that the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setInts (int[] value)
|
||||
{
|
||||
int[] ovalue = this.ints;
|
||||
requestAttributeChange(
|
||||
INTS, value, ovalue);
|
||||
this.ints = (value == null) ? null : (int[])value.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>index</code>th element of
|
||||
* <code>ints</code> field be set to the specified value.
|
||||
* The local value will be updated immediately and an event will be
|
||||
* propagated through the system to notify all listeners that the
|
||||
* attribute did change. Proxied copies of this object (on clients)
|
||||
* will apply the value change when they received the attribute
|
||||
* changed notification.
|
||||
*/
|
||||
public void setIntsAt (int value, int index)
|
||||
{
|
||||
int ovalue = this.ints[index];
|
||||
requestElementUpdate(
|
||||
INTS, index, new Integer(value), new Integer(ovalue));
|
||||
this.ints[index] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>strings</code> field be set to the
|
||||
* specified value. The local value will be updated immediately and an
|
||||
* event will be propagated through the system to notify all listeners
|
||||
* that the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setStrings (String[] value)
|
||||
{
|
||||
String[] ovalue = this.strings;
|
||||
requestAttributeChange(
|
||||
STRINGS, value, ovalue);
|
||||
this.strings = (value == null) ? null : (String[])value.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>index</code>th element of
|
||||
* <code>strings</code> field be set to the specified value.
|
||||
* The local value will be updated immediately and an event will be
|
||||
* propagated through the system to notify all listeners that the
|
||||
* attribute did change. Proxied copies of this object (on clients)
|
||||
* will apply the value change when they received the attribute
|
||||
* changed notification.
|
||||
*/
|
||||
public void setStringsAt (String value, int index)
|
||||
{
|
||||
String ovalue = this.strings[index];
|
||||
requestElementUpdate(
|
||||
STRINGS, index, value, ovalue);
|
||||
this.strings[index] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that <code>oid</code> be added to the <code>list</code>
|
||||
* oid list. The list will not change until the event is actually
|
||||
* propagated through the system.
|
||||
*/
|
||||
public void addToList (int oid)
|
||||
{
|
||||
requestOidAdd(LIST, oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that <code>oid</code> be removed from the
|
||||
* <code>list</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFromList (int oid)
|
||||
{
|
||||
requestOidRemove(LIST, oid);
|
||||
}
|
||||
// AUTO-GENERATED: METHODS END
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DOMTest.java,v 1.11 2004/08/27 02:21:04 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -24,6 +24,7 @@ package com.threerings.presents.server;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.threerings.presents.data.TestObject;
|
||||
import com.threerings.presents.dobj.*;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DestroyedRefTest.java,v 1.10 2004/08/27 02:21:04 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -25,6 +25,7 @@ import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.data.TestObject;
|
||||
import com.threerings.presents.dobj.*;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: RefTest.java,v 1.10 2004/08/27 02:21:04 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -24,6 +24,7 @@ package com.threerings.presents.server;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.threerings.presents.data.TestObject;
|
||||
import com.threerings.presents.dobj.*;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
//
|
||||
// $Id: TestObject.java,v 1.5 2004/08/27 02:21:04 mdb Exp $
|
||||
//
|
||||
// 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.presents.server;
|
||||
|
||||
import com.threerings.presents.dobj.*;
|
||||
|
||||
/**
|
||||
* A test distributed object.
|
||||
*/
|
||||
public class TestObject extends DObject
|
||||
{
|
||||
/** The field name of the <code>foo</code> field. */
|
||||
public static final String FOO = "foo";
|
||||
|
||||
/** The field name of the <code>bar</code> field. */
|
||||
public static final String BAR = "bar";
|
||||
|
||||
/** The field name of the <code>ints</code> field. */
|
||||
public static final String INTS = "ints";
|
||||
|
||||
/** The field name of the <code>strings</code> field. */
|
||||
public static final String STRINGS = "strings";
|
||||
|
||||
/** The field name of the <code>list</code> field. */
|
||||
public static final String LIST = "list";
|
||||
|
||||
public int foo;
|
||||
public String bar;
|
||||
public int[] ints = new int[5];
|
||||
public String[] strings = new String[5];
|
||||
public OidList list = new OidList();
|
||||
|
||||
/**
|
||||
* Requests that the <code>foo</code> field be set to the specified
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setFoo (int foo)
|
||||
{
|
||||
requestAttributeChange(FOO, new Integer(foo));
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>bar</code> field be set to the specified
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setBar (String bar)
|
||||
{
|
||||
requestAttributeChange(BAR, bar);
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>ints</code> field be set to the specified
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setInts (int[] ints)
|
||||
{
|
||||
requestAttributeChange(INTS, ints);
|
||||
this.ints = ints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>index</code>th element of
|
||||
* <code>ints</code> field be set to the specified value. The local
|
||||
* value will be updated immediately and an event will be propagated
|
||||
* through the system to notify all listeners that the attribute did
|
||||
* change. Proxied copies of this object (on clients) will apply the
|
||||
* value change when they received the attribute changed notification.
|
||||
*/
|
||||
public void setIntsAt (int value, int index)
|
||||
{
|
||||
requestElementUpdate(INTS, new Integer(value), index);
|
||||
this.ints[index] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>strings</code> field be set to the specified
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setStrings (String[] strings)
|
||||
{
|
||||
requestAttributeChange(STRINGS, strings);
|
||||
this.strings = strings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>index</code>th element of
|
||||
* <code>strings</code> field be set to the specified value. The local
|
||||
* value will be updated immediately and an event will be propagated
|
||||
* through the system to notify all listeners that the attribute did
|
||||
* change. Proxied copies of this object (on clients) will apply the
|
||||
* value change when they received the attribute changed notification.
|
||||
*/
|
||||
public void setStringsAt (String value, int index)
|
||||
{
|
||||
requestElementUpdate(STRINGS, value, index);
|
||||
this.strings[index] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be added to the
|
||||
* <code>list</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void addToList (int oid)
|
||||
{
|
||||
requestOidAdd(LIST, oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be removed from the
|
||||
* <code>list</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFromList (int oid)
|
||||
{
|
||||
requestOidRemove(LIST, oid);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TestServer.java,v 1.10 2004/08/27 02:21:04 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.threerings.presents.server;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.data.TestObject;
|
||||
import com.threerings.presents.dobj.*;
|
||||
|
||||
public class TestServer extends PresentsServer
|
||||
|
||||
Reference in New Issue
Block a user