ArchiveManager { public Location newArchiveLocation( int siteId, String projectName, String revisionName, long contentLength) { if (uploadArchiveType.equals(ArchiveType.DB)) { return new Location(uploadArchiveType, null); } else { return new Location(uploadArchiveType, formatFilePath(siteId, projectName, revisionName)); } } @Inject  ArchiveManager(StorageManager storageManager, Config systemConfig); Location newArchiveLocation(
            int siteId, String projectName, String revisionName,
            long contentLength); Storage getStorage(ArchiveType type); Optional<StorageObject> openArchive(ProjectStore ps, int projectId, String revisionName); Optional<StoredArchive> getArchive(ProjectStore ps, int projectId, String revisionName);  }
@Test public void newArchiveLocation() throws IOException { String rev = UUID.randomUUID().toString(); ArchiveManager.Location location = archiveManager.newArchiveLocation(42, "my-proj", rev, 123456); assertThat(location.getArchiveType(), is(ArchiveType.of("s3"))); String encodeProjectName = new String(Base64.getEncoder().encode("my-proj".getBytes(UTF_8)), UTF_8).replace("=", ""); assertThat(location.getPath(), is(startsWith(String.format("projects/42/%s/%s.", encodeProjectName, rev)))); assertThat(location.getPath(), is(endsWith(".tar.gz"))); }