You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ma...@apache.org on 2015/05/25 08:11:41 UTC

[09/11] incubator-kylin git commit: KYLIN-697 non-integration tests passed after merging codes

KYLIN-697 non-integration tests passed after merging codes


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

Branch: refs/heads/new697
Commit: 148576eaaa415e6d0b75d06127c65823595630f5
Parents: 42f124f
Author: honma <ho...@ebay.com>
Authored: Mon May 25 13:19:51 2015 +0800
Committer: honma <ho...@ebay.com>
Committed: Mon May 25 13:19:51 2015 +0800

----------------------------------------------------------------------
 .../kylin/common/restclient/AbstractRestCache.java     |  1 +
 .../kylin/common/restclient/SingleValueCache.java      | 13 ++++++++-----
 .../java/org/apache/kylin/cube/CubeManagerTest.java    |  6 +++---
 .../apache/kylin/rest/service/CacheServiceTest.java    |  1 +
 4 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/148576ea/common/src/main/java/org/apache/kylin/common/restclient/AbstractRestCache.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/kylin/common/restclient/AbstractRestCache.java b/common/src/main/java/org/apache/kylin/common/restclient/AbstractRestCache.java
index d9e98fd..c728ff2 100644
--- a/common/src/main/java/org/apache/kylin/common/restclient/AbstractRestCache.java
+++ b/common/src/main/java/org/apache/kylin/common/restclient/AbstractRestCache.java
@@ -24,6 +24,7 @@ package org.apache.kylin.common.restclient;
  */
 public abstract class AbstractRestCache<K, V> {
 
+
     protected final Broadcaster.TYPE syncType;
 
     protected AbstractRestCache(Broadcaster.TYPE syncType) {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/148576ea/common/src/main/java/org/apache/kylin/common/restclient/SingleValueCache.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/kylin/common/restclient/SingleValueCache.java b/common/src/main/java/org/apache/kylin/common/restclient/SingleValueCache.java
index fb44206..00f8a3e 100644
--- a/common/src/main/java/org/apache/kylin/common/restclient/SingleValueCache.java
+++ b/common/src/main/java/org/apache/kylin/common/restclient/SingleValueCache.java
@@ -43,10 +43,12 @@ public abstract class SingleValueCache<K, V> extends AbstractRestCache<K, V> {
     }
 
     public void put(K key, V value) {
-        //enforce all cache changes coming from REST
-        //final V result = innerCache.put(key, value);
+        boolean exists = innerCache.containsKey(key);
+        //The put operation will be duplicated when REST request is received.
+        //It is intended so because many test cases does not have REST env
+        innerCache.put(key, value);
 
-        if (!innerCache.containsKey(key)) {
+        if (!exists) {
             syncRemote(key, Broadcaster.EVENT.CREATE);
         } else {
             syncRemote(key, Broadcaster.EVENT.UPDATE);
@@ -59,8 +61,9 @@ public abstract class SingleValueCache<K, V> extends AbstractRestCache<K, V> {
 
     public void remove(K key) {
         if (innerCache.containsKey(key)) {
-            //enforce all cache changes coming from REST
-            //innerCache.remove(key);
+            //The remove operation will be duplicated when REST request is received.
+            //It is intended so because many test cases does not have REST env
+            innerCache.remove(key);
             syncRemote(key, Broadcaster.EVENT.DROP);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/148576ea/cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java
----------------------------------------------------------------------
diff --git a/cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java b/cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java
index 8970295..3b0bd3f 100644
--- a/cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java
+++ b/cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java
@@ -18,8 +18,6 @@
 
 package org.apache.kylin.cube;
 
-import static org.junit.Assert.*;
-
 import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.persistence.ResourceStore;
 import org.apache.kylin.common.util.JsonUtil;
@@ -31,6 +29,8 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.*;
+
 /**
  * @author yangli9
  */
@@ -75,7 +75,7 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
 
         assertTrue(prjMgr.listAllRealizations(ProjectInstance.DEFAULT_PROJECT_NAME).contains(createdCube));
 
-        CubeInstance droppedCube = CubeManager.getInstance(getTestConfig()).dropCube("a_whole_new_cube", true);
+        CubeInstance droppedCube = CubeManager.getInstance(getTestConfig()).dropCube("a_whole_new_cube", false);
         assertTrue(createdCube == droppedCube);
 
         assertTrue(!prjMgr.listAllRealizations(ProjectInstance.DEFAULT_PROJECT_NAME).contains(droppedCube));

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/148576ea/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java b/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java
index 9f0598d..795afaf 100644
--- a/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/service/CacheServiceTest.java
@@ -125,6 +125,7 @@ public class CacheServiceTest extends LocalFileMetadataTestCase {
     @Before
     public void setUp() throws Exception {
         counter.set(0L);
+        createTestMetadata();
     }
 
     @After