@Test public void test() { final String catalogName = "mycatalog"; final HiveCatalog expectedCatalog = HiveTestUtils.createHiveCatalog(catalogName, null); final CatalogDescriptor catalogDescriptor = new HiveCatalogDescriptor(); final Map<String, String> properties = catalogDescriptor.toProperties(); final Catalog actualCatalog = TableFactoryService.find(CatalogFactory.class, properties) .createCatalog(catalogName, properties); checkEquals(expectedCatalog, (HiveCatalog) actualCatalog); }
@Override public Catalog createCatalog(String name, Map<String, String> properties) { final DescriptorProperties descriptorProperties = getValidatedProperties(properties); final String defaultDatabase = descriptorProperties.getOptionalString(CATALOG_DEFAULT_DATABASE) .orElse(HiveCatalog.DEFAULT_DB); final Optional<String> hiveConfDir = descriptorProperties.getOptionalString(CATALOG_HIVE_CONF_DIR); final String version = descriptorProperties.getOptionalString(CATALOG_HIVE_VERSION).orElse(HiveShimLoader.getHiveVersion()); return new HiveCatalog(name, defaultDatabase, hiveConfDir.orElse(null), version); }
HiveCatalogFactory implements CatalogFactory { @Override public Catalog createCatalog(String name, Map<String, String> properties) { final DescriptorProperties descriptorProperties = getValidatedProperties(properties); final String defaultDatabase = descriptorProperties.getOptionalString(CATALOG_DEFAULT_DATABASE) .orElse(HiveCatalog.DEFAULT_DB); final Optional<String> hiveConfDir = descriptorProperties.getOptionalString(CATALOG_HIVE_CONF_DIR); final String version = descriptorProperties.getOptionalString(CATALOG_HIVE_VERSION).orElse(HiveShimLoader.getHiveVersion()); return new HiveCatalog(name, defaultDatabase, hiveConfDir.orElse(null), version); } }
HiveCatalogFactory implements CatalogFactory { @Override public Catalog createCatalog(String name, Map<String, String> properties) { final DescriptorProperties descriptorProperties = getValidatedProperties(properties); final String defaultDatabase = descriptorProperties.getOptionalString(CATALOG_DEFAULT_DATABASE) .orElse(HiveCatalog.DEFAULT_DB); final Optional<String> hiveConfDir = descriptorProperties.getOptionalString(CATALOG_HIVE_CONF_DIR); final String version = descriptorProperties.getOptionalString(CATALOG_HIVE_VERSION).orElse(HiveShimLoader.getHiveVersion()); return new HiveCatalog(name, defaultDatabase, hiveConfDir.orElse(null), version); }  }
HiveCatalogFactory implements CatalogFactory { @Override public Catalog createCatalog(String name, Map<String, String> properties) { final DescriptorProperties descriptorProperties = getValidatedProperties(properties); final String defaultDatabase = descriptorProperties.getOptionalString(CATALOG_DEFAULT_DATABASE) .orElse(HiveCatalog.DEFAULT_DB); final Optional<String> hiveConfDir = descriptorProperties.getOptionalString(CATALOG_HIVE_CONF_DIR); final String version = descriptorProperties.getOptionalString(CATALOG_HIVE_VERSION).orElse(HiveShimLoader.getHiveVersion()); return new HiveCatalog(name, defaultDatabase, hiveConfDir.orElse(null), version); }  @Override Map<String, String> requiredContext(); @Override List<String> supportedProperties(); @Override Catalog createCatalog(String name, Map<String, String> properties); }
HiveCatalogFactory implements CatalogFactory { @Override public Catalog createCatalog(String name, Map<String, String> properties) { final DescriptorProperties descriptorProperties = getValidatedProperties(properties); final String defaultDatabase = descriptorProperties.getOptionalString(CATALOG_DEFAULT_DATABASE) .orElse(HiveCatalog.DEFAULT_DB); final Optional<String> hiveConfDir = descriptorProperties.getOptionalString(CATALOG_HIVE_CONF_DIR); final String version = descriptorProperties.getOptionalString(CATALOG_HIVE_VERSION).orElse(HiveShimLoader.getHiveVersion()); return new HiveCatalog(name, defaultDatabase, hiveConfDir.orElse(null), version); }  @Override Map<String, String> requiredContext(); @Override List<String> supportedProperties(); @Override Catalog createCatalog(String name, Map<String, String> properties);  }