@Test public void shouldSkipInvalidObjects() { ManifestCms manifestCms = getRootManifestCms(); when(certificateRepositoryObjectFetcher.getObject( eq(ROOT_SIA_REPO_RSYNC_LOCATION.resolve("foo1")), eq(taContext), eq(manifestCms.getFileContentSpecification("foo1")), isA(ValidationResult.class))) .thenReturn(null); when(certificateRepositoryObjectFetcher.getObject( eq(ROOT_SIA_REPO_RSYNC_LOCATION.resolve("BaR")), eq(taContext), eq(manifestCms.getFileContentSpecification("BaR")), isA(ValidationResult.class))) .thenReturn(null); subject.processManifestFiles(taContext, manifestCms); assertTrue(workQueue.isEmpty()); }
@Test public void shouldAddFetchedObjectIssuerToWorkQueue() { ManifestCms manifestCms = getRootManifestCms(); X509Crl crl = getCrl(); when(certificateRepositoryObjectFetcher.getObject( eq(ROOT_SIA_REPO_RSYNC_LOCATION.resolve("foo1")), eq(taContext), eq(manifestCms.getFileContentSpecification("foo1")), isA(ValidationResult.class))) .thenReturn(ta); when(certificateRepositoryObjectFetcher.getObject( eq(ROOT_SIA_REPO_RSYNC_LOCATION.resolve("BaR")), eq(taContext), eq(manifestCms.getFileContentSpecification("BaR")), isA(ValidationResult.class))) .thenReturn(crl); subject.processManifestFiles(taContext, manifestCms); assertEquals(1, workQueue.size()); assertEquals(ta, workQueue.remove().getCertificate()); }