@Test public void test_tar_and_zip_naming() { String tarId = "20190701165216262-a8e7c997-3c44-4119-b169-5d2000015697.tar"; String backupId = "20190701165216263-mongod-shard12.zip"; String date = LocalFileUtils.getCreationDateFromArchiveId(tarId); Assertions.assertThat(tarId).contains(date); date = LocalFileUtils.getCreationDateFromArchiveId(backupId); Assertions.assertThat(backupId).contains(date); }
public static String getCreationDateFromArchiveId(String archiveId) { Matcher matcher = ARCHIVE_ID_FILENAME_PATTERN.matcher(archiveId); if (!matcher.matches()) { throw new IllegalArgumentException("Invalid archiveId '" + archiveId + "'"); } return matcher.group("CreationDate"); }
LocalFileUtils { public static String getCreationDateFromArchiveId(String archiveId) { Matcher matcher = ARCHIVE_ID_FILENAME_PATTERN.matcher(archiveId); if (!matcher.matches()) { throw new IllegalArgumentException("Invalid archiveId '" + archiveId + "'"); } return matcher.group("CreationDate"); } }
LocalFileUtils { public static String getCreationDateFromArchiveId(String archiveId) { Matcher matcher = ARCHIVE_ID_FILENAME_PATTERN.matcher(archiveId); if (!matcher.matches()) { throw new IllegalArgumentException("Invalid archiveId '" + archiveId + "'"); } return matcher.group("CreationDate"); } private  LocalFileUtils(); }
LocalFileUtils { public static String getCreationDateFromArchiveId(String archiveId) { Matcher matcher = ARCHIVE_ID_FILENAME_PATTERN.matcher(archiveId); if (!matcher.matches()) { throw new IllegalArgumentException("Invalid archiveId '" + archiveId + "'"); } return matcher.group("CreationDate"); } private  LocalFileUtils(); static String createStorageId(String objectName); static String storageIdToObjectName(String storageId); static String createTarEntryName(String containerName, String storageId, int entryIndex); static String getContainerNameFromTarEntryName(String tarEntryName); static String getStorageIdFromTarEntryName(String tarEntryName); static int getEntryIndexFromTarEntryName(String tarEntryName); static String createTarId(LocalDateTime now); static String archiveFileNameRelativeToInputArchiveStorageFolder(String fileBucket, String archiveId); static String getCreationDateFromArchiveId(String archiveId); static String archiveFileNamePathToArchiveId(String tarFileName); static Path fileBuckedInputFilePath(String inputTarStorageFolder, String fileBucketId); }
LocalFileUtils { public static String getCreationDateFromArchiveId(String archiveId) { Matcher matcher = ARCHIVE_ID_FILENAME_PATTERN.matcher(archiveId); if (!matcher.matches()) { throw new IllegalArgumentException("Invalid archiveId '" + archiveId + "'"); } return matcher.group("CreationDate"); } private  LocalFileUtils(); static String createStorageId(String objectName); static String storageIdToObjectName(String storageId); static String createTarEntryName(String containerName, String storageId, int entryIndex); static String getContainerNameFromTarEntryName(String tarEntryName); static String getStorageIdFromTarEntryName(String tarEntryName); static int getEntryIndexFromTarEntryName(String tarEntryName); static String createTarId(LocalDateTime now); static String archiveFileNameRelativeToInputArchiveStorageFolder(String fileBucket, String archiveId); static String getCreationDateFromArchiveId(String archiveId); static String archiveFileNamePathToArchiveId(String tarFileName); static Path fileBuckedInputFilePath(String inputTarStorageFolder, String fileBucketId); static final String TAR_EXTENSION; static final String ZIP_EXTENSION; static final String TMP_EXTENSION; static final String INPUT_TAR_TMP_FOLDER; }