Skip to content

Commit

Permalink
description api separator update
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkoo committed Dec 11, 2017
1 parent 904db15 commit 575c971
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions application.properties_template
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ box.checksum=md5
box.checksum_buffer_size=1024
box.checksum_persist=true
box.checksum_ensure=1
box.version_as_timestamp=false
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class FilesystemDescriptionProvider implements DescriptionProvider {

public static final String DESCRIPTIONS_FILE = "descriptions.csv";
private static final String SEPARATOR = ";;;";
private static final String DESCRIPTION_TIMESTAMPT_SEPARATOR = "-";
private static final String DESCRIPTION_TIMESTAMPT_SEPARATOR = " - ";

private final File boxHome;
private final boolean versionAsTimestamp;
Expand Down Expand Up @@ -105,16 +105,6 @@ private DescriptionLine parseLine(String line) {
return new DescriptionLine(splittedLine[0], splittedLine[1]);
}

private static class DescriptionLine {
private final String version;
private final String description;

DescriptionLine(String version, String description) {
this.version = version;
this.description = description;
}
}

private String getDescriptionWithTimestamp(DescriptionLine descriptionLine) {
return Stream.of(
getDateFromTimestamp(descriptionLine.version),
Expand All @@ -126,4 +116,14 @@ private String getDescriptionWithTimestamp(DescriptionLine descriptionLine) {
private String getDateFromTimestamp(String timestamp) {
return Instant.ofEpochSecond(Long.valueOf(timestamp)).toString();
}

private static class DescriptionLine {
private final String version;
private final String description;

DescriptionLine(String version, String description) {
this.version = version;
this.description = description;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void givenValidDescriptionFileAndVersionAsTimestamp_whenGet_thenDescripti
true
);

String expectedDescription = "2017-01-01T00:00:00Z-DescriptionWithTimestamp";
String expectedDescription = "2017-01-01T00:00:00Z - DescriptionWithTimestamp";
assertEquals(descriptionProviderWithTimestamp.getDescription("f25", String.valueOf(versionAsTimestamp)).get(), expectedDescription);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class VersionAsTimestampTest extends AbstractIntegrationTest {
private final String VM_2_BOX = VM2 + "_" + VM2_TEST_TIMESTAMP.getEpochSecond() + "_vmware.box";

private final String EXPECTED_VM1BOX_DESCRIPTION = "2017-10-10T12:00:00Z";
private final String EXPECTED_VM2BOX_DESCRIPTION = "2017-10-10T10:00:00Z-Some useful description";
private final String EXPECTED_VM2BOX_DESCRIPTION = "2017-10-10T10:00:00Z - Some useful description";

@Override
public void createFolderStructure() throws IOException {
Expand Down

0 comments on commit 575c971

Please sign in to comment.