Nixed our ATUnit dependency which wasn't working. Better that we just do the

Guicing we need ourselves.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5884 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-07-21 00:29:37 +00:00
parent 0cd0a67679
commit 9d93ea7a90
5 changed files with 37 additions and 42 deletions
+3 -3
View File
@@ -163,8 +163,8 @@
</target>
<!-- run the tests -->
<target name="tests" depends="compile"
description="Run the tests.">
<property name="test" value=""/>
<target name="tests" depends="compile" description="Run the tests.">
<junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
<classpath refid="classpath"/>
<sysproperty key="test_dir" value="${test.dir}"/>
@@ -172,7 +172,7 @@
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${src.dir}">
<include name="**/*Test.java"/>
<include name="**/*${test}Test.java"/>
</fileset>
</batchtest>
</junit>
@@ -22,13 +22,6 @@
package com.threerings.presents.server;
import org.junit.Test;
import org.junit.runner.RunWith;
import atunit.AtUnit;
import atunit.Container;
import atunit.Unit;
import com.google.inject.Inject;
import com.threerings.presents.data.TestObject;
import com.threerings.presents.dobj.AttributeChangeListener;
@@ -41,9 +34,7 @@ import static org.junit.Assert.assertTrue;
/**
* A simple test case for the dobjmgr.
*/
@RunWith(AtUnit.class)
@Container(Container.Option.GUICE)
public class DOMTest
public class DOMTest extends PresentsTestBase
implements AttributeChangeListener, ElementUpdateListener
{
@Test public void runTest ()
@@ -106,5 +97,5 @@ public class DOMTest
// the values we'll receive via attribute changed events
protected Object[] values = { new Integer(99), "hoopie", new Integer(25), "howdy" };
@Inject @Unit protected PresentsDObjectMgr _omgr;
protected PresentsDObjectMgr _omgr = getInstance(PresentsDObjectMgr.class);
}
@@ -22,13 +22,6 @@
package com.threerings.presents.server;
import org.junit.Test;
import org.junit.runner.RunWith;
import atunit.AtUnit;
import atunit.Container;
import atunit.Unit;
import com.google.inject.Inject;
import com.threerings.presents.data.TestObject;
import com.threerings.presents.dobj.AttributeChangedEvent;
@@ -37,17 +30,15 @@ import com.threerings.presents.dobj.EventListener;
import com.threerings.presents.dobj.ObjectAddedEvent;
import com.threerings.presents.dobj.ObjectDestroyedEvent;
import static com.threerings.presents.Log.log;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static com.threerings.presents.Log.log;
/**
* Tests that the dobjmgr will not allow a destroyed object to be added to
* an oid list.
* Tests that the dobjmgr will not allow a destroyed object to be added to an oid list.
*/
@RunWith(AtUnit.class)
@Container(Container.Option.GUICE)
public class DestroyedRefTest
public class DestroyedRefTest extends PresentsTestBase
{
@Test public void runTest ()
{
@@ -63,9 +54,8 @@ public class DestroyedRefTest
log.info("The following addToList() should be ignored.");
_objtwo.addToList(_objone.getOid());
// now that we have both objects, try to set up the reference. first
// we queue up a destroy event for object two, then we try to reference
// it on object one's oid list
// now that we have both objects, try to set up the reference. first we queue up a destroy
// event for object two, then we try to reference it on object one's oid list
_objtwo.destroy();
_objone.addToList(_objtwo.getOid());
@@ -101,5 +91,5 @@ public class DestroyedRefTest
protected TestObject _objone, _objtwo;
@Inject @Unit protected PresentsDObjectMgr _omgr;
protected PresentsDObjectMgr _omgr = getInstance(PresentsDObjectMgr.class);
}
@@ -0,0 +1,23 @@
//
// $Id$
package com.threerings.presents.server;
import com.google.inject.Guice;
import com.google.inject.Injector;
/**
* Sets up Guice so that presents things can be tested.
*/
public class PresentsTestBase
{
protected <T> T getInstance (Class<T> clazz)
{
if (_injector == null) {
_injector = Guice.createInjector(new PresentsServer.Module());
}
return _injector.getInstance(clazz);
}
protected Injector _injector;
}
@@ -22,13 +22,6 @@
package com.threerings.presents.server;
import org.junit.Test;
import org.junit.runner.RunWith;
import atunit.AtUnit;
import atunit.Container;
import atunit.Unit;
import com.google.inject.Inject;
import com.threerings.presents.data.TestObject;
import com.threerings.presents.dobj.DEvent;
@@ -42,9 +35,7 @@ import static org.junit.Assert.assertTrue;
/**
* Tests the oid list reference tracking code.
*/
@RunWith(AtUnit.class)
@Container(Container.Option.GUICE)
public class RefTest
public class RefTest extends PresentsTest
{
@Test public void runTest ()
{
@@ -96,5 +87,5 @@ public class RefTest
protected TestObject _objone;
protected TestObject _objtwo;
@Inject @Unit protected PresentsDObjectMgr _omgr;
protected PresentsDObjectMgr _omgr = getInstance(PresentsDObjectMgr.class);
}