OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ReassignOwnedTest.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 ReassignOwnedTest extends DDLTest {
12  public ReassignOwnedTest() {
13  resourceDirPath = ReassignOwnedTest.class.getClassLoader().getResource("").getPath();
14  jsonTestDir = "reassignowned";
15  }
16 
17  @Test
18  public void reassignOwned() throws Exception {
19  final JsonObject expectedJsonObject = getJsonFromFile("reassign_owned.json");
20  final TPlanResult result =
21  processDdlCommand("REASSIGN OWNED BY user_1, user_2 To user_3;");
22  final JsonObject actualJsonObject =
23  gson.fromJson(result.plan_result, JsonObject.class);
24  assertEquals(expectedJsonObject, actualJsonObject);
25  }
26 
27  @Test
28  public void reassignAllOwned() throws Exception {
29  final JsonObject expectedJsonObject = getJsonFromFile("reassign_all_owned.json");
30  final TPlanResult result =
31  processDdlCommand("REASSIGN ALL OWNED BY user_1, user_2 To user_3;");
32  final JsonObject actualJsonObject =
33  gson.fromJson(result.plan_result, JsonObject.class);
34  assertEquals(expectedJsonObject, actualJsonObject);
35  }
36 }
JsonObject getJsonFromFile(final String fileName)
Definition: DDLTest.java:51
TPlanResult processDdlCommand(final String ddlCommand)
Definition: DDLTest.java:35