Java Code Examples for org.apache.flink.table.client.gateway.SessionContext#removeView()
The following examples show how to use
org.apache.flink.table.client.gateway.SessionContext#removeView() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalExecutorITCase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testValidateSession() throws Exception { final Executor executor = createDefaultExecutor(clusterClient); final SessionContext session = new SessionContext("test-session", new Environment()); executor.validateSession(session); session.addView(ViewEntry.create("AdditionalView1", "SELECT 1")); session.addView(ViewEntry.create("AdditionalView2", "SELECT * FROM AdditionalView1")); executor.validateSession(session); List<String> actualTables = executor.listTables(session); List<String> expectedTables = Arrays.asList( "AdditionalView1", "AdditionalView2", "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); session.removeView("AdditionalView1"); try { executor.validateSession(session); fail(); } catch (SqlExecutionException e) { // AdditionalView2 needs AdditionalView1 } session.removeView("AdditionalView2"); executor.validateSession(session); actualTables = executor.listTables(session); expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); }
Example 2
Source File: LocalExecutorITCase.java From flink with Apache License 2.0 | 4 votes |
@Test public void testValidateSession() throws Exception { final Executor executor = createDefaultExecutor(clusterClient); final SessionContext session = new SessionContext("test-session", new Environment()); executor.validateSession(session); session.addView(ViewEntry.create("AdditionalView1", "SELECT 1")); session.addView(ViewEntry.create("AdditionalView2", "SELECT * FROM AdditionalView1")); executor.validateSession(session); List<String> actualTables = executor.listTables(session); List<String> expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2", "AdditionalView1", "AdditionalView2"); assertEquals(expectedTables, actualTables); session.removeView("AdditionalView1"); try { executor.validateSession(session); fail(); } catch (SqlExecutionException e) { // AdditionalView2 needs AdditionalView1 } session.removeView("AdditionalView2"); executor.validateSession(session); actualTables = executor.listTables(session); expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); }