@Test public void testDifferentKey() throws IOException { Config config1 = ConfigFactory.parseMap(ImmutableMap.of(ConfigurationKeys.STATE_STORE_DB_URL_KEY, "url1", ConfigurationKeys.STATE_STORE_DB_USER_KEY, "user", ConfigurationKeys.STATE_STORE_DB_PASSWORD_KEY, "dummypwd")); Config config2 = ConfigFactory.parseMap(ImmutableMap.of(ConfigurationKeys.STATE_STORE_DB_URL_KEY, "url2", ConfigurationKeys.STATE_STORE_DB_USER_KEY, "user", ConfigurationKeys.STATE_STORE_DB_PASSWORD_KEY, "dummypwd")); BasicDataSource basicDataSource1 = MysqlDataSourceFactory.get(config1, SharedResourcesBrokerFactory.getImplicitBroker()); BasicDataSource basicDataSource2 = MysqlDataSourceFactory.get(config2, SharedResourcesBrokerFactory.getImplicitBroker()); Assert.assertNotEquals(basicDataSource1, basicDataSource2); }
public static <S extends ScopeType<S>> BasicDataSource get(Config config, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new MysqlDataSourceFactory<S>(), new MysqlDataSourceKey(MysqlStateStore.getDataSourceId(config), config)); } catch (NotConfiguredException nce) { throw new IOException(nce); } }
MysqlDataSourceFactory implements SharedResourceFactory<BasicDataSource, MysqlDataSourceKey, S> { public static <S extends ScopeType<S>> BasicDataSource get(Config config, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new MysqlDataSourceFactory<S>(), new MysqlDataSourceKey(MysqlStateStore.getDataSourceId(config), config)); } catch (NotConfiguredException nce) { throw new IOException(nce); } } }
MysqlDataSourceFactory implements SharedResourceFactory<BasicDataSource, MysqlDataSourceKey, S> { public static <S extends ScopeType<S>> BasicDataSource get(Config config, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new MysqlDataSourceFactory<S>(), new MysqlDataSourceKey(MysqlStateStore.getDataSourceId(config), config)); } catch (NotConfiguredException nce) { throw new IOException(nce); } }  }
MysqlDataSourceFactory implements SharedResourceFactory<BasicDataSource, MysqlDataSourceKey, S> { public static <S extends ScopeType<S>> BasicDataSource get(Config config, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new MysqlDataSourceFactory<S>(), new MysqlDataSourceKey(MysqlStateStore.getDataSourceId(config), config)); } catch (NotConfiguredException nce) { throw new IOException(nce); } }  static BasicDataSource get(Config config,
      SharedResourcesBroker<S> broker); @Override String getName(); @Override SharedResourceFactoryResponse<BasicDataSource> createResource(SharedResourcesBroker<S> broker,
    ScopedConfigView<S, MysqlDataSourceKey> config); @Override S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, MysqlDataSourceKey> config); }
MysqlDataSourceFactory implements SharedResourceFactory<BasicDataSource, MysqlDataSourceKey, S> { public static <S extends ScopeType<S>> BasicDataSource get(Config config, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new MysqlDataSourceFactory<S>(), new MysqlDataSourceKey(MysqlStateStore.getDataSourceId(config), config)); } catch (NotConfiguredException nce) { throw new IOException(nce); } }  static BasicDataSource get(Config config,
      SharedResourcesBroker<S> broker); @Override String getName(); @Override SharedResourceFactoryResponse<BasicDataSource> createResource(SharedResourcesBroker<S> broker,
    ScopedConfigView<S, MysqlDataSourceKey> config); @Override S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, MysqlDataSourceKey> config); static final String FACTORY_NAME; }