Repository: incubator-griffin
Updated Branches:
  refs/heads/master 9c586ee68 -> e7e4c3a76


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/e7e4c3a7/service/src/test/java/org/apache/griffin/core/measure/repo/MeasureRepoTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/measure/repo/MeasureRepoTest.java
 
b/service/src/test/java/org/apache/griffin/core/measure/repo/MeasureRepoTest.java
index f6b8725..4052630 100644
--- 
a/service/src/test/java/org/apache/griffin/core/measure/repo/MeasureRepoTest.java
+++ 
b/service/src/test/java/org/apache/griffin/core/measure/repo/MeasureRepoTest.java
@@ -1,85 +1,85 @@
-/*
-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.repo;
-
-import org.apache.griffin.core.measure.entity.Measure;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
-import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.util.List;
-
-import static 
org.apache.griffin.core.measure.MeasureTestHelper.createATestMeasure;
-import static org.assertj.core.api.Assertions.assertThat;
-
-@RunWith(SpringRunner.class)
-@DataJpaTest
-public class MeasureRepoTest {
-
-    @Autowired
-    private TestEntityManager entityManager;
-
-    @Autowired
-    private MeasureRepo measureRepo;
-
-    @Before
-    public void setup() throws Exception {
-        entityManager.clear();
-        entityManager.flush();
-        setEntityManager();
-    }
-
-    @Test
-    public void testFindAllOrganizations() {
-        List<String> orgs = measureRepo.findOrganizations(false);
-        assertThat(orgs.size()).isEqualTo(3);
-    }
-
-
-    @Test
-    public void testFindNameByOrganization() {
-        List<String> orgs = measureRepo.findNameByOrganization("org1",false);
-        assertThat(orgs.size()).isEqualTo(1);
-        assertThat(orgs.get(0)).isEqualToIgnoringCase("m1");
-
-    }
-
-    @Test
-    public void testFindOrgByName() {
-        String org = measureRepo.findOrgByName("m2");
-        assertThat(org).isEqualTo("org2");
-    }
-
-
-    public void setEntityManager() throws Exception {
-        Measure measure = createATestMeasure("m1", "org1");
-        entityManager.persistAndFlush(measure);
-
-        Measure measure2 = createATestMeasure("m2", "org2");
-        entityManager.persistAndFlush(measure2);
-
-        Measure measure3 = createATestMeasure("m3", "org3");
-        entityManager.persistAndFlush(measure3);
-    }
-}
+///*
+//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.repo;
+//
+//import org.apache.griffin.core.measure.entity.Measure;
+//import org.junit.Before;
+//import org.junit.Test;
+//import org.junit.runner.RunWith;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+//import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
+//import org.springframework.test.context.junit4.SpringRunner;
+//
+//import java.util.List;
+//
+//import static 
org.apache.griffin.core.measure.MeasureTestHelper.createATestGriffinMeasure;
+//import static org.assertj.core.api.Assertions.assertThat;
+//
+//@RunWith(SpringRunner.class)
+//@DataJpaTest
+//public class MeasureRepoTest {
+//
+//    @Autowired
+//    private TestEntityManager entityManager;
+//
+//    @Autowired
+//    private MeasureRepo measureRepo;
+//
+//    @Before
+//    public void setup() throws Exception {
+//        entityManager.clear();
+//        entityManager.flush();
+//        setEntityManager();
+//    }
+//
+//    @Test
+//    public void testFindAllOrganizations() {
+//        List<String> orgs = measureRepo.findOrganizations(false);
+//        assertThat(orgs.size()).isEqualTo(3);
+//    }
+//
+//
+//    @Test
+//    public void testFindNameByOrganization() {
+//        List<String> orgs = measureRepo.findNameByOrganization("org1",false);
+//        assertThat(orgs.size()).isEqualTo(1);
+//        assertThat(orgs.get(0)).isEqualToIgnoringCase("m1");
+//
+//    }
+//
+//    @Test
+//    public void testFindOrgByName() {
+//        String org = measureRepo.findOrgByName("m2");
+//        assertThat(org).isEqualTo("org2");
+//    }
+//
+//
+//    public void setEntityManager() throws Exception {
+//        Measure measure = createATestGriffinMeasure("m1", "org1");
+//        entityManager.persistAndFlush(measure);
+//
+//        Measure measure2 = createATestGriffinMeasure("m2", "org2");
+//        entityManager.persistAndFlush(measure2);
+//
+//        Measure measure3 = createATestGriffinMeasure("m3", "org3");
+//        entityManager.persistAndFlush(measure3);
+//    }
+//}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/e7e4c3a7/service/src/test/java/org/apache/griffin/core/metric/MetricControllerTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/metric/MetricControllerTest.java
 
b/service/src/test/java/org/apache/griffin/core/metric/MetricControllerTest.java
deleted file mode 100644
index 0e521ba..0000000
--- 
a/service/src/test/java/org/apache/griffin/core/metric/MetricControllerTest.java
+++ /dev/null
@@ -1,65 +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.metric;
-
-import org.apache.griffin.core.util.URLHelper;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.test.web.servlet.MockMvc;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.mockito.BDDMockito.given;
-import static 
org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static 
org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
-import static 
org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-
-@RunWith(SpringRunner.class)
-@WebMvcTest(value = MetricController.class, secure = false)
-public class MetricControllerTest {
-
-    @Autowired
-    private MockMvc mvc;
-
-    @MockBean
-    private MetricService service;
-
-    @Before
-    public void setup() {
-    }
-
-
-    @Test
-    public void testGetOrgByMeasureName() throws Exception {
-        String measureName = "default";
-        String org = "test";
-        given(service.getOrgByMeasureName(measureName)).willReturn(org);
-
-        mvc.perform(get(URLHelper.API_VERSION_PATH + 
"/metrics/org").param("measureName", measureName))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$", is(org)));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/e7e4c3a7/service/src/test/java/org/apache/griffin/core/metric/MetricServiceImplTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/metric/MetricServiceImplTest.java
 
b/service/src/test/java/org/apache/griffin/core/metric/MetricServiceImplTest.java
deleted file mode 100644
index 041e289..0000000
--- 
a/service/src/test/java/org/apache/griffin/core/metric/MetricServiceImplTest.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.metric;
-
-import org.apache.griffin.core.measure.repo.MeasureRepo;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.TestConfiguration;
-import org.springframework.boot.test.mock.mockito.MockBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.BDDMockito.given;
-
-@RunWith(SpringRunner.class)
-public class MetricServiceImplTest {
-    @TestConfiguration
-    static class MetricServiceConfiguration {
-        @Bean
-        public MetricServiceImpl service() {
-            return new MetricServiceImpl();
-        }
-    }
-
-    @MockBean
-    private MeasureRepo measureRepo;
-
-    @Autowired
-    private MetricServiceImpl service;
-
-    @Before
-    public void setup() {
-    }
-
-    @Test
-    public void testGetOrgByMeasureName() {
-        String measureName = "default";
-        String org = "test";
-        given(measureRepo.findOrgByName("default")).willReturn(org);
-        assertEquals(service.getOrgByMeasureName(measureName), org);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/e7e4c3a7/service/src/test/java/org/apache/griffin/core/util/GriffinUtilTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/util/GriffinUtilTest.java 
b/service/src/test/java/org/apache/griffin/core/util/GriffinUtilTest.java
index 192206a..f1563d1 100644
--- a/service/src/test/java/org/apache/griffin/core/util/GriffinUtilTest.java
+++ b/service/src/test/java/org/apache/griffin/core/util/GriffinUtilTest.java
@@ -19,10 +19,12 @@ under the License.
 
 package org.apache.griffin.core.util;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import org.apache.griffin.core.job.entity.JobHealth;
 import org.junit.Before;
 import org.junit.Test;
+import org.springframework.core.io.ClassPathResource;
 
 import java.io.IOException;
 import java.util.HashMap;
@@ -38,7 +40,7 @@ public class GriffinUtilTest {
     }
 
     @Test
-    public void testToJson() {
+    public void testToJson() throws JsonProcessingException {
         JobHealth jobHealth = new JobHealth(5, 10);
         String jobHealthStr = JsonUtil.toJson(jobHealth);
         System.out.println(jobHealthStr);
@@ -64,18 +66,20 @@ public class GriffinUtilTest {
 
     @Test
     public void testGetPropertiesForSuccess() {
-        Properties properties = 
PropertiesUtil.getProperties("/quartz.properties");
+        String path = "/quartz.properties";
+        Properties properties = PropertiesUtil.getProperties(path, new 
ClassPathResource(path));
         assertEquals(properties.get("org.quartz.jobStore.isClustered"), 
"true");
     }
 
     @Test
     public void testGetPropertiesForFailWithWrongPath() {
-        Properties properties = 
PropertiesUtil.getProperties(".././quartz.properties");
+        String path = ".././quartz.properties";
+        Properties properties = PropertiesUtil.getProperties(path, new 
ClassPathResource(path));
         assertEquals(properties, null);
     }
 
     @Test
-    public void testToJsonWithFormat() {
+    public void testToJsonWithFormat() throws JsonProcessingException {
         JobHealth jobHealth = new JobHealth(5, 10);
         String jobHealthStr = JsonUtil.toJsonWithFormat(jobHealth);
         System.out.println(jobHealthStr);

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/e7e4c3a7/service/src/test/java/org/apache/griffin/core/util/TimeUtilTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/util/TimeUtilTest.java 
b/service/src/test/java/org/apache/griffin/core/util/TimeUtilTest.java
new file mode 100644
index 0000000..02c7320
--- /dev/null
+++ b/service/src/test/java/org/apache/griffin/core/util/TimeUtilTest.java
@@ -0,0 +1,27 @@
+/*
+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.util;
+
+import org.junit.Test;
+
+public class TimeUtilTest {
+
+
+}
\ No newline at end of file

Reply via email to