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);
}
Aggregations