hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tjungb...@apache.org
Subject svn commit: r1241943 - /incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message/TestAvroMessageManager.java
Date Wed, 08 Feb 2012 15:45:16 GMT
Author: tjungblut
Date: Wed Feb  8 15:45:16 2012
New Revision: 1241943

URL: http://svn.apache.org/viewvc?rev=1241943&view=rev
Log:
Turning main method to testcase

Modified:
    incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message/TestAvroMessageManager.java

Modified: incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message/TestAvroMessageManager.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message/TestAvroMessageManager.java?rev=1241943&r1=1241942&r2=1241943&view=diff
==============================================================================
--- incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message/TestAvroMessageManager.java
(original)
+++ incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message/TestAvroMessageManager.java
Wed Feb  8 15:45:16 2012
@@ -9,6 +9,8 @@ import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 import java.util.Random;
 
+import junit.framework.TestCase;
+
 import org.apache.avro.AvroRemoteException;
 import org.apache.avro.ipc.NettyServer;
 import org.apache.avro.ipc.NettyTransceiver;
@@ -23,21 +25,28 @@ import org.apache.hama.bsp.BooleanMessag
 import org.apache.hama.bsp.DoubleMessage;
 import org.apache.hama.bsp.IntegerMessage;
 
-public class TestAvroMessageManager {
+public class TestAvroMessageManager extends TestCase {
 
   private static NettyServer server;
   private static Server hadoopServer;
   private static long start;
 
+  public void compareMessengers() throws Exception {
+    BSPMessageBundle randomBundle = getRandomBundle();
+    testAvro(randomBundle);
+    testHadoop(randomBundle);
+  }
+
   public static final class MessageSender implements Sender {
 
     @Override
     public Void transfer(AvroBSPMessageBundle messagebundle)
         throws AvroRemoteException {
       try {
-        BSPMessageBundle msg = deserializeMessage(messagebundle.data);
+        BSPMessageBundle msg = deserializeMessage(messagebundle.getData());
         System.out.println("Received message in "
-            + (System.currentTimeMillis() - start) + "ms");
+            + (System.currentTimeMillis() - start) + "ms. Size: "
+            + msg.getMessages().size());
       } catch (IOException e) {
         e.printStackTrace();
       }
@@ -86,20 +95,14 @@ public class TestAvroMessageManager {
     return bundle;
   }
 
-  public static final void main(String[] args) throws IOException {
-    BSPMessageBundle randomBundle = getRandomBundle();
-    testAvro(randomBundle);
-    testHadoop(randomBundle);
-  }
-
   private static final void testAvro(BSPMessageBundle bundle)
       throws IOException, AvroRemoteException {
 
     server = new NettyServer(new SpecificResponder(Sender.class,
         new MessageSender()), new InetSocketAddress(13530));
 
-    NettyTransceiver client = new NettyTransceiver(new InetSocketAddress(server
-        .getPort()));
+    NettyTransceiver client = new NettyTransceiver(new InetSocketAddress(
+        server.getPort()));
     Sender proxy = (Sender) SpecificRequestor.getClient(Sender.class, client);
 
     AvroBSPMessageBundle msg = new AvroBSPMessageBundle();



Mime
View raw message