Search in sources :

Example 1 with CertificateRegenerateRequest

use of org.cloudfoundry.credhub.request.CertificateRegenerateRequest in project credhub by cloudfoundry-incubator.

the class CertificatesHandlerTest method handleRegenerate_passesOnTransitionalFlagWhenRegeneratingCertificate.

@Test
public void handleRegenerate_passesOnTransitionalFlagWhenRegeneratingCertificate() {
    BaseCredentialGenerateRequest generateRequest = mock(BaseCredentialGenerateRequest.class);
    CertificateCredentialVersion certificate = mock(CertificateCredentialVersion.class);
    CertificateCredentialValue newValue = mock(CertificateCredentialValue.class);
    when(certificate.getName()).thenReturn("test");
    when(certificateService.findByCredentialUuid(eq(UUID_STRING), any())).thenReturn(certificate);
    when(generationRequestGenerator.createGenerateRequest(eq(certificate), eq("test"), any())).thenReturn(generateRequest);
    when(universalCredentialGenerator.generate(eq(generateRequest))).thenReturn(newValue);
    when(permissionedCertificateService.save(eq(certificate), any(), any(), any())).thenReturn(mock(CertificateCredentialVersion.class));
    CertificateRegenerateRequest regenerateRequest = new CertificateRegenerateRequest(true);
    subject.handleRegenerate(UUID_STRING, Collections.emptyList(), regenerateRequest);
    verify(newValue).setTransitional(true);
}
Also used : CertificateRegenerateRequest(org.cloudfoundry.credhub.request.CertificateRegenerateRequest) BaseCredentialGenerateRequest(org.cloudfoundry.credhub.request.BaseCredentialGenerateRequest) CertificateCredentialValue(org.cloudfoundry.credhub.credential.CertificateCredentialValue) CertificateCredentialVersion(org.cloudfoundry.credhub.domain.CertificateCredentialVersion) Test(org.junit.Test)

Aggregations

CertificateCredentialValue (org.cloudfoundry.credhub.credential.CertificateCredentialValue)1 CertificateCredentialVersion (org.cloudfoundry.credhub.domain.CertificateCredentialVersion)1 BaseCredentialGenerateRequest (org.cloudfoundry.credhub.request.BaseCredentialGenerateRequest)1 CertificateRegenerateRequest (org.cloudfoundry.credhub.request.CertificateRegenerateRequest)1 Test (org.junit.Test)1