Skip to content

Commit 4b94d53

Browse files
authored
Merge pull request #813 from Stueypoo/Remove-EE-certs-after-web-systemtests
Remove ee certs after web systemtests and enable OCSP test port config
2 parents 03723d4 + db49f08 commit 4b94d53

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

modules/systemtests/src-test/org/cesecore/CaTestUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ public static void removeCa(AuthenticationToken authenticationToken, CAInfo caIn
231231
if (caInfo.getCAToken() != null) {
232232
cryptoTokenManagementSession.deleteCryptoToken(authenticationToken, caInfo.getCAToken().getCryptoTokenId());
233233
}
234+
internalCertificateStoreSession.removeCertificatesByIssuer(caInfo.getSubjectDN());
234235
internalCertificateStoreSession.removeCertificatesBySubject(caInfo.getSubjectDN());
235236
internalCertificateStoreSession.removeCRLs(authenticationToken, caInfo.getSubjectDN());
236237
}

modules/systemtests/src-test/org/cesecore/certificates/ocsp/OcspTestUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import org.bouncycastle.asn1.ocsp.OCSPObjectIdentifiers;
3535
import org.bouncycastle.operator.OperatorCreationException;
36+
import org.cesecore.SystemTestsConfiguration;
3637
import org.cesecore.authentication.tokens.AuthenticationToken;
3738
import org.cesecore.authorization.AuthorizationDeniedException;
3839
import org.cesecore.certificates.ca.CADoesntExistsException;
@@ -353,7 +354,8 @@ public static void removeInternalKeyBinding(AuthenticationToken alwaysAllowtoken
353354

354355
public static void clearOcspSigningCache() {
355356
try {
356-
final URL url = new URL("http://localhost:8080/ejbca/clearcache?command=clearcaches&excludeactivects=true");
357+
final String httpPort = SystemTestsConfiguration.getRemotePortHttp("8080");
358+
final URL url = new URL("http://localhost:"+httpPort+"/ejbca/clearcache?command=clearcaches&excludeactivects=true");
357359
final HttpURLConnection con = (HttpURLConnection) url.openConnection();
358360
if (con.getResponseCode() != HttpURLConnection.HTTP_OK) {
359361
Assert.fail("Failed to clear caches using URL: http://localhost:8080/ejbca/clearcache?command=clearcaches&excludeactivects=true"

modules/systemtests/src-test/org/cesecore/junit/util/CryptoTokenRunner.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,15 @@ public void tearDownCa(X509CAInfo ca) {
155155
if (caCertificate != null) {
156156
internalCertificateStoreSession.removeCertificate(caCertificate);
157157
}
158+
159+
// Delete certs and CRLs issued by the CA
160+
internalCertificateStoreSession.removeCertificatesByIssuer(ca.getSubjectDN());
161+
internalCertificateStoreSession.removeCertificatesBySubject(ca.getSubjectDN());
162+
internalCertificateStoreSession.removeCRLs(alwaysAllowToken, ca.getSubjectDN());
158163
} catch (AuthorizationDeniedException e) {
159164
throw new IllegalStateException(e);
160165
}
166+
161167
casToRemove.remove(ca.getCAId());
162168
}
163169

modules/systemtests/src-test/org/ejbca/core/protocol/ocsp/OcspJunitHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ private void servletGetWithParam(String param) throws IOException, URISyntaxExce
370370
*/
371371
final URI uriWithParam = new URI(
372372
this.baseURI.getScheme(), this.baseURI.getUserInfo(), "127.0.0.1",
373-
8080, this.baseURI.getPath(), param, this.baseURI.getFragment());
373+
this.baseURI.getPort(), this.baseURI.getPath(), param, this.baseURI.getFragment());
374374
final URL url = uriWithParam.toURL();
375375
final HttpURLConnection con = (HttpURLConnection)url.openConnection();
376376
log.debug("Connection to " + url.toExternalForm() + " resulted in HTTP " + con.getResponseCode());

0 commit comments

Comments
 (0)