incubator-s4-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [28/50] [abbrv] git commit: working TCP and UDP Tests
Date Tue, 03 Jan 2012 14:03:28 GMT
working TCP and UDP Tests


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

Branch: refs/heads/piper
Commit: 5311f8d724d145d424d49b49e69af8d9e25e8742
Parents: 5a69991
Author: Karthik Kambatla <kkambatl@cs.purdue.edu>
Authored: Mon Oct 31 02:06:41 2011 -0400
Committer: Karthik Kambatla <kkambatl@cs.purdue.edu>
Committed: Mon Oct 31 02:06:41 2011 -0400

----------------------------------------------------------------------
 .../test/java/org/apache/s4/comm/NettyTest.java    |   88 -------------
 .../test/java/org/apache/s4/comm/TCPCommTest.java  |   88 +++++++++++++
 .../test/java/org/apache/s4/comm/UDPCommTest.java  |   88 +++++++++++++
 .../src/test/java/org/apache/s4/comm/UDPTest.java  |   96 ---------------
 4 files changed, 176 insertions(+), 184 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/5311f8d7/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
deleted file mode 100644
index 20458e8..0000000
--- a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/NettyTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.apache.s4.comm;
-
-import java.io.InputStream;
-
-import org.apache.commons.configuration.ConfigurationConverter;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.ConfigurationUtils;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.s4.base.Emitter;
-import org.apache.s4.base.Hasher;
-import org.apache.s4.base.Listener;
-import org.apache.s4.base.SerializerDeserializer;
-import org.apache.s4.comm.serialize.KryoSerDeser;
-import org.apache.s4.comm.topology.Assignment;
-import org.apache.s4.comm.topology.AssignmentFromFile;
-import org.apache.s4.comm.topology.Cluster;
-import org.apache.s4.comm.topology.Topology;
-import org.apache.s4.comm.topology.TopologyFromFile;
-import org.apache.s4.comm.netty.NettyEmitter;
-import org.apache.s4.comm.netty.NettyListener;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Binder;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.name.Names;
-
-public class NettyTest extends SimpleDeliveryTest {
-
-	@Override
-	public void setup() {
-		Injector injector = Guice.createInjector(new NettyTestModule());
-		sdt = injector.getInstance(CommWrapper.class);
-	}
-
-	class NettyTestModule extends AbstractModule {
-
-		protected PropertiesConfiguration config = null;
-
-		private void loadProperties(Binder binder) {
-
-			try {
-				InputStream is = this.getClass().getResourceAsStream(
-						"/s4-comm-test.properties");
-				config = new PropertiesConfiguration();
-				config.load(is);
-
-				System.out.println(ConfigurationUtils.toString(config));
-				Names.bindProperties(binder,
-						ConfigurationConverter.getProperties(config));
-			} catch (ConfigurationException e) {
-				binder.addError(e);
-				e.printStackTrace();
-			}
-		}
-
-		@Override
-		protected void configure() {
-			if (config == null)
-				loadProperties(binder());
-
-			int numHosts = config.getList("cluster.hosts").size();
-			boolean isCluster = numHosts > 1 ? true : false;
-			bind(Boolean.class).annotatedWith(Names.named("isCluster"))
-					.toInstance(Boolean.valueOf(isCluster));
-
-			bind(Cluster.class);
-
-			bind(Assignment.class).to(AssignmentFromFile.class);
-
-			bind(Topology.class).to(TopologyFromFile.class);
-
-			/* Use a simple UDP comm layer implementation. */
-			bind(Listener.class).to(NettyListener.class);
-			bind(Emitter.class).to(NettyEmitter.class);
-
-			/* The hashing function to map keys top partitions. */
-			bind(Hasher.class).to(DefaultHasher.class);
-
-			/* Use Kryo to serialize events. */
-			bind(SerializerDeserializer.class).to(KryoSerDeser.class);
-
-			bind(Integer.class).annotatedWith(
-					Names.named("emitter.send.interval")).toInstance(
-					config.getInt("emitter.send.interval"));
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/5311f8d7/subprojects/s4-comm/src/test/java/org/apache/s4/comm/TCPCommTest.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/TCPCommTest.java b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/TCPCommTest.java
new file mode 100644
index 0000000..a691cf6
--- /dev/null
+++ b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/TCPCommTest.java
@@ -0,0 +1,88 @@
+package org.apache.s4.comm;
+
+import java.io.InputStream;
+
+import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.ConfigurationUtils;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.s4.base.Emitter;
+import org.apache.s4.base.Hasher;
+import org.apache.s4.base.Listener;
+import org.apache.s4.base.SerializerDeserializer;
+import org.apache.s4.comm.serialize.KryoSerDeser;
+import org.apache.s4.comm.topology.Assignment;
+import org.apache.s4.comm.topology.AssignmentFromFile;
+import org.apache.s4.comm.topology.Cluster;
+import org.apache.s4.comm.topology.Topology;
+import org.apache.s4.comm.topology.TopologyFromFile;
+import org.apache.s4.comm.netty.NettyEmitter;
+import org.apache.s4.comm.netty.NettyListener;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Binder;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.name.Names;
+
+public class TCPCommTest extends SimpleDeliveryTest {
+
+	@Override
+	public void setup() {
+		Injector injector = Guice.createInjector(new NettyTestModule());
+		sdt = injector.getInstance(CommWrapper.class);
+	}
+
+	class NettyTestModule extends AbstractModule {
+
+		protected PropertiesConfiguration config = null;
+
+		private void loadProperties(Binder binder) {
+
+			try {
+				InputStream is = this.getClass().getResourceAsStream(
+						"/s4-comm-test.properties");
+				config = new PropertiesConfiguration();
+				config.load(is);
+
+				System.out.println(ConfigurationUtils.toString(config));
+				Names.bindProperties(binder,
+						ConfigurationConverter.getProperties(config));
+			} catch (ConfigurationException e) {
+				binder.addError(e);
+				e.printStackTrace();
+			}
+		}
+
+		@Override
+		protected void configure() {
+			if (config == null)
+				loadProperties(binder());
+
+			int numHosts = config.getList("cluster.hosts").size();
+			boolean isCluster = numHosts > 1 ? true : false;
+			bind(Boolean.class).annotatedWith(Names.named("isCluster"))
+					.toInstance(Boolean.valueOf(isCluster));
+
+			bind(Cluster.class);
+
+			bind(Assignment.class).to(AssignmentFromFile.class);
+
+			bind(Topology.class).to(TopologyFromFile.class);
+
+			/* Use a simple UDP comm layer implementation. */
+			bind(Listener.class).to(NettyListener.class);
+			bind(Emitter.class).to(NettyEmitter.class);
+
+			/* The hashing function to map keys top partitions. */
+			bind(Hasher.class).to(DefaultHasher.class);
+
+			/* Use Kryo to serialize events. */
+			bind(SerializerDeserializer.class).to(KryoSerDeser.class);
+
+			bind(Integer.class).annotatedWith(
+					Names.named("emitter.send.interval")).toInstance(
+					config.getInt("emitter.send.interval"));
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/5311f8d7/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPCommTest.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPCommTest.java b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPCommTest.java
new file mode 100644
index 0000000..6dceb19
--- /dev/null
+++ b/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPCommTest.java
@@ -0,0 +1,88 @@
+package org.apache.s4.comm;
+
+import java.io.InputStream;
+
+import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.ConfigurationUtils;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.s4.base.Emitter;
+import org.apache.s4.base.Hasher;
+import org.apache.s4.base.Listener;
+import org.apache.s4.base.SerializerDeserializer;
+import org.apache.s4.comm.serialize.KryoSerDeser;
+import org.apache.s4.comm.topology.Assignment;
+import org.apache.s4.comm.topology.AssignmentFromFile;
+import org.apache.s4.comm.topology.Cluster;
+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 com.google.inject.AbstractModule;
+import com.google.inject.Binder;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.name.Names;
+
+public class UDPCommTest extends SimpleDeliveryTest {
+
+	@Override
+	public void setup() {
+		Injector injector = Guice.createInjector(new UDPCommTestModule());
+		sdt = injector.getInstance(CommWrapper.class);
+	}
+
+	class UDPCommTestModule extends AbstractModule {
+
+		protected PropertiesConfiguration config = null;
+
+		private void loadProperties(Binder binder) {
+
+			try {
+				InputStream is = this.getClass().getResourceAsStream(
+						"/s4-comm-test.properties");
+				config = new PropertiesConfiguration();
+				config.load(is);
+
+				System.out.println(ConfigurationUtils.toString(config));
+				Names.bindProperties(binder,
+						ConfigurationConverter.getProperties(config));
+			} catch (ConfigurationException e) {
+				binder.addError(e);
+				e.printStackTrace();
+			}
+		}
+
+		@Override
+		protected void configure() {
+			if (config == null)
+				loadProperties(binder());
+
+			int numHosts = config.getList("cluster.hosts").size();
+			boolean isCluster = numHosts > 1 ? true : false;
+			bind(Boolean.class).annotatedWith(Names.named("isCluster"))
+					.toInstance(Boolean.valueOf(isCluster));
+
+			bind(Cluster.class);
+
+			bind(Assignment.class).to(AssignmentFromFile.class);
+
+			bind(Topology.class).to(TopologyFromFile.class);
+
+			/* Use a simple UDP comm layer implementation. */
+			bind(Listener.class).to(UDPListener.class);
+			bind(Emitter.class).to(UDPEmitter.class);
+
+			/* The hashing function to map keys top partitions. */
+			bind(Hasher.class).to(DefaultHasher.class);
+
+			/* Use Kryo to serialize events. */
+			bind(SerializerDeserializer.class).to(KryoSerDeser.class);
+
+			bind(Integer.class).annotatedWith(
+					Names.named("emitter.send.interval")).toInstance(
+					config.getInt("emitter.send.interval"));
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/5311f8d7/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
deleted file mode 100644
index dda2e18..0000000
--- a/subprojects/s4-comm/src/test/java/org/apache/s4/comm/UDPTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.apache.s4.comm;
-
-import java.io.InputStream;
-
-import org.apache.commons.configuration.ConfigurationConverter;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.ConfigurationUtils;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.s4.base.Emitter;
-import org.apache.s4.base.Hasher;
-import org.apache.s4.base.Listener;
-import org.apache.s4.base.SerializerDeserializer;
-import org.apache.s4.comm.serialize.KryoSerDeser;
-import org.apache.s4.comm.topology.Assignment;
-import org.apache.s4.comm.topology.AssignmentFromFile;
-import org.apache.s4.comm.topology.Cluster;
-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;
-import com.google.inject.Binder;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-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
-	public void setup() {
-		Injector injector = Guice.createInjector(new UDPTestModule());
-		sdt = injector.getInstance(CommWrapper.class);
-	}
-
-	class UDPTestModule extends AbstractModule {
-
-		protected PropertiesConfiguration config = null;
-
-		private void loadProperties(Binder binder) {
-
-			try {
-				InputStream is = this.getClass().getResourceAsStream(
-						"/s4-comm-test.properties");
-				config = new PropertiesConfiguration();
-				config.load(is);
-
-				System.out.println(ConfigurationUtils.toString(config));
-				Names.bindProperties(binder,
-						ConfigurationConverter.getProperties(config));
-			} catch (ConfigurationException e) {
-				binder.addError(e);
-				e.printStackTrace();
-			}
-		}
-
-		@Override
-		protected void configure() {
-			if (config == null)
-				loadProperties(binder());
-
-			int numHosts = config.getList("cluster.hosts").size();
-			boolean isCluster = numHosts > 1 ? true : false;
-			bind(Boolean.class).annotatedWith(Names.named("isCluster"))
-					.toInstance(Boolean.valueOf(isCluster));
-
-			bind(Cluster.class);
-
-			bind(Assignment.class).to(AssignmentFromFile.class);
-
-			bind(Topology.class).to(TopologyFromFile.class);
-
-			/* Use a simple UDP comm layer implementation. */
-			bind(Listener.class).to(UDPListener.class);
-			bind(Emitter.class).to(UDPEmitter.class);
-
-			/* The hashing function to map keys top partitions. */
-			bind(Hasher.class).to(DefaultHasher.class);
-
-			/* Use Kryo to serialize events. */
-			bind(SerializerDeserializer.class).to(KryoSerDeser.class);
-
-			bind(Integer.class).annotatedWith(
-					Names.named("emitter.send.interval")).toInstance(
-					config.getInt("emitter.send.interval"));
-
-		}
-	}
-}


Mime
View raw message