@Test void decide() { DefaultS3DestinationDecider.Config config = new DefaultS3DestinationDecider.Config(); config.setKeyPrefix("archives"); config.setKeySuffix(".testdata"); DefaultS3DestinationDecider decider = new DefaultS3DestinationDecider(config); ZonedDateTime time = ZonedDateTime.of(2019, 12, 31, 23, 59, 59, 999999000, TIMEZONE_JST); S3DestinationDecider.S3Destination destination = decider.decide("web.access_log", time.toInstant()); assertEquals("web.access_log", destination.getBucket()); assertEquals("archives/2019/12/31/14/59-59-999999.testdata", destination.getKey()); }
@Override public S3Destination decide(String tag, Instant time) { String keyPrefix = getKeyPrefix() == null ? "" : getKeyPrefix() + "/"; String keySuffix = getKeySuffix() == null ? "" : getKeySuffix(); return new S3Destination(getBucket(tag), keyPrefix + getKeyBase(time) + keySuffix); }
DefaultS3DestinationDecider implements S3DestinationDecider { @Override public S3Destination decide(String tag, Instant time) { String keyPrefix = getKeyPrefix() == null ? "" : getKeyPrefix() + "/"; String keySuffix = getKeySuffix() == null ? "" : getKeySuffix(); return new S3Destination(getBucket(tag), keyPrefix + getKeyBase(time) + keySuffix); } }
DefaultS3DestinationDecider implements S3DestinationDecider { @Override public S3Destination decide(String tag, Instant time) { String keyPrefix = getKeyPrefix() == null ? "" : getKeyPrefix() + "/"; String keySuffix = getKeySuffix() == null ? "" : getKeySuffix(); return new S3Destination(getBucket(tag), keyPrefix + getKeyBase(time) + keySuffix); } DefaultS3DestinationDecider(Config config); }
DefaultS3DestinationDecider implements S3DestinationDecider { @Override public S3Destination decide(String tag, Instant time) { String keyPrefix = getKeyPrefix() == null ? "" : getKeyPrefix() + "/"; String keySuffix = getKeySuffix() == null ? "" : getKeySuffix(); return new S3Destination(getBucket(tag), keyPrefix + getKeyBase(time) + keySuffix); } DefaultS3DestinationDecider(Config config); @Override S3Destination decide(String tag, Instant time); String getKeyPrefix(); String getKeySuffix(); ZoneId getZoneId(); }
DefaultS3DestinationDecider implements S3DestinationDecider { @Override public S3Destination decide(String tag, Instant time) { String keyPrefix = getKeyPrefix() == null ? "" : getKeyPrefix() + "/"; String keySuffix = getKeySuffix() == null ? "" : getKeySuffix(); return new S3Destination(getBucket(tag), keyPrefix + getKeyBase(time) + keySuffix); } DefaultS3DestinationDecider(Config config); @Override S3Destination decide(String tag, Instant time); String getKeyPrefix(); String getKeySuffix(); ZoneId getZoneId();  }