Revamped distributed object creation. There was no particular reason to create
distributed objects by reflection since we don't allow clients to create objects, furthermore we needn't do it asynchronously. The object creation methods were moved into the server-side only interface and made "immediate", so the caller creates a derived instance of DObject and registers it with the system instead of creating it with a Subscriber callback. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4342 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -31,45 +31,13 @@ import com.threerings.presents.dobj.*;
|
||||
* A simple test case for the dobjmgr.
|
||||
*/
|
||||
public class DOMTest extends TestCase
|
||||
implements Subscriber<TestObject>, AttributeChangeListener,
|
||||
ElementUpdateListener
|
||||
implements AttributeChangeListener, ElementUpdateListener
|
||||
{
|
||||
public DOMTest ()
|
||||
{
|
||||
super(DOMTest.class.getName());
|
||||
}
|
||||
|
||||
public void objectAvailable (TestObject object)
|
||||
{
|
||||
// add ourselves as a listener
|
||||
_test = object;
|
||||
_test.addListener(this);
|
||||
|
||||
// test transactions
|
||||
_test.startTransaction();
|
||||
_test.setFoo(99);
|
||||
_test.setBar("hoopie");
|
||||
_test.commitTransaction();
|
||||
|
||||
// set some elements
|
||||
_test.setIntsAt(15, 3);
|
||||
_test.setIntsAt(5, 2);
|
||||
_test.setIntsAt(1, 0);
|
||||
_test.setStringsAt("Hello", 0);
|
||||
_test.setStringsAt("Goodbye", 1);
|
||||
_test.setStringsAt(null, 1);
|
||||
|
||||
// now set some values straight up
|
||||
_test.setFoo(25);
|
||||
_test.setBar("howdy");
|
||||
}
|
||||
|
||||
public void requestFailed (int oid, ObjectAccessException cause)
|
||||
{
|
||||
fail("Request failed: " + cause);
|
||||
_omgr.harshShutdown();
|
||||
}
|
||||
|
||||
public void attributeChanged (AttributeChangedEvent event)
|
||||
{
|
||||
assertTrue(fields[_fcount] + " == " + values[_fcount],
|
||||
@@ -91,11 +59,29 @@ public class DOMTest extends TestCase
|
||||
|
||||
public void runTest ()
|
||||
{
|
||||
// request that a new TestObject be created
|
||||
_omgr.createObject(TestObject.class, this);
|
||||
// request that a new TestObject be registered
|
||||
_test = _omgr.registerObject(new TestObject());
|
||||
|
||||
// or for fun you can try this bogus create request
|
||||
// _omgr.createObject(Integer.class, sub);
|
||||
// add ourselves as a listener
|
||||
_test.addListener(this);
|
||||
|
||||
// test transactions
|
||||
_test.startTransaction();
|
||||
_test.setFoo(99);
|
||||
_test.setBar("hoopie");
|
||||
_test.commitTransaction();
|
||||
|
||||
// set some elements
|
||||
_test.setIntsAt(15, 3);
|
||||
_test.setIntsAt(5, 2);
|
||||
_test.setIntsAt(1, 0);
|
||||
_test.setStringsAt("Hello", 0);
|
||||
_test.setStringsAt("Goodbye", 1);
|
||||
_test.setStringsAt(null, 1);
|
||||
|
||||
// now set some values straight up
|
||||
_test.setFoo(25);
|
||||
_test.setBar("howdy");
|
||||
|
||||
// and run the object manager
|
||||
_omgr.run();
|
||||
|
||||
Reference in New Issue
Block a user