@Test public void testCatalogs() throws Exception { final String inmemoryCatalog = "inmemorycatalog"; final String hiveCatalog = "hivecatalog"; final String hiveDefaultVersionCatalog = "hivedefaultversion"; final ExecutionContext<?> context = createCatalogExecutionContext(); final TableEnvironment tableEnv = context.createEnvironmentInstance().getTableEnvironment(); assertEquals(inmemoryCatalog, tableEnv.getCurrentCatalog()); assertEquals("mydatabase", tableEnv.getCurrentDatabase()); Catalog catalog = tableEnv.getCatalog(hiveCatalog).orElse(null); assertNotNull(catalog); assertTrue(catalog instanceof HiveCatalog); assertEquals("2.3.4", ((HiveCatalog) catalog).getHiveVersion()); catalog = tableEnv.getCatalog(hiveDefaultVersionCatalog).orElse(null); assertNotNull(catalog); assertTrue(catalog instanceof HiveCatalog); assertFalse(StringUtils.isNullOrWhitespaceOnly(((HiveCatalog) catalog).getHiveVersion())); tableEnv.useCatalog(hiveCatalog); assertEquals(hiveCatalog, tableEnv.getCurrentCatalog()); Set<String> allCatalogs = new HashSet<>(Arrays.asList(tableEnv.listCatalogs())); assertEquals(6, allCatalogs.size()); assertEquals( new HashSet<>( Arrays.asList( "default_catalog", inmemoryCatalog, hiveCatalog, hiveDefaultVersionCatalog, "catalog1", "catalog2") ), allCatalogs ); }
public EnvironmentInstance createEnvironmentInstance() { try { return wrapClassLoader(EnvironmentInstance::new); } catch (Throwable t) { throw new SqlExecutionException("Could not create environment instance.", t); } }
ExecutionContext { public EnvironmentInstance createEnvironmentInstance() { try { return wrapClassLoader(EnvironmentInstance::new); } catch (Throwable t) { throw new SqlExecutionException("Could not create environment instance.", t); } } }
ExecutionContext { public EnvironmentInstance createEnvironmentInstance() { try { return wrapClassLoader(EnvironmentInstance::new); } catch (Throwable t) { throw new SqlExecutionException("Could not create environment instance.", t); } } ExecutionContext(Environment defaultEnvironment, SessionContext sessionContext, List<URL> dependencies,
			Configuration flinkConfig, Options commandLineOptions, List<CustomCommandLine<?>> availableCommandLines); }
ExecutionContext { public EnvironmentInstance createEnvironmentInstance() { try { return wrapClassLoader(EnvironmentInstance::new); } catch (Throwable t) { throw new SqlExecutionException("Could not create environment instance.", t); } } ExecutionContext(Environment defaultEnvironment, SessionContext sessionContext, List<URL> dependencies,
			Configuration flinkConfig, Options commandLineOptions, List<CustomCommandLine<?>> availableCommandLines); SessionContext getSessionContext(); ClassLoader getClassLoader(); Environment getMergedEnvironment(); ClusterSpecification getClusterSpec(); T getClusterId(); ClusterDescriptor<T> createClusterDescriptor(); EnvironmentInstance createEnvironmentInstance(); Map<String, Catalog> getCatalogs(); Map<String, TableSource<?>> getTableSources(); Map<String, TableSink<?>> getTableSinks(); R wrapClassLoader(Supplier<R> supplier); }
ExecutionContext { public EnvironmentInstance createEnvironmentInstance() { try { return wrapClassLoader(EnvironmentInstance::new); } catch (Throwable t) { throw new SqlExecutionException("Could not create environment instance.", t); } } ExecutionContext(Environment defaultEnvironment, SessionContext sessionContext, List<URL> dependencies,
			Configuration flinkConfig, Options commandLineOptions, List<CustomCommandLine<?>> availableCommandLines); SessionContext getSessionContext(); ClassLoader getClassLoader(); Environment getMergedEnvironment(); ClusterSpecification getClusterSpec(); T getClusterId(); ClusterDescriptor<T> createClusterDescriptor(); EnvironmentInstance createEnvironmentInstance(); Map<String, Catalog> getCatalogs(); Map<String, TableSource<?>> getTableSources(); Map<String, TableSink<?>> getTableSinks(); R wrapClassLoader(Supplier<R> supplier);  }