diff --git a/pace-packaging/src/main/java/edu/colorado/cires/pace/packaging/PackageProcessor.java b/pace-packaging/src/main/java/edu/colorado/cires/pace/packaging/PackageProcessor.java index cc562930..0a900962 100644 --- a/pace-packaging/src/main/java/edu/colorado/cires/pace/packaging/PackageProcessor.java +++ b/pace-packaging/src/main/java/edu/colorado/cires/pace/packaging/PackageProcessor.java @@ -27,11 +27,13 @@ public void process(PackingJob packingJob, Path outputDir, ProgressIndicator... validatePackingJob(packingJob); FileUtils.mkdir(outputDir); + Path packageOutputDir = outputDir.resolve(((Dataset) packingJob).getPackageId()); + FileUtils.mkdir(packageOutputDir); Stream instructionStream = PackageInstructionFactory.getPackageInstructions( packingJob, - FileUtils.writeMetadata((Dataset) packingJob, objectMapper, outputDir.resolve("data")), - outputDir + FileUtils.writeMetadata((Dataset) packingJob, objectMapper, packageOutputDir.resolve("data")), + packageOutputDir ); long totalRecords = instructionStream.count() + 4L; // accounting for generated files @@ -41,13 +43,13 @@ public void process(PackingJob packingJob, Path outputDir, ProgressIndicator... instructionStream = PackageInstructionFactory.getPackageInstructions( packingJob, - FileUtils.writeMetadata((Dataset) packingJob, objectMapper, outputDir.resolve("data")), - outputDir + FileUtils.writeMetadata((Dataset) packingJob, objectMapper, packageOutputDir.resolve("data")), + packageOutputDir ); Packager.run( instructionStream, - outputDir, + packageOutputDir, progressIndicators ); } diff --git a/pace-packaging/src/test/java/edu/colorado/cires/pace/packaging/PackagerProcessorTest.java b/pace-packaging/src/test/java/edu/colorado/cires/pace/packaging/PackagerProcessorTest.java index 84e8594f..d0b026b6 100644 --- a/pace-packaging/src/test/java/edu/colorado/cires/pace/packaging/PackagerProcessorTest.java +++ b/pace-packaging/src/test/java/edu/colorado/cires/pace/packaging/PackagerProcessorTest.java @@ -171,7 +171,7 @@ void testProcess( processor.process(packingJob, testOutputPath, progressIndicator); verify(progressIndicator, times(expectedNumberOfInvocations + 5)).incrementProcessedRecords(); - Path baseExpectedOutputPath = testOutputPath.resolve("data"); + Path baseExpectedOutputPath = testOutputPath.resolve(((Dataset) packingJob).getPackageId()).resolve("data"); checkTargetPaths(packingJob.getBiologicalPath(), baseExpectedOutputPath.resolve("biological")); checkTargetPaths(packingJob.getCalibrationDocumentsPath(), baseExpectedOutputPath.resolve("calibration")); @@ -183,7 +183,7 @@ void testProcess( (packingJob instanceof AudioDataset || packingJob instanceof CPodDataset) ? "acoustic_files" : "data_files" )); - String actualMetadata = FileUtils.readFileToString(testOutputPath.resolve("data").resolve(String.format( + String actualMetadata = FileUtils.readFileToString(baseExpectedOutputPath.resolve(String.format( "%s.json", ((Dataset) packingJob).getPackageId() )).toFile(), StandardCharsets.UTF_8);