Fixed type-unsafety and deprecation bits.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4247 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -31,38 +31,37 @@ import com.threerings.presents.dobj.*;
|
||||
* A simple test case for the dobjmgr.
|
||||
*/
|
||||
public class DOMTest extends TestCase
|
||||
implements Subscriber, AttributeChangeListener, ElementUpdateListener
|
||||
implements Subscriber<TestObject>, AttributeChangeListener,
|
||||
ElementUpdateListener
|
||||
{
|
||||
public DOMTest ()
|
||||
{
|
||||
super(DOMTest.class.getName());
|
||||
}
|
||||
|
||||
public void objectAvailable (DObject object)
|
||||
public void objectAvailable (TestObject object)
|
||||
{
|
||||
// add ourselves as a listener
|
||||
object.addListener(this);
|
||||
|
||||
TestObject to = (TestObject)object;
|
||||
_test = to;
|
||||
_test = object;
|
||||
_test.addListener(this);
|
||||
|
||||
// test transactions
|
||||
to.startTransaction();
|
||||
to.setFoo(99);
|
||||
to.setBar("hoopie");
|
||||
to.commitTransaction();
|
||||
_test.startTransaction();
|
||||
_test.setFoo(99);
|
||||
_test.setBar("hoopie");
|
||||
_test.commitTransaction();
|
||||
|
||||
// set some elements
|
||||
to.setIntsAt(15, 3);
|
||||
to.setIntsAt(5, 2);
|
||||
to.setIntsAt(1, 0);
|
||||
to.setStringsAt("Hello", 0);
|
||||
to.setStringsAt("Goodbye", 1);
|
||||
to.setStringsAt(null, 1);
|
||||
_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
|
||||
to.setFoo(25);
|
||||
to.setBar("howdy");
|
||||
_test.setFoo(25);
|
||||
_test.setBar("howdy");
|
||||
}
|
||||
|
||||
public void requestFailed (int oid, ObjectAccessException cause)
|
||||
|
||||
@@ -32,26 +32,25 @@ import com.threerings.presents.dobj.*;
|
||||
* Tests that the dobjmgr will not allow a destroyed object to be added to
|
||||
* an oid list.
|
||||
*/
|
||||
public class DestroyedRefTest
|
||||
extends TestCase
|
||||
implements Subscriber, EventListener
|
||||
public class DestroyedRefTest extends TestCase
|
||||
implements Subscriber<TestObject>, EventListener
|
||||
{
|
||||
public DestroyedRefTest ()
|
||||
{
|
||||
super(DestroyedRefTest.class.getName());
|
||||
}
|
||||
|
||||
public void objectAvailable (DObject object)
|
||||
public void objectAvailable (TestObject object)
|
||||
{
|
||||
// add ourselves as an event listener
|
||||
object.addListener(this);
|
||||
|
||||
// keep references to our test objects
|
||||
if (_objone == null) {
|
||||
_objone = (TestObject)object;
|
||||
_objone = object;
|
||||
|
||||
} else {
|
||||
_objtwo = (TestObject)object;
|
||||
_objtwo = object;
|
||||
|
||||
// add object one to object two twice in a row to make sure
|
||||
// repeated adds don't result in the object being listed twice
|
||||
|
||||
@@ -30,27 +30,25 @@ import com.threerings.presents.dobj.*;
|
||||
/**
|
||||
* Tests the oid list reference tracking code.
|
||||
*/
|
||||
public class RefTest
|
||||
extends TestCase
|
||||
implements Subscriber, EventListener
|
||||
public class RefTest extends TestCase
|
||||
implements Subscriber<TestObject>, EventListener
|
||||
{
|
||||
public RefTest ()
|
||||
{
|
||||
super(RefTest.class.getName());
|
||||
}
|
||||
|
||||
public void objectAvailable (DObject object)
|
||||
public void objectAvailable (TestObject object)
|
||||
{
|
||||
// add ourselves as an event listener to our subscribed object
|
||||
object.addListener(this);
|
||||
|
||||
// keep references to our test objects
|
||||
if (_objone == null) {
|
||||
_objone = (TestObject)object;
|
||||
_objone = object;
|
||||
|
||||
} else {
|
||||
_objtwo = (TestObject)object;
|
||||
|
||||
_objtwo = object;
|
||||
// now that we have both objects, set up the references
|
||||
_objone.addToList(_objtwo.getOid());
|
||||
_objtwo.addToList(_objone.getOid());
|
||||
|
||||
@@ -38,15 +38,11 @@ public class TestServer extends PresentsServer
|
||||
invmgr.registerDispatcher(new TestDispatcher(new TestProvider()), true);
|
||||
|
||||
// create a test object
|
||||
Subscriber sub = new Subscriber()
|
||||
{
|
||||
public void objectAvailable (DObject object)
|
||||
{
|
||||
testobj = (TestObject)object;
|
||||
Subscriber<TestObject> sub = new Subscriber<TestObject>() {
|
||||
public void objectAvailable (TestObject object) {
|
||||
testobj = object;
|
||||
}
|
||||
|
||||
public void requestFailed (int oid, ObjectAccessException cause)
|
||||
{
|
||||
public void requestFailed (int oid, ObjectAccessException cause) {
|
||||
Log.warning("Unable to create test object " +
|
||||
"[error=" + cause + "].");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user