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:
+3
-3
@@ -163,8 +163,8 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- run the tests -->
|
<!-- run the tests -->
|
||||||
<target name="tests" depends="compile"
|
<property name="test" value=""/>
|
||||||
description="Run the tests.">
|
<target name="tests" depends="compile" description="Run the tests.">
|
||||||
<junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
|
<junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
|
||||||
<classpath refid="classpath"/>
|
<classpath refid="classpath"/>
|
||||||
<sysproperty key="test_dir" value="${test.dir}"/>
|
<sysproperty key="test_dir" value="${test.dir}"/>
|
||||||
@@ -172,7 +172,7 @@
|
|||||||
<formatter type="brief" usefile="false"/>
|
<formatter type="brief" usefile="false"/>
|
||||||
<batchtest>
|
<batchtest>
|
||||||
<fileset dir="${src.dir}">
|
<fileset dir="${src.dir}">
|
||||||
<include name="**/*Test.java"/>
|
<include name="**/*${test}Test.java"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</batchtest>
|
</batchtest>
|
||||||
</junit>
|
</junit>
|
||||||
|
|||||||
@@ -22,13 +22,6 @@
|
|||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
import org.junit.Test;
|
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.data.TestObject;
|
||||||
import com.threerings.presents.dobj.AttributeChangeListener;
|
import com.threerings.presents.dobj.AttributeChangeListener;
|
||||||
@@ -41,9 +34,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
/**
|
/**
|
||||||
* A simple test case for the dobjmgr.
|
* A simple test case for the dobjmgr.
|
||||||
*/
|
*/
|
||||||
@RunWith(AtUnit.class)
|
public class DOMTest extends PresentsTestBase
|
||||||
@Container(Container.Option.GUICE)
|
|
||||||
public class DOMTest
|
|
||||||
implements AttributeChangeListener, ElementUpdateListener
|
implements AttributeChangeListener, ElementUpdateListener
|
||||||
{
|
{
|
||||||
@Test public void runTest ()
|
@Test public void runTest ()
|
||||||
@@ -106,5 +97,5 @@ public class DOMTest
|
|||||||
// the values we'll receive via attribute changed events
|
// the values we'll receive via attribute changed events
|
||||||
protected Object[] values = { new Integer(99), "hoopie", new Integer(25), "howdy" };
|
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;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
import org.junit.Test;
|
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.data.TestObject;
|
||||||
import com.threerings.presents.dobj.AttributeChangedEvent;
|
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.ObjectAddedEvent;
|
||||||
import com.threerings.presents.dobj.ObjectDestroyedEvent;
|
import com.threerings.presents.dobj.ObjectDestroyedEvent;
|
||||||
|
|
||||||
import static com.threerings.presents.Log.log;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
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
|
* Tests that the dobjmgr will not allow a destroyed object to be added to an oid list.
|
||||||
* an oid list.
|
|
||||||
*/
|
*/
|
||||||
@RunWith(AtUnit.class)
|
public class DestroyedRefTest extends PresentsTestBase
|
||||||
@Container(Container.Option.GUICE)
|
|
||||||
public class DestroyedRefTest
|
|
||||||
{
|
{
|
||||||
@Test public void runTest ()
|
@Test public void runTest ()
|
||||||
{
|
{
|
||||||
@@ -63,9 +54,8 @@ public class DestroyedRefTest
|
|||||||
log.info("The following addToList() should be ignored.");
|
log.info("The following addToList() should be ignored.");
|
||||||
_objtwo.addToList(_objone.getOid());
|
_objtwo.addToList(_objone.getOid());
|
||||||
|
|
||||||
// now that we have both objects, try to set up the reference. first
|
// now that we have both objects, try to set up the reference. first we queue up a destroy
|
||||||
// we queue up a destroy event for object two, then we try to reference
|
// event for object two, then we try to reference it on object one's oid list
|
||||||
// it on object one's oid list
|
|
||||||
_objtwo.destroy();
|
_objtwo.destroy();
|
||||||
_objone.addToList(_objtwo.getOid());
|
_objone.addToList(_objtwo.getOid());
|
||||||
|
|
||||||
@@ -101,5 +91,5 @@ public class DestroyedRefTest
|
|||||||
|
|
||||||
protected TestObject _objone, _objtwo;
|
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;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
import org.junit.Test;
|
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.data.TestObject;
|
||||||
import com.threerings.presents.dobj.DEvent;
|
import com.threerings.presents.dobj.DEvent;
|
||||||
@@ -42,9 +35,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
/**
|
/**
|
||||||
* Tests the oid list reference tracking code.
|
* Tests the oid list reference tracking code.
|
||||||
*/
|
*/
|
||||||
@RunWith(AtUnit.class)
|
public class RefTest extends PresentsTest
|
||||||
@Container(Container.Option.GUICE)
|
|
||||||
public class RefTest
|
|
||||||
{
|
{
|
||||||
@Test public void runTest ()
|
@Test public void runTest ()
|
||||||
{
|
{
|
||||||
@@ -96,5 +87,5 @@ public class RefTest
|
|||||||
protected TestObject _objone;
|
protected TestObject _objone;
|
||||||
protected TestObject _objtwo;
|
protected TestObject _objtwo;
|
||||||
|
|
||||||
@Inject @Unit protected PresentsDObjectMgr _omgr;
|
protected PresentsDObjectMgr _omgr = getInstance(PresentsDObjectMgr.class);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user