Provide mock IdleMonitorService for testing.
@@ -23,17 +23,16 @@ package com.thinkbiganalytics.spark.rest;
import com.thinkbiganalytics.spark.metadata.TransformJob;
import com.thinkbiganalytics.spark.rest.model.TransformRequest;
import com.thinkbiganalytics.spark.rest.model.TransformResponse;
+import com.thinkbiganalytics.spark.service.IdleMonitorService;
import com.thinkbiganalytics.spark.service.TransformService;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import javax.script.ScriptException;
import javax.ws.rs.core.Response;
-@Ignore
public class SparkShellTransformControllerTest {
/**
@@ -55,6 +54,7 @@ public class SparkShellTransformControllerTest {
// Test transforming
SparkShellTransformController controller = new SparkShellTransformController();
+ controller.idleMonitorService = Mockito.mock(IdleMonitorService.class);
controller.transformService = transformService;
Response response = controller.create(transformRequest);
@@ -74,6 +74,8 @@ public class SparkShellTransformControllerTest {
// Test missing parent script
SparkShellTransformController controller = new SparkShellTransformController();
+ controller.idleMonitorService = Mockito.mock(IdleMonitorService.class);
+
Response response = controller.create(request);
Assert.assertEquals(Response.Status.BAD_REQUEST, response.getStatusInfo());
@@ -97,6 +99,8 @@ public class SparkShellTransformControllerTest {
// Test missing parent table
SparkShellTransformController controller = new SparkShellTransformController();
+ controller.idleMonitorService = Mockito.mock(IdleMonitorService.class);
+
Response response = controller.create(request);
Assert.assertEquals(Response.Status.BAD_REQUEST, response.getStatusInfo());
@@ -111,6 +115,8 @@ public class SparkShellTransformControllerTest {
@Test
public void createWithMissingScript() {
SparkShellTransformController controller = new SparkShellTransformController();
+ controller.idleMonitorService = Mockito.mock(IdleMonitorService.class);
+
Response response = controller.create(new TransformRequest());
Assert.assertEquals(Response.Status.BAD_REQUEST, response.getStatusInfo());
@@ -133,6 +139,7 @@ public class SparkShellTransformControllerTest {
// Test script exception
SparkShellTransformController controller = new SparkShellTransformController();
+ controller.idleMonitorService = Mockito.mock(IdleMonitorService.class);
controller.transformService = transformService;
Response response = controller.create(request);
@@ -164,6 +171,7 @@ public class SparkShellTransformControllerTest {
// Test with pending job
SparkShellTransformController controller = new SparkShellTransformController();
+ controller.idleMonitorService = Mockito.mock(IdleMonitorService.class);
controller.transformService = transformService;
Response response = controller.getTable("PendingJob");
