Skip to content

Commit

Permalink
JBMESSAGING-1634: Remove easymock
Browse files Browse the repository at this point in the history
* goodbye easymock, we hardly knew ya...
* rewrote tests using easymocks with either fake objects or inner classes
  • Loading branch information
jmesnil committed Jun 9, 2009
1 parent e9270f5 commit 3c1478a
Show file tree
Hide file tree
Showing 12 changed files with 750 additions and 575 deletions.
5 changes: 1 addition & 4 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,13 @@
<classpathentry kind="lib" path="thirdparty/jboss/microcontainer/lib/jboss-aop-mc-int.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss/jboss-jaspi-api/lib/jboss-jaspi-api.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss/jnpserver/lib/jnpserver.jar" sourcepath="thirdparty/jboss/jnpserver/lib/jnpserver-sources.jar"/>
<classpathentry kind="lib" path="thirdparty/netty/lib/netty-3.1.0.BETA3.jar"/>
<classpathentry kind="lib" path="thirdparty/netty/lib/netty-3.1.0.BETA3.jar" sourcepath="thirdparty/netty/lib/netty-3.1.0.BETA3-sources.jar"/>
<classpathentry kind="lib" path="thirdparty/sun-jaxb/lib/jaxb-api.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss/jboss-common-logging-log4j/lib/jboss-common-logging-log4j.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss/jbossts/lib/jbossts-common.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="thirdparty/jboss/jboss-javaee/lib/jboss-javaee.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss/jbosssx-client/lib/jbosssx-client.jar"/>
<classpathentry kind="lib" path="thirdparty/easymock/lib/easymock.jar" sourcepath="thirdparty/easymock/lib/src.zip"/>
<classpathentry kind="lib" path="thirdparty/easymock-classextension/lib/easymockclassextension.jar"/>
<classpathentry kind="lib" path="thirdparty/cglib/lib/cglib.jar"/>
<classpathentry kind="lib" path="tests/tmpfiles"/>
<classpathentry kind="lib" path="thirdparty/jboss/jboss-common-logging-spi/lib/jboss-common-logging-spi.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss/jbossts/lib/jbossjta.jar"/>
Expand Down
7 changes: 0 additions & 7 deletions build-messaging.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@
<path refid="jboss.jboss.reflect.classpath"/>
<path refid="jboss.jboss.common.logging.spi.classpath"/>
<path refid="jboss.jboss.mdr.classpath"/>
<path refid="easymock.easymock.classpath"/>
<path refid="easymock.classextension.classpath"/>
<path location="${build.jars.dir}/${ra.jar.name}"/>
<path location="${build.jars.dir}/${jms.jar.name}"/>
<path location="${build.jars.dir}/${transports.jar.name}"/>
Expand All @@ -232,7 +230,6 @@
<path refid="jboss.jboss.reflect.classpath"/>
<path refid="jboss.jboss.common.logging.spi.classpath"/>
<path refid="jboss.jboss.mdr.classpath"/>
<path refid="easymock.easymock.classpath"/>
<path location="${build.jars.dir}/${core.jar.name}"/>
<path location="${build.jars.dir}/${jms.jar.name}"/>
<path location="${build.jars.dir}/${transports.jar.name}"/>
Expand All @@ -253,7 +250,6 @@
<path location="${build.jars.dir}/jboss-${module.name}.jar"/>
<path refid="junit.junit.classpath"/>
<path refid="jboss.profiler.jvmti.classpath"/>
<path refid="easymock.easymock.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
</path>

Expand All @@ -273,7 +269,6 @@
<path refid="test.compilation.classpath"/>
<path refid="sun.jaxb.classpath"/>
<path refid="apache.log4j.classpath"/>
<path refid="cglib.classpath"/>
<path refid="jboss.common.core.classpath"/>
<path refid="jboss.aop.classpath"/>
<path refid="trove.trove.classpath"/>
Expand All @@ -292,7 +287,6 @@
<pathelement location="${src.schema.dir}"/>
<path refid="test.compilation.classpath"/>
<path refid="apache.log4j.classpath"/>
<path refid="cglib.classpath"/>
<path refid="jboss.common.core.classpath"/>
<path refid="jboss.aop.classpath"/>
<path refid="trove.trove.classpath"/>
Expand All @@ -311,7 +305,6 @@
<path location="${build.jars.dir}/${transports.jar.name}"/>
<path refid="jms.test.compilation.classpath"/>
<path refid="sun.jaxb.classpath"/>
<path refid="cglib.classpath"/>
<path refid="jboss.common.core.classpath"/>
<path refid="jboss.aop.classpath"/>
<path refid="trove.trove.classpath"/>
Expand Down
8 changes: 0 additions & 8 deletions build-thirdparty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,6 @@

<componentref name="apache-logging" version="1.1.0.jboss"/>


<!--
required by the timing tests.
-->
<componentref name="easymock" version="2.3"/>
<!-- the extension is used to mock some concrete classes -->
<componentref name="easymock-classextension" version="2.3"/>

</build>

<synchronizeinfo/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.easymock.EasyMock;
import org.easymock.IAnswer;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.server.Consumer;
import org.jboss.messaging.core.server.HandleStatus;
Expand Down Expand Up @@ -244,27 +242,24 @@ private void testScheduled(boolean direct) throws Exception

public void testDeliveryScheduled() throws Exception
{
Consumer consumer = EasyMock.createStrictMock(Consumer.class);
Queue queue = new QueueImpl(1, new SimpleString("address1"), queue1, null, false, true, scheduledExecutor, null, null, null);
MessageReference messageReference = generateReference(queue, 1);
final CountDownLatch countDownLatch = new CountDownLatch(1);
EasyMock.expect(consumer.handle(messageReference)).andAnswer(new IAnswer<HandleStatus>()
Consumer consumer = new FakeConsumer()
{
public HandleStatus answer() throws Throwable
@Override
public synchronized HandleStatus handle(MessageReference reference)
{
countDownLatch.countDown();
return HandleStatus.HANDLED;
}
});
EasyMock.replay(consumer);
};
Queue queue = new QueueImpl(1, new SimpleString("address1"), queue1, null, false, true, scheduledExecutor, null, null, null);
MessageReference messageReference = generateReference(queue, 1);
queue.addConsumer(consumer);
messageReference.setScheduledDeliveryTime(System.currentTimeMillis() + 2000);
queue.addFirst(messageReference);

countDownLatch.await(3000, TimeUnit.MILLISECONDS);

EasyMock.verify(consumer);

boolean gotLatch = countDownLatch.await(3000, TimeUnit.MILLISECONDS);
assertTrue(gotLatch);
}

}
Loading

0 comments on commit 3c1478a

Please sign in to comment.