OmniSciDB  b28c0d5765
 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 
7 import org.junit.Test;
8 
9 import ai.heavy.thrift.calciteserver.TPlanResult;
10 
11 public class InterruptCommandTest extends DDLTest {
14  InterruptCommandTest.class.getClassLoader().getResource("").getPath();
15  jsonTestDir = "interruptcommands";
16  }
17 
18  @Test
19  public void killQuery() throws Exception {
20  final JsonObject expectedJsonObject = getJsonFromFile("kill_query.json");
21  final TPlanResult result = processDdlCommand("KILL QUERY '123-a1b2';");
22  final JsonObject actualJsonObject =
23  gson.fromJson(result.plan_result, JsonObject.class);
24  assertEquals(expectedJsonObject, actualJsonObject);
25  }
26 
27  @Test
28  public void alterSystemClear_cpu() throws Exception {
29  final JsonObject expectedJsonObject = getJsonFromFile("alter_system_clear_cpu.json");
30  final TPlanResult result = processDdlCommand("ALTER SYSTEM CLEAR CPU MEMORY;");
31  final JsonObject actualJsonObject =
32  gson.fromJson(result.plan_result, JsonObject.class);
33  assertEquals(expectedJsonObject, actualJsonObject);
34  }
35 
36  @Test
37  public void alterSystemClear_gpu() throws Exception {
38  final JsonObject expectedJsonObject = getJsonFromFile("alter_system_clear_gpu.json");
39  final TPlanResult result = processDdlCommand("ALTER SYSTEM CLEAR GPU MEMORY;");
40  final JsonObject actualJsonObject =
41  gson.fromJson(result.plan_result, JsonObject.class);
42  assertEquals(expectedJsonObject, actualJsonObject);
43  }
44 
45  @Test
46  public void alterSystemClear_render() throws Exception {
47  final JsonObject expectedJsonObject =
48  getJsonFromFile("alter_system_clear_render.json");
49  final TPlanResult result = processDdlCommand("ALTER SYSTEM CLEAR RENDER MEMORY;");
50  final JsonObject actualJsonObject =
51  gson.fromJson(result.plan_result, JsonObject.class);
52  assertEquals(expectedJsonObject, actualJsonObject);
53  }
54 
55  @Test
56  public void alterSessionSetExecutor_cpu() throws Exception {
57  final JsonObject expectedJsonObject =
58  getJsonFromFile("alter_session_set_executor_cpu.json");
59  final TPlanResult result =
60  processDdlCommand("ALTER SESSION SET EXECUTOR_DEVICE='CPU';");
61  final JsonObject actualJsonObject =
62  gson.fromJson(result.plan_result, JsonObject.class);
63  assertEquals(expectedJsonObject, actualJsonObject);
64  }
65 
66  @Test
67  public void alterSessionSetExecutor_gpu() throws Exception {
68  final JsonObject expectedJsonObject =
69  getJsonFromFile("alter_session_set_executor_gpu.json");
70  final TPlanResult result =
71  processDdlCommand("ALTER SESSION SET EXECUTOR_DEVICE='GPU';");
72  final JsonObject actualJsonObject =
73  gson.fromJson(result.plan_result, JsonObject.class);
74  assertEquals(expectedJsonObject, actualJsonObject);
75  }
76 }
JsonObject getJsonFromFile(final String fileName)
Definition: DDLTest.java:50
TPlanResult processDdlCommand(final String ddlCommand)
Definition: DDLTest.java:35