kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lid...@apache.org
Subject [01/50] [abbrv] kylin git commit: KYLIN-1550 Update unittests [Forced Update!]
Date Fri, 22 Apr 2016 04:11:30 GMT
Repository: kylin
Updated Branches:
  refs/heads/1.5.x-HBase1.1.3 9125d148e -> c68689907 (forced update)


KYLIN-1550 Update unittests


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

Branch: refs/heads/1.5.x-HBase1.1.3
Commit: c7d4449b8a61dbf7879a9034d4cddb44bf8103da
Parents: cfb3c44
Author: lidongsjtu <lidong@apache.org>
Authored: Wed Mar 30 21:56:33 2016 +0800
Committer: lidongsjtu <lidong@apache.org>
Committed: Wed Mar 30 21:59:11 2016 +0800

----------------------------------------------------------------------
 build/bin/metastore.sh                                |  4 ++--
 .../apache/kylin/metadata/badquery/BadQueryEntry.java |  8 +++++++-
 .../metadata/badquery/BadQueryHistoryManagerTest.java | 14 +++++++-------
 .../kylin/rest/service/BadQueryDetectorTest.java      |  6 +++---
 4 files changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/c7d4449b/build/bin/metastore.sh
----------------------------------------------------------------------
diff --git a/build/bin/metastore.sh b/build/bin/metastore.sh
index 8908351..7573270 100755
--- a/build/bin/metastore.sh
+++ b/build/bin/metastore.sh
@@ -18,9 +18,9 @@
 #
 
 # This script is for production metadata store manipulation
-# It is desinged to run in hadoop CLI, both in sandbox or in real hadoop environment
+# It is designed to run in hadoop CLI, both in sandbox or in real hadoop environment
 #
-# If you're a developper of Kylin and want to download sandbox's metadata into your dev machine,
+# If you're a developer of Kylin and want to download sandbox's metadata into your dev machine,
 # take a look at SandboxMetastoreCLI
 
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/c7d4449b/core-metadata/src/main/java/org/apache/kylin/metadata/badquery/BadQueryEntry.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/badquery/BadQueryEntry.java
b/core-metadata/src/main/java/org/apache/kylin/metadata/badquery/BadQueryEntry.java
index 658cc0a..8a21e9c 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/badquery/BadQueryEntry.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/badquery/BadQueryEntry.java
@@ -19,6 +19,7 @@
 package org.apache.kylin.metadata.badquery;
 
 import org.apache.kylin.common.persistence.RootPersistentEntity;
+import org.apache.kylin.common.util.DateFormat;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -91,6 +92,11 @@ public class BadQueryEntry extends RootPersistentEntity implements Comparable<Ba
 
     @Override
     public int compareTo(BadQueryEntry obj) {
-        return (int) (this.startTime - obj.startTime);
+        return this.startTime >= obj.startTime ? 1 : -1;
+    }
+
+    @Override
+    public String toString() {
+        return "BadQueryEntry [ adj=" + adj + ", server=" + server + ", startTime=" + DateFormat.formatToTimeStr(startTime)
+ "]";
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/c7d4449b/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
b/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
index 28b1805..f37908b 100644
--- a/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
+++ b/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
@@ -18,6 +18,8 @@
 
 package org.apache.kylin.metadata.badquery;
 
+import static org.junit.Assert.*;
+
 import java.io.IOException;
 import java.util.NavigableSet;
 
@@ -28,8 +30,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
-
 public class BadQueryHistoryManagerTest extends LocalFileMetadataTestCase {
     @Before
     public void setUp() throws Exception {
@@ -63,22 +63,22 @@ public class BadQueryHistoryManagerTest extends LocalFileMetadataTestCase
{
     public void testAddEntryToProject() throws IOException {
         KylinConfig kylinConfig = getTestConfig();
         BadQueryHistoryManager manager = BadQueryHistoryManager.getInstance(kylinConfig);
-        BadQueryHistory history = manager.addEntryToProject("sql", "adj", 123, "server",
"t-0", "default");
-
+        BadQueryHistory history = manager.addEntryToProject("sql", "adj", 1459362239992L,
"server", "t-0", "default");
         NavigableSet<BadQueryEntry> entries = history.getEntries();
         assertEquals(3, entries.size());
 
         BadQueryEntry newEntry = entries.last();
+
+        System.out.println(newEntry);
         assertEquals("sql", newEntry.getSql());
         assertEquals("adj", newEntry.getAdj());
-        assertEquals(123, newEntry.getStartTime());
+        assertEquals(1459362239992L, newEntry.getStartTime());
         assertEquals("server", newEntry.getServer());
         assertEquals("t-0", newEntry.getThread());
 
         for (int i = 0; i < kylinConfig.getBadQueryHistoryNum(); i++) {
-            history = manager.addEntryToProject("sql", "adj", 123 + i + 1, "server", "t-0",
"default");
+            history = manager.addEntryToProject("sql", "adj", 1459362239993L + i, "server",
"t-0", "default");
         }
-
         assertEquals(kylinConfig.getBadQueryHistoryNum(), history.getEntries().size());
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/c7d4449b/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java
b/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java
index d4223a8..d09d297 100644
--- a/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/service/BadQueryDetectorTest.java
@@ -34,12 +34,12 @@ public class BadQueryDetectorTest extends LocalFileMetadataTestCase {
     public void before() {
         super.createTestMetadata();
     }
-    
+
     @After
     public void after() {
         super.cleanupTestMetadata();
     }
-    
+
     @SuppressWarnings("deprecation")
     @Test
     public void test() throws InterruptedException {
@@ -59,7 +59,7 @@ public class BadQueryDetectorTest extends LocalFileMetadataTestCase {
 
         {
             Thread.sleep(1000);
-            
+
             SQLRequest sqlRequest = new SQLRequest();
             sqlRequest.setSql(mockSql);
             badQueryDetector.queryStart(Thread.currentThread(), sqlRequest);


Mime
View raw message