@Test(groups = {"regressiontest"}) public void noIntegrityIssuesTest() { addDescription("Verifies that missing files are reported correctly"); addStep( "Create a clean reporter", "hasIntegrityIssues() should return false and the summary report should " + "state that no inform of the missing file."); BasicIntegrityReporter reporter = new BasicIntegrityReporter("CollectionWithoutIssues", "test", new File("target/")); assertFalse( "Reporter interpreted delete file as a integrity issue", reporter.hasIntegrityIssues()); String expectedReport = "No integrity issues found"; assertEquals( "Reporter didn't create clean report", expectedReport, reporter.generateSummaryOfReport()); }
@Test(groups = {"regressiontest"}) public void deletedFilesTest() throws Exception { addDescription("Verifies that the hasIntegrityIssues() reports deleted files correctly"); addStep( "Report a delete file for a new Reporter", "hasIntegrityIssues() should return false and the summary " + "report should inform that no issues where found."); BasicIntegrityReporter reporter = new BasicIntegrityReporter("CollectionWithIssues", "test", new File("target/")); reporter.reportDeletedFile("TestFile", "Pillar1"); assertFalse( "Reporter interpreted delete file as a integrity issue", reporter.hasIntegrityIssues()); String expectedReport = "No integrity issues found"; assertEquals( "Reporter didn't create clean report", expectedReport, reporter.generateSummaryOfReport()); reporter.generateReport(); }
@Test(groups = {"regressiontest"}) public void checksumIssuesTest() throws Exception { addDescription("Verifies that missing files are reported correctly"); addStep( "Report a checksum issue", "hasIntegrityIssues() should return true and the summary report should " + "correctly inform of the checksum issue."); BasicIntegrityReporter reporter = new BasicIntegrityReporter("CollectionWithIssues", "test", new File("target/")); reporter.reportChecksumIssue("TestFile", "Pillar1"); assertTrue( "Reporter didn't interpreted checksum issue as a integrity issue", reporter.hasIntegrityIssues()); String expectedReport = REPORT_SUMMARY_START + "Pillar1 has 1 potentially corrupt file."; assertEquals( "Wrong report returned on checksum issue", expectedReport, reporter.generateSummaryOfReport()); addStep( "Report another checksum issue on the same pillar", "The summary report should be update with the " + "additional checksum issue."); reporter.reportChecksumIssue("TestFile2", "Pillar1"); expectedReport = REPORT_SUMMARY_START + "Pillar1 has 2 potentially corrupt files."; assertEquals( "Wrong report returned on checksum issue", expectedReport, reporter.generateSummaryOfReport()); addStep( "Report a checksum issue on another pillar", "The summary report should be update with the new pillar problem."); reporter.reportChecksumIssue("TestFile3", "Pillar2"); expectedReport = REPORT_SUMMARY_START + "Pillar1 has 2 potentially corrupt files." + "\nPillar2 has 1 " + "potentially corrupt file."; assertEquals( "Wrong report returned on checksum issue", expectedReport, reporter.generateSummaryOfReport()); }
@Test(groups = {"regressiontest"}) public void missingChecksumTest() throws Exception { addDescription("Verifies that missing checksums are reported correctly"); addStep( "Report a missing checksum", "hasIntegrityIssues() should return true and the summary report should " + "correctly inform of the missing checksum."); BasicIntegrityReporter reporter = new BasicIntegrityReporter("CollectionWithIssues", "test", new File("target/")); reporter.reportMissingChecksum("TestChecksum", "Pillar1"); assertTrue( "Reporter didn't interpreted missing checksum as a integrity issue", reporter.hasIntegrityIssues()); String expectedReport = REPORT_SUMMARY_START + "Pillar1 is missing 1 checksum."; assertEquals( "Wrong report returned on missing checksum", expectedReport, reporter.generateSummaryOfReport()); addStep( "Report another missing checksum on the same pillar", "The summary report should be update with the " + "additional missing checksum."); reporter.reportMissingChecksum("TestChecksum2", "Pillar1"); expectedReport = REPORT_SUMMARY_START + "Pillar1 is missing 2 checksums."; assertEquals( "Wrong report returned on missing checksum", expectedReport, reporter.generateSummaryOfReport()); addStep( "Report a missing checksum on another pillar", "The summary report should be update with the new pillar problem."); reporter.reportMissingChecksum("TestChecksum3", "Pillar2"); expectedReport = REPORT_SUMMARY_START + "Pillar1 is missing 2 checksums." + "\nPillar2 is missing 1 checksum."; assertEquals( "Wrong report returned on missing checksum", expectedReport, reporter.generateSummaryOfReport()); }