updated timeout message
Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/42ad4ab2 Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/42ad4ab2 Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/42ad4ab2 Branch: refs/heads/branch-1.1 Commit: 42ad4ab22c8dfc0fc7cd044470ad47e6d436fc11 Parents: 809d880 Author: kunal642 <kunal.kap...@knoldus.in> Authored: Thu May 25 16:06:39 2017 +0530 Committer: ravipesala <ravi.pes...@gmail.com> Committed: Thu Jun 15 13:26:07 2017 +0530 ---------------------------------------------------------------------- .../client/DictionaryClientHandler.java | 9 ++++++++- .../dictionary/client/DictionaryClientTest.java | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/carbondata/blob/42ad4ab2/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java b/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java index 1ed8b36..9922523 100644 --- a/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java +++ b/core/src/main/java/org/apache/carbondata/core/dictionary/client/DictionaryClientHandler.java @@ -91,7 +91,14 @@ public class DictionaryClientHandler extends ChannelInboundHandlerAdapter { try { dictionaryMessage = responseMsgQueue.poll(100, TimeUnit.SECONDS); if (dictionaryMessage == null) { - throw new RuntimeException("Request timed out for key : " + key); + StringBuilder message = new StringBuilder(); + message.append("DictionaryMessage { ColumnName: ") + .append(key.getColumnName()) + .append(", DictionaryValue: ") + .append(key.getDictionaryValue()) + .append(", type: ") + .append(key.getType()); + throw new RuntimeException("Request timed out for key : " + message); } return dictionaryMessage; } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/carbondata/blob/42ad4ab2/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java b/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java index a96e364..60d3c26 100644 --- a/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java +++ b/core/src/test/java/org/apache/carbondata/core/dictionary/client/DictionaryClientTest.java @@ -19,6 +19,8 @@ package org.apache.carbondata.core.dictionary.client; import java.io.File; import java.util.Arrays; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.dictionary.generator.key.DictionaryMessage; @@ -33,6 +35,8 @@ import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension; import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema; import org.apache.carbondata.core.util.CarbonProperties; +import mockit.Mock; +import mockit.MockUp; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -160,6 +164,22 @@ public class DictionaryClientTest { // Shutdown the server } + @Test public void testToCheckIfCorrectTimeOutExceptionMessageIsThrown() { + new MockUp<LinkedBlockingQueue<DictionaryMessage>>() { + @SuppressWarnings("unused") + @Mock + DictionaryMessage poll(long timeout, TimeUnit unit) throws InterruptedException { + return null; + } + }; + try { + testClient(); + Assert.fail(); + } catch (Exception e) { + Assert.assertFalse(e.getMessage().contains("data")); + } + } + @After public void tearDown() { // Cleanup created files CarbonMetadata.getInstance().removeTable(tableInfo.getTableUniqueName());