LOTLParsingTask extends AbstractParsingTask implements Supplier<LOTLParsingResult> { @Override public LOTLParsingResult get() { LOTLParsingResult result = new LOTLParsingResult(); TrustStatusListType jaxbObject = getJAXBObject(); parseSchemeInformation(result, jaxbObject.getSchemeInformation()); return result; } LOTLParsingTask(DSSDocument document, LOTLSource lotlSource); @Override LOTLParsingResult get();  }
@Test public void parseLOTLDefault() { LOTLParsingTask task = new LOTLParsingTask(LOTL, new LOTLSource()); LOTLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(248, result.getSequenceNumber()); assertNull(result.getSigningCertificateAnnouncementURL()); assertNull(result.getPivotURLs()); assertEquals(1, result.getLotlPointers().size()); checkOtherPointers(result.getLotlPointers()); assertEquals(31, result.getTlPointers().size()); checkOtherPointers(result.getTlPointers()); assertEquals("EU", result.getTerritory()); OtherTSLPointer otherTSLPointer = result.getLotlPointers().get(0); assertEquals(8, otherTSLPointer.getCertificates().size()); assertEquals("https: assertNotNull(result.getDistributionPoints()); assertEquals(1, result.getDistributionPoints().size()); }
@Test public void parseLOTLNoSig() { LOTLParsingTask task = new LOTLParsingTask(LOTL_NO_SIG, new LOTLSource()); LOTLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(248, result.getSequenceNumber()); assertNull(result.getSigningCertificateAnnouncementURL()); assertNull(result.getPivotURLs()); assertEquals(1, result.getLotlPointers().size()); checkOtherPointers(result.getLotlPointers()); assertEquals(31, result.getTlPointers().size()); checkOtherPointers(result.getTlPointers()); assertEquals("EU", result.getTerritory()); assertNotNull(result.getDistributionPoints()); assertEquals(1, result.getDistributionPoints().size()); }
@Test public void parseLOTLPivotSupport() { LOTLSource lotlSource = new LOTLSource(); lotlSource.setPivotSupport(true); LOTLParsingTask task = new LOTLParsingTask(LOTL, lotlSource); LOTLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(248, result.getSequenceNumber()); assertNull(result.getSigningCertificateAnnouncementURL()); assertNotNull(result.getPivotURLs()); assertEquals(0, result.getPivotURLs().size()); assertEquals(1, result.getLotlPointers().size()); assertEquals(31, result.getTlPointers().size()); assertEquals("EU", result.getTerritory()); }
@Test public void parseLOTLPivotSupportAndSigningCertAnnouncement() { LOTLSource lotlSource = new LOTLSource(); lotlSource.setPivotSupport(true); lotlSource.setSigningCertificatesAnnouncementPredicate(new OfficialJournalSchemeInformationURI("https: LOTLParsingTask task = new LOTLParsingTask(LOTL, lotlSource); LOTLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(248, result.getSequenceNumber()); assertNotNull(result.getPivotURLs()); assertEquals(0, result.getPivotURLs().size()); assertEquals("https: result.getSigningCertificateAnnouncementURL()); assertEquals(1, result.getLotlPointers().size()); assertEquals(31, result.getTlPointers().size()); assertEquals("EU", result.getTerritory()); }
@Test public void parseLOTLOnlyBEandPTPointers() { LOTLSource lotlSource = new LOTLSource(); Set<String> countries = new HashSet<>(); countries.add("BE"); countries.add("PT"); lotlSource.setTlPredicate(new SchemeTerritoryOtherTSLPointer(countries).and(new XMLOtherTSLPointer())); LOTLParsingTask task = new LOTLParsingTask(LOTL, lotlSource); LOTLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(248, result.getSequenceNumber()); assertNull(result.getSigningCertificateAnnouncementURL()); assertNull(result.getPivotURLs()); assertEquals(1, result.getLotlPointers().size()); checkOtherPointers(result.getLotlPointers()); List<OtherTSLPointer> tlPointers = result.getTlPointers(); assertEquals(2, tlPointers.size()); checkOtherPointers(tlPointers); assertEquals("EU", result.getTerritory()); }
@Test public void parsePivotLOTLDefault() { LOTLParsingTask task = new LOTLParsingTask(LOTL_PIVOT, new LOTLSource()); LOTLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(247, result.getSequenceNumber()); assertNull(result.getSigningCertificateAnnouncementURL()); assertNull(result.getPivotURLs()); assertEquals(1, result.getLotlPointers().size()); checkOtherPointers(result.getLotlPointers()); assertEquals(31, result.getTlPointers().size()); checkOtherPointers(result.getTlPointers()); assertEquals("EU", result.getTerritory()); }
@Test public void parseTL() { LOTLParsingTask task = new LOTLParsingTask(TL, new LOTLSource()); LOTLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(18, result.getSequenceNumber()); assertNull(result.getSigningCertificateAnnouncementURL()); assertNull(result.getPivotURLs()); assertEquals(1, result.getLotlPointers().size()); checkOtherPointers(result.getLotlPointers()); assertEquals(0, result.getTlPointers().size()); checkOtherPointers(result.getTlPointers()); assertEquals("IE", result.getTerritory()); OtherTSLPointer otherTSLPointer = result.getLotlPointers().get(0); assertEquals(8, otherTSLPointer.getCertificates().size()); assertEquals("https: }
@Test public void parsePivotLOTLWithPivotSupport() { LOTLSource lotlSource = new LOTLSource(); lotlSource.setPivotSupport(true); LOTLParsingTask task = new LOTLParsingTask(LOTL_PIVOT, lotlSource); LOTLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(247, result.getSequenceNumber()); assertNull(result.getSigningCertificateAnnouncementURL()); List<String> pivotURLs = result.getPivotURLs(); assertNotNull(pivotURLs); assertEquals(4, pivotURLs.size()); assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals(1, result.getLotlPointers().size()); checkOtherPointers(result.getLotlPointers()); assertEquals(31, result.getTlPointers().size()); checkOtherPointers(result.getTlPointers()); assertEquals("EU", result.getTerritory()); }
@Test public void notParseable() { LOTLParsingTask task = new LOTLParsingTask(LOTL_NOT_PARSEABLE, new LOTLSource()); DSSException exception = assertThrows(DSSException.class, () -> task.get()); assertTrue(exception.getMessage().contains("Unable to parse binaries")); }