kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [22/50] [abbrv] kylin git commit: Minor, fix model draft not listed
Date Sun, 04 Feb 2018 00:51:25 GMT
Minor, fix model draft not listed


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

Branch: refs/heads/sync
Commit: 67f7197b849249df65d79bf3ec3ca090c0bb50a9
Parents: cc130e9
Author: nichunen <chunen.ni@kyligence.io>
Authored: Fri Jan 5 17:05:41 2018 +0800
Committer: Li Yang <liyang@apache.org>
Committed: Fri Jan 26 22:54:58 2018 +0800

----------------------------------------------------------------------
 .../apache/kylin/rest/service/ModelService.java   |  2 +-
 .../kylin/rest/service/ModelServiceTest.java      | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/67f7197b/server-base/src/main/java/org/apache/kylin/rest/service/ModelService.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/ModelService.java b/server-base/src/main/java/org/apache/kylin/rest/service/ModelService.java
index 43ce0b1..ee01f3e 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/ModelService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/ModelService.java
@@ -413,7 +413,7 @@ public class ModelService extends BasicService {
             RootPersistentEntity e = d.getEntity();
             if (e instanceof DataModelDesc) {
                 DataModelDesc m = (DataModelDesc) e;
-                if (modelName == null || modelName.equals(m.getName()))
+                if (StringUtils.isEmpty(modelName) || modelName.equals(m.getName()))
                     result.add(d);
             }
         }

http://git-wip-us.apache.org/repos/asf/kylin/blob/67f7197b/server/src/test/java/org/apache/kylin/rest/service/ModelServiceTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/service/ModelServiceTest.java b/server/src/test/java/org/apache/kylin/rest/service/ModelServiceTest.java
index fff4ed9..aeb6d79 100644
--- a/server/src/test/java/org/apache/kylin/rest/service/ModelServiceTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/service/ModelServiceTest.java
@@ -27,6 +27,8 @@ import java.util.List;
 
 import org.apache.kylin.common.persistence.Serializer;
 import org.apache.kylin.job.exception.JobException;
+import org.apache.kylin.metadata.draft.Draft;
+import org.apache.kylin.metadata.draft.DraftManager;
 import org.apache.kylin.metadata.model.DataModelDesc;
 import org.apache.kylin.metadata.model.ModelDimensionDesc;
 import org.junit.Assert;
@@ -132,6 +134,22 @@ public class ModelServiceTest extends ServiceTestBase {
         }
     }
 
+    @Test
+    public void testModelDraft() throws IOException {
+        DraftManager mgr = DraftManager.getInstance(getTestConfig());
+        // Create a draft of model
+        Draft d = new Draft();
+        d.setProject("default");
+        d.updateRandomUuid();
+        DataModelDesc modelDesc = modelService.getModel("ci_left_join_model", "default");
+        d.setEntity(modelDesc);
+        mgr.save(d);
+
+        // Check list draft
+        List<Draft> draftList = modelService.listModelDrafts("", "default");
+        Assert.assertEquals(draftList.size(), 1);
+    }
+
 
     private String[] cutItems(String[] origin, int count) {
         if (origin == null)


Mime
View raw message