From 77290fc1a62459a1e70e4551ac1623bb37094999 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 5 Jul 2006 18:59:31 +0000 Subject: [PATCH] Fixed type-unsafety and deprecation bits. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4247 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- tests/build.xml | 3 +- .../threerings/crowd/client/TestClient.java | 4 +-- .../threerings/crowd/data/JabberConfig.java | 5 +-- .../presents/client/TestClient.java | 10 +++--- .../threerings/presents/dobj/DSetTest.java | 6 ++-- .../threerings/presents/server/DOMTest.java | 35 +++++++++---------- .../presents/server/DestroyedRefTest.java | 11 +++--- .../threerings/presents/server/RefTest.java | 12 +++---- .../presents/server/TestServer.java | 12 +++---- 9 files changed, 46 insertions(+), 52 deletions(-) diff --git a/tests/build.xml b/tests/build.xml index f346119ff..59e85aaaf 100644 --- a/tests/build.xml +++ b/tests/build.xml @@ -106,10 +106,11 @@ + debug="on" optimize="off" deprecation="on"> + diff --git a/tests/src/java/com/threerings/crowd/client/TestClient.java b/tests/src/java/com/threerings/crowd/client/TestClient.java index 9bf6e3667..a8223ced8 100644 --- a/tests/src/java/com/threerings/crowd/client/TestClient.java +++ b/tests/src/java/com/threerings/crowd/client/TestClient.java @@ -67,7 +67,7 @@ public class TestClient // loop over our queue, running the runnables while (true) { - Runnable run = (Runnable)_queue.get(); + Runnable run = _queue.get(); run.run(); } } @@ -184,5 +184,5 @@ public class TestClient protected ChatDirector _chatdir; protected Thread _main; - protected Queue _queue = new Queue(); + protected Queue _queue = new Queue(); } diff --git a/tests/src/java/com/threerings/crowd/data/JabberConfig.java b/tests/src/java/com/threerings/crowd/data/JabberConfig.java index 8c424a486..147f73251 100644 --- a/tests/src/java/com/threerings/crowd/data/JabberConfig.java +++ b/tests/src/java/com/threerings/crowd/data/JabberConfig.java @@ -4,6 +4,7 @@ package com.threerings.crowd.data; import com.threerings.crowd.client.JabberController; +import com.threerings.crowd.client.PlaceController; import com.threerings.crowd.data.PlaceConfig; /** @@ -12,9 +13,9 @@ import com.threerings.crowd.data.PlaceConfig; public class JabberConfig extends PlaceConfig { // documentation inherited - public Class getControllerClass () + public PlaceController createController () { - return JabberController.class; + return new JabberController(); } // documentation inherited diff --git a/tests/src/java/com/threerings/presents/client/TestClient.java b/tests/src/java/com/threerings/presents/client/TestClient.java index 0836db116..445010a19 100644 --- a/tests/src/java/com/threerings/presents/client/TestClient.java +++ b/tests/src/java/com/threerings/presents/client/TestClient.java @@ -35,7 +35,7 @@ import com.threerings.presents.net.*; * A standalone test client. */ public class TestClient - implements RunQueue, SessionObserver, Subscriber, EventListener, + implements RunQueue, SessionObserver, Subscriber, EventListener, TestService.TestFuncListener, TestService.TestOidListener, TestReceiver { @@ -61,7 +61,7 @@ public class TestClient // loop over our queue, running the runnables while (true) { - Runnable run = (Runnable)_queue.get(); + Runnable run = _queue.get(); run.run(); } } @@ -91,11 +91,11 @@ public class TestClient System.exit(0); } - public void objectAvailable (DObject object) + public void objectAvailable (TestObject object) { object.addListener(this); Log.info("Object available: " + object); - ((TestObject)object).setBar("lawl!"); + object.setBar("lawl!"); } public void requestFailed (int oid, ObjectAccessException cause) @@ -161,6 +161,6 @@ public class TestClient } protected Thread _main; - protected Queue _queue = new Queue(); + protected Queue _queue = new Queue(); protected Client _client; } diff --git a/tests/src/java/com/threerings/presents/dobj/DSetTest.java b/tests/src/java/com/threerings/presents/dobj/DSetTest.java index d43b95b4a..eacadcf05 100644 --- a/tests/src/java/com/threerings/presents/dobj/DSetTest.java +++ b/tests/src/java/com/threerings/presents/dobj/DSetTest.java @@ -1,5 +1,5 @@ // -// $Id: DSetTest.java,v 1.2 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 @@ -58,14 +58,14 @@ public class DSetTest extends TestCase public void runTest () { - ArrayList seed = new ArrayList(); + ArrayList seed = new ArrayList(); seed.add(new TestEntry(15)); seed.add(new TestEntry(7)); seed.add(new TestEntry(3)); seed.add(new TestEntry(29)); seed.add(new TestEntry(32)); - DSet set = new DSet(seed.iterator()); + DSet set = new DSet(seed.iterator()); System.out.println(set.add(new TestEntry(15)) + ": " + set); System.out.println(set.add(new TestEntry(9)) + ": " + set); System.out.println(set.remove(new TestEntry(32)) + ": " + set); diff --git a/tests/src/java/com/threerings/presents/server/DOMTest.java b/tests/src/java/com/threerings/presents/server/DOMTest.java index 42003e7d7..215e3bebb 100644 --- a/tests/src/java/com/threerings/presents/server/DOMTest.java +++ b/tests/src/java/com/threerings/presents/server/DOMTest.java @@ -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, 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) diff --git a/tests/src/java/com/threerings/presents/server/DestroyedRefTest.java b/tests/src/java/com/threerings/presents/server/DestroyedRefTest.java index 53aaefd21..f8a8d2572 100644 --- a/tests/src/java/com/threerings/presents/server/DestroyedRefTest.java +++ b/tests/src/java/com/threerings/presents/server/DestroyedRefTest.java @@ -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, 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 diff --git a/tests/src/java/com/threerings/presents/server/RefTest.java b/tests/src/java/com/threerings/presents/server/RefTest.java index 9ca3b8c3a..7eecace3d 100644 --- a/tests/src/java/com/threerings/presents/server/RefTest.java +++ b/tests/src/java/com/threerings/presents/server/RefTest.java @@ -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, 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()); diff --git a/tests/src/java/com/threerings/presents/server/TestServer.java b/tests/src/java/com/threerings/presents/server/TestServer.java index a3ffcfec2..6c9323765 100644 --- a/tests/src/java/com/threerings/presents/server/TestServer.java +++ b/tests/src/java/com/threerings/presents/server/TestServer.java @@ -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 sub = new Subscriber() { + 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 + "]."); }