Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit b84d676

Browse files
Replacing the use of CloudConnectorException by ConnectorException
1 parent 080671f commit b84d676

3 files changed

Lines changed: 7 additions & 294 deletions

File tree

src/main/java/com/venafi/vcert/sdk/connectors/cloud/CloudConnector.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.venafi.vcert.sdk.connectors.cloud;
22

3-
import static com.venafi.vcert.sdk.connectors.cloud.CloudConnectorException.*;
3+
import static com.venafi.vcert.sdk.connectors.ConnectorException.*;
44
import static java.lang.String.format;
55
import static java.time.Duration.ZERO;
66
import static org.apache.commons.lang3.StringUtils.isBlank;
@@ -97,7 +97,7 @@ public String getVendorAndProductName() {
9797
public void ping() throws VCertException {
9898
Response response = doPing();
9999
if (response.status() != 200) {
100-
throw new UnexpectedStatusException( response.status(), response.reason());
100+
throw new CloudPingException( response.status(), response.reason());
101101
}
102102
}
103103

@@ -230,7 +230,7 @@ public PEMCollection retrieveCertificate(CertificateRequest request) throws VCer
230230
Cloud.CertificateSearchResponse certificateSearchResponse =
231231
searchCertificatesByFingerprint(request.thumbprint());
232232
if (certificateSearchResponse.certificates().size() == 0) {
233-
throw new CertificateNotFoundByFingerprintException(request.thumbprint());
233+
throw new CertificateNotFoundByThumbprintException(request.thumbprint());
234234
}
235235

236236
List<String> reqIds = new ArrayList<>();
@@ -428,15 +428,15 @@ public String renewCertificate(RenewalRequest request) throws VCertException {
428428
if (requestIds.size() > 1) {
429429
throw new MoreThanOneCertificateRequestIdException(request.thumbprint());
430430
} else if (requestIds.size() == 0) {
431-
throw new CertificateNotFoundByFingerprintException(request.thumbprint());
431+
throw new CertificateNotFoundByThumbprintException(request.thumbprint());
432432
}
433433

434434
certificateRequestId = requestIds.iterator().next();
435435

436436
} else if (isNotBlank(request.certificateDN())) {
437437
certificateRequestId = request.certificateDN();
438438
} else {
439-
throw new CertificateDNOrFingerprintWasNotProvidedException();
439+
throw new CertificateDNOrThumbprintWasNotProvidedException();
440440
}
441441

442442
final CertificateStatus status = cloud.certificateStatus(certificateRequestId, auth.apiKey());

src/main/java/com/venafi/vcert/sdk/connectors/cloud/CloudConnectorException.java

Lines changed: 0 additions & 286 deletions
This file was deleted.

src/test/java/com/venafi/vcert/sdk/connectors/cloud/CloudConnectorAT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.bouncycastle.util.Strings;
3030
import org.junit.jupiter.api.BeforeEach;
3131
import org.junit.jupiter.api.DisplayName;
32-
import org.junit.jupiter.api.RepeatedTest;
3332
import org.junit.jupiter.api.Test;
3433
import org.slf4j.Logger;
3534
import org.slf4j.LoggerFactory;
@@ -45,7 +44,7 @@
4544
import com.venafi.vcert.sdk.certificate.RenewalRequest;
4645
import com.venafi.vcert.sdk.certificate.RevocationRequest;
4746
import com.venafi.vcert.sdk.connectors.ZoneConfiguration;
48-
import com.venafi.vcert.sdk.connectors.cloud.CloudConnectorException.CertificateNotFoundByFingerprintException;
47+
import com.venafi.vcert.sdk.connectors.ConnectorException.CertificateNotFoundByThumbprintException;
4948
import com.venafi.vcert.sdk.endpoint.Authentication;
5049
import com.venafi.vcert.sdk.endpoint.ConnectorType;
5150
import com.venafi.vcert.sdk.utils.VCertUtils;
@@ -210,7 +209,7 @@ void renewCertificate() throws VCertException, UnknownHostException,
210209
try {
211210
renewRequestId = classUnderTest.renewCertificate(
212211
new RenewalRequest().request(certificateRequestToRenew).thumbprint(thumbprint));
213-
} catch (CertificateNotFoundByFingerprintException e) {
212+
} catch (CertificateNotFoundByThumbprintException e) {
214213
//wait for 5 sec, it's very probably that the Certificate is not ready at this point
215214
logger.warn("Failed to renewCertificate, because it's very probably that the Certificate is not ready yet. Waiting 5 sec to attempt one more time...");
216215
try {

0 commit comments

Comments
 (0)