use of com.palantir.atlasdb.config.AtlasDbConfig in project atlasdb by palantir.
the class AtlasDbCliCommand method run.
@Override
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
AtlasDbConfig cliConfiguration = AtlasDbCommandUtils.convertServerConfigToClientConfig(configuration.getAtlasDbConfig(), configuration.getAtlasDbRuntimeConfig());
Map<String, OptionType> optionTypes = getCliOptionTypes();
Map<String, Object> globalAttrs = Maps.filterKeys(namespace.getAttrs(), key -> optionTypes.get(key) == OptionType.GLOBAL);
Map<String, Object> groupAttrs = Maps.filterKeys(namespace.getAttrs(), key -> optionTypes.get(key) == OptionType.GROUP);
Map<String, Object> commandAttrs = Maps.filterKeys(namespace.getAttrs(), key -> optionTypes.get(key) == OptionType.COMMAND);
Iterable<String> groups = Iterables.limit(namespace.getList(COMMAND_NAME_ATTR), 1);
Iterable<String> commands = Iterables.skip(namespace.getList(COMMAND_NAME_ATTR), 1);
List<String> allArgs = ImmutableList.<String>builder().add("--inline-config").add(AtlasDbCommandUtils.serialiseConfiguration(cliConfiguration)).addAll(AtlasDbCommandUtils.gatherPassedInArguments(globalAttrs)).addAll(groups).addAll(AtlasDbCommandUtils.gatherPassedInArguments(groupAttrs)).addAll(commands).addAll(AtlasDbCommandUtils.gatherPassedInArguments(commandAttrs)).build();
try {
CLI.parse(allArgs).call();
} catch (Throwable e) {
log.error("Error running AtlasDB CLI", e);
throw e;
}
}
use of com.palantir.atlasdb.config.AtlasDbConfig in project atlasdb by palantir.
the class AtlasDbConsoleCommandTest method lockAndTimestampFieldsShouldBeSetWhenRunningOnline.
@Test
public void lockAndTimestampFieldsShouldBeSetWhenRunningOnline() throws JsonProcessingException {
AtlasDbConfig cliConfig = getConfigFromConsoleCommand(ONLINE_PARAMS, MINIMAL_LEADER_CONFIG);
assertThat(cliConfig.lock().isPresent()).describedAs("Lock block must be present").isTrue();
assertThat(cliConfig.timestamp().isPresent()).describedAs("Timestamp block must be present").isTrue();
}
use of com.palantir.atlasdb.config.AtlasDbConfig in project atlasdb by palantir.
the class KvsMigrationCommand method connectToServices.
public AtlasDbServices connectToServices() throws IOException {
AtlasDbConfig toConfig = toConfigFile != null ? AtlasDbConfigs.load(toConfigFile, configRoot, AtlasDbConfig.class) : AtlasDbConfigs.loadFromString(inlineConfig, null, AtlasDbConfig.class);
ServicesConfigModule scm = ServicesConfigModule.create(makeOfflineIfNecessary(toConfig), AtlasDbRuntimeConfig.withSweepDisabled());
return DaggerAtlasDbServices.builder().servicesConfigModule(scm).build();
}
use of com.palantir.atlasdb.config.AtlasDbConfig in project atlasdb by palantir.
the class KvsMigrationCommand method connectFromServices.
public AtlasDbServices connectFromServices() throws IOException {
AtlasDbConfig fromConfig = AtlasDbConfigs.load(fromConfigFile, configRoot, AtlasDbConfig.class);
ServicesConfigModule scm = ServicesConfigModule.create(makeOfflineIfNecessary(fromConfig), AtlasDbRuntimeConfig.withSweepDisabled());
return DaggerAtlasDbServices.builder().servicesConfigModule(scm).build();
}
use of com.palantir.atlasdb.config.AtlasDbConfig in project atlasdb by palantir.
the class TransactionManagersTest method keyValueServiceMetricsDoNotContainUserAgent.
@Test
public void keyValueServiceMetricsDoNotContainUserAgent() {
AtlasDbConfig atlasDbConfig = ImmutableAtlasDbConfig.builder().keyValueService(new InMemoryAtlasDbConfig()).build();
TransactionManagers.builder().config(atlasDbConfig).userAgent("test").globalMetricsRegistry(new MetricRegistry()).globalTaggedMetricRegistry(DefaultTaggedMetricRegistry.getDefault()).registrar(environment).build().serializable();
assertThat(metricsRule.metrics().getNames().stream().anyMatch(metricName -> metricName.contains(USER_AGENT_NAME)), is(false));
}
Aggregations