You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@griffin.apache.org by gu...@apache.org on 2017/10/31 08:27:17 UTC

incubator-griffin git commit: fix javadoc, hive log error, remove swagger2 and update ut

Repository: incubator-griffin
Updated Branches:
  refs/heads/master 09cc35064 -> 4a998d4ec


fix javadoc,hive log error,remove swagger2 and update ut

Author: ahutsunshine <ah...@gmail.com>

Closes #158 from ahutsunshine/master.


Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/4a998d4e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/4a998d4e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/4a998d4e

Branch: refs/heads/master
Commit: 4a998d4ec1cf89e564292a1b7dd53b130e543ee6
Parents: 09cc350
Author: ahutsunshine <ah...@gmail.com>
Authored: Tue Oct 31 16:26:58 2017 +0800
Committer: William Guo <gu...@icloud.com>
Committed: Tue Oct 31 16:26:58 2017 +0800

----------------------------------------------------------------------
 griffin-doc/postman/griffin.json                |  4 +-
 service/pom.xml                                 | 24 ------
 .../griffin/core/config/SwaggerConfig.java      | 62 ----------------
 .../core/info/GriffinInfoController.java        |  4 -
 .../apache/griffin/core/job/JobController.java  | 25 ++-----
 .../apache/griffin/core/job/JobServiceImpl.java | 20 ++---
 .../apache/griffin/core/job/SparkSubmitJob.java |  2 +-
 .../griffin/core/job/entity/SparkJobDO.java     | 29 --------
 .../griffin/core/job/repo/JobInstanceRepo.java  |  2 +-
 .../griffin/core/login/LoginController.java     |  7 --
 .../griffin/core/measure/MeasureController.java | 22 ++----
 .../core/measure/MeasureOrgController.java      | 29 ++------
 .../griffin/core/measure/MeasureOrgService.java | 32 ++++++++
 .../core/measure/MeasureOrgServiceImpl.java     | 57 +++++++++++++++
 .../griffin/core/measure/entity/DataSource.java |  2 -
 .../metastore/hive/HiveMetaStoreController.java | 22 ++----
 .../hive/HiveMetaStoreServiceImpl.java          | 15 ++--
 .../metastore/kafka/KafkaSchemaController.java  |  4 -
 .../griffin/core/metric/MetricController.java   |  9 +--
 .../core/measure/MeasureOrgControllerTest.java  | 16 ++--
 .../core/measure/MeasureOrgServiceImplTest.java | 77 ++++++++++++++++++++
 21 files changed, 224 insertions(+), 240 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/griffin-doc/postman/griffin.json
----------------------------------------------------------------------
diff --git a/griffin-doc/postman/griffin.json b/griffin-doc/postman/griffin.json
index 40c2a94..f401f09 100644
--- a/griffin-doc/postman/griffin.json
+++ b/griffin-doc/postman/griffin.json
@@ -1027,7 +1027,7 @@
 			"currentHelper": "normal",
 			"helperAttributes": {},
 			"time": 1508998395708,
