コード例 #1
0
  @Test
  public void shouldFetchManifest() {
    ManifestCms manifestCms = getRootManifestCms();
    when(certificateRepositoryObjectFetcher.getManifest(
            eq(ROOT_SIA_MANIFEST_RSYNC_LOCATION), eq(taContext), isA(ValidationResult.class)))
        .thenReturn(manifestCms);

    assertEquals(manifestCms, subject.fetchManifest(ROOT_SIA_MANIFEST_RSYNC_LOCATION, taContext));
  }
コード例 #2
0
  @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());
  }
コード例 #3
0
  @Test
  public void shouldNotProcessFilesWhenManifestIsNull() {
    when(certificateRepositoryObjectFetcher.getManifest(
            eq(ROOT_SIA_MANIFEST_RSYNC_LOCATION), eq(taContext), isA(ValidationResult.class)))
        .thenReturn(null);

    subject.processManifest(taContext);

    verify(certificateRepositoryObjectFetcher)
        .getManifest(
            eq(ROOT_SIA_MANIFEST_RSYNC_LOCATION), eq(taContext), isA(ValidationResult.class));
    verifyNoMoreInteractions(certificateRepositoryObjectFetcher);
  }
コード例 #4
0
  @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());
  }