@Test public void typical() { when(configMapSupplier.get()).thenReturn(configMap); when(configMap.getData()).thenReturn(ImmutableMap.of("profiles", "default")); underTest = new ArgsFactory("bootstrapServers", "kafkaStoreTopic", "piiReplacerClassName", "s3Bucket", "s3EndpointUrl", "s3EndpointSigningRegion", "graphiteEndpoint", configMapSupplier); HashMap<Integer, OffsetRange> roadOffsets = Maps.newHashMap(); roadOffsets.put(1, new OffsetRange(1, 2)); roadOffsets.put(2, new OffsetRange(2, 3)); roadOffsets.put(3, new OffsetRange(3, 4)); LanderConfiguration landerConfiguration = new LanderConfiguration("name", "topic", roadOffsets, "s3KeyPrefix", false, "partitionColumnValue", false); List<String> result = underTest.newInstance(landerConfiguration); List<String> expected = ImmutableList .<String> builder() .add("--spring.profiles.active=default") .add("--kafka.bootstrapServers=bootstrapServers") .add("--road.name=name") .add("--road.topic=topic") .add("--kafka.road.topic=kafkaStoreTopic") .add("--piiReplacerClassName=piiReplacerClassName") .add("--road.offsets=1:1,2;2:2,3;3:3,4") .add("--s3.bucket=s3Bucket") .add("--s3.keyPrefix=s3KeyPrefix") .add("--s3.endpoint.url=s3EndpointUrl") .add("--s3.endpoint.signingRegion=s3EndpointSigningRegion") .add("--s3.enableServerSideEncryption=false") .add("--metrics.graphiteEndpoint=graphiteEndpoint") .build(); assertThat(result, is(expected)); }
public List<String> newInstance(LanderConfiguration config) { String formattedOffsets = formatOffsets(config.getOffsets()); log.info("Formatted offsets for topic: {} to launch Truck Park with: {}", config.getTopicName(), formattedOffsets); return ImmutableMap .<String, String> builder() .put("spring.profiles.active", configMapSupplier.get().getData().get("profiles")) .put("kafka.bootstrapServers", bootstrapServers) .put("road.name", config.getRoadName()) .put("road.topic", config.getTopicName()) .put("kafka.road.topic", roadModelTopic) .put("piiReplacerClassName", piiReplacerClassName) .put("road.offsets", formattedOffsets) .put("s3.bucket", s3Bucket) .put("s3.keyPrefix", config.getS3KeyPrefix()) .put("s3.endpoint.url", s3EndpointUrl) .put("s3.endpoint.signingRegion", s3EndpointSigningRegion) .put("s3.enableServerSideEncryption", Boolean.toString(config.isEnableServerSideEncryption())) .put("metrics.graphiteEndpoint", graphiteEndpoint) .build() .entrySet() .stream() .map(e -> String.format("--%s=%s", e.getKey(), e.getValue())) .collect(Collectors.toList()); }
ArgsFactory { public List<String> newInstance(LanderConfiguration config) { String formattedOffsets = formatOffsets(config.getOffsets()); log.info("Formatted offsets for topic: {} to launch Truck Park with: {}", config.getTopicName(), formattedOffsets); return ImmutableMap .<String, String> builder() .put("spring.profiles.active", configMapSupplier.get().getData().get("profiles")) .put("kafka.bootstrapServers", bootstrapServers) .put("road.name", config.getRoadName()) .put("road.topic", config.getTopicName()) .put("kafka.road.topic", roadModelTopic) .put("piiReplacerClassName", piiReplacerClassName) .put("road.offsets", formattedOffsets) .put("s3.bucket", s3Bucket) .put("s3.keyPrefix", config.getS3KeyPrefix()) .put("s3.endpoint.url", s3EndpointUrl) .put("s3.endpoint.signingRegion", s3EndpointSigningRegion) .put("s3.enableServerSideEncryption", Boolean.toString(config.isEnableServerSideEncryption())) .put("metrics.graphiteEndpoint", graphiteEndpoint) .build() .entrySet() .stream() .map(e -> String.format("--%s=%s", e.getKey(), e.getValue())) .collect(Collectors.toList()); } }
ArgsFactory { public List<String> newInstance(LanderConfiguration config) { String formattedOffsets = formatOffsets(config.getOffsets()); log.info("Formatted offsets for topic: {} to launch Truck Park with: {}", config.getTopicName(), formattedOffsets); return ImmutableMap .<String, String> builder() .put("spring.profiles.active", configMapSupplier.get().getData().get("profiles")) .put("kafka.bootstrapServers", bootstrapServers) .put("road.name", config.getRoadName()) .put("road.topic", config.getTopicName()) .put("kafka.road.topic", roadModelTopic) .put("piiReplacerClassName", piiReplacerClassName) .put("road.offsets", formattedOffsets) .put("s3.bucket", s3Bucket) .put("s3.keyPrefix", config.getS3KeyPrefix()) .put("s3.endpoint.url", s3EndpointUrl) .put("s3.endpoint.signingRegion", s3EndpointSigningRegion) .put("s3.enableServerSideEncryption", Boolean.toString(config.isEnableServerSideEncryption())) .put("metrics.graphiteEndpoint", graphiteEndpoint) .build() .entrySet() .stream() .map(e -> String.format("--%s=%s", e.getKey(), e.getValue())) .collect(Collectors.toList()); } @Autowired  ArgsFactory(
      @Value("${kafka.bootstrapServers}") String bootstrapServers,
      @Value("${kafka.road.topic}") String roadModelTopic,
      @Value("${piiReplacerClassName}") String piiReplacerClassName,
      @Value("${hive.table.location.bucket}") String s3Bucket,
      @Value("${s3.endpoint.url}") String s3EndpointUrl,
      @Value("${s3.endpoint.signingRegion}") String s3EndpointSigningRegion,
      @Value("${graphite.endpoint:disabled}") String graphiteEndpoint,
      Supplier<ConfigMap> configMapSupplier); }
