Repository: incubator-griffin
Updated Branches:
  refs/heads/master 9ae78689c -> 4aab9d533


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/service/src/test/java/org/apache/griffin/core/job/JobServiceImplTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/job/JobServiceImplTest.java 
b/service/src/test/java/org/apache/griffin/core/job/JobServiceImplTest.java
index 3e6eab0..1d2f0f5 100644
--- a/service/src/test/java/org/apache/griffin/core/job/JobServiceImplTest.java
+++ b/service/src/test/java/org/apache/griffin/core/job/JobServiceImplTest.java
@@ -47,6 +47,8 @@ import org.springframework.web.client.RestTemplate;
 
 import java.util.*;
 
+import static org.apache.griffin.core.job.entity.LivySessionStates.State;
+import static org.apache.griffin.core.job.entity.LivySessionStates.State.*;
 import static org.apache.griffin.core.util.EntityHelper.*;
 import static org.junit.Assert.assertEquals;
 import static org.mockito.BDDMockito.given;
@@ -57,12 +59,12 @@ public class JobServiceImplTest {
 
     @TestConfiguration
     public static class SchedulerServiceConfiguration {
-        @Bean
+        @Bean("jobServiceImpl")
         public JobServiceImpl service() {
             return new JobServiceImpl();
         }
 
-        @Bean
+        @Bean(name = "schedulerFactoryBean")
         public SchedulerFactoryBean factoryBean() {
             return new SchedulerFactoryBean();
         }
@@ -139,11 +141,11 @@ public class JobServiceImplTest {
         js.setId(1L);
         GriffinMeasure measure = createGriffinMeasure("measureName");
         GriffinJob job = createGriffinJob();
+        job.setJobSchedule(js);
         Scheduler scheduler = Mockito.mock(Scheduler.class);
         given(factory.getScheduler()).willReturn(scheduler);
         given(griffinMeasureRepo.findByIdAndDeleted(js.getMeasureId(), 
false)).willReturn(measure);
         given(jobRepo.countByJobNameAndDeleted(js.getJobName(), 
false)).willReturn(0);
-        given(jobScheduleRepo.save(js)).willReturn(js);
         given(jobRepo.save(Matchers.any(GriffinJob.class))).willReturn(job);
 
         JobSchedule createdJs = service.addJob(js);
@@ -240,10 +242,11 @@ public class JobServiceImplTest {
         Long jobId = 1L;
         GriffinJob job = new GriffinJob(1L, "jobName", "quartzJobName", 
"quartzGroupName", false);
         JobInstanceBean instance = new 
JobInstanceBean(LivySessionStates.State.finding, "pName", "pGroup", null, null);
-        job.setJobInstances(Arrays.asList(instance));
+        instance.setGriffinJob(job);
         Scheduler scheduler = Mockito.mock(Scheduler.class);
         given(jobRepo.findByIdAndDeleted(jobId, false)).willReturn(job);
         given(factory.getScheduler()).willReturn(scheduler);
+        
given(jobInstanceRepo.findByJobId(Matchers.anyLong())).willReturn(Arrays.asList(instance));
         
given(scheduler.checkExists(Matchers.any(JobKey.class))).willReturn(true);
 
         service.deleteJob(jobId);
@@ -258,10 +261,11 @@ public class JobServiceImplTest {
         Long jobId = 1L;
         GriffinJob job = new GriffinJob(1L, "jobName", "quartzJobName", 
"quartzGroupName", false);
         JobInstanceBean instance = new 
JobInstanceBean(LivySessionStates.State.finding, "pName", "pGroup", null, null);
-        job.setJobInstances(Arrays.asList(instance));
+        instance.setGriffinJob(job);
         Scheduler scheduler = Mockito.mock(Scheduler.class);
         given(factory.getScheduler()).willReturn(scheduler);
         given(jobRepo.findByIdAndDeleted(jobId, false)).willReturn(job);
+        
given(jobInstanceRepo.findByJobId(Matchers.anyLong())).willReturn(Arrays.asList(instance));
         
given(scheduler.checkExists(Matchers.any(JobKey.class))).willReturn(false);
 
         service.deleteJob(jobId);
@@ -295,10 +299,11 @@ public class JobServiceImplTest {
     public void testDeleteJobByNameForSuccessWithTriggerKeyExist() throws 
SchedulerException {
         GriffinJob job = new GriffinJob(1L, 1L, "jobName", "quartzJobName", 
"quartzGroupName", false);
         JobInstanceBean instance = new 
JobInstanceBean(LivySessionStates.State.finding, "pName", "pGroup", null, null);
-        job.setJobInstances(Arrays.asList(instance));
+        instance.setGriffinJob(job);
         Scheduler scheduler = Mockito.mock(Scheduler.class);
         given(jobRepo.findByJobNameAndDeleted(job.getJobName(), 
false)).willReturn(Arrays.asList(job));
         given(factory.getScheduler()).willReturn(scheduler);
+        
given(jobInstanceRepo.findByJobId(Matchers.anyLong())).willReturn(Arrays.asList(instance));
         
given(scheduler.checkExists(Matchers.any(JobKey.class))).willReturn(true);
         doNothing().when(scheduler).pauseJob(Matchers.any(JobKey.class));
         
given(scheduler.deleteJob(Matchers.any(JobKey.class))).willReturn(true);
@@ -315,10 +320,11 @@ public class JobServiceImplTest {
     public void testDeleteJobByNameForSuccessWithTriggerKeyNotExist() throws 
SchedulerException {
         GriffinJob job = new GriffinJob(1L, 1L, "jobName", "quartzJobName", 
"quartzGroupName", false);
         JobInstanceBean instance = new 
JobInstanceBean(LivySessionStates.State.finding, "pName", "pGroup", null, null);
-        job.setJobInstances(Arrays.asList(instance));
+        instance.setGriffinJob(job);
         Scheduler scheduler = Mockito.mock(Scheduler.class);
         given(factory.getScheduler()).willReturn(scheduler);
         given(jobRepo.findByJobNameAndDeleted(job.getJobName(), 
false)).willReturn(Arrays.asList(job));
+        
given(jobInstanceRepo.findByJobId(Matchers.anyLong())).willReturn(Arrays.asList(instance));
         
given(scheduler.checkExists(Matchers.any(JobKey.class))).willReturn(false);
 
         service.deleteJob(job.getJobName());
@@ -352,10 +358,11 @@ public class JobServiceImplTest {
     public void testDeleteJobsRelateToMeasureForSuccessWithTriggerKeyExist() 
throws SchedulerException {
         GriffinJob job = createGriffinJob();
         JobInstanceBean instance = new 
JobInstanceBean(LivySessionStates.State.finding, "pName", "pGroup", null, null);
-        job.setJobInstances(Arrays.asList(instance));
+        instance.setGriffinJob(job);
         Scheduler scheduler = Mockito.mock(Scheduler.class);
         given(jobRepo.findByMeasureIdAndDeleted(1L, 
false)).willReturn(Arrays.asList(job));
         given(factory.getScheduler()).willReturn(scheduler);
+        
given(jobInstanceRepo.findByJobId(Matchers.anyLong())).willReturn(Arrays.asList(instance));
         
given(scheduler.checkExists(Matchers.any(JobKey.class))).willReturn(true);
 
         service.deleteJobsRelateToMeasure(1L);
@@ -369,10 +376,11 @@ public class JobServiceImplTest {
     public void 
testDeleteJobsRelateToMeasureForSuccessWithTriggerKeyNotExist() throws 
SchedulerException {
         GriffinJob job = createGriffinJob();
         JobInstanceBean instance = new 
JobInstanceBean(LivySessionStates.State.finding, "pName", "pGroup", null, null);
-        job.setJobInstances(Arrays.asList(instance));
+        instance.setGriffinJob(job);
         Scheduler scheduler = Mockito.mock(Scheduler.class);
         given(jobRepo.findByMeasureIdAndDeleted(1L, 
false)).willReturn(Arrays.asList(job));
         given(factory.getScheduler()).willReturn(scheduler);
+        
given(jobInstanceRepo.findByJobId(Matchers.anyLong())).willReturn(Arrays.asList(instance));
         
given(scheduler.checkExists(Matchers.any(JobKey.class))).willReturn(false);
 
         service.deleteJobsRelateToMeasure(1L);
@@ -397,7 +405,7 @@ public class JobServiceImplTest {
         Long measureId = 1L;
         GriffinJob job = createGriffinJob();
         JobInstanceBean instance = new 
JobInstanceBean(LivySessionStates.State.finding, "pName", "pGroup", null, null);
-        job.setJobInstances(Arrays.asList(instance));
+        instance.setGriffinJob(job);
         Scheduler scheduler = Mockito.mock(Scheduler.class);
         given(jobRepo.findByMeasureIdAndDeleted(measureId, 
false)).willReturn(Arrays.asList(job));
         given(factory.getScheduler()).willReturn(scheduler);
@@ -480,7 +488,8 @@ public class JobServiceImplTest {
     @Test
     public void testSyncInstancesOfJobForSuccess() {
         JobInstanceBean instance = createJobInstance();
-        
given(jobInstanceRepo.findByActiveState()).willReturn(Arrays.asList(instance));
+        LivySessionStates.State[] states = {starting, not_started, recovering, 
idle, running, busy};
+        
given(jobInstanceRepo.findByActiveState(states)).willReturn(Arrays.asList(instance));
         Whitebox.setInternalState(service, "restTemplate", restTemplate);
         String result = 
"{\"id\":1,\"state\":\"starting\",\"appId\":123,\"appInfo\":{\"driverLogUrl\":null,\"sparkUiUrl\":null},\"log\":[]}";
         given(restTemplate.getForObject(Matchers.anyString(), 
Matchers.any())).willReturn(result);
@@ -493,7 +502,8 @@ public class JobServiceImplTest {
     public void testSyncInstancesOfJobForFailureWithRestClientException() {
         JobInstanceBean instance = createJobInstance();
         instance.setSessionId(1234564L);
-        
given(jobInstanceRepo.findByActiveState()).willReturn(Arrays.asList(instance));
+        LivySessionStates.State[] states = {starting, not_started, recovering, 
idle, running, busy};
+        
given(jobInstanceRepo.findByActiveState(states)).willReturn(Arrays.asList(instance));
         Whitebox.setInternalState(service, "restTemplate", restTemplate);
         given(restTemplate.getForObject(Matchers.anyString(), 
Matchers.any())).willThrow(RestClientException.class);
 
@@ -504,7 +514,8 @@ public class JobServiceImplTest {
     @Test
     public void testSyncInstancesOfJobForFailureWithIOException() {
         JobInstanceBean instance = createJobInstance();
-        
given(jobInstanceRepo.findByActiveState()).willReturn(Arrays.asList(instance));
+        LivySessionStates.State[] states = {starting, not_started, recovering, 
idle, running, busy};
+        
given(jobInstanceRepo.findByActiveState(states)).willReturn(Arrays.asList(instance));
         Whitebox.setInternalState(service, "restTemplate", restTemplate);
         given(restTemplate.getForObject(Matchers.anyString(), 
Matchers.any())).willReturn("result");
 
@@ -515,7 +526,8 @@ public class JobServiceImplTest {
     @Test
     public void testSyncInstancesOfJobForFailureWithIllegalArgumentException() 
{
         JobInstanceBean instance = createJobInstance();
-        
given(jobInstanceRepo.findByActiveState()).willReturn(Arrays.asList(instance));
+        LivySessionStates.State[] states = {starting, not_started, recovering, 
idle, running, busy};
+        
given(jobInstanceRepo.findByActiveState(states)).willReturn(Arrays.asList(instance));
         Whitebox.setInternalState(service, "restTemplate", restTemplate);
         given(restTemplate.getForObject(Matchers.anyString(), 
Matchers.any())).willReturn("{\"state\":\"wrong\"}");
 
@@ -526,7 +538,8 @@ public class JobServiceImplTest {
     @Test
     public void testSyncInstancesOfJobForFailureWithException() {
         JobInstanceBean instance = createJobInstance();
-        
given(jobInstanceRepo.findByActiveState()).willReturn(Arrays.asList(instance));
+        LivySessionStates.State[] states = {starting, not_started, recovering, 
idle, running, busy};
+        
given(jobInstanceRepo.findByActiveState(states)).willReturn(Arrays.asList(instance));
         Whitebox.setInternalState(service, "restTemplate", restTemplate);
         String result = 
"{\"id\":1,\"state\":\"starting\",\"appId\":123,\"appInfo\":{\"driverLogUrl\":null,\"sparkUiUrl\":null},\"log\":[]}";
         given(restTemplate.getForObject(Matchers.anyString(), 
Matchers.any())).willReturn(result);

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/service/src/test/java/org/apache/griffin/core/job/repo/JobInstanceRepoTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/job/repo/JobInstanceRepoTest.java
 
b/service/src/test/java/org/apache/griffin/core/job/repo/JobInstanceRepoTest.java
index 72dbc8c..1d319e0 100644
--- 
a/service/src/test/java/org/apache/griffin/core/job/repo/JobInstanceRepoTest.java
+++ 
b/service/src/test/java/org/apache/griffin/core/job/repo/JobInstanceRepoTest.java
@@ -19,6 +19,8 @@ under the License.
 
 package org.apache.griffin.core.job.repo;
 
+import org.apache.griffin.core.config.EclipseLinkJpaConfigForTest;
+import org.apache.griffin.core.job.entity.GriffinJob;
 import org.apache.griffin.core.job.entity.JobInstanceBean;
 import org.apache.griffin.core.job.entity.LivySessionStates;
 import org.junit.Before;
@@ -27,14 +29,18 @@ 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.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.util.List;
 
+import static org.apache.griffin.core.job.entity.LivySessionStates.State.*;
+import static org.apache.griffin.core.job.entity.LivySessionStates.State;
 import static org.assertj.core.api.Assertions.assertThat;
 
 @RunWith(SpringRunner.class)
 @DataJpaTest
+@ContextConfiguration(classes = {EclipseLinkJpaConfigForTest.class})
 public class JobInstanceRepoTest {
 
     @Autowired
@@ -52,7 +58,8 @@ public class JobInstanceRepoTest {
 
     @Test
     public void testFindByActiveState() {
-        List<JobInstanceBean> beans = jobInstanceRepo.findByActiveState();
+        State[] states = {starting, not_started, recovering, idle, running, 
busy};
+        List<JobInstanceBean> beans = 
jobInstanceRepo.findByActiveState(states);
         assertThat(beans.size()).isEqualTo(1);
     }
 
@@ -75,10 +82,16 @@ public class JobInstanceRepoTest {
     }
 
     private void setEntityManager() {
-        JobInstanceBean bean1 = new JobInstanceBean( 
LivySessionStates.State.finding, "pName1", "pGroup1", null, 1516004640092L);
-        JobInstanceBean bean2 = new JobInstanceBean( 
LivySessionStates.State.not_found, "pName2", "pGroup2", null, 1516004640093L);
-        JobInstanceBean bean3 = new JobInstanceBean( 
LivySessionStates.State.running, "pName3", "pGroup3", null, 1516004640082L);
-        JobInstanceBean bean4 = new JobInstanceBean( 
LivySessionStates.State.success, "pName4", "pGroup4", null, 1516004640094L);
+        GriffinJob job = new GriffinJob(1L, "jobName", "qName", "qGroup", 
false);
+        entityManager.persistAndFlush(job);
+        JobInstanceBean bean1 = new 
JobInstanceBean(LivySessionStates.State.finding, "pName1", "pGroup1", null, 
1516004640092L);
+        JobInstanceBean bean2 = new 
JobInstanceBean(LivySessionStates.State.not_found, "pName2", "pGroup2", null, 
1516004640093L);
+        JobInstanceBean bean3 = new 
JobInstanceBean(LivySessionStates.State.running, "pName3", "pGroup3", null, 
1516004640082L);
+        JobInstanceBean bean4 = new 
JobInstanceBean(LivySessionStates.State.success, "pName4", "pGroup4", null, 
1516004640094L);
+        bean1.setGriffinJob(job);
+        bean2.setGriffinJob(job);
+        bean3.setGriffinJob(job);
+        bean4.setGriffinJob(job);
         entityManager.persistAndFlush(bean1);
         entityManager.persistAndFlush(bean2);
         entityManager.persistAndFlush(bean3);

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/service/src/test/java/org/apache/griffin/core/job/repo/JobRepoTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/job/repo/JobRepoTest.java 
b/service/src/test/java/org/apache/griffin/core/job/repo/JobRepoTest.java
index 96a27e4..9f1c879 100644
--- a/service/src/test/java/org/apache/griffin/core/job/repo/JobRepoTest.java
+++ b/service/src/test/java/org/apache/griffin/core/job/repo/JobRepoTest.java
@@ -19,6 +19,7 @@ under the License.
 
 package org.apache.griffin.core.job.repo;
 
+import org.apache.griffin.core.config.EclipseLinkJpaConfigForTest;
 import org.apache.griffin.core.job.entity.AbstractJob;
 import org.apache.griffin.core.job.entity.GriffinJob;
 import org.apache.griffin.core.job.entity.VirtualJob;
@@ -28,6 +29,7 @@ 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.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.util.List;
@@ -36,6 +38,7 @@ import static org.junit.Assert.assertEquals;
 
 @RunWith(SpringRunner.class)
 @DataJpaTest
+@ContextConfiguration(classes = {EclipseLinkJpaConfigForTest.class})
 public class JobRepoTest {
 
     @Autowired
@@ -45,43 +48,43 @@ public class JobRepoTest {
     private JobRepo jobRepo;
 
     @Before
-    public void setup() throws Exception {
+    public void setup() {
         entityManager.clear();
         entityManager.flush();
         setEntityManager();
     }
 
     @Test
-    public void testCountByJobNameAndDeleted() throws Exception {
+    public void testCountByJobNameAndDeleted() {
         int count = jobRepo.countByJobNameAndDeleted("griffinJobName1", false);
         assertEquals(count, 1);
     }
 
     @Test
-    public void testFindByDeleted() throws Exception {
+    public void testFindByDeleted() {
         List<AbstractJob> jobs = jobRepo.findByDeleted(false);
         assertEquals(jobs.size(), 4);
     }
 
     @Test
-    public void findByJobNameAndDeleted() throws Exception {
+    public void findByJobNameAndDeleted() {
         List<AbstractJob> jobs = 
jobRepo.findByJobNameAndDeleted("griffinJobName1", false);
         assertEquals(jobs.size(), 1);
     }
 
     @Test
-    public void findByMeasureIdAndDeleted() throws Exception {
+    public void findByMeasureIdAndDeleted() {
         List<AbstractJob> jobs = jobRepo.findByMeasureIdAndDeleted(1L, false);
         assertEquals(jobs.size(), 4);
     }
 
     @Test
-    public void findByIdAndDeleted() throws Exception {
+    public void findByIdAndDeleted() {
         AbstractJob job = jobRepo.findByIdAndDeleted(1L, true);
         assert job == null;
     }
 
-    public void setEntityManager() throws Exception {
+    public void setEntityManager() {
         AbstractJob job1 = new GriffinJob(1L, "griffinJobName1", "qName1", 
"qGroup1", false);
         AbstractJob job2 = new GriffinJob(1L, "griffinJobName2", "qName2", 
"qGroup2", false);
         AbstractJob job3 = new VirtualJob("virtualJobName1", 1L, 
"metricName1");

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/service/src/test/java/org/apache/griffin/core/measure/repo/DataConnectorRepoTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/measure/repo/DataConnectorRepoTest.java
 
b/service/src/test/java/org/apache/griffin/core/measure/repo/DataConnectorRepoTest.java
index 78ac6a2..01b208b 100644
--- 
a/service/src/test/java/org/apache/griffin/core/measure/repo/DataConnectorRepoTest.java
+++ 
b/service/src/test/java/org/apache/griffin/core/measure/repo/DataConnectorRepoTest.java
@@ -19,25 +19,27 @@ under the License.
 
 package org.apache.griffin.core.measure.repo;
 
+import org.apache.griffin.core.config.EclipseLinkJpaConfigForTest;
 import org.apache.griffin.core.measure.entity.DataConnector;
-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.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
 import static org.apache.griffin.core.util.EntityHelper.createDataConnector;
-import static org.apache.griffin.core.util.EntityHelper.createGriffinMeasure;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 @RunWith(SpringRunner.class)
 @DataJpaTest
+@ContextConfiguration(classes = {EclipseLinkJpaConfigForTest.class})
 public class DataConnectorRepoTest {
 
     @Autowired
@@ -54,26 +56,26 @@ public class DataConnectorRepoTest {
     }
 
     @Test
-    public void testFindByConnectorNames() throws Exception {
+    public void testFindByConnectorNames() {
         List<DataConnector> connectors = 
dcRepo.findByConnectorNames(Arrays.asList("name1", "name2"));
-        assertEquals(connectors.size(),2);
+        assertEquals(connectors.size(), 2);
     }
 
     @Test
-    public void testFindByConnectorNamesWithNull() throws Exception {
-        List<DataConnector> connectors = dcRepo.findByConnectorNames(null);
-        assertEquals(connectors.size(),0);
+    public void testFindByConnectorNamesWithEmpty() {
+        List<DataConnector> connectors = dcRepo.findByConnectorNames(new 
ArrayList<>());
+        assertEquals(connectors.size(), 0);
     }
 
     public void setEntityManager() throws Exception {
-        DataConnector dc1 = 
createDataConnector("name1","database1","table1","/dt=#YYYYMM#");
+        DataConnector dc1 = createDataConnector("name1", "database1", 
"table1", "/dt=#YYYYMM#");
 
         entityManager.persistAndFlush(dc1);
 
-        DataConnector dc2 = 
createDataConnector("name2","database2","table2","/dt=#YYYYMM#");
+        DataConnector dc2 = createDataConnector("name2", "database2", 
"table2", "/dt=#YYYYMM#");
         entityManager.persistAndFlush(dc2);
 
-        DataConnector dc3 = 
createDataConnector("name3","database3","table3","/dt=#YYYYMM#");
+        DataConnector dc3 = createDataConnector("name3", "database3", 
"table3", "/dt=#YYYYMM#");
         entityManager.persistAndFlush(dc3);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/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 3f66cdf..dc42f73 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
@@ -19,6 +19,7 @@ under the License.
 
 package org.apache.griffin.core.measure.repo;
 
+import org.apache.griffin.core.config.EclipseLinkJpaConfigForTest;
 import org.apache.griffin.core.measure.entity.Measure;
 import org.junit.Before;
 import org.junit.Test;
@@ -26,6 +27,7 @@ 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.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.util.List;
@@ -35,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 @RunWith(SpringRunner.class)
 @DataJpaTest
+@ContextConfiguration(classes = {EclipseLinkJpaConfigForTest.class})
 public class MeasureRepoTest {
 
     @Autowired

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/service/src/test/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImplTest.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImplTest.java
 
b/service/src/test/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImplTest.java
index 07d4fc2..96157ab 100644
--- 
a/service/src/test/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImplTest.java
+++ 
b/service/src/test/java/org/apache/griffin/core/metastore/hive/HiveMetaStoreServiceImplTest.java
@@ -46,7 +46,7 @@ public class HiveMetaStoreServiceImplTest {
 
     @TestConfiguration
     public static class HiveMetaStoreServiceConfiguration {
-        @Bean
+        @Bean("hiveMetaStoreServiceImpl")
         public HiveMetaStoreService service() {
             return new HiveMetaStoreServiceImpl();
         }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/service/src/test/java/org/apache/griffin/core/util/EntityHelper.java
----------------------------------------------------------------------
diff --git 
a/service/src/test/java/org/apache/griffin/core/util/EntityHelper.java 
b/service/src/test/java/org/apache/griffin/core/util/EntityHelper.java
index ebb8980..2428bad 100644
--- a/service/src/test/java/org/apache/griffin/core/util/EntityHelper.java
+++ b/service/src/test/java/org/apache/griffin/core/util/EntityHelper.java
@@ -64,15 +64,15 @@ public class EntityHelper {
         return new GriffinMeasure(name, "test", dataSources, evaluateRule);
     }
 
-    public static DataConnector createDataConnector(String name, String 
database, String table, String where) throws IOException {
+    public static DataConnector createDataConnector(String name, String 
database, String table, String where) {
         HashMap<String, String> config = new HashMap<>();
         config.put("database", database);
         config.put("table.name", table);
         config.put("where", where);
-        return new DataConnector(name, "1h", config, null);
+        return new DataConnector(name, "1h", config, new ArrayList<>());
     }
 
-    public static DataConnector createDataConnector(String name, String 
database, String table, String where, SegmentPredicate predicate) throws 
IOException {
+    public static DataConnector createDataConnector(String name, String 
database, String table, String where, SegmentPredicate predicate)  {
         HashMap<String, String> config = new HashMap<>();
         config.put("database", database);
         config.put("table.name", table);

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/service/src/test/resources/application.properties
----------------------------------------------------------------------
diff --git a/service/src/test/resources/application.properties 
b/service/src/test/resources/application.properties
index 02df856..c9c148e 100644
--- a/service/src/test/resources/application.properties
+++ b/service/src/test/resources/application.properties
@@ -17,17 +17,13 @@
 # under the License.
 #
 
-spring.datasource.url = 
jdbc:mysql://localhost:3306/quartz?autoReconnect=true&useSSL=false
-spring.datasource.username = test
-spring.datasource.password = test
-spring.datasource.driver-class-name = com.mysql.jdbc.Driver
+spring.jpa.generate-ddl=true
+spring.datasource.driver-class-name=org.h2.Driver
+spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
+spring.datasource.username=test
+spring.datasource.password=test
 
-# Hibernate ddl auto (validate, create, create-drop, update)
-spring.jpa.hibernate.ddl-auto = update
 spring.jpa.show-sql = true
-spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
-# Naming strategy
-spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
 
 # Hive metastore
 hive.metastore.uris = thrift://localhost:9083

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/4aab9d53/service/src/test/resources/quartz.properties
----------------------------------------------------------------------
diff --git a/service/src/test/resources/quartz.properties 
b/service/src/test/resources/quartz.properties
index 3cb7158..b5fb2de 100644
--- a/service/src/test/resources/quartz.properties
+++ b/service/src/test/resources/quartz.properties
@@ -17,11 +17,13 @@
 # under the License.
 #
 
+
 org.quartz.scheduler.instanceName=spring-boot-quartz-test
 org.quartz.scheduler.instanceId=AUTO
 org.quartz.threadPool.threadCount=5
 org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
-org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+# be careful to configure driver with PostgreSQLDelegate in postgresql not 
StdJDBCDelegate in mysql
+org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
 org.quartz.jobStore.useProperties=true
 org.quartz.jobStore.misfireThreshold=60000
 org.quartz.jobStore.tablePrefix=QRTZ_

Reply via email to