OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InterruptCommandTest.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl;
2 
3 import static org.junit.Assert.assertEquals;
4 
5 import com.google.gson.JsonObject;
6 import com.omnisci.thrift.calciteserver.TPlanResult;
7 
8 import org.junit.Test;
9 
10 public class InterruptCommandTest extends DDLTest {
13  InterruptCommandTest.class.getClassLoader().getResource("").getPath();
14  jsonTestDir = "interruptcommands";
15  }
16 
17  @Test
18  public void killQuery() throws Exception {
19  final JsonObject expectedJsonObject = getJsonFromFile("kill_query.json");
20  final TPlanResult result = processDdlCommand("KILL QUERY '123-a1b2';");
21  final JsonObject actualJsonObject =
22  gson.fromJson(result.plan_result, JsonObject.class);
23  assertEquals(expectedJsonObject, actualJsonObject);
24  }
25 
26  @Test
27  public void alterSystemClear_cpu() throws Exception {
28  final JsonObject expectedJsonObject = getJsonFromFile("alter_system_clear_cpu.json");
29  final TPlanResult result = processDdlCommand("ALTER SYSTEM CLEAR CPU MEMORY;");
30  final JsonObject actualJsonObject =
31  gson.fromJson(result.plan_result, JsonObject.class);
32  assertEquals(expectedJsonObject, actualJsonObject);
33  }
34 
35  @Test
36  public void alterSystemClear_gpu() throws Exception {
37  final JsonObject expectedJsonObject = getJsonFromFile("alter_system_clear_gpu.json");
38  final TPlanResult result = processDdlCommand("ALTER SYSTEM CLEAR GPU MEMORY;");
39  final JsonObject actualJsonObject =
40  gson.fromJson(result.plan_result, JsonObject.class);
41  assertEquals(expectedJsonObject, actualJsonObject);
42  }
43 
44  @Test
45  public void alterSystemClear_render() throws Exception {
46  final JsonObject expectedJsonObject =
47  getJsonFromFile("alter_system_clear_render.json");
48  final TPlanResult result = processDdlCommand("ALTER SYSTEM CLEAR RENDER MEMORY;");
49  final JsonObject actualJsonObject =
50  gson.fromJson(result.plan_result, JsonObject.class);
51  assertEquals(expectedJsonObject, actualJsonObject);
52  }
53 }
JsonObject getJsonFromFile(final String fileName)
Definition: DDLTest.java:37
TPlanResult processDdlCommand(final String ddlCommand)
Definition: DDLTest.java:32