TLParsingTask extends AbstractParsingTask implements Supplier<TLParsingResult> { @Override public TLParsingResult get() { TLParsingResult result = new TLParsingResult(); TrustStatusListType jaxbObject = getJAXBObject(); parseSchemeInformation(result, jaxbObject.getSchemeInformation()); parseTrustServiceProviderList(result, jaxbObject.getTrustServiceProviderList()); return result; } TLParsingTask(DSSDocument document, TLSource tlSource); @Override TLParsingResult get();  }
@Test public void testIEDefault() { TLParsingTask task = new TLParsingTask(IE_TL, new TLSource()); TLParsingResult result = task.get(); assertNotNull(result); assertEquals(5, result.getVersion()); assertEquals(18, result.getSequenceNumber()); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals("IE", result.getTerritory()); assertTrue(Utils.isCollectionEmpty(result.getDistributionPoints())); List<TrustServiceProvider> trustServiceProviders = result.getTrustServiceProviders(); assertNotNull(trustServiceProviders); assertEquals(3, trustServiceProviders.size()); checkTSPs(trustServiceProviders); TrustServiceProvider postTrust = trustServiceProviders.get(0); assertEquals(1, postTrust.getServices().size()); TrustServiceProvider adobe = trustServiceProviders.get(1); assertEquals(1, adobe.getServices().size()); TrustServiceProvider trustPro = trustServiceProviders.get(2); assertEquals(2, trustPro.getServices().size()); }
@Test public void testSKDefault() { TLParsingTask task = new TLParsingTask(SK_TL, new TLSource()); TLParsingResult result = task.get(); assertNotNull(result); assertEquals(5, result.getVersion()); assertEquals(59, result.getSequenceNumber()); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals("SK", result.getTerritory()); assertNotNull(result.getDistributionPoints()); List<TrustServiceProvider> trustServiceProviders = result.getTrustServiceProviders(); assertNotNull(trustServiceProviders); assertEquals(6, trustServiceProviders.size()); checkTSPs(trustServiceProviders); TrustServiceProvider nsa = trustServiceProviders.get(0); assertEquals(27, nsa.getServices().size()); TrustServiceProvider disig = trustServiceProviders.get(1); assertEquals(56, disig.getServices().size()); TrustServiceProvider mil = trustServiceProviders.get(2); assertEquals(8, mil.getServices().size()); }
@Test public void testLOTL() { TLParsingTask task = new TLParsingTask(LOTL, new TLSource()); TLParsingResult result = task.get(); assertNotNull(result); assertNotNull(result); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals(5, result.getVersion()); assertEquals(248, result.getSequenceNumber()); assertEquals("EU", result.getTerritory()); assertNotNull(result.getDistributionPoints()); List<TrustServiceProvider> trustServiceProviders = result.getTrustServiceProviders(); assertNotNull(trustServiceProviders); assertEquals(0, trustServiceProviders.size()); }
@Test public void notParseable() { TLParsingTask task = new TLParsingTask(LOTL_NOT_PARSEABLE, new TLSource()); DSSException exception = assertThrows(DSSException.class, () -> task.get()); assertTrue(exception.getMessage().contains("Unable to parse binaries")); }
@Test public void testFilterAllTrustServiceProviders() { TLSource tlSource = new TLSource(); tlSource.setTrustServiceProviderPredicate(new TrustServiceProviderPredicate() { @Override public boolean test(TSPType t) { return false; } }); TLParsingTask task = new TLParsingTask(IE_TL, tlSource); TLParsingResult result = task.get(); assertNotNull(result); assertEquals(0, result.getTrustServiceProviders().size()); }
@Test public void testFilterAllTrustServices() { TLSource tlSource = new TLSource(); tlSource.setTrustServicePredicate(new TrustServicePredicate() { @Override public boolean test(TSPServiceType t) { return false; } }); TLParsingTask task = new TLParsingTask(IE_TL, tlSource); TLParsingResult result = task.get(); assertNotNull(result); assertEquals(0, result.getTrustServiceProviders().size()); }
@Test public void countCertificatesDE() throws Exception { TLParsingTask task = new TLParsingTask(DE_TL, new TLSource()); TLParsingResult result = task.get(); assertNotNull(result); assertEquals(4, result.getVersion()); assertEquals(22, result.getSequenceNumber()); assertNotNull(result.getIssueDate()); assertNotNull(result.getNextUpdateDate()); assertEquals("DE", result.getTerritory()); assertTrue(Utils.isCollectionNotEmpty(result.getDistributionPoints())); List<TrustServiceProvider> trustServiceProviders = result.getTrustServiceProviders(); assertNotNull(trustServiceProviders); Set<CertificateToken> certs = new HashSet<>(); for (TrustServiceProvider tslServiceProvider : trustServiceProviders) { List<TrustService> services = tslServiceProvider.getServices(); for (TrustService tslService : services) { certs.addAll(tslService.getCertificates()); } } assertEquals(413, certs.size()); }
@Test public void dss1911() throws ParseException { CertificateToken certificate = DSSUtils.loadCertificateFromBase64EncodedString( "MIIG6jCCBNKgAwIBAgIKAegBhfr9CQACpjANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJTSzETMBEGA1UEBwwKQnJhdGlzbGF2YTEXMBUGA1UEBRMOTlRSU0stMzYwNjE3MDExIjAgBgNVBAoMGU5hcm9kbnkgYmV6cGVjbm9zdG55IHVyYWQxDDAKBgNVBAsMA1NFUDEOMAwGA1UEAwwFU05DQTMwHhcNMTkwMjI1MTE0NTQ0WhcNMjEwMjI0MTE0NTQ0WjCB8zELMAkGA1UEBhMCU0sxDjAMBgNVBBEMBTg1MTA2MTAwLgYDVQQHDCdCcmF0aXNsYXZhIC0gbWVzdHNrw6EgxI1hc8WlIFBldHLFvmFsa2ExFzAVBgNVBAkMDkJ1ZGF0w61uc2thIDMwMRMwEQYLKwYBBAGCNzwCAQMMAkVVMRowGAYDVQQPDBFHb3Zlcm5tZW50IEVudGl0eTEXMBUGA1UEBRMOTlRSU0stMzYwNjE3MDExJzAlBgNVBAoMHk7DoXJvZG7DvSBiZXpwZcSNbm9zdG7DvSDDunJhZDEWMBQGA1UEAwwNdGwubmJ1Lmdvdi5zazCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALs7qOQsbZZjQ7pL/1zgwNRjBgaSLkRxbi9LfXX2BNBt5GpHYsSfvw3YBtDgEfEE1RtqR3ktyw2yEQaH/52Okf5UhZTd8F4XKaitnqpFQkxtxoxR1eNTdnpc6EU5OYawNAwaSfnVok1vbvu6OhE2NVSiverFRMrHi26H/m0BiVUIDqw/DP11dJRvIHie5Ldt+XfJ9E5oiV+/iaHM4WFd7TDO2MZmRKqV8SsmljHpluVGu9ntSVJlW8PokDRSDchrLqSZvSsg76BEzohFlVubpNxdQIAOdzCC0I0YTp+WxpPuWLVn0RhCOwuwLQ6VfcNQEoIMvOlR/OMfb5D51z5PqjUCAwEAAaOCAfMwggHvMIGgBggrBgEFBQcBAQSBkzCBkDAzBggrBgEFBQcwAYYnaHR0cDovL3NuY2EzLW9jc3AubmJ1Lmdvdi5zay9vY3NwL3NuY2EzMDYGCCsGAQUFBzAChipodHRwOi8vZXAubmJ1Lmdvdi5zay9zbmNhL2NlcnRzMy9zbmNhMy5wN2MwIQYIKwYBBQUHMAKkFTATMREwDwYDVQQFEwhUTElTSy04MjAdBgNVHQ4EFgQUlSCdtY3rt/LHmVzsNx29rhT25CkwHwYDVR0jBBgwFoAUKaIHEeYMKI6axfcIS0LG1RwNvOIwDAYDVR0TAQH/BAIwADBpBgNVHSAEYjBgMA8GDSuBHpGZhAUAAAABAgIwRAYKK4EekZmEBQABAjA2MDQGCCsGAQUFBwIBFihodHRwOi9lcC5uYnUuZ292LnNrL3NuY2EvZG9jL2NwX3NuY2EucGRmMAcGBWeBDAEBMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATA7BgNVHR8ENDAyMDCgLqAshipodHRwOi8vY2RwLm5idS5nb3Yuc2svc25jYS9jcmxzMy9zbmNhMy5jcmwwGAYIKwYBBQUHAQMEDDAKMAgGBgQAjkYBATAYBgNVHREEETAPgg10bC5uYnUuZ292LnNrMA0GCSqGSIb3DQEBCwUAA4ICAQBf7OIaTY3Aq2pmgEzjFMfVBrhj3XQPn TLParsingTask task = new TLParsingTask(SK_1911, new TLSource()); TLParsingResult result = task.get(); assertNotNull(result); List<TrustServiceProvider> trustServiceProviders = result.getTrustServiceProviders(); assertEquals(1, trustServiceProviders.size()); TrustServiceProvider uniqueTSP = trustServiceProviders.get(0); List<TrustService> services = uniqueTSP.getServices(); assertEquals(1, services.size()); TrustService uniqueService = services.get(0); assertNotNull(uniqueService); TimeDependentValues<TrustServiceStatusAndInformationExtensions> statusAndInformationExtensions = uniqueService.getStatusAndInformationExtensions(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = sdf.parse("2019-08-01"); TrustServiceStatusAndInformationExtensions forDate = statusAndInformationExtensions.getCurrent(date); assertNotNull(forDate); List<ConditionForQualifiers> conditionsForQualifiers = forDate.getConditionsForQualifiers(); assertEquals(2, conditionsForQualifiers.size()); for (ConditionForQualifiers conditionForQualifiers : conditionsForQualifiers) { assertTrue(conditionForQualifiers.getCondition().check(certificate)); } }