@Test public void testHiveConfFactory() throws Exception { HiveConf hiveConf = HiveConfFactory.get(Optional.absent(), SharedResourcesBrokerFactory.getImplicitBroker()); HiveConf hiveConf1 = HiveConfFactory.get(Optional.absent(), SharedResourcesBrokerFactory.getImplicitBroker()); Assert.assertEquals(hiveConf, hiveConf1); Assert.assertTrue(hiveConf.getVar(METASTOREURIS).equals("file: Assert.assertTrue(hiveConf.get(HIVE_METASTORE_TOKEN_SIGNATURE).equals("file: HiveConf hiveConf2 = HiveConfFactory.get(Optional.of("hcat1"), SharedResourcesBrokerFactory.getImplicitBroker()); HiveConf hiveConf3 = HiveConfFactory.get(Optional.of("hcat1"), SharedResourcesBrokerFactory.getImplicitBroker()); Assert.assertEquals(hiveConf2, hiveConf3); HiveConf hiveConf4 = HiveConfFactory.get(Optional.of("hcat11"), SharedResourcesBrokerFactory.getImplicitBroker()); Assert.assertNotEquals(hiveConf3, hiveConf4); Assert.assertNotEquals(hiveConf4, hiveConf); Assert.assertEquals(hiveConf3.getVar(METASTOREURIS), "hcat1"); Assert.assertEquals(hiveConf3.get(HIVE_METASTORE_TOKEN_SIGNATURE), "hcat1"); Assert.assertEquals(hiveConf4.getVar(METASTOREURIS), "hcat11"); Assert.assertEquals(hiveConf4.get(HIVE_METASTORE_TOKEN_SIGNATURE), "hcat11"); }
public static <S extends ScopeType<S>> HiveConf get(Optional<String> hcatURI, SharedResourcesBroker<S> broker) throws IOException { try { SharedHiveConfKey confKey = hcatURI.isPresent() && StringUtils.isNotBlank(hcatURI.get()) ? new SharedHiveConfKey(hcatURI.get()) : SharedHiveConfKey.INSTANCE; return broker.getSharedResource(new HiveConfFactory<>(), confKey); } catch (NotConfiguredException nce) { throw new IOException(nce); } }
HiveConfFactory implements SharedResourceFactory<HiveConf, SharedHiveConfKey, S> { public static <S extends ScopeType<S>> HiveConf get(Optional<String> hcatURI, SharedResourcesBroker<S> broker) throws IOException { try { SharedHiveConfKey confKey = hcatURI.isPresent() && StringUtils.isNotBlank(hcatURI.get()) ? new SharedHiveConfKey(hcatURI.get()) : SharedHiveConfKey.INSTANCE; return broker.getSharedResource(new HiveConfFactory<>(), confKey); } catch (NotConfiguredException nce) { throw new IOException(nce); } } }
HiveConfFactory implements SharedResourceFactory<HiveConf, SharedHiveConfKey, S> { public static <S extends ScopeType<S>> HiveConf get(Optional<String> hcatURI, SharedResourcesBroker<S> broker) throws IOException { try { SharedHiveConfKey confKey = hcatURI.isPresent() && StringUtils.isNotBlank(hcatURI.get()) ? new SharedHiveConfKey(hcatURI.get()) : SharedHiveConfKey.INSTANCE; return broker.getSharedResource(new HiveConfFactory<>(), confKey); } catch (NotConfiguredException nce) { throw new IOException(nce); } }  }
HiveConfFactory implements SharedResourceFactory<HiveConf, SharedHiveConfKey, S> { public static <S extends ScopeType<S>> HiveConf get(Optional<String> hcatURI, SharedResourcesBroker<S> broker) throws IOException { try { SharedHiveConfKey confKey = hcatURI.isPresent() && StringUtils.isNotBlank(hcatURI.get()) ? new SharedHiveConfKey(hcatURI.get()) : SharedHiveConfKey.INSTANCE; return broker.getSharedResource(new HiveConfFactory<>(), confKey); } catch (NotConfiguredException nce) { throw new IOException(nce); } }  @Override String getName(); @Override SharedResourceFactoryResponse<HiveConf> createResource(SharedResourcesBroker<S> broker,
      ScopedConfigView<S, SharedHiveConfKey> config); static HiveConf get(Optional<String> hcatURI, SharedResourcesBroker<S> broker); @Override S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, SharedHiveConfKey> config); }
HiveConfFactory implements SharedResourceFactory<HiveConf, SharedHiveConfKey, S> { public static <S extends ScopeType<S>> HiveConf get(Optional<String> hcatURI, SharedResourcesBroker<S> broker) throws IOException { try { SharedHiveConfKey confKey = hcatURI.isPresent() && StringUtils.isNotBlank(hcatURI.get()) ? new SharedHiveConfKey(hcatURI.get()) : SharedHiveConfKey.INSTANCE; return broker.getSharedResource(new HiveConfFactory<>(), confKey); } catch (NotConfiguredException nce) { throw new IOException(nce); } }  @Override String getName(); @Override SharedResourceFactoryResponse<HiveConf> createResource(SharedResourcesBroker<S> broker,
      ScopedConfigView<S, SharedHiveConfKey> config); static HiveConf get(Optional<String> hcatURI, SharedResourcesBroker<S> broker); @Override S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, SharedHiveConfKey> config);  }