incubator-s4-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [31/50] [abbrv] git commit: modified s4-comm tests to use junit4; UDPTest not working yet
Date Tue, 03 Jan 2012 14:03:28 GMT
modified s4-comm tests to use junit4; UDPTest not working yet


Project: http://git-wip-us.apache.org/repos/asf/incubator-s4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s4/commit/208426c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s4/tree/208426c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s4/diff/208426c2

Branch: refs/heads/piper
Commit: 208426c21258d7abd786d2b3f549420b5bec8489
Parents: 31b5d22
Author: Karthik Kambatla <kkambatl@cs.purdue.edu>
Authored: Thu Oct 27 21:56:18 2011 -0400
Committer: Karthik Kambatla <kkambatl@cs.purdue.edu>
Committed: Thu Oct 27 21:56:18 2011 -0400

----------------------------------------------------------------------
 .../test/java/org/apache/s4/comm/NettyTest.java    |    2 +-
 .../org/apache/s4/comm/SimpleDeliveryTest.java     |   22 +++++++++++----
 .../src/test/java/org/apache/s4/comm/UDPTest.java  |    5 +++-
 3 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/208426c2/subprojects/s4-comm/src/test/java/org/apache/s4/comm/NettyTest.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/NettyTest.java b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/NettyTest.java
index 4db680d..20458e8 100644
--- a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/NettyTest.java
+++ b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/NettyTest.java
@@ -28,7 +28,7 @@ import com.google.inject.name.Names;
 public class NettyTest extends SimpleDeliveryTest {
 
 	@Override
-	protected void setUp() {
+	public void setup() {
 		Injector injector = Guice.createInjector(new NettyTestModule());
 		sdt = injector.getInstance(CommWrapper.class);
 	}

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/208426c2/subprojects/s4-comm/src/test/java/org/apache/s4/comm/SimpleDeliveryTest.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/SimpleDeliveryTest.java
b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/SimpleDeliveryTest.java
index 17a2376..f80d287 100644
--- a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/SimpleDeliveryTest.java
+++ b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/SimpleDeliveryTest.java
@@ -2,12 +2,13 @@ package org.apache.s4.comm;
 
 import org.apache.s4.base.Emitter;
 import org.apache.s4.base.Listener;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
 import com.google.inject.Inject;
 import com.google.inject.name.Named;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
 /*
  * Test class to test communication protocols. As comm-layer connections need to be
  *  made including acquiring locks, the test is declared abstract and needs to be 
@@ -24,7 +25,7 @@ import junit.framework.TestCase;
  * </ul>
  * 
  */
-public abstract class SimpleDeliveryTest extends TestCase {
+public abstract class SimpleDeliveryTest {
 	protected CommWrapper sdt;
 
 	static class CommWrapper {
@@ -140,14 +141,23 @@ public abstract class SimpleDeliveryTest extends TestCase {
 		}
 	}
 
+
+	
+	/*
+	 * All tests extending this class need to implement this method
+	 */
+	@Before
+	public abstract void setup();
+	
 	/**
-	 * test() tests the protocol. If all components function without throwing
+	 * Tests the protocol. If all components function without throwing
 	 * exceptions, the test passes. The test also reports the loss of messages,
 	 * if any.
 	 * 
 	 * @throws InterruptedException
 	 */
-	public void test() throws InterruptedException {
+	@Test
+	public void testCommLayerProtocol() throws InterruptedException {
 		try {
 			// start send and receive threads
 			sdt.sendThread.start();

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/208426c2/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPTest.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPTest.java b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPTest.java
index 289790b..dda2e18 100644
--- a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPTest.java
+++ b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPTest.java
@@ -18,6 +18,8 @@ import org.apache.s4.comm.topology.Topology;
 import org.apache.s4.comm.topology.TopologyFromFile;
 import org.apache.s4.comm.udp.UDPEmitter;
 import org.apache.s4.comm.udp.UDPListener;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
 import org.junit.Ignore;
 
 import com.google.inject.AbstractModule;
@@ -29,10 +31,11 @@ import com.google.inject.name.Names;
 // TODO: this test class excluded and set as abstract because:
 // 1. test hangs and blocks the whole test suite
 // 2. it does not use junit 4 and therefore there is no simple way to time out
+@RunWith(JUnit4.class)
 public abstract class UDPTest extends SimpleDeliveryTest {
 
 	@Override
-	protected void setUp() {
+	public void setup() {
 		Injector injector = Guice.createInjector(new UDPTestModule());
 		sdt = injector.getInstance(CommWrapper.class);
 	}


Mime
View raw message