Search in sources :

Example 1 with RevocationRequest

use of com.venafi.vcert.sdk.certificate.RevocationRequest in project vcert-java by Venafi.

the class VCertTknClientTest method revokeCertificate.

@Test
@DisplayName("Revoke certificate")
void revokeCertificate() throws VCertException {
    final RevocationRequest revocationRequest = mock(RevocationRequest.class);
    classUnderTest.revokeCertificate(revocationRequest);
    verify(connector).revokeCertificate(revocationRequest);
}
Also used : RevocationRequest(com.venafi.vcert.sdk.certificate.RevocationRequest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 2 with RevocationRequest

use of com.venafi.vcert.sdk.certificate.RevocationRequest in project vcert-java by Venafi.

the class VCertTknClientTest method revokeCertificateWithServerError.

@Test
@DisplayName("Revoke certificate with server error")
void revokeCertificateWithServerError() throws VCertException {
    final RevocationRequest revocationRequest = mock(RevocationRequest.class);
    doThrow(new FeignException.InternalServerError("Error", request, "".getBytes())).when(connector).revokeCertificate(revocationRequest);
    assertThrows(VCertException.class, () -> classUnderTest.revokeCertificate(revocationRequest));
}
Also used : RevocationRequest(com.venafi.vcert.sdk.certificate.RevocationRequest) FeignException(feign.FeignException) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 3 with RevocationRequest

use of com.venafi.vcert.sdk.certificate.RevocationRequest in project vcert-java by Venafi.

the class VCertClientTest method revokeCertificate.

@Test
@DisplayName("Revoke certificate")
void revokeCertificate() throws VCertException {
    final RevocationRequest revocationRequest = mock(RevocationRequest.class);
    classUnderTest.revokeCertificate(revocationRequest);
    verify(connector).revokeCertificate(revocationRequest);
}
Also used : RevocationRequest(com.venafi.vcert.sdk.certificate.RevocationRequest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 4 with RevocationRequest

use of com.venafi.vcert.sdk.certificate.RevocationRequest in project vcert-java by Venafi.

the class TppTokenConnectorCertAT method revokeCertificate.

@Test
void revokeCertificate() throws VCertException, SocketException, UnknownHostException {
    TppTokenConnector connector = connectorResource.connector();
    ZoneConfiguration zoneConfiguration = connectorResource.zoneConfiguration();
    CertificateRequest certificateRequest = connector.generateRequest(zoneConfiguration, connectorResource.certificateRequest());
    String certificateId = connector.requestCertificate(certificateRequest, zoneConfiguration);
    assertThat(certificateId).isNotNull();
    // just wait for the certificate issuance
    connector.retrieveCertificate(certificateRequest);
    RevocationRequest revocationRequest = new RevocationRequest();
    revocationRequest.reason("key-compromise");
    revocationRequest.certificateDN(certificateRequest.pickupId());
    connector.revokeCertificate(revocationRequest);
}
Also used : RevocationRequest(com.venafi.vcert.sdk.certificate.RevocationRequest) ZoneConfiguration(com.venafi.vcert.sdk.connectors.ZoneConfiguration) CertificateRequest(com.venafi.vcert.sdk.certificate.CertificateRequest) Test(org.junit.jupiter.api.Test)

Example 5 with RevocationRequest

use of com.venafi.vcert.sdk.certificate.RevocationRequest in project vcert-java by Venafi.

the class TppConnectorCertAT method revokeCertificate.

@Test
void revokeCertificate() throws VCertException, SocketException, UnknownHostException {
    TppConnector connector = connectorResource.connector();
    ZoneConfiguration zoneConfiguration = connectorResource.zoneConfiguration();
    CertificateRequest certificateRequest = connectorResource.certificateRequest();
    certificateRequest = connector.generateRequest(zoneConfiguration, certificateRequest);
    String certificateId = connector.requestCertificate(certificateRequest, zoneConfiguration);
    assertThat(certificateId).isNotNull();
    // just wait for the certificate issuance
    connector.retrieveCertificate(certificateRequest);
    RevocationRequest revocationRequest = new RevocationRequest();
    revocationRequest.reason("key-compromise");
    revocationRequest.certificateDN(certificateRequest.pickupId());
    connector.revokeCertificate(revocationRequest);
}
Also used : RevocationRequest(com.venafi.vcert.sdk.certificate.RevocationRequest) ZoneConfiguration(com.venafi.vcert.sdk.connectors.ZoneConfiguration) CertificateRequest(com.venafi.vcert.sdk.certificate.CertificateRequest) Test(org.junit.jupiter.api.Test)

Aggregations

RevocationRequest (com.venafi.vcert.sdk.certificate.RevocationRequest)6 Test (org.junit.jupiter.api.Test)6 DisplayName (org.junit.jupiter.api.DisplayName)4 CertificateRequest (com.venafi.vcert.sdk.certificate.CertificateRequest)2 ZoneConfiguration (com.venafi.vcert.sdk.connectors.ZoneConfiguration)2 FeignException (feign.FeignException)2