@Test public void testFullOverride() throws Exception { final DefaultObjectMapper mapper = new DefaultObjectMapper(); final ZkPathsConfig zkPathsConfig = new ZkPathsConfig(); IndexerZkConfig indexerZkConfig = new IndexerZkConfig( zkPathsConfig, "/druid/prod", "/druid/prod/a", "/druid/prod/t", "/druid/prod/s" ); Map<String, String> value = mapper.readValue( mapper.writeValueAsString(indexerZkConfig), JacksonUtils.TYPE_REFERENCE_MAP_STRING_STRING ); IndexerZkConfig newConfig = new IndexerZkConfig( zkPathsConfig, value.get("base"), value.get("announcementsPath"), value.get("tasksPath"), value.get("statusPath") ); Assert.assertEquals(indexerZkConfig, newConfig); } }
public RemoteTaskRunner makeRemoteTaskRunner( RemoteTaskRunnerConfig config, ProvisioningStrategy<WorkerTaskRunner> provisioningStrategy ) { RemoteTaskRunner remoteTaskRunner = new TestableRemoteTaskRunner( jsonMapper, config, new IndexerZkConfig( new ZkPathsConfig() { @Override public String getBase() { return basePath; } }, null, null, null, null ), cf, new PathChildrenCacheFactory.Builder(), null, DSuppliers.of(new AtomicReference<>(DefaultWorkerBehaviorConfig.defaultConfig())), provisioningStrategy ); remoteTaskRunner.start(); return remoteTaskRunner; }
new IndexerZkConfig(new ZkPathsConfig()
@Test public void testExactConfig() { final Injector injector = Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), ImmutableList.of(simpleZkConfigModule) ); propertyValues.setProperty(zkServiceConfigString + ".base", "/druid/metrics"); JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get(); JsonConfigProvider<ZkPathsConfig> zkPathsConfig = JsonConfigProvider.of( zkServiceConfigString, ZkPathsConfig.class ); zkPathsConfig.inject(propertyValues, configurator); ZkPathsConfig zkPathsConfig1 = zkPathsConfig.get().get(); IndexerZkConfig indexerZkConfig = new IndexerZkConfig(zkPathsConfig1, null, null, null, null); Assert.assertEquals("/druid/metrics/indexer", indexerZkConfig.getBase()); Assert.assertEquals("/druid/metrics/indexer/announcements", indexerZkConfig.getAnnouncementsPath()); }
new IndexerZkConfig( new ZkPathsConfig()
taskStorage, EasyMock.createNiceMock(CuratorFramework.class), new IndexerZkConfig(new ZkPathsConfig(), null, null, null, null) );