protected function documentFileTestChecksum()
 {
     $currentDocumentObject = end($this->stack);
     $testProperty = new FileChecksumTestProperty(Constants::TEST_CHECKSUM);
     $checksumTest = new ChecksumTest(Constants::TEST_CHECKSUM, $currentDocumentObject->getReferenceDocumentFile(), $this->directory, $currentDocumentObject->getChecksumAlgorithm(), $currentDocumentObject->getChecksum(), $testProperty);
     $checksumTest->runTest();
     // In the final report we only want to show documents that have failed checksum
     // All checksums will be reported in the log file
     if ($testProperty->getTestResult() == false) {
         $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A2);
     }
     $checksumTest = null;
 }
 public function postProcessDocumentObject()
 {
     $currentDocumentObject = end($this->stack);
     $this->logger->trace('In ' . __METHOD__ . ' current object is ' . $currentDocumentObject);
     $testProperty = new TestProperty(Constants::TEST_CHECKSUM);
     $checksumTest = new ChecksumTest(Constants::TEST_CHECKSUM, $currentDocumentObject->getReferenceDocumentFile(), $this->directory, $currentDocumentObject->getChecksumAlgorithm(), $currentDocumentObject->getChecksum(), $testProperty);
     $testResult = $checksumTest->runTest();
     // The results of this test are only displayed in the logfile
     if ($testResult == false) {
         $this->errorsEncountered = true;
         $this->numberErrorsEncountered++;
     }
     $checksumTest = null;
     $testProperty = null;
 }
Exemplo n.º 3
0
 public function test9()
 {
     $checksumValue = $this->infoFileHandler->getChecksumInfo()->getChecksumValue();
     $checksumAlgorithm = $this->infoFileHandler->getChecksumInfo()->getChecksumAlgorithm();
     $testProperty = new FileChecksumTestProperty(Constants::TEST_CHECKSUM);
     $checksumTest = new ChecksumTest(Constants::TEST_CHECKSUM, Constants::NAME_ARKIVUTTREKK_XML, $this->directory, $checksumAlgorithm, $checksumValue, $testProperty);
     $checksumTest->runTest();
     $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A9);
     print $testProperty . PHP_EOL;
     $checksumTest = null;
 }
Exemplo n.º 4
0
 public function testA9()
 {
     $this->logger->info('START test A9: Calculate and check the checksum value of arkivuttrekk.xml against the value specified in info.xml');
     try {
         $checksumValue = $this->infoFileDetails->getChecksumInfo()->getChecksumValue();
         $checksumAlgorithm = $this->infoFileDetails->getChecksumInfo()->getChecksumAlgorithm();
         $testProperty = new TestProperty(Constants::TEST_CHECKSUM);
         $checksumTest = new ChecksumTest(Constants::TEST_CHECKSUM, Constants::NAME_ARKIVUTTREKK_XML, $this->directory, $checksumAlgorithm, $checksumValue, $testProperty);
         $checksumTest->runTest();
         if ($testProperty->getTestResult() == true) {
             $this->logger->info(' RESULT The checksum for arkivuttrekk.xml, specified in info.xml has been checked and found to be correct');
         } else {
             $this->logger->error(' RESULT The checksum for arkivuttrekk.xml, specified in info.xml has been checked and found to be incorrect!. See logfile for details');
         }
         $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A9);
         $checksumTest = null;
     } catch (Exception $e) {
         $this->logger->error("Error when attempting test " . $testProperty->getDescription() . ". The following exception occured " . $e);
     }
     $this->logger->info('END test A9');
     $this->logger->info('');
 }