tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject git commit: TAJO-719: JUnit test failures. (jinho)
Date Sat, 29 Mar 2014 07:40:39 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 85b38348f -> bbbf21dc1


TAJO-719: JUnit test failures. (jinho)


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/bbbf21dc
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/bbbf21dc
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/bbbf21dc

Branch: refs/heads/master
Commit: bbbf21dc1b8383d0ddf842887aa656b171ce6463
Parents: 85b3834
Author: jinossy <jinossy@gmail.com>
Authored: Sat Mar 29 16:39:51 2014 +0900
Committer: jinossy <jinossy@gmail.com>
Committed: Sat Mar 29 16:39:51 2014 +0900

----------------------------------------------------------------------
 CHANGES.txt                                         |  2 ++
 .../tajo/master/querymaster/QueryInProgress.java    |  4 ++--
 .../java/org/apache/tajo/rpc/NettyClientBase.java   |  4 ++++
 .../test/java/org/apache/tajo/rpc/TestAsyncRpc.java | 16 ++++++++++++++++
 .../java/org/apache/tajo/rpc/TestBlockingRpc.java   | 13 +++++++++++++
 5 files changed, 37 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/bbbf21dc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ac4d325..a4efd4e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -292,6 +292,8 @@ Release 0.8.0 - unreleased
 
   BUG FIXES
 
+    TAJO-719: JUnit test failures. (jinho)
+
     TAJO-713: Missing INET4 in UniformRangePartition. (jihoon)
 
     TAJO-718: A group-by clause with the same columns but aliased causes

http://git-wip-us.apache.org/repos/asf/tajo/blob/bbbf21dc/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryInProgress.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryInProgress.java
b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryInProgress.java
index b8f312e..de323cd 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryInProgress.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryInProgress.java
@@ -206,8 +206,8 @@ public class QueryInProgress extends CompositeService {
   }
 
   private void connectQueryMaster() throws Exception {
-    InetSocketAddress addr = NetUtils.createSocketAddr(
-        queryInfo.getQueryMasterHost() + ":" + queryInfo.getQueryMasterPort());
+    InetSocketAddress addr = NetUtils.createSocketAddrForHost(
+        queryInfo.getQueryMasterHost(), queryInfo.getQueryMasterPort());
     LOG.info("Connect to QueryMaster:" + addr);
     queryMasterRpc =
         RpcConnectionPool.getPool((TajoConf) getConfig()).getConnection(addr, QueryMasterProtocol.class,
true);

http://git-wip-us.apache.org/repos/asf/tajo/blob/bbbf21dc/tajo-rpc/src/main/java/org/apache/tajo/rpc/NettyClientBase.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/src/main/java/org/apache/tajo/rpc/NettyClientBase.java b/tajo-rpc/src/main/java/org/apache/tajo/rpc/NettyClientBase.java
index 60d3aa6..8f49e17 100644
--- a/tajo-rpc/src/main/java/org/apache/tajo/rpc/NettyClientBase.java
+++ b/tajo-rpc/src/main/java/org/apache/tajo/rpc/NettyClientBase.java
@@ -20,6 +20,7 @@ package org.apache.tajo.rpc;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.tajo.util.NetUtils;
 import org.jboss.netty.bootstrap.ClientBootstrap;
 import org.jboss.netty.channel.Channel;
 import org.jboss.netty.channel.ChannelFuture;
@@ -63,6 +64,9 @@ public abstract class NettyClientBase implements Closeable {
   }
 
   public void connect(InetSocketAddress addr) {
+    if(addr.isUnresolved()){
+       addr = NetUtils.createSocketAddr(addr.getHostName(), addr.getPort());
+    }
     this.channelFuture = bootstrap.connect(addr);
     this.channelFuture.awaitUninterruptibly();
     if (!channelFuture.isSuccess()) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/bbbf21dc/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java b/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
index 97bc28d..0e2db45 100644
--- a/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
+++ b/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
@@ -162,4 +162,20 @@ public class TestAsyncRpc {
     assertTrue(future.getController().failed());
     assertTrue(future.getController().errorText() != null);
   }
+
+  @Test
+  public void testUnresolvedAddress() throws Exception {
+    String hostAndPort = NetUtils.normalizeInetSocketAddress(server.getListenAddress());
+    AsyncRpcClient client = new AsyncRpcClient(DummyProtocol.class, NetUtils.createUnresolved(hostAndPort));
+    Interface stub = client.getStub();
+    EchoMessage echoMessage = EchoMessage.newBuilder()
+        .setMessage(MESSAGE).build();
+    CallFuture<EchoMessage> future = new CallFuture<EchoMessage>();
+    stub.deley(null, echoMessage, future);
+
+    assertFalse(future.isDone());
+    assertEquals(future.get(), echoMessage);
+    assertTrue(future.isDone());
+    client.close();
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bbbf21dc/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java b/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
index dedd96e..fe8685a 100644
--- a/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
+++ b/tajo-rpc/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
@@ -174,4 +174,17 @@ public class TestBlockingRpc {
       fail(error.toString());
     }
   }
+
+  @Test
+  public void testUnresolvedAddress() throws Exception {
+    String hostAndPort = NetUtils.normalizeInetSocketAddress(server.getListenAddress());
+    BlockingRpcClient client = new BlockingRpcClient(DummyProtocol.class, NetUtils.createUnresolved(hostAndPort));
+    BlockingInterface stub = client.getStub();
+
+    EchoMessage message = EchoMessage.newBuilder()
+        .setMessage(MESSAGE).build();
+    EchoMessage response2 = stub.echo(null, message);
+    assertEquals(MESSAGE, response2.getMessage());
+    client.close();
+  }
 }
\ No newline at end of file


Mime
View raw message