diff --git a/src/main/java/gov/loc/repository/bagit/conformance/ManifestChecker.java b/src/main/java/gov/loc/repository/bagit/conformance/ManifestChecker.java index d847e6413..2bfba8135 100644 --- a/src/main/java/gov/loc/repository/bagit/conformance/ManifestChecker.java +++ b/src/main/java/gov/loc/repository/bagit/conformance/ManifestChecker.java @@ -20,31 +20,32 @@ import gov.loc.repository.bagit.util.PathUtils; /** - * Part of the BagIt conformance suite. - * This checker checks for various problems related to the manifests in a bag. + * Part of the BagIt conformance suite. This checker checks for various problems + * related to the manifests in a bag. */ @SuppressWarnings({"PMD.UseLocaleWithCaseConversions"}) -public final class ManifestChecker { +public final class ManifestChecker{ + private static final Logger logger = LoggerFactory.getLogger(ManifestChecker.class); private static final ResourceBundle messages = ResourceBundle.getBundle("MessageBundle"); - + private static final String THUMBS_DB_FILE = "[Tt][Hh][Uu][Mm][Bb][Ss]\\.[Dd][Bb]"; private static final String DS_STORE_FILE = "\\.[Dd][Ss]_[Ss][Tt][Oo][Rr][Ee]"; private static final String SPOTLIGHT_FILE = "\\.[Ss][Pp][Oo][Tt][Ll][Ii][Gg][Hh][Tt]-[Vv]100"; private static final String TRASHES_FILE = "\\.(_.)?[Tt][Rr][Aa][Ss][Hh][Ee][Ss]"; private static final String FS_EVENTS_FILE = "\\.[Ff][Ss][Ee][Vv][Ee][Nn][Tt][Ss][Dd]"; private static final String OS_FILES_REGEX = ".*data/(" + THUMBS_DB_FILE + "|" + DS_STORE_FILE + "|" + SPOTLIGHT_FILE + "|" + TRASHES_FILE + "|" + FS_EVENTS_FILE + ")"; - + private ManifestChecker(){ //intentionally left empty } - + /* * Check for all the manifest specific potential problems */ - public static void checkManifests(final Path bagitDir, final Charset encoding, final Set warnings, - final Collection warningsToIgnore) throws IOException, InvalidBagitFileFormatException{ - + public static void checkManifests(final Path bagitDir, final Charset encoding, final Set warnings, + final Collection warningsToIgnore) throws IOException, InvalidBagitFileFormatException{ + boolean missingTagManifest = true; try(final DirectoryStream files = Files.newDirectoryStream(bagitDir)){ for(final Path file : files){ @@ -52,102 +53,101 @@ public static void checkManifests(final Path bagitDir, final Charset encoding, f if(filename.contains("manifest-")){ if(filename.startsWith("manifest-")){ checkData(file, encoding, warnings, warningsToIgnore, true); - } - else{ + } else{ checkData(file, encoding, warnings, warningsToIgnore, false); missingTagManifest = false; } - + final String algorithm = filename.split("[-\\.]")[1]; checkAlgorthm(algorithm, warnings, warningsToIgnore); } } } - + if(!warningsToIgnore.contains(BagitWarning.MISSING_TAG_MANIFEST) && missingTagManifest){ logger.warn(messages.getString("bag_missing_tag_manifest_warning"), bagitDir); warnings.add(BagitWarning.MISSING_TAG_MANIFEST); } } - + /* * Check for a "bag within a bag" and for relative paths in the manifests */ private static void checkData(final Path manifestFile, final Charset encoding, final Set warnings, final Collection warningsToIgnore, final boolean isPayloadManifest) throws IOException, InvalidBagitFileFormatException{ try(final BufferedReader reader = Files.newBufferedReader(manifestFile, encoding)){ final Set paths = new HashSet<>(); - + String line = reader.readLine(); while(line != null){ String path = parsePath(line); - + path = checkForManifestCreatedWithMD5SumTools(path, warnings, warningsToIgnore); - + if(!warningsToIgnore.contains(BagitWarning.DIFFERENT_CASE) && paths.contains(path.toLowerCase())){ logger.warn(messages.getString("different_case_warning"), manifestFile, path); warnings.add(BagitWarning.DIFFERENT_CASE); } paths.add(path.toLowerCase()); - + if(encoding.name().startsWith("UTF")){ checkNormalization(path, manifestFile.getParent(), warnings, warningsToIgnore); } - + checkForBagWithinBag(line, warnings, warningsToIgnore, isPayloadManifest); - + checkForRelativePaths(line, warnings, warningsToIgnore, manifestFile); - + checkForOSSpecificFiles(line, warnings, warningsToIgnore, manifestFile); - + line = reader.readLine(); } } } - + static String parsePath(final String line) throws InvalidBagitFileFormatException{ final String[] parts = line.split("\\s+", 2); if(parts.length < 2){ final String formattedMessage = messages.getString("manifest_line_violated_spec_error"); throw new InvalidBagitFileFormatException(MessageFormatter.format(formattedMessage, line).getMessage()); } - + return parts[1]; } - + private static String checkForManifestCreatedWithMD5SumTools(final String path, final Set warnings, final Collection warningsToIgnore){ String fixedPath = path; final boolean startsWithStar = path.charAt(0) == '*'; - + if(startsWithStar){ fixedPath = path.substring(1); } - + if(!warningsToIgnore.contains(BagitWarning.MD5SUM_TOOL_GENERATED_MANIFEST) && startsWithStar){ logger.warn(messages.getString("md5sum_generated_line_warning"), path); warnings.add(BagitWarning.MD5SUM_TOOL_GENERATED_MANIFEST); } - + return fixedPath; } - + /* * Check that the file specified has not changed its normalization (i.e. have the bytes changed but it still looks the same?) */ private static void checkNormalization(final String path, final Path rootDir, final Set warnings, final Collection warningsToIgnore) throws IOException{ if(!warningsToIgnore.contains(BagitWarning.DIFFERENT_NORMALIZATION)){ - + final Path fileToCheck = rootDir.resolve(path).normalize(); final Path dirToCheck = fileToCheck.getParent(); - if(dirToCheck == null){ + if(dirToCheck == null){ final String formattedMessage = messages.getString("cannot_access_parent_path_error"); throw new IOException(MessageFormatter.format(formattedMessage, fileToCheck).getMessage()); //to satisfy findbugs } final String normalizedFileToCheck = normalizePathToNFD(fileToCheck); - + try(final DirectoryStream files = Files.newDirectoryStream(dirToCheck)){ for(final Path file : files){ final String normalizedFile = normalizePathToNFD(file); - + if(!file.equals(fileToCheck) && normalizedFileToCheck.equals(normalizedFile)){ logger.warn(messages.getString("different_normalization_in_manifest_warning"), fileToCheck); warnings.add(BagitWarning.DIFFERENT_NORMALIZATION); @@ -156,14 +156,14 @@ private static void checkNormalization(final String path, final Path rootDir, fi } } } - + /* * Normalize to Canonical decomposition. */ static String normalizePathToNFD(final Path path){ return Normalizer.normalize(path.toString(), Normalizer.Form.NFD); } - + /* * check for a bag within a bag */ @@ -173,7 +173,7 @@ private static void checkForBagWithinBag(final String line, final Set warnings, final Collection warningsToIgnore){ final String upperCaseAlg = algorithm.toUpperCase(); - if(!warningsToIgnore.contains(BagitWarning.WEAK_CHECKSUM_ALGORITHM) && - (upperCaseAlg.startsWith("MD") || upperCaseAlg.matches("SHA(1|224|256|384)?"))){ + if(!warningsToIgnore.contains(BagitWarning.WEAK_CHECKSUM_ALGORITHM) + && (upperCaseAlg.startsWith("MD") || upperCaseAlg.matches("SHA(1|224|256|384)?"))){ logger.warn(messages.getString("weak_algorithm_warning"), algorithm); warnings.add(BagitWarning.WEAK_CHECKSUM_ALGORITHM); - } - - else if(!warningsToIgnore.contains(BagitWarning.NON_STANDARD_ALGORITHM) && !"SHA-512".equals(upperCaseAlg)){ + } else if(!warningsToIgnore.contains(BagitWarning.NON_STANDARD_ALGORITHM) && !"SHA-512".equals(upperCaseAlg)){ logger.warn(messages.getString("non_standard_algorithm_warning"), algorithm); warnings.add(BagitWarning.NON_STANDARD_ALGORITHM); } } //for unit test only - static String getOsFilesRegex() { + static String getOsFilesRegex(){ return OS_FILES_REGEX; } diff --git a/src/main/java/gov/loc/repository/bagit/conformance/MetadataChecker.java b/src/main/java/gov/loc/repository/bagit/conformance/MetadataChecker.java index 912287fb1..74d8cdb28 100644 --- a/src/main/java/gov/loc/repository/bagit/conformance/MetadataChecker.java +++ b/src/main/java/gov/loc/repository/bagit/conformance/MetadataChecker.java @@ -16,38 +16,39 @@ import gov.loc.repository.bagit.reader.MetadataReader; /** - * Part of the BagIt conformance suite. - * This checker checks the bag metadata (bag-info.txt) for various problems. + * Part of the BagIt conformance suite. This checker checks the bag metadata + * (bag-info.txt) for various problems. */ public final class MetadataChecker { private static final Logger logger = LoggerFactory.getLogger(MetadataChecker.class); private static final ResourceBundle messages = ResourceBundle.getBundle("MessageBundle"); - - private MetadataChecker(){ - //intentionally left empty + + private MetadataChecker() { + // intentionally left empty } - - public static void checkBagMetadata(final Path bagitDir, final Charset encoding, final Set warnings, - final Collection warningsToIgnore) throws IOException, InvalidBagMetadataException{ + + public static void checkBagMetadata(final Path bagitDir, final Charset encoding, final Set warnings, + final Collection warningsToIgnore) throws IOException, InvalidBagMetadataException { checkForPayloadOxumMetadata(bagitDir, encoding, warnings, warningsToIgnore); } - + /* * Check that the metadata contains the Payload-Oxum key-value pair */ - private static void checkForPayloadOxumMetadata(final Path bagitDir, final Charset encoding, final Set warnings, - final Collection warningsToIgnore) throws IOException, InvalidBagMetadataException{ - if(!warningsToIgnore.contains(BagitWarning.PAYLOAD_OXUM_MISSING)){ + private static void checkForPayloadOxumMetadata(final Path bagitDir, final Charset encoding, + final Set warnings, + final Collection warningsToIgnore) throws IOException, InvalidBagMetadataException { + if (!warningsToIgnore.contains(BagitWarning.PAYLOAD_OXUM_MISSING)) { final List> metadata = MetadataReader.readBagMetadata(bagitDir, encoding); boolean containsPayloadOxum = false; - - for(final SimpleImmutableEntry pair : metadata){ - if("Payload-Oxum".equals(pair.getKey())){ + + for (final SimpleImmutableEntry pair : metadata) { + if ("Payload-Oxum".equals(pair.getKey())) { containsPayloadOxum = true; } } - - if(!containsPayloadOxum){ + + if (!containsPayloadOxum) { logger.warn(messages.getString("missing_payload_oxum_warning")); warnings.add(BagitWarning.PAYLOAD_OXUM_MISSING); } diff --git a/src/main/java/gov/loc/repository/bagit/writer/PayloadWriter.java b/src/main/java/gov/loc/repository/bagit/writer/PayloadWriter.java index 2760d5605..a0e717f38 100644 --- a/src/main/java/gov/loc/repository/bagit/writer/PayloadWriter.java +++ b/src/main/java/gov/loc/repository/bagit/writer/PayloadWriter.java @@ -21,73 +21,80 @@ * Responsible for writing out the bag payload to the filesystem */ public final class PayloadWriter { + private static final Logger logger = LoggerFactory.getLogger(PayloadWriter.class); private static final Version VERSION_2_0 = new Version(2, 0); private static final ResourceBundle messages = ResourceBundle.getBundle("MessageBundle"); - - private PayloadWriter(){ - //intentionally left empty + + private PayloadWriter() { + // intentionally left empty } - + /* - * Write the payload files in the data directory or under the root directory depending on the version + * Write the payload files in the data directory or under the root directory + * depending on the version */ - static Path writeVersionDependentPayloadFiles(final Bag bag, final Path outputDir) throws IOException{ + static Path writeVersionDependentPayloadFiles(final Bag bag, final Path outputDir) throws IOException { Path bagitDir = outputDir; - //@Incubating - if(bag.getVersion().isSameOrNewer(VERSION_2_0)){ + // @Incubating + if (bag.getVersion().isSameOrNewer(VERSION_2_0)) { bagitDir = outputDir.resolve(".bagit"); Files.createDirectories(bagitDir); writePayloadFiles(bag.getPayLoadManifests(), bag.getItemsToFetch(), outputDir, bag.getRootDir()); - } - else{ + } else { final Path dataDir = outputDir.resolve("data"); Files.createDirectories(dataDir); writePayloadFiles(bag.getPayLoadManifests(), bag.getItemsToFetch(), dataDir, bag.getRootDir().resolve("data")); } - + return bagitDir; } - + /** - * Write the payload file(s) to the output directory - * - * @param payloadManifests the set of objects representing the payload manifests - * @param fetchItems the list of items to exclude from writing in the output directory because they will be fetched - * @param outputDir the data directory of the bag - * @param bagDataDir the data directory of the bag - * - * @throws IOException if there was a problem writing a file - */ - public static void writePayloadFiles(final Set payloadManifests, final List fetchItems, final Path outputDir, final Path bagDataDir) throws IOException{ - logger.info(messages.getString("writing_payload_files")); - final Set fetchPaths = getFetchPaths(fetchItems); - - for(final Manifest payloadManifest : payloadManifests){ - for(final Path payloadFile : payloadManifest.getFileToChecksumMap().keySet()){ - final Path relativePayloadPath = bagDataDir.relativize(payloadFile); - - if(fetchPaths.contains(relativePayloadPath.normalize())) { - logger.info(messages.getString("skip_fetch_item_when_writing_payload"), payloadFile); - } - else { - final Path writeToPath = outputDir.resolve(relativePayloadPath); - logger.debug(messages.getString("writing_payload_file_to_path"), payloadFile, writeToPath); - final Path parent = writeToPath.getParent(); - if(parent != null){ - Files.createDirectories(parent); - } - Files.copy(payloadFile, writeToPath, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); - } - } - } - } - - private static Set getFetchPaths(final List fetchItems){ - final Set fetchPaths = new HashSet<>(); - for(final FetchItem fetchItem : fetchItems) { - fetchPaths.add(fetchItem.getPath()); - } - return fetchPaths; - } + * Write the payload file(s) to the output directory + * + * @param payloadManifests + * the set of objects representing the payload manifests + * @param fetchItems + * the list of items to exclude from writing in the output directory + * because they will be fetched + * @param outputDir + * the data directory of the bag + * @param bagDataDir + * the data directory of the bag + * + * @throws IOException + * if there was a problem writing a file + */ + public static void writePayloadFiles(final Set payloadManifests, final List fetchItems, + final Path outputDir, final Path bagDataDir) throws IOException { + logger.info(messages.getString("writing_payload_files")); + final Set fetchPaths = getFetchPaths(fetchItems, bagDataDir); + + for (final Manifest payloadManifest : payloadManifests) { + for (final Path payloadFile : payloadManifest.getFileToChecksumMap().keySet()) { + final Path relativePayloadPath = bagDataDir.relativize(payloadFile); + + if (fetchPaths.contains(relativePayloadPath.normalize())) { + logger.info(messages.getString("skip_fetch_item_when_writing_payload"), payloadFile); + } else { + final Path writeToPath = outputDir.resolve(relativePayloadPath); + logger.debug(messages.getString("writing_payload_file_to_path"), payloadFile, writeToPath); + final Path parent = writeToPath.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } + Files.copy(payloadFile, writeToPath, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); + } + } + } + } + + private static Set getFetchPaths(final List fetchItems, final Path bagDataDir) { + final Set fetchPaths = new HashSet<>(); + fetchItems.forEach((fetchItem) -> { + fetchPaths.add(bagDataDir.relativize(bagDataDir.getParent().resolve(fetchItem.getPath()))); + }); + return fetchPaths; + } } diff --git a/src/main/resources/MessageBundle.properties b/src/main/resources/MessageBundle.properties index 33e749e3f..7fd1c6aff 100644 --- a/src/main/resources/MessageBundle.properties +++ b/src/main/resources/MessageBundle.properties @@ -23,22 +23,22 @@ different_case=The bag contains two files that differ only in case. This can cau different_normalization=The bag contains two files that differ only in the normalization. This can cause verification to fail on some systems, and general user confusion. extra_lines_in_bagit_files=The bagit specification says it must only contain 2 lines. However, some implementations have decided to ignore this which may cause compatibility issues leading_dot_slash=A manifest lists all data files as relative to the bag root directory, it is superfluous to therefore specify it with a dot. -non_standard_algorithm=The checksum algorithm used does not come standard with the Java runtime. Consider using SHA512 instead. -md5sum_tool_generated_manifest=The manifest was created using a using checksum utilities such as those contained in the GNU Coreutils package (md5sum, sha1sum, etc.), collectively referred to here as 'md5sum'. This creates slight differences in generated manifests that can cause problems in some implementations. -missing_tag_manifest=The tag manifest guards against a truncated payload manifest as well as other potental problems and is always recommened that it be included. +non_standard_algorithm=The checksum algorithm used does not come standard with the Java runtime. Consider using SHA-512 instead. +md5sum_tool_generated_manifest=The manifest was created using checksum utilities such as those contained in the GNU Coreutils package (md5sum, sha1sum, etc.), collectively referred to here as 'md5sum'. This creates slight differences in generated manifests that can cause problems in some implementations. +missing_tag_manifest=The tag manifest guards against a truncated payload manifest as well as other potential problems and is always recommened that it be included. old_bagit_version=The bagit specification version is not the newest. Consider converting to the latest version. os_specific_files=Files created by the operating system (OS) for its own use. They are non-portable across OS versions and should not be included in any manifest. Examples Thumbs.db on Windows or .DS_Store on OS X payload_oxum_missing=It is recommended to always include the Payload-Oxum in the bag metadata since it allows for a 'quick verification' of the bag. tag_files_encoding=It is recommended to always use UTF-8. -weak_checksum_algorithm=The checksum algorithm used is known to be weak. We recommend using SHA512. +weak_checksum_algorithm=The checksum algorithm used is known to be weak. We recommend using SHA-512. #for BagLinter.java checking_encoding_problems=Checking encoding problems. -checking_latest_version=checking for latest version. -checking_manifest_problems=checking manifests for problems. -checking_metadata_problems=checking bag metadata for problems. -skipping_check_extra_lines=skipping check for extra lines in bagit files. -checking_extra_lines=checking if [{}] contains more than 2 lines. +checking_latest_version=Checking for latest version. +checking_manifest_problems=Checking manifests for problems. +checking_metadata_problems=Checking bag metadata for problems. +skipping_check_extra_lines=Skipping check for extra lines in bagit files. +checking_extra_lines=Checking if [{}] contains more than 2 lines. extra_lines_warning=The bagit specification states that the bagit.txt file must contain exactly 2 lines. However we found [{}] lines, some implementations will ignore this but may cause incompatibility issues with other tools. #for BagProfileChecker.java @@ -46,7 +46,7 @@ checking_fetch_file_allowed=Checking if the fetch file is allowed for bag [{}]. checking_metadata_entry_required=Checking if [{}] is required in the bag metadata. check_values_acceptable=Checking if all the values listed for [{}] are acceptable. check_required_manifests_present=Checking if all the required manifests are present. -required_tag_manifest_type_not_present=Required tagmanifest type [{}] was not present. +required_tag_manifest_type_not_present=Required tag manifest type [{}] was not present. required_manifest_type_not_present=Required manifest type [{}] was not present. checking_required_tag_file_exists=Checking if all the required tag files exist. @@ -74,7 +74,7 @@ different_case_warning=In manifest [{}], path [{}] is the same as another path e manifest_line_violated_spec_error=Manifest contains line [{}] which does not follow the specified form of md5sum_generated_line_warning=Path [{}] starts with a *, which means it was generated with a non-bagit tool. It is recommended to remove the * in order to conform to the bagit specification. cannot_access_parent_path_error=Could not access parent folder of [{}]. -different_normalization_in_manifest_warning=File [{}] has a different normalization then what is specified in the manifest. +different_normalization_in_manifest_warning=File [{}] has a different normalization than what is specified in the manifest. bag_within_bag_warning=We stronger recommend not storing a bag within a bag as it is known to cause problems. leading_dot_slash_warning=In manifest [{}] line [{}] is a non-normalized path. os_specific_files_warning=In manifest [{}] line [{}] contains a OS specific file. @@ -139,7 +139,7 @@ found_metadata_file=Found metadata file [{}]. #for TagFileReader.java removing_asterisk=Encountered path that was created by non-bagit tool. Removing * from path. Please remove all * from manifest files! -blackslash_used_as_path_separator_error=[{}] is invalid due to the use of the path separactor [\\]! +blackslash_used_as_path_separator_error=[{}] is invalid due to the use of the path separator [\\]! malicious_path_error=[{}] is trying to be malicious and access a file outside the bag! invalid_url_format_error=URL [{}] is invalid! @@ -161,7 +161,7 @@ checking_checksums=Checking file [{}] to see if checksum matches [{}]. corrupt_checksum_error=File [{}] is suppose to have a [{}] hash of [{}] but was computed [{}]. #for FileCoundAndTotalSizeVisitor.java -file_size_in_bytes=File [{}] hash a size of [{}] bytes. +file_size_in_bytes=File [{}] has a size of [{}] bytes. #for MandatoryVerifier.java checking_fetch_items_exist=Checking if all [{}] items in fetch.txt exist in the [{}] directory. @@ -186,11 +186,11 @@ checking_file_in_at_least_one_manifest=Checking if all payload files (files in [ checking_file_in_all_manifests=Checking if all payload files (files in [{}] directory) are listed in all manifests. #for QuickVerifier.java -found_payload_oxum=Found payload-oxum [{}] for bag [{}]. +found_payload_oxum=Found Payload-Oxum [{}] for bag [{}]. payload_oxum_missing_error=Payload-Oxum does not exist in bag! parse_size_in_bytes=Parsing [{}] for the total byte size of the payload oxum. parse_number_of_files=Parsing [{}] for the number of files to find in the payload directory. -compare_payload_oxums=supplied payload-oxum: [{}], Calculated payload-oxum: [{}.{}], for payload directory [{}]. +compare_payload_oxums=Supplied payload-oxum: [{}], Calculated payload-oxum: [{}.{}], for payload directory [{}]. invalid_total_size_error=Invalid total size. Expected [{}] but calculated [{}]! invalid_file_cound_error=Invalid file count. Expected [{}] but found [{}]! diff --git a/src/main/resources/MessageBundle_de_DE.properties b/src/main/resources/MessageBundle_de_DE.properties new file mode 100644 index 000000000..e7488a22d --- /dev/null +++ b/src/main/resources/MessageBundle_de_DE.properties @@ -0,0 +1,221 @@ +#default is English, United States (en_US). This is used to store all messages in bagit-java + +#for BagitProfileDeserializer.java +fetch_allowed=Sind Fetch Dateien erlaubt? [{}] +serialization_allowed=Serialisierung ist: [{}] +parsing_bagit_profile_info_section=Lese Abschnitt BagIt-Profile-Info +identifier=Identifier hat den Wert [{}] +source_organization=Source-Organization hat den Wert [{}] +contact_name=Contact-Name hat den Wert [{}] +contact_email=Contact-Email hat den Wert [{}] +external_description=External-Description hat den Wert [{}] +version=Version hat den Wert [{}] +parsing_bag_info=Lese Abschnitt Bag-Info +required_manifest_types=Erforderliche Manifeste {} +acceptable_serialization_mime_types=Akzeptierte MIME Typen f\u00fcr die Serialisierung sind {} +required_tagmanifest_types=Erforderliche Tag Manifeste sind {} +tag_files_required=Erforderliche Tag Dateien sind {} +acceptable_bagit_versions=Akzeptierte bagit Versionen sind {} + +#for BagitWarning.java +bag_within_a_bag=Das Verzeichnis data kann alles beinhalten, inklusive einer anderen bag. Es wird allerdings empfohlen, mehrere bags zusammenzufassen. +different_case=Eine bag kann mehrere Dateien mit unterschiedlicher Gro\u00df- und Kleinschreibung enthalten. Dies kann zu Problemen mit bestimmten Dateisystemen f\u00fchren, z.B. mit dem von Apple verwendeten HFS. +different_normalization=Eine bag kann mehrere Dateien mit unterschiedlicher Normalisierung enthalten. Dies kann bei einigen Dateisystemen zu Problemen bei der Verifizierung f\u00fchren und den Benutzer verwirren. +extra_lines_in_bagit_files=Laut bagit Spezifikation d\u00fcrfen nur 2 Zeilen enthalten sein. Dennoch haben sich einige Implementierungen daf\u00fcr entschieden dies zu ignorieren, was zu Kompatibilit\u00e4tsproblemen f\u00fchren kann. +leading_dot_slash=Eine Manifest Datei f\u00fchrt alle Dateien im Verzeichnis data relativ zum Wurzelverzeichnis der bag auf. Daher ist es nicht notwendig, die Dateipfade mit einem Punkt zu beginnen. +non_standard_algorithm=Der verwendete Algorithmus zur Pr\u00fcfsummenberechnung ist nicht Teil der Standard Java Laufzeitumgebung. Die Verwendung von SHA512 wird empfohlen. +md5sum_tool_generated_manifest=Das Manifest wurde mit Hilfe von Werkzeugen zur Pr\u00fcfsummenberechnung erstellt, die z.B. Teil des GNU Coreutils Paketes sind (md5sum, sha1sum, etc.), hier als 'md5sum' bezeichnet. Diese erzeugen minimale Unterschiede in den erstellten Manifesten, was zu Problemen mit einigen Implementierungen f\u00fchren kann. +missing_tag_manifest=Das Tag Manifest verhindert unvollst\u00e4ndige Payload Manifeste sowie andere potentielle Probleme. Daher wird empfohlen, dass es Teil jeder bag ist. +old_bagit_version=Die verwendete Version der bagit Spezifikation ist veraltet. Es wird empfohlen, auf die aktuellste Version zu umzusteigen. +os_specific_files=Dateien die vom Betriebssystem f\u00fcr eigene Zwecke erzeugt wurden. Diese sind nicht zwischen verschiedenen Betriebssystemversionen portierbar und sollten nicht im Manifest aufgef\u00fchrt werden. Beispiele hierf\u00fcr sind Thumbs.db unter Windows oder .DS_Store unter OS X. +payload_oxum_missing=Es wird empfohlen, die Eigenschaft Payload-Oxum in den Metadaten jeder bag zu hinterlegen, da diese eine schnelle \u00dcberpr\u00fcfung der bag erlaubt. +tag_files_encoding=Es wird empfohlen UTF-8 zu verwenden. +weak_checksum_algorithm=Der verwendete Algorithmus zur Pr\u00fcfsummenerzeugung ist angreifbar. Wir empfehlen die Verwendung von SHA-512. + +#for BagLinter.java +checking_encoding_problems=Pr\u00fcfe auf Probleme mit der Zeichenkodierung. +checking_latest_version=Pr\u00fcfe auf aktuellste Version. +checking_manifest_problems=Pr\u00fcfe Manifeste auf Probleme. +checking_metadata_problems=Pr\u00fcfe bag Metadaten auf Probleme. +skipping_check_extra_lines=\u00dcberspringe Pr\u00fcfung auf Extrazeilen in bagit Dateien. +checking_extra_lines=Pr\u00fcfe ob [{}] mehr als 2 Zeilen enth\u00e4lt. +extra_lines_warning=The bagit Spezifikation sagt aus, dass bagit.txt genau 2 Zeilen enthalten darf. Die vorliegende bagit.txt enth\u00e4lt [{}] Zeilen. Dies kann von einigen Implementierungen ignoriert werden oder zu Kombatibilit\u00e4tsproblemen f\u00fchren. + +#for BagProfileChecker.java +checking_fetch_file_allowed=Pr\u00fcfe ob Fetch Dateien f\u00fcr die bag [{}] erlaubt sind. +checking_metadata_entry_required=Pr\u00fcfe ob [{}] in den bag Metadaten ben\u00f6tigt wird. +check_values_acceptable=Pr\u00fcfe ob alle f\u00fcr [{}] aufgef\u00fchrten Werte akzeptiert werden k\u00f6nnen. +check_required_manifests_present=Pr\u00fcfe ob alle ben\u00f6tigten Manifeste vorhanden sind. +required_tag_manifest_type_not_present=Ben\u00f6tigtes Tag Manifest vom Typ [{}] konnte nicht gefunden werden. +required_manifest_type_not_present=Ben\u00f6tigtes Manifest vom Typ [{}] konnte nicht gefunden werden. +checking_required_tag_file_exists=Pr\u00fcfe ob alle Tag Dateien vorhanden sind. + +#for BagitVersionIsNotAcceptableException.java +bagit_version_not_acceptable_error=Version [{}] ist nicht in der Liste der akzeptieren Versionen {}. + +#for RequiredMetadataFieldNotPresentException.java +required_metadata_field_not_present_error=Das im Profil auf\u00fchrte Metadatum [{}] ist notwendig, wurde aber nicht gefunden! + +#for FetchFileNotAllowedException.java +fetch_file_not_allowed_error=Fetch Datei konnte nicht in der bag [{}] gefunden werden. + +#for MetadataBalueIsNotAcceptableException.java +metadata_value_not_acceptable_error=Laut Profil sind g\u00fcltige Werte f\u00fcr die Eigenschaft [{}]: {}. Der aufgef\u00fchrte Wert [{}] befindet sich nicht darunter. + +#for RequiredTagFileNotPresentException.java +required_tag_file_not_found_error=Die ben\u00f6tigte Tag Datei [{}] konnte nicht gefunden werden. + +#for EncodingChecker.java +tag_files_not_encoded_with_utf8_warning=Tag Dateien sind [{}] kodiert. Wir empfehlen stattdessen die Verwendung von UTF-8. + +#For ManifestChecker.java +bag_missing_tag_manifest_warning=Die bag [{}] enth\u00e4lt kein Tag Manifest, welches f\u00fcr jede bag empfohlen wird. +different_case_warning=Im Manifest [{}] wird der Pfad [{}] mit unterschiedlicher Gro\u00df- und Kleinschreibung aufgef\u00fchrt. Dies kann bei einigen Dateisystemen zu Problemen f\u00fchren. +manifest_line_violated_spec_error=Das Manifest enth\u00e4lt die Zeile [{}], welche nicht dem geforderten Schema folgt. +md5sum_generated_line_warning=Der Pfad [{}] beginnt mit einem *, was bedeutet, dass der Eintrag nicht mit einem bagit-Werkzeug erstellt wurde. Es wird empfohlen, den * entsprechend der bagit Spezifikation zu entfernen. +cannot_access_parent_path_error=Zugriff auf \u00fcbergeordnetes Verzeichnis von [{}] nicht m\u00f6glich. +different_normalization_in_manifest_warning=Die Datei [{}] ist anders normalisiert f\u00fcr die Manifest Datei erforderlich. +bag_within_bag_warning=Wir empfehlen keine bag innerhalb einer anderen bag zu speichern, da dies bekannterma\u00dfen zu Problemen f\u00fchren kann. +leading_dot_slash_warning=Manifest [{}] enth\u00e4lt in Zeile [{}] einen nicht normalisierten Pfad. +os_specific_files_warning=Manifest [{}] enth\u00e4lt in Zeile [{}] eine betriebssystemspezifische Datei. +weak_algorithm_warning=Pr\u00fcfsummenalgorithmus [{}] ist als angreifbar bekannt. Dank der Fortschritte aktueller Computersysteme verursacht die Erzeugung einer st\u00e4rkeren Pr\u00fcfsumme nur minimale Verz\u00f6gerung. +non_standard_algorithm_warning=Der verwendete Pr\u00fcfsummenalgorithmus [{}] ist nicht Teil der Standard Java Laufzeitumgebung. Dies erschwert das Lesen der bag auf einigen Systemen. Die Verwendung von SHA-512 wird empfohlen. + +#for MetadataChecker.java +missing_payload_oxum_warning=Die Eigenschaft Payload-Oxum wurde nicht in den bag Metadaten gefunden. Dies verhindert eine schnelle \u00dcberpr\u00fcfung der bag. + +#for VersionChecker.java +old_version_warning=Die verwendete bagit Version [{}] ist veraltet. Die akuelle Version ist [{}]. + +#for AbstractCreateManifestVistor +skipping_hidden_file=\u00dcberspringe [{}] da versteckte Dateien ignoriert werden. +skipping_ignored_directory=\u00dcberspringe [{}] da versteckte Verzeichnisse ignoriert werden. + +#for BagCreator.java +creating_bag=Erstelle bag in Version: [{}] im Verzeichnis: [{}]. +creating_payload_manifests=Erstelle Payload Manifest(e). +creating_tag_manifests=Erstelle Tag Manifest(e). +calculating_payload_oxum=Berechne Payload Oxum des Datenverzeichnisses [{}]. +creating_metadata_file=Erstelle bag Metadaten (bag-info.txt oder package-info.txt). + +#for Hasher.java +adding_checksum=F\u00fcge dem Manifest den Eintrag [{}] mit Pr\u00fcfsumme [{}] hinzu. + +#for UnsupportedAlgorithmException.java +algorithm_not_supported_error=[{}] wird nicht unterst\u00fctzt! + +#for BagitTextFileReader.java +reading_version_and_encoding=Lese [{}] f\u00fcr die Bestimmung von Version und Zeichenkodierung. +bagit_version=BagIt-Version ist [{}]. +tag_file_encoding=Zeichenkodierung in Tag Datei ist [{}]. +invalid_bagit_text_file_error=bagit.txt MUSS die Eigenschaften 'BagIt-Version' UND 'Tag-File-Character-Encoding' enthalten! +bom_present_error=Datei [{}] enth\u00e4lt eine Byte-Reihenfolge-Markierung, was laut bagit Spezifikation nicht zul\u00e4ssig ist! +strict_only_two_lines_error=bagit.txt MUSS genau 2 Zeilen enthalten. Zus\u00e4tzliche gefundene Zeile(n): [{}] +strict_first_line_error=Die erste Zeile in bagit.txt muss dem Schema [BagIt-Version: ] entsprechen. Stattdessen wurde die Zeile [{}] gefunden. Mehr Informationen findet man in der bagit Spezifikation. +strict_second_line_error=Die zweite Zeile in bagit.txt muss dem Schema [Tag-File-Character-Encoding: ] entsprechen. Stattdessen wurde die Zeile [{}] gefunden. Mehr Informationen findet man in der bagit Spezifikation. + +#for UnparsableVersionException.java +unparsable_version_error=Version muss im Format MAJOR.MINOR angegeben werden. Stattdessen wurde der Wert [{}] gefunden. + +#for FetchReader.java +reading_fetch_file=Versuche [{}] zu lesen. +read_fetch_file_line=Lese URL [{}] mit L\u00e4nge [{}] und Pfad [{}] aus Fetch Datei [{}]. +invalid_fetch_file_line_error=Zeile [{}] ist kein g\u00fcltiger fetch.txt Eintrag. Jede Zeile muss nach dem Schema aufgebaut sein. + +#for KeyValueReader.java +read_key_value_line=Schl\u00fcssel [{}] mit Wert [{}] in Datei [{}] gefunden. Verwende regul\u00e4ren Ausdruck [{}] f\u00fcr die Aufspaltung. +found_indented_line=Einger\u00fcckte Zeile gefunden - f\u00fcge sie mit Schl\u00fcssel [{}] zusammen. +malformed_key_value_line_error=Zeile [{}] entspricht nicht der bagit Spezifikation f\u00fcr eine Tag Datei. M\u00f6glicherweise sollte die Zeile per Leerzeichen oder Tab einger\u00fcckt werden oder es wurde kein Doppelpunkt verwendet, um einen Schl\u00fcssel von einem Wert zu trennen? Es muss das Schema {} verwendet werden. Falls ein Wert in einer neuen Zeile fortgesetzt wird, muss diese per Leerzeichen oder Tab einger\u00fcckt werden. + +#for ManifestReader.java +attempting_read_manifests=Versuche die Manifeste zu finden und zu lesen. +found_tagmanifest=Tag Manifest [{}] gefunden. +found_payload_manifest=Payload Manifest [{}] gefunden. +reading_manifest=Lese Manifest [{}]. + +#for MetadataReader.java +attempting_read_metadata=Versuche bag Metadaten Datei zu lesen. +found_metadata_file=Metadaten Datei [{}] gefunden. + +#for TagFileReader.java +removing_asterisk=Es wurde ein Pfad gefunden, der nicht mit einem bagit-Werkzeug erstellt wurde. Alle * werden aus dem Pfad entfernt. Bitte entfernen Sie auch alle * aus den Manifesten! +blackslash_used_as_path_separator_error=[{}] ist ung\u00fcltig, da zur Pfadtrennung [\\] verwendet wird! +malicious_path_error=[{}] verweist ung\u00fcltigerweise auf eine Datei au\u00dferhalb der bag! +invalid_url_format_error=URL [{}] is ung\u00fcltig! + +#for BagVerifier.java +checking_bag_is_valid=Pr\u00fcfe ob die bag mit dem Wurzelverzeichnis [{}] g\u00fcltig ist. +checking_payload_checksums=Pr\u00fcfe Pr\u00fcfsummen der/des Payload Manifeste(s). +checking_tag_file_checksums=Pr\u00fcfe Pr\u00fcfsummen der/des Tag Manifeste(s). +checksums_not_matching_error=[{}] Fehler gefunden. Mindestens ein Fehler ist auf fehlerhafte Pr\u00fcfsummen zur\u00fcckzuf\u00fchren. +checking_bag_is_complete=Pr\u00fcfe ob die bag mit dem Wurzelverzeichnis [{}] vollst\u00e4ndig ist. + +#for CheckIfFileExistsTask.java +different_normalization_on_filesystem_warning=Der Dateiname [{}] verwendet eine andere Normalisierung als das unterliegende Dateisystem! +error_reading_normalized_file=Fehler beim Zugriff auf [{}], um zu pr\u00fcfen, ob eine Datei in diesem Verzeichnis dem normalisierten Dateinamen [{}] entspricht! + +#for CheckManifestHashesTask.java +checking_checksums=Pr\u00fcfe Datei [{}] auf Pr\u00fcfsumme [{}]. + +#for CorruptChecksumException.java +corrupt_checksum_error=Datei [{}] sollte eine [{}] Pr\u00fcfsumme mit dem Wert [{}] aufweisen. Die errechnete Pr\u00fcfsumme ist jedoch [{}]. + +#for FileCoundAndTotalSizeVisitor.java +file_size_in_bytes=Datei [{}] hat eine Gr\u00f6\u00dfe von [{}] Byte. + +#for MandatoryVerifier.java +checking_fetch_items_exist=Pr\u00fcfe ob alle [{}] Eintr\u00e4ge in fetch.txt im Verzeichnis [{}] existieren. +fetch_item_missing_error=Fetch Eintrag [{}] wurde nicht geladen! +file_should_exist_error=Datei [{}] sollte existieren, tut es aber nicht! +checking_payload_directory_exists=Pr\u00fcfe ob ein spezielles Payload Verzeichnis existiert (nur Version 0.97 und \u00e4lter). + +#for MissingPayloadManifestException.java +missing_payload_manifest_error=Bag enth\u00e4lt kein Payload Manifest! + +#for PayloadFileExistsInAllManifestsVistor.java +file_not_in_manifest_error=Datei [{}] befindet sich im Payload Verzeichnis, ist aber nicht im Manifest manifest-{}.txt aufgef\u00fchrt! +file_in_all_manifests=[{}] befindet sich in allen Manifesten. +file_not_in_any_manifest_error=Datei [{}] befindet sich im Payload Verzeichnis, ist aber in keinem Manifest aufgef\u00fchrt! + +#for PayloadVerifier.java +all_files_in_manifests=Lese alle Dateien aus allen Manifesten. +get_listing_in_manifest=Lese Dateien und Pr\u00fcfsummen die in [{}] aufgef\u00fchrt sind. +check_all_files_in_manifests_exist=Pr\u00fcfe ob alle Dateien aus allen Manifesten existieren. +missing_payload_files_error=Manifeste enthalten Datei(en) {} die nicht existieren! +checking_file_in_at_least_one_manifest=Pr\u00fcfe ob alle Payload Dateien (Dateien im Verzeichnis [{}]) in mindestens einem Manifest aufgef\u00fchrt sind. +checking_file_in_all_manifests=Pr\u00fcfe ob alle Payload Dateien (Dateien im Verzeichnis [{}]) in allen Manifesten aufgef\u00fchrt sind. + +#for QuickVerifier.java +found_payload_oxum=Eigenschaft Payload-Oxum [{}] f\u00fcr bag [{}] gefunden. +payload_oxum_missing_error=Eigenschaft Payload-Oxum nicht in den bag metadaten gefunden! +parse_size_in_bytes=Suche in Wert [{}] nach der Gesamtanzahl an Bytes. +parse_number_of_files=Suche in Wert [{}] nach der Gesamtanzahl an Dateien im Payload Verzeichnis. +compare_payload_oxums=Angegebener Wert der Eigenschaft Payload-Oxum : [{}], berechneter Wert von Payload-Oxum : [{}.{}] f\u00fcr das Payload Verzeichnis [{}]. +invalid_total_size_error=Ung\u00fcltige Gesamtanzahl an Bytes. Ertwartet wurde [{}], berechnet wurde [{}]! +invalid_file_cound_error=Ung\u00fcltige Gesamtanzahl an Dateien. Erwartet wurde [{}], berechnet wurde [{}]! + +#for BagitFileWriter.java +write_bagit_file_to_path=Schreibe bagit.txt nach [{}] +writing_line_to_file=Schreibe Zeile [{}] nach [{}] + +#for BagWriter.java +writing_payload_files=Schreibe Payload Dateien. +upsert_payload_oxum=F\u00fcge Eigenschaft Payload-Oxum hinzu. +writing_bagit_file=Schreibe Datei bagit.txt . +writing_payload_manifests=Schreibe das/die Payload Manifest(e). +writing_bag_metadata=Schreibe bag Metadaten. +writing_fetch_file=Schreibe Fetch Datei. +writing_tag_manifests=Schreibe Tag Manifest(e). + +#for FetchWriter.java +writing_fetch_file_to_path=Schreibe fetch.txt nach [{}]. + +#for ManifestWriter.java +writing_manifest_to_path=Schreibe Manifest nach [{}]. + +#for MetadataWriter.java +writing_metadata_to_path=Schreibe bag Metdaten Datei [{}] nach [{}]. + +#for PayloadWriter.java +writing_payload_file_to_path=Schreibe Payload Datei [{}] nach [{}]. +skip_fetch_item_when_writing_payload=\u00dcberspringe Payload Datei {} da sie sich in der Fetch Liste befindet. \ No newline at end of file diff --git a/src/test/java/gov/loc/repository/bagit/conformance/BagLinterTest.java b/src/test/java/gov/loc/repository/bagit/conformance/BagLinterTest.java index f98083e0f..78aa957ac 100644 --- a/src/test/java/gov/loc/repository/bagit/conformance/BagLinterTest.java +++ b/src/test/java/gov/loc/repository/bagit/conformance/BagLinterTest.java @@ -3,7 +3,6 @@ import java.io.File; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; -import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -17,47 +16,52 @@ import gov.loc.repository.bagit.PrivateConstructorTest; import gov.loc.repository.bagit.domain.Bag; import gov.loc.repository.bagit.reader.BagReader; +import java.nio.file.FileSystems; + +public class BagLinterTest extends PrivateConstructorTest { + + private final Path rootDir = Paths.get("src", "test", "resources", "linterTestBag"); -public class BagLinterTest extends PrivateConstructorTest{ - - private final Path rootDir = Paths.get("src","test","resources","linterTestBag"); - @Test - public void testClassIsWellDefined() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException{ + public void testClassIsWellDefined() + throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { assertUtilityClassWellDefined(BagLinter.class); } - + @Test - public void testLintBag() throws Exception{ + public void testLintBag() throws Exception { Set expectedWarnings = new HashSet<>(); expectedWarnings.addAll(Arrays.asList(BagitWarning.values())); Set warnings = BagLinter.lintBag(rootDir); - if(FileSystems.getDefault().getClass().getName() == "sun.nio.fs.MacOSXFileSystem"){ - expectedWarnings.remove(BagitWarning.DIFFERENT_NORMALIZATION); //don't test normalization on mac + if (FileSystems.getDefault().getClass().getName() == "sun.nio.fs.MacOSXFileSystem") { + expectedWarnings.remove(BagitWarning.DIFFERENT_NORMALIZATION); // don't + // test + // normalization + // on mac } - + Set diff = new HashSet<>(expectedWarnings); diff.removeAll(warnings); - + assertEquals("Warnings missing: " + diff.toString() + "\n", expectedWarnings, warnings); } - + @Test - public void testCheckAgainstProfile() throws Exception{ + public void testCheckAgainstProfile() throws Exception { Path profileJson = new File("src/test/resources/bagitProfiles/exampleProfile.json").toPath(); Path bagRootPath = new File("src/test/resources/bagitProfileTestBags/profileConformantBag").toPath(); BagReader reader = new BagReader(); Bag bag = reader.read(bagRootPath); - - try(InputStream inputStream = Files.newInputStream(profileJson, StandardOpenOption.READ)){ + + try (InputStream inputStream = Files.newInputStream(profileJson, StandardOpenOption.READ)) { BagLinter.checkAgainstProfile(inputStream, bag); } } - + @Test - public void testIgnoreCheckForExtraLines() throws Exception{ + public void testIgnoreCheckForExtraLines() throws Exception { Set warnings = BagLinter.lintBag(rootDir, Arrays.asList(BagitWarning.EXTRA_LINES_IN_BAGIT_FILES)); assertFalse(warnings.contains(BagitWarning.EXTRA_LINES_IN_BAGIT_FILES)); } -} \ No newline at end of file +} diff --git a/src/test/java/gov/loc/repository/bagit/writer/PayloadWriterTest.java b/src/test/java/gov/loc/repository/bagit/writer/PayloadWriterTest.java index 5e907597b..383644c7e 100644 --- a/src/test/java/gov/loc/repository/bagit/writer/PayloadWriterTest.java +++ b/src/test/java/gov/loc/repository/bagit/writer/PayloadWriterTest.java @@ -23,15 +23,16 @@ public class PayloadWriterTest extends PrivateConstructorTest { @Rule - public TemporaryFolder folder= new TemporaryFolder(); - + public TemporaryFolder folder = new TemporaryFolder(); + @Test - public void testClassIsWellDefined() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException{ + public void testClassIsWellDefined() + throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { assertUtilityClassWellDefined(PayloadWriter.class); } - + @Test - public void testWritePayloadFiles() throws IOException, URISyntaxException{ + public void testWritePayloadFiles() throws IOException, URISyntaxException { Path rootDir = Paths.get(getClass().getClassLoader().getResource("bags/v0_97/bag").toURI()); Path testFile = Paths.get(getClass().getClassLoader().getResource("bags/v0_97/bag/data/dir1/test3.txt").toURI()); Manifest manifest = new Manifest(StandardSupportedAlgorithms.MD5); @@ -40,14 +41,14 @@ public void testWritePayloadFiles() throws IOException, URISyntaxException{ payloadManifests.add(manifest); File outputDir = folder.newFolder(); File copiedFile = new File(outputDir, "data/dir1/test3.txt"); - + assertFalse(copiedFile.exists() || copiedFile.getParentFile().exists()); - PayloadWriter.writePayloadFiles(payloadManifests, new ArrayList<>(),Paths.get(outputDir.toURI()), rootDir); + PayloadWriter.writePayloadFiles(payloadManifests, new ArrayList<>(), Paths.get(outputDir.toURI()), rootDir); assertTrue(copiedFile.exists() && copiedFile.getParentFile().exists()); } - + @Test - public void testWritePayloadFilesMinusFetchFiles() throws IOException, URISyntaxException{ + public void testWritePayloadFilesMinusFetchFiles() throws IOException, URISyntaxException { Path rootDir = Paths.get(getClass().getClassLoader().getResource("bags/v0_97/bag").toURI()); Path testFile = Paths.get(getClass().getClassLoader().getResource("bags/v0_97/bag/data/dir1/test3.txt").toURI()); Manifest manifest = new Manifest(StandardSupportedAlgorithms.MD5); @@ -56,9 +57,11 @@ public void testWritePayloadFilesMinusFetchFiles() throws IOException, URISyntax payloadManifests.add(manifest); File outputDir = folder.newFolder(); File copiedFile = new File(outputDir, "data/dir1/test3.txt"); - + assertFalse(copiedFile.exists() || copiedFile.getParentFile().exists()); - PayloadWriter.writePayloadFiles(payloadManifests, Arrays.asList(new FetchItem(null, null, Paths.get("data/dir1/test3.txt"))),Paths.get(outputDir.toURI()), rootDir); + PayloadWriter.writePayloadFiles(payloadManifests, + Arrays.asList(new FetchItem(null, null, Paths.get("data/dir1/test3.txt"))), Paths.get(outputDir.toURI()), + rootDir.resolve("data")); assertFalse(copiedFile.exists() && copiedFile.getParentFile().exists()); } }