|
12 | 12 | use OCA\Libresign\DataObjects\VisibleElementAssoc; |
13 | 13 | use OCA\Libresign\Db\FileElement; |
14 | 14 | use OCA\Libresign\Enum\DocMdpLevel; |
| 15 | +use OCA\Libresign\Exception\LibresignException; |
15 | 16 | use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory; |
16 | 17 | use OCA\Libresign\Handler\SignEngine\JSignPdfHandler; |
17 | 18 | use OCA\Libresign\Helper\JavaHelper; |
@@ -732,4 +733,26 @@ public static function providerGetSignatureText(): array { |
732 | 733 | ['GRAPHIC_ONLY', 'a$a', '""'], |
733 | 734 | ]; |
734 | 735 | } |
| 736 | + |
| 737 | + public function testCheckTsaErrorInvalidTsaMentionsDnsNetworkFirewall(): void { |
| 738 | + $jSignPdfHandler = $this->getInstance(); |
| 739 | + |
| 740 | + $this->expectException(LibresignException::class); |
| 741 | + $this->expectExceptionMessage('Timestamp Authority (TSA) service is unavailable. Check DNS/network/firewall connectivity from this server: https://invalid-tsa.example.com/tsr'); |
| 742 | + |
| 743 | + self::invokePrivate($jSignPdfHandler, 'checkTsaError', [ |
| 744 | + "Invalid TSA 'https://invalid-tsa.example.com/tsr'", |
| 745 | + ]); |
| 746 | + } |
| 747 | + |
| 748 | + public function testCheckTsaErrorUnknownHostMentionsDnsNetworkFirewall(): void { |
| 749 | + $jSignPdfHandler = $this->getInstance(); |
| 750 | + |
| 751 | + $this->expectException(LibresignException::class); |
| 752 | + $this->expectExceptionMessage("Timestamp Authority (TSA) service error.\nCheck TSA endpoint and DNS/network/firewall connectivity from this server."); |
| 753 | + |
| 754 | + self::invokePrivate($jSignPdfHandler, 'checkTsaError', [ |
| 755 | + 'TSAClientBouncyCastle: java.net.UnknownHostException: invalid-tsa.example.com', |
| 756 | + ]); |
| 757 | + } |
735 | 758 | } |
0 commit comments