You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by bi...@apache.org on 2016/12/19 11:23:26 UTC

[03/15] kylin git commit: KYLIN-2283 A new data gen tool for CI

http://git-wip-us.apache.org/repos/asf/kylin/blob/d1175d2c/core-metadata/src/test/java/org/apache/kylin/source/datagen/DataGenTest.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/test/java/org/apache/kylin/source/datagen/DataGenTest.java b/core-metadata/src/test/java/org/apache/kylin/source/datagen/DataGenTest.java
new file mode 100644
index 0000000..82455ab
--- /dev/null
+++ b/core-metadata/src/test/java/org/apache/kylin/source/datagen/DataGenTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.source.datagen;
+
+import java.io.IOException;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.apache.kylin.metadata.MetadataManager;
+import org.apache.kylin.metadata.model.DataModelDesc;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DataGenTest extends LocalFileMetadataTestCase {
+
+    @Before
+    public void setUp() throws Exception {
+        this.createTestMetadata();
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testCIConfigured() throws IOException {
+        DataModelDesc model = getModel("test_kylin_inner_join_model_desc");
+        ModelDataGenerator gen = new ModelDataGenerator(model, 100);
+        gen.outprint = true;
+        
+        gen.generate();
+    }
+
+    @Test
+    public void testSSBNoConfig() throws IOException {
+        DataModelDesc model = getModel("ssb");
+        ModelDataGenerator gen = new ModelDataGenerator(model, 100);
+        gen.outprint = true;
+        
+        gen.generate();
+    }
+
+    private DataModelDesc getModel(String name) {
+        MetadataManager mgr = MetadataManager.getInstance(KylinConfig.getInstanceFromEnv());
+        DataModelDesc model = mgr.getDataModelDesc(name);
+        return model;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/kylin/blob/d1175d2c/examples/test_case_data/localmeta/data/data_gen_config.json
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta/data/data_gen_config.json b/examples/test_case_data/localmeta/data/data_gen_config.json
deleted file mode 100644
index 15b3fd0..0000000
--- a/examples/test_case_data/localmeta/data/data_gen_config.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-  "differentiateBoundary": "2013-07-01",
-  "columnConfigs": [
-    {
-      "columnName": "lstg_format_name",
-      "valueSet": [
-        "FP-GTC",
-        "FP-non GTC",
-        "ABIN",
-        "Auction",
-        "Others"
-      ],
-      "exclusive": true,
-      "differentiateByDateBoundary": true
-    },
-    {
-      "columnName": "BUYER_COUNTRY",
-      "valueSet": [
-        "CN",
-        "DE",
-        "FR",
-        "JP",
-        "UK",
-        "US"
-      ],
-      "exclusive": true
-    },
-    {
-      "columnName": "SELLER_COUNTRY",
-      "valueSet": [
-        "CN",
-        "DE",
-        "FR",
-        "JP",
-        "UK",
-        "US"
-      ],
-      "exclusive": true
-    },
-    {
-      "columnName": "SELLER_ID",
-      "valueSet": [
-        "10000000",
-        "10001000"
-      ],
-      "asRange": true
-    },
-    {
-      "columnName": "ITEM_COUNT",
-      "valueSet": [
-        "0",
-        "2000000"
-      ],
-      "asRange": true
-    },
-    {
-      "columnName": "PRICE",
-      "valueSet": [
-        "0",
-        "1000"
-      ],
-      "asRange": true
-    }
-  ]
-}