-			"name": "Get measures by org",
+			"name": "Get measures by owner",
 			"description": "`GET /api/v1/measures/owner/{owner}`\n\n#### Path Variable\n- owner -`required` `String` owner name\n\n#### Request Sample\n\n`/api/v1/measures/owner/test`\n\n#### Response Body Sample\n```\n[\n  {\n    \"name\": \"demo-accu\",\n    \"id\": \"2\"\n  }\n]\n```",
 			"collectionId": "689bb3f2-1c6a-b45e-5409-4df1ef07554c",
 			"responses": [
@@ -1094,7 +1094,7 @@
 					"write": true,
 					"empty": false,
 					"failed": false,
-					"name": "Get measures by org example",
+					"name": "Get measures by owner example",
 					"id": "498dd59c-2bde-9c41-bafa-d1fa85c50ec0",
 					"request": {
 						"url": "{{BASE_PATH}}/api/v1/measures/owner/:owner",

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/pom.xml
----------------------------------------------------------------------
diff --git a/service/pom.xml b/service/pom.xml
index 7aecfe6..b3a42cf 100644
--- a/service/pom.xml
+++ b/service/pom.xml
@@ -102,22 +102,12 @@ under the License.
                     <artifactId>servlet-api</artifactId>
                     <groupId>javax.servlet</groupId>
                 </exclusion>
-                <exclusion>
-                    <artifactId>guava</artifactId>
-                    <groupId>com.google.guava</groupId>
-                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.hive</groupId>
             <artifactId>hive-metastore</artifactId>
             <version>${hive.version}</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>guava</artifactId>
-                    <groupId>com.google.guava</groupId>
-                </exclusion>
-            </exclusions>
         </dependency>
 
         <!-- to access confluent schema registry -->
@@ -176,20 +166,6 @@ under the License.
             <scope>test</scope>
         </dependency>
 
-        <!--swagger-->
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger2</artifactId>
-            <version>2.6.1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger-ui</artifactId>
-            <version>2.6.1</version>
-        </dependency>
-
-
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/config/SwaggerConfig.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/config/SwaggerConfig.java b/service/src/main/java/org/apache/griffin/core/config/SwaggerConfig.java
deleted file mode 100644
index 02d57c1..0000000
--- a/service/src/main/java/org/apache/griffin/core/config/SwaggerConfig.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-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.griffin.core.config;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Predicates;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-@Configuration
-@EnableSwagger2
-public class SwaggerConfig {
-
-    /**
-     * exclude the basic-error-controller from swagger api
-     */
-    @Bean
-    public Docket excludeSwaggerErrorControllerApi() {
-        return new Docket(DocumentationType.SWAGGER_2)
-                .select()
-                .apis(RequestHandlerSelectors.any())
-                .paths(Predicates.not(PathSelectors.regex("/error.*")))
-                .build()
-                .apiInfo(metaData());
-    }
-
-    private ApiInfo metaData(){
-        ApiInfo apiInfo =new ApiInfo(
-                "REST API Document",
-                "Spring Boot REST API for Apache Griffin",
-                "0.1.0",
-                "",
-                new Contact("","",""),
-                "Apache License Version 2.0",
-                "https://www.apache.org/licenses/LICENSE-2.0");
-        return apiInfo;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/info/GriffinInfoController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/info/GriffinInfoController.java b/service/src/main/java/org/apache/griffin/core/info/GriffinInfoController.java
index e460cff..a3d403a 100644
--- a/service/src/main/java/org/apache/griffin/core/info/GriffinInfoController.java
+++ b/service/src/main/java/org/apache/griffin/core/info/GriffinInfoController.java
@@ -19,18 +19,14 @@ under the License.
 
 package org.apache.griffin.core.info;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-@Api(tags = "Basic introduce", description = "griffin version")
 @RestController
 @RequestMapping("/api/v1")
 public class GriffinInfoController {
 
-    @ApiOperation(value = "Get griffin version", response = String.class)
     @RequestMapping(value = "/version", method = RequestMethod.GET)
     public String greeting() {
         return "0.1.0";

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/job/JobController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/job/JobController.java b/service/src/main/java/org/apache/griffin/core/job/JobController.java
index 0e12baf..222006e 100644
--- a/service/src/main/java/org/apache/griffin/core/job/JobController.java
+++ b/service/src/main/java/org/apache/griffin/core/job/JobController.java
@@ -19,9 +19,6 @@ under the License.
 
 package org.apache.griffin.core.job;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
 import org.apache.griffin.core.job.entity.JobHealth;
 import org.apache.griffin.core.job.entity.JobInstance;
 import org.apache.griffin.core.job.entity.JobRequestBody;
@@ -35,7 +32,6 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
-@Api(tags = "Jobs", description = "execute your measure periodically")
 @RestController
 @RequestMapping("/api/v1/jobs")
 public class JobController {
@@ -44,39 +40,28 @@ public class JobController {
     @Autowired
     private JobService jobService;
 
-    @ApiOperation(value = "Get jobs", response = List.class)
     @RequestMapping(value = "", method = RequestMethod.GET)
     public List<Map<String, Serializable>> getJobs() {
         return jobService.getAliveJobs();
     }
 
-    @ApiOperation(value = "Add job", response = GriffinOperationMessage.class)
     @RequestMapping(value = "", method = RequestMethod.POST)
-    public GriffinOperationMessage addJob(@ApiParam(value = "job group name", required = true) @RequestParam("group") String groupName,
-                                          @ApiParam(value = "job name", required = true) @RequestParam("jobName") String jobName,
-                                          @ApiParam(value = "measure id", required = true) @RequestParam("measureId") Long measureId,
-                                          @ApiParam(value = "custom class composed of job key parameters", required = true)
-                                          @RequestBody JobRequestBody jobRequestBody) {
+    public GriffinOperationMessage addJob(@RequestParam("group") String groupName, @RequestParam("jobName") String jobName,
+                                          @RequestParam("measureId") Long measureId, @RequestBody JobRequestBody jobRequestBody) {
         return jobService.addJob(groupName, jobName, measureId, jobRequestBody);
     }
 
-    @ApiOperation(value = "Delete job", response = GriffinOperationMessage.class)
     @RequestMapping(value = "", method = RequestMethod.DELETE)
-    public GriffinOperationMessage deleteJob(@ApiParam(value = "job group name", required = true) @RequestParam("group") String group,
-                                             @ApiParam(value = "job name", required = true) @RequestParam("jobName") String jobName) {
+    public GriffinOperationMessage deleteJob(@RequestParam("group") String group, @RequestParam("jobName") String jobName) {
         return jobService.deleteJob(group, jobName);
     }
 
-    @ApiOperation(value = "Get job instances", response = List.class)
     @RequestMapping(value = "/instances", method = RequestMethod.GET)
-    public List<JobInstance> findInstancesOfJob(@ApiParam(value = "job group name", required = true) @RequestParam("group") String group,
-                                                @ApiParam(value = "job name", required = true) @RequestParam("jobName") String jobName,
-                                                @ApiParam(value = "page you want starting from index 0", required = true) @RequestParam("page") int page,
-                                                @ApiParam(value = "instance number per page", required = true) @RequestParam("size") int size) {
+    public List<JobInstance> findInstancesOfJob(@RequestParam("group") String group, @RequestParam("jobName") String jobName,
+                                                @RequestParam("page") int page, @RequestParam("size") int size) {
         return jobService.findInstancesOfJob(group, jobName, page, size);
     }
 
-    @ApiOperation(value = "Get job healthy statistics", response = JobHealth.class)
     @RequestMapping(value = "/health", method = RequestMethod.GET)
     public JobHealth getHealthInfo() {
         return jobService.getHealthInfo();

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/job/JobServiceImpl.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/job/JobServiceImpl.java b/service/src/main/java/org/apache/griffin/core/job/JobServiceImpl.java
index 251d280..e1aab82 100644
--- a/service/src/main/java/org/apache/griffin/core/job/JobServiceImpl.java
+++ b/service/src/main/java/org/apache/griffin/core/job/JobServiceImpl.java
@@ -241,9 +241,9 @@ public class JobServiceImpl implements JobService {
      * 1. pause these jobs
      * 2. set these jobs as deleted status
      *
-     * @param group
-     * @param name
-     * @return
+     * @param group job group name
+     * @param name job name
+     * @return  custom information
      */
     @Override
     public GriffinOperationMessage deleteJob(String group, String name) {
@@ -260,7 +260,9 @@ public class JobServiceImpl implements JobService {
      * 1. search jobs related to measure
      * 2. deleteJob
      *
-     * @param measure
+     * @param measure measure data quality between source and target dataset
+     * @throws SchedulerException  quartz throws if schedule has problem
+     *
      */
     public void deleteJobsRelateToMeasure(Measure measure) throws SchedulerException {
         Scheduler scheduler = factory.getObject();
@@ -308,11 +310,11 @@ public class JobServiceImpl implements JobService {
         //update all instance info belongs to this group and job.
         List<JobInstance> jobInstanceList = jobInstanceRepo.findByGroupNameAndJobName(group, jobName);
         for (JobInstance jobInstance : jobInstanceList) {
-            if (!LivySessionStates.isActive(jobInstance.getState())) {
-                continue;
+            if (LivySessionStates.isActive(jobInstance.getState())) {
+                String uri = sparkJobProps.getProperty("livy.uri") + "/" + jobInstance.getSessionId();
+                setJobInstanceInfo(jobInstance, uri, group, jobName);
             }
-            String uri = sparkJobProps.getProperty("livy.uri") + "/" + jobInstance.getSessionId();
-            setJobInstanceInfo(jobInstance, uri, group, jobName);
+
         }
     }
 
@@ -355,7 +357,7 @@ public class JobServiceImpl implements JobService {
     /**
      * a job is regard as healthy job when its latest instance is in healthy state.
      *
-     * @return
+     * @return job healthy statistics
      */
     @Override
     public JobHealth getHealthInfo() {

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/job/SparkSubmitJob.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/job/SparkSubmitJob.java b/service/src/main/java/org/apache/griffin/core/job/SparkSubmitJob.java
index 4590fc8..7ae52cc 100644
--- a/service/src/main/java/org/apache/griffin/core/job/SparkSubmitJob.java
+++ b/service/src/main/java/org/apache/griffin/core/job/SparkSubmitJob.java
@@ -80,7 +80,7 @@ public class SparkSubmitJob implements Job {
     /**
      * execute method is used to submit sparkJobDO to Livy.
      *
-     * @param context
+     * @param context Job execution context
      */
     @Override
     public void execute(JobExecutionContext context) {

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/job/entity/SparkJobDO.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/job/entity/SparkJobDO.java b/service/src/main/java/org/apache/griffin/core/job/entity/SparkJobDO.java
index 437cde7..b5925f6 100644
--- a/service/src/main/java/org/apache/griffin/core/job/entity/SparkJobDO.java
+++ b/service/src/main/java/org/apache/griffin/core/job/entity/SparkJobDO.java
@@ -23,35 +23,6 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
-/**
- * SparkJobDO
- * {
- * "file": "hdfs:///griffin/griffin-measure.jar",
- * "className": "org.apache.griffin.measure.batch.Application",
- * "args": [
- * "/benchmark/test/env.json",
- * "{\"name\":\"data_rdm\",\"type\":\"accuracy\",\"source\":{\"type\":\"hive\",\"version\":\"1.2\",\"config\":{\"database\":\"default\",\"table.name\":\"data_rdm\"} },\"target\":{\"type\":\"hive\",\"version\":\"1.2\",\"config\":{\"database\":\"default\",\"table.name\":\"data_rdm\"} },\"evaluateRule\":{\"sampleRatio\":1,\"rules\":\"$source.uage > 100 AND $source.uid = $target.uid AND $source.uage + 12 = $target.uage + 10 + 2 AND $source.udes + 11 = $target.udes + 1 + 1\"} }",
- * "hdfs,raw"
- * ],
- * "name": "griffin-livy",
- * "queue": "default",
- * "numExecutors": 2,
- * "executorCores": 4,
- * "driverMemory": "2g",
- * "executorMemory": "2g",
- * "conf": {
- * "spark.jars.packages": "com.databricks:spark-avro_2.10:2.0.1"
- * },
- * "jars": [
- * "/livy/datanucleus-api-jdo-3.2.6.jar",
- * "/livy/datanucleus-core-3.2.10.jar",
- * "/livy/datanucleus-rdbms-3.2.9.jar"
- * ],
- * "files": [
- * "/livy/hive-site.xml"
- * ]
- * }'
- */
 public class SparkJobDO implements Serializable {
 
     private String file;

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/job/repo/JobInstanceRepo.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/job/repo/JobInstanceRepo.java b/service/src/main/java/org/apache/griffin/core/job/repo/JobInstanceRepo.java
index 392f398..610d282 100644
--- a/service/src/main/java/org/apache/griffin/core/job/repo/JobInstanceRepo.java
+++ b/service/src/main/java/org/apache/griffin/core/job/repo/JobInstanceRepo.java
@@ -34,7 +34,7 @@ public interface JobInstanceRepo extends CrudRepository<JobInstance, Long> {
     /**
      * @param group    is group name
      * @param name     is job name
-     * @param pageable
+     * @param pageable page info
      * @return all job instances scheduled at different time using the same prototype job,
      * the prototype job is determined by SCHED_NAME, group name and job name in table QRTZ_JOB_DETAILS.
      */

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/login/LoginController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/login/LoginController.java b/service/src/main/java/org/apache/griffin/core/login/LoginController.java
index d189f03..511f59e 100644
--- a/service/src/main/java/org/apache/griffin/core/login/LoginController.java
+++ b/service/src/main/java/org/apache/griffin/core/login/LoginController.java
@@ -19,9 +19,6 @@ under the License.
 
 package org.apache.griffin.core.login;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,10 +29,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.List;
 import java.util.Map;
 
-@Api(tags = "Auth", description = "user authentication")
 @RestController
 @RequestMapping("/api/v1/login")
 public class LoginController {
@@ -47,10 +42,8 @@ public class LoginController {
     @Autowired
     private Environment env;
 
-    @ApiOperation(value = "Get all jobs", response = ResponseEntity.class)
     @RequestMapping(value = "/authenticate", method = RequestMethod.POST)
     public ResponseEntity<Map<String, Object>> login(
-            @ApiParam(value = "a map contains user name and password", required = true)
             @RequestBody Map<String, String> map) {
         return loginService.login(map);
     }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java b/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java
index 52ad0a1..fae0169 100644
--- a/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java
+++ b/service/src/main/java/org/apache/griffin/core/measure/MeasureController.java
@@ -19,56 +19,46 @@ under the License.
 
 package org.apache.griffin.core.measure;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
 import org.apache.griffin.core.measure.entity.Measure;
 import org.apache.griffin.core.util.GriffinOperationMessage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
-import java.util.Map;
 
-@Api(tags = "Measures",description = "measure data quality between source and target dataset")
 @RestController
 @RequestMapping(value = "/api/v1")
 public class MeasureController {
     @Autowired
     private MeasureService measureService;
 
-    @ApiOperation(value ="Get measures",response = Iterable.class)
     @RequestMapping(value = "/measures", method = RequestMethod.GET)
     public Iterable<Measure> getAllAliveMeasures() {
         return measureService.getAllAliveMeasures();
     }
 
-    @ApiOperation(value ="Get measure by id",response = Measure.class)
     @RequestMapping(value = "/measure/{id}", method = RequestMethod.GET)
-    public Measure getMeasureById(@ApiParam(value = "measure id", required = true)  @PathVariable("id") long id) {
+    public Measure getMeasureById(@PathVariable("id") long id) {
         return measureService.getMeasureById(id);
     }
 
-    @ApiOperation(value ="Delete measure",response = GriffinOperationMessage.class)
     @RequestMapping(value = "/measure/{id}", method = RequestMethod.DELETE)
-    public GriffinOperationMessage deleteMeasureById(@ApiParam(value = "measure id", required = true) @PathVariable("id") Long id) {
+    public GriffinOperationMessage deleteMeasureById(@PathVariable("id") Long id) {
         return measureService.deleteMeasureById(id);
     }
-    @ApiOperation(value ="Update measure",response = GriffinOperationMessage.class)
+
     @RequestMapping(value = "/measure", method = RequestMethod.PUT)
-    public GriffinOperationMessage updateMeasure(@ApiParam(value = "measure entity", required = true) @RequestBody Measure measure) {
+    public GriffinOperationMessage updateMeasure(@RequestBody Measure measure) {
         return measureService.updateMeasure(measure);
     }
 
-    @ApiOperation(value ="Get measures by org",response = List.class)
     @RequestMapping(value = "/measures/owner/{owner}", method = RequestMethod.GET)
-    public List<Measure> getAliveMeasuresByOwner(@ApiParam(value = "org name", required = true) @PathVariable("owner") String owner) {
+    public List<Measure> getAliveMeasuresByOwner(@PathVariable("owner") String owner) {
         return measureService.getAliveMeasuresByOwner(owner);
     }
 
-    @ApiOperation(value ="Add measure",response = GriffinOperationMessage.class)
     @RequestMapping(value = "/measure", method = RequestMethod.POST)
-    public GriffinOperationMessage createMeasure(@ApiParam(value = "measure entity", required = true) @RequestBody Measure measure) {
+    public GriffinOperationMessage createMeasure(@RequestBody Measure measure) {
         return measureService.createMeasure(measure);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgController.java b/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgController.java
index 5982e0c..499ee8e 100644
--- a/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgController.java
+++ b/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgController.java
@@ -19,54 +19,39 @@ under the License.
 
 package org.apache.griffin.core.measure;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.apache.griffin.core.measure.repo.MeasureRepo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-@Api(tags = "Organization Dimension", description = "measure belongs to")
 @RestController
 @RequestMapping(value = "/api/v1")
 public class MeasureOrgController {
+
     @Autowired
-    private MeasureRepo measureRepo;
+    private MeasureOrgService measureOrgService;
 
-    @ApiOperation(value = "Get orgs for measure", response = List.class)
     @RequestMapping(value = "/org", method = RequestMethod.GET)
     public List<String> getOrgs() {
-        return measureRepo.findOrganizations();
+        return measureOrgService.getOrgs();
     }
 
     /**
-     * @param org
+     * @param org organization name
      * @return list of metric name, and a metric is the result of executing the job sharing the same name with
      * measure.
      */
-    @ApiOperation(value = "Get measure names by org", response = List.class)
     @RequestMapping(value = "/org/{org}", method = RequestMethod.GET)
-    public List<String> getMetricNameListByOrg(@ApiParam(value = "organization name") @PathVariable("org") String org) {
-        return measureRepo.findNameByOrganization(org);
+    public List<String> getMetricNameListByOrg(@PathVariable("org") String org) {
+        return measureOrgService.getMetricNameListByOrg(org);
     }
 
-    @ApiOperation(value = "Get measure names group by org", response = Map.class)
     @RequestMapping(value = "/org/measure/names", method = RequestMethod.GET)
     public Map<String, List<String>> getMeasureNamesGroupByOrg() {
-        Map<String, List<String>> orgWithMetricsMap = new HashMap<>();
-        List<String> orgList = measureRepo.findOrganizations();
-        for (String org : orgList) {
-            if (org != null) {
-                orgWithMetricsMap.put(org, measureRepo.findNameByOrganization(org));
-            }
-        }
-        return orgWithMetricsMap;
+        return measureOrgService.getMeasureNamesGroupByOrg();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgService.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgService.java b/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgService.java
new file mode 100644
index 0000000..8b1eb08
--- /dev/null
+++ b/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgService.java
@@ -0,0 +1,32 @@
+/*
+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.griffin.core.measure;
+
+import java.util.List;
+import java.util.Map;
+
+public interface MeasureOrgService {
+
+    List<String> getOrgs();
+
+    List<String> getMetricNameListByOrg(String org);
+
+    Map<String, List<String>> getMeasureNamesGroupByOrg();
+}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgServiceImpl.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgServiceImpl.java b/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgServiceImpl.java
new file mode 100644
index 0000000..05f8eda
--- /dev/null
+++ b/service/src/main/java/org/apache/griffin/core/measure/MeasureOrgServiceImpl.java
@@ -0,0 +1,57 @@
+/*
+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.griffin.core.measure;
+
+import org.apache.griffin.core.measure.repo.MeasureRepo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class MeasureOrgServiceImpl implements MeasureOrgService {
+
+    @Autowired
+    private MeasureRepo measureRepo;
+
+    @Override
+    public List<String> getOrgs() {
+        return measureRepo.findOrganizations();
+    }
+
+    @Override
+    public List<String> getMetricNameListByOrg(String org) {
+        return measureRepo.findNameByOrganization(org);
+    }
+
+    @Override
+    public Map<String, List<String>> getMeasureNamesGroupByOrg() {
+        Map<String, List<String>> orgWithMetricsMap = new HashMap<>();
+        List<String> orgList = measureRepo.findOrganizations();
+        for (String org : orgList) {
+            if (org != null) {
+                orgWithMetricsMap.put(org, measureRepo.findNameByOrganization(org));
+            }
+        }
+        return orgWithMetricsMap;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/measure/entity/DataSource.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/measure/entity/DataSource.java b/service/src/main/java/org/apache/griffin/core/measure/entity/DataSource.java
index b6097c6..14619cb 100644
--- a/service/src/main/java/org/apache/griffin/core/measure/entity/DataSource.java
+++ b/service/src/main/java/org/apache/griffin/core/measure/entity/DataSource.java
@@ -20,8 +20,6 @@ under the License.
 package org.apache.griffin.core.measure.entity;
 
 
-import io.swagger.annotations.ApiModelProperty;
-
 import javax.persistence.*;
 import java.util.List;
 

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreController.java b/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreController.java
index 6b446e0..bedad79 100644
--- a/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreController.java
+++ b/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreController.java
@@ -19,17 +19,16 @@ under the License.
 package org.apache.griffin.core.metastore.hive;
 
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
 import org.apache.hadoop.hive.metastore.api.Table;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 import java.util.Map;
 
-@Api(tags = "Hive metastore",description = "hive table and database manipulation")
 @RestController
 @RequestMapping("/api/v1/metadata/hive")
 public class HiveMetaStoreController {
@@ -37,36 +36,29 @@ public class HiveMetaStoreController {
     @Autowired
     private HiveMetaStoreService hiveMetaStoreService;
 
-    @ApiOperation(value = "Get database names", response = Iterable.class)
     @RequestMapping(value = "/dbs", method = RequestMethod.GET)
     public Iterable<String> getAllDatabases() {
         return hiveMetaStoreService.getAllDatabases();
     }
 
 
-    @ApiOperation(value = "Get table names", response = Iterable.class)
     @RequestMapping(value = "/tables/names", method = RequestMethod.GET)
-    public Iterable<String> getAllTableNames(@ApiParam(value = "hive db name", required = true) @RequestParam("db") String dbName) {
+    public Iterable<String> getAllTableNames(@RequestParam("db") String dbName) {
         return hiveMetaStoreService.getAllTableNames(dbName);
     }
 
-    @ApiOperation(value = "Get tables metadata", response = List.class)
     @RequestMapping(value = "/tables", method = RequestMethod.GET)
-    public List<Table> getAllTables(@ApiParam(value = "hive db name", required = true) @RequestParam("db") String dbName) {
+    public List<Table> getAllTables(@RequestParam("db") String dbName) {
         return hiveMetaStoreService.getAllTable(dbName);
     }
 
-    @ApiOperation(value = "Get all database tables metadata", response = Map.class)
     @RequestMapping(value = "/dbs/tables", method = RequestMethod.GET)
     public Map<String, List<Table>> getAllTables() {
         return hiveMetaStoreService.getAllTable();
     }
 
-
-    @ApiOperation(value = "Get table metadata", response = Table.class)
     @RequestMapping(value = "/table", method = RequestMethod.GET)
-    public Table getTable(@ApiParam(value = "hive database name", required = true) @RequestParam("db") String dbName,
-                          @ApiParam(value = "hive table name", required = true) @RequestParam("table") String tableName) {
+    public Table getTable(@RequestParam("db") String dbName, @RequestParam("table") String tableName) {
         return hiveMetaStoreService.getTable(dbName, tableName);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImpl.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImpl.java b/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImpl.java
index cc1a599..d5861e7 100644
--- a/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImpl.java
+++ b/service/src/main/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImpl.java
@@ -106,18 +106,17 @@ public class HiveMetaStoreServiceImpl implements HiveMetaStoreService {
     @Cacheable(key = "#root.methodName")
     public Map<String, List<Table>> getAllTable() {
         Map<String, List<Table>> results = new HashMap<>();
-        Iterable<String> dbs = null;
+        Iterable<String> dbs;
         // if hive.metastore.uris in application.properties configs wrong, client will be injected failure and will be null.
-        if (client != null) {
-            dbs = getAllDatabases();
+        if (client == null) {
             LOGGER.error("hive client is null.Please check your hive config.");
-        }
-        //MetaException happens
-        if (dbs == null) {
             return results;
         }
-        for (String db : dbs) {
-            results.put(db, getTables(db));
+        dbs = getAllDatabases();
+        if (dbs != null) {
+            for (String db : dbs) {
+                results.put(db, getTables(db));
+            }
         }
         return results;
     }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/metastore/kafka/KafkaSchemaController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/metastore/kafka/KafkaSchemaController.java b/service/src/main/java/org/apache/griffin/core/metastore/kafka/KafkaSchemaController.java
index 0ef6159..acff59b 100644
--- a/service/src/main/java/org/apache/griffin/core/metastore/kafka/KafkaSchemaController.java
+++ b/service/src/main/java/org/apache/griffin/core/metastore/kafka/KafkaSchemaController.java
@@ -22,13 +22,9 @@ package org.apache.griffin.core.metastore.kafka;
 import io.confluent.kafka.schemaregistry.client.rest.entities.Config;
 import io.confluent.kafka.schemaregistry.client.rest.entities.Schema;
 import io.confluent.kafka.schemaregistry.client.rest.entities.SchemaString;
-import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
 
-@Api(tags = "Kafka metastore")
-@ApiIgnore
 @RestController
 @RequestMapping("/api/v1/metadata/kafka")
 public class KafkaSchemaController {

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/main/java/org/apache/griffin/core/metric/MetricController.java
----------------------------------------------------------------------
diff --git a/service/src/main/java/org/apache/griffin/core/metric/MetricController.java b/service/src/main/java/org/apache/griffin/core/metric/MetricController.java
index 1b3c3d5..f4b97c4 100644
--- a/service/src/main/java/org/apache/griffin/core/metric/MetricController.java
+++ b/service/src/main/java/org/apache/griffin/core/metric/MetricController.java
@@ -19,8 +19,6 @@ under the License.
 
 package org.apache.griffin.core.metric;
 
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,23 +26,20 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.annotations.ApiIgnore;
 
 /**
  * In griffin, metricName usually equals to measureName, and we only save measureName in server.
  */
 
-@ApiIgnore
 @RestController
 @RequestMapping("/api/v1/metrics")
 public class MetricController {
     private static final Logger LOGGER = LoggerFactory.getLogger(MetricController.class);
     @Autowired
-    MetricService metricService;
+    private MetricService metricService;
 
-    @ApiOperation(value = "Get org by measure name", response = String.class)
     @RequestMapping(value = "/org", method = RequestMethod.GET)
-    public String getOrgByMeasureName(@ApiParam(value = "measure name", required = true) @RequestParam("measureName") String measureName) {
+    public String getOrgByMeasureName(@RequestParam("measureName") String measureName) {
         return metricService.getOrgByMeasureName(measureName);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgControllerTest.java
----------------------------------------------------------------------
diff --git a/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgControllerTest.java b/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgControllerTest.java
index 33a2ede..17e7e85 100644
--- a/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgControllerTest.java
+++ b/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgControllerTest.java
@@ -19,7 +19,6 @@ under the License.
 
 package org.apache.griffin.core.measure;
 
-import org.apache.griffin.core.measure.repo.MeasureRepo;
 import org.apache.griffin.core.util.URLHelper;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -30,7 +29,9 @@ import org.springframework.test.context.junit4.SpringRunner;
 import org.springframework.test.web.servlet.MockMvc;
 
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.Matchers.hasSize;
@@ -47,13 +48,13 @@ public class MeasureOrgControllerTest {
     private MockMvc mockMvc;
 
     @MockBean
-    private MeasureRepo measureRepo;
+    private MeasureOrgService measureOrgService;
 
 
     @Test
     public void testGetOrgs() throws Exception {
         String org = "orgName";
-        when(measureRepo.findOrganizations()).thenReturn(Arrays.asList(org));
+        when(measureOrgService.getOrgs()).thenReturn(Arrays.asList(org));
 
         mockMvc.perform(get(URLHelper.API_VERSION_PATH + "/org"))
                 .andExpect(status().isOk())
@@ -63,7 +64,7 @@ public class MeasureOrgControllerTest {
     @Test
     public void testGetMetricNameListByOrg() throws Exception {
         String org = "hadoop";
-        when(measureRepo.findNameByOrganization(org)).thenReturn(Arrays.asList(org));
+        when(measureOrgService.getMetricNameListByOrg(org)).thenReturn(Arrays.asList(org));
 
         mockMvc.perform(get(URLHelper.API_VERSION_PATH + "/org/{org}", org))
                 .andExpect(status().isOk())
@@ -72,9 +73,10 @@ public class MeasureOrgControllerTest {
 
     @Test
     public void testGetMeasureNamesGroupByOrg() throws Exception {
-        List<String> orgs = Arrays.asList("orgName");
-        when(measureRepo.findOrganizations()).thenReturn(orgs);
-        when(measureRepo.findNameByOrganization(orgs.get(0))).thenReturn(Arrays.asList("measureName"));
+        List<String> measures = Arrays.asList("measureName");
+        Map<String, List<String>> map = new HashMap<>();
+        map.put("orgName", measures);
+        when(measureOrgService.getMeasureNamesGroupByOrg()).thenReturn(map);
 
         mockMvc.perform(get(URLHelper.API_VERSION_PATH + "/org/measure/names"))
                 .andExpect(status().isOk())

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4a998d4e/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgServiceImplTest.java
----------------------------------------------------------------------
diff --git a/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgServiceImplTest.java b/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgServiceImplTest.java
new file mode 100644
index 0000000..d55121b
--- /dev/null
+++ b/service/src/test/java/org/apache/griffin/core/measure/MeasureOrgServiceImplTest.java
@@ -0,0 +1,77 @@
+/*
+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.griffin.core.measure;
+
+
+import org.apache.griffin.core.measure.repo.MeasureRepo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.when;
+
+@RunWith(SpringRunner.class)
+public class MeasureOrgServiceImplTest {
+
+    @InjectMocks
+    private MeasureOrgServiceImpl service;
+
+    @Mock
+    private MeasureRepo measureRepo;
+
+    @Test
+    public void testGetOrgs(){
+        String orgName = "orgName";
+        given(measureRepo.findOrganizations()).willReturn(Arrays.asList(orgName));
+        List<String> orgs =service.getOrgs();
+        assertThat(orgs.size()).isEqualTo(1);
+        assertThat(orgs.get(0)).isEqualTo(orgName);
+    }
+
+    @Test
+    public void testGetMetricNameListByOrg(){
+        String orgName = "orgName";
+        String measureName = "measureName";
+        given(measureRepo.findNameByOrganization(orgName)).willReturn(Arrays.asList(measureName));
+        List<String> measureNames=service.getMetricNameListByOrg(orgName);
+        assertThat(measureNames.size()).isEqualTo(1);
+        assertThat(measureNames.get(0)).isEqualTo(measureName);
+    }
+
+    @Test
+    public void testGetMeasureNamesGroupByOrg(){
+        List<String> orgs = Arrays.asList("orgName");
+        when(measureRepo.findOrganizations()).thenReturn(orgs);
+        when(measureRepo.findNameByOrganization(orgs.get(0))).thenReturn(Arrays.asList("measureName"));
+
+        Map<String,List<String>> map = service.getMeasureNamesGroupByOrg();
+        assertThat(map.size()).isEqualTo(1);
+
+    }
+
+}
\ No newline at end of file