use of com.venafi.vcert.sdk.certificate.CertificateRequest in project vcert-java by Venafi.
the class CloudConnectorCertResource method beforeEach.
@Override
public void beforeEach(ExtensionContext context) throws Exception {
super.beforeEach(context);
zoneConfiguration = connector().readZoneConfiguration(TestUtils.CLOUD_ZONE);
certificateRequest = new CertificateRequest().subject(new CertificateRequest.PKIXName().commonName(TestUtils.randomCN()).organization(Collections.singletonList("Venafi, Inc.")).organizationalUnit(Arrays.asList("DevOps", "Automated Tests")).country(Collections.singletonList("US")).locality(Collections.singletonList("Salt Lake City")).province(Collections.singletonList("Utah"))).dnsNames(Collections.singletonList(InetAddress.getLocalHost().getHostName()));
}
use of com.venafi.vcert.sdk.certificate.CertificateRequest in project vcert-java by Venafi.
the class CloudConnectorIT method requestCertificate.
@Test
void requestCertificate() throws VCertException {
CertificateRequest certificateRequest = new CertificateRequest().csr("-----BEGIN CERTIFICATE REQUEST-----\nMIIBrDCCARUCAQAwbDELMAkGA1UEBhMCVVMxDTALBgNVBAgMBFV0YWgxEjAQBgNV\nBAcMCVNhbHQgTGFrZTEPMA0GA1UECgwGVmVuYWZpMQ8wDQYDVQQLDAZEZXZPcHMx\nGDAWBgNVBAMMD3Rlc3QudmVuZGV2LmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw\ngYkCgYEAqIPiGtjnxep5gQHIiDXhHpHYhr/ndwFKQ2HNGftD3AMjMDyolSQY27w7\nPScTZXcuENew0zsH4iA7UsFhEGB6AIoelBWxiWc1SYRNslIgsSxsRlksJowFcL/E\n40qkmL0TerI2vq829jF3XY6X1E3e1OXo0kbmBLwEB/xnpfuvpt0CAwEAAaAAMA0G\nCSqGSIb3DQEBCwUAA4GBAGsKm5fJ8Zm/j9XMPXhPYmOdiDj+9QlcFq7uRRqwpxo7\nC507RR5Pj2zBRZRLJcc/bNTQFqnW92kIcvJ+YvrQl/GkEMKM2wds/RyMXRHtOJvZ\nYQt6JtkAeQOMECJ7RRHrZiG+m2by2YAB2krthK2gJGSr80xWzZWzrgdwdTe2sxUG\n-----BEGIN CERTIFICATE REQUEST-----".getBytes());
// todo: improve test: add request matcher (and add data to request to ensure it gets passed
// through all right)
ZoneConfiguration zoneConfiguration = new ZoneConfiguration();
zoneConfiguration.zoneId("Default");
String requestId = classUnderTest.requestCertificate(certificateRequest, zoneConfiguration);
assertThat(requestId).isEqualTo("04c051d0-f118-11e5-8b33-d96cf8021ce5");
}
use of com.venafi.vcert.sdk.certificate.CertificateRequest in project vcert-java by Venafi.
the class VCertClientTest method retrieveCertificateWithServerError.
@Test
@DisplayName("Retrieve certificate with server error")
void retrieveCertificateWithServerError() throws VCertException {
final CertificateRequest certificateRequest = mock(CertificateRequest.class);
doThrow(new FeignException.InternalServerError("Error", request, "".getBytes())).when(connector).retrieveCertificate(certificateRequest);
assertThrows(VCertException.class, () -> classUnderTest.retrieveCertificate(certificateRequest));
}
use of com.venafi.vcert.sdk.certificate.CertificateRequest in project vcert-java by Venafi.
the class VCertTknClientTest method requestCertificateWithServerError.
@Test
@DisplayName("Request certificate with server error")
void requestCertificateWithServerError() throws VCertException {
final CertificateRequest certificateRequest = mock(CertificateRequest.class);
final ZoneConfiguration zoneConfiguration = mock(ZoneConfiguration.class);
zoneConfiguration.zoneId("test_zone");
doThrow(new FeignException.InternalServerError("Error", request, "".getBytes())).when(connector).requestCertificate(certificateRequest, zoneConfiguration);
assertThrows(VCertException.class, () -> classUnderTest.requestCertificate(certificateRequest, zoneConfiguration));
}
use of com.venafi.vcert.sdk.certificate.CertificateRequest in project vcert-java by Venafi.
the class VCertTknClientTest method generateRequestWithServerError.
@Test
@DisplayName("Generate request with server error")
void generateRequestWithServerError() throws VCertException {
final ZoneConfiguration zoneConfiguration = mock(ZoneConfiguration.class);
final CertificateRequest certificateRequest = mock(CertificateRequest.class);
doThrow(new FeignException.InternalServerError("Error", request, "".getBytes())).when(connector).generateRequest(zoneConfiguration, certificateRequest);
assertThrows(VCertException.class, () -> classUnderTest.generateRequest(zoneConfiguration, certificateRequest));
}
Aggregations