ArgsFactory { public List<String> newInstance(LanderConfiguration config) { String formattedOffsets = formatOffsets(config.getOffsets()); log.info("Formatted offsets for topic: {} to launch Truck Park with: {}", config.getTopicName(), formattedOffsets); return ImmutableMap .<String, String> builder() .put("spring.profiles.active", configMapSupplier.get().getData().get("profiles")) .put("kafka.bootstrapServers", bootstrapServers) .put("road.name", config.getRoadName()) .put("road.topic", config.getTopicName()) .put("kafka.road.topic", roadModelTopic) .put("piiReplacerClassName", piiReplacerClassName) .put("road.offsets", formattedOffsets) .put("s3.bucket", s3Bucket) .put("s3.keyPrefix", config.getS3KeyPrefix()) .put("s3.endpoint.url", s3EndpointUrl) .put("s3.endpoint.signingRegion", s3EndpointSigningRegion) .put("s3.enableServerSideEncryption", Boolean.toString(config.isEnableServerSideEncryption())) .put("metrics.graphiteEndpoint", graphiteEndpoint) .build() .entrySet() .stream() .map(e -> String.format("--%s=%s", e.getKey(), e.getValue())) .collect(Collectors.toList()); } @Autowired  ArgsFactory(
      @Value("${kafka.bootstrapServers}") String bootstrapServers,
      @Value("${kafka.road.topic}") String roadModelTopic,
      @Value("${piiReplacerClassName}") String piiReplacerClassName,
      @Value("${hive.table.location.bucket}") String s3Bucket,
      @Value("${s3.endpoint.url}") String s3EndpointUrl,
      @Value("${s3.endpoint.signingRegion}") String s3EndpointSigningRegion,
      @Value("${graphite.endpoint:disabled}") String graphiteEndpoint,
      Supplier<ConfigMap> configMapSupplier); List<String> newInstance(LanderConfiguration config); }
ArgsFactory { public List<String> newInstance(LanderConfiguration config) { String formattedOffsets = formatOffsets(config.getOffsets()); log.info("Formatted offsets for topic: {} to launch Truck Park with: {}", config.getTopicName(), formattedOffsets); return ImmutableMap .<String, String> builder() .put("spring.profiles.active", configMapSupplier.get().getData().get("profiles")) .put("kafka.bootstrapServers", bootstrapServers) .put("road.name", config.getRoadName()) .put("road.topic", config.getTopicName()) .put("kafka.road.topic", roadModelTopic) .put("piiReplacerClassName", piiReplacerClassName) .put("road.offsets", formattedOffsets) .put("s3.bucket", s3Bucket) .put("s3.keyPrefix", config.getS3KeyPrefix()) .put("s3.endpoint.url", s3EndpointUrl) .put("s3.endpoint.signingRegion", s3EndpointSigningRegion) .put("s3.enableServerSideEncryption", Boolean.toString(config.isEnableServerSideEncryption())) .put("metrics.graphiteEndpoint", graphiteEndpoint) .build() .entrySet() .stream() .map(e -> String.format("--%s=%s", e.getKey(), e.getValue())) .collect(Collectors.toList()); } @Autowired  ArgsFactory(
      @Value("${kafka.bootstrapServers}") String bootstrapServers,
      @Value("${kafka.road.topic}") String roadModelTopic,
      @Value("${piiReplacerClassName}") String piiReplacerClassName,
      @Value("${hive.table.location.bucket}") String s3Bucket,
      @Value("${s3.endpoint.url}") String s3EndpointUrl,
      @Value("${s3.endpoint.signingRegion}") String s3EndpointSigningRegion,
      @Value("${graphite.endpoint:disabled}") String graphiteEndpoint,
      Supplier<ConfigMap> configMapSupplier); List<String> newInstance(LanderConfiguration config);  }