summaryrefslogtreecommitdiffstats
path: root/certService/src/test/java
diff options
context:
space:
mode:
authorMichal Banka <michal.banka@nokia.com>2020-03-18 12:40:13 +0100
committerMichał Bańka <michal.banka@nokia.com>2020-03-20 12:33:21 +0000
commit5be846ddf01abf99ca1d15ec6ad0f3c53354272f (patch)
tree29948cad6b116a04cb7fa28a5e2de49251a64000 /certService/src/test/java
parent4b65b3c32da416ebfecb7eac808d76d89ae4b2a8 (diff)
Removed unused parameters when creating certificate
Signed-off-by: Michal Banka <michal.banka@nokia.com> Change-Id: I72d9e3ea30d3c2ba8e4e6c7e5afa0cfad2508bc5 Issue-ID: AAF-1107
Diffstat (limited to 'certService/src/test/java')
-rw-r--r--certService/src/test/java/org/onap/aaf/certservice/certification/adapter/Cmpv2ClientAdapterTest.java24
-rw-r--r--certService/src/test/java/org/onap/aaf/certservice/cmpv2client/Cmpv2ClientTest.java10
2 files changed, 8 insertions, 26 deletions
diff --git a/certService/src/test/java/org/onap/aaf/certservice/certification/adapter/Cmpv2ClientAdapterTest.java b/certService/src/test/java/org/onap/aaf/certservice/certification/adapter/Cmpv2ClientAdapterTest.java
index e18d1ffb..56a29e85 100644
--- a/certService/src/test/java/org/onap/aaf/certservice/certification/adapter/Cmpv2ClientAdapterTest.java
+++ b/certService/src/test/java/org/onap/aaf/certservice/certification/adapter/Cmpv2ClientAdapterTest.java
@@ -46,7 +46,6 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.aaf.certservice.certification.configuration.model.CaMode;
import org.onap.aaf.certservice.certification.configuration.model.Cmpv2Server;
-import org.onap.aaf.certservice.certification.exception.Cmpv2ClientAdapterException;
import org.onap.aaf.certservice.certification.model.CertificationModel;
import org.onap.aaf.certservice.certification.model.CsrModel;
import org.onap.aaf.certservice.cmpv2client.api.CmpClient;
@@ -97,7 +96,7 @@ class Cmpv2ClientAdapterTest {
stubInternalProperties();
// When
- Mockito.when(cmpClient.createCertificate(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()))
+ Mockito.when(cmpClient.createCertificate(Mockito.any(), Mockito.any()))
.thenThrow(new CmpClientException(TEST_MSG));
// Then
@@ -107,12 +106,12 @@ class Cmpv2ClientAdapterTest {
@Test
void shouldConvertToCertificationModel()
throws OperatorCreationException, CertificateException, NoSuchProviderException, IOException,
- CmpClientException, Cmpv2ClientAdapterException {
+ CmpClientException {
// Given
stubInternalProperties();
// When
- Mockito.when(cmpClient.createCertificate(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()))
+ Mockito.when(cmpClient.createCertificate(Mockito.any(), Mockito.any()))
.thenReturn(createCorrectClientResponse());
CertificationModel certificationModel = adapter.callCmpClient(csrModel, server);
@@ -131,23 +130,6 @@ class Cmpv2ClientAdapterTest {
Assertions.assertEquals(trustedCertificateModel, expectedTrustedCertificate);
}
- @Test
- void adapterShouldThrowClientAdapterExceptionOnFailure()
- throws OperatorCreationException, CertificateException, NoSuchProviderException, IOException,
- CmpClientException {
- // Given
- stubInternalProperties();
-
- // When
- Mockito.when(cmpClient.createCertificate(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()))
- .thenReturn(createCorrectClientResponse());
- Mockito.when(certificateFactoryProvider.generateCertificate(Mockito.any()))
- .thenThrow(new CertificateException(TEST_MSG));
-
- // Then
- Assertions.assertThrows(Cmpv2ClientAdapterException.class, () -> adapter.callCmpClient(csrModel, server));
- }
-
private List<List<X509Certificate>> createCorrectClientResponse()
throws CertificateException, NoSuchProviderException {
InputStream certificateChain = getClass().getClassLoader().getResourceAsStream("certificateChain.first");
diff --git a/certService/src/test/java/org/onap/aaf/certservice/cmpv2client/Cmpv2ClientTest.java b/certService/src/test/java/org/onap/aaf/certservice/cmpv2client/Cmpv2ClientTest.java
index bea6b6a1..06eeecce 100644
--- a/certService/src/test/java/org/onap/aaf/certservice/cmpv2client/Cmpv2ClientTest.java
+++ b/certService/src/test/java/org/onap/aaf/certservice/cmpv2client/Cmpv2ClientTest.java
@@ -153,7 +153,7 @@ class Cmpv2ClientTest {
CmpClientImpl cmpClient = spy(new CmpClientImpl(httpClient));
// when
List<List<X509Certificate>> cmpClientResult =
- cmpClient.createCertificate("data", "RA", csrModel, server, cert, notBefore, notAfter);
+ cmpClient.createCertificate(csrModel, server, notBefore, notAfter);
// then
assertNotNull(cmpClientResult);
}
@@ -192,7 +192,7 @@ class Cmpv2ClientTest {
// then
Assertions.assertThrows(
CmpClientException.class,
- () -> cmpClient.createCertificate("data", "RA", csrModel, server, cert, notBefore, notAfter));
+ () -> cmpClient.createCertificate(csrModel, server, notBefore, notAfter));
}
@Test
@@ -229,7 +229,7 @@ class Cmpv2ClientTest {
// then
Assertions.assertThrows(
CmpClientException.class,
- () -> cmpClient.createCertificate("data", "RA", csrModel, server, cert, notBefore, notAfter));
+ () -> cmpClient.createCertificate(csrModel, server, notBefore, notAfter));
}
@Test
@@ -248,7 +248,7 @@ class Cmpv2ClientTest {
// then
Assertions.assertThrows(
IllegalArgumentException.class,
- () -> cmpClient.createCertificate("data", "RA", csrModel, server, cert, notBefore, notAfter));
+ () -> cmpClient.createCertificate(csrModel, server, notBefore, notAfter));
}
@Test
@@ -268,7 +268,7 @@ class Cmpv2ClientTest {
// then
Assertions.assertThrows(
CmpClientException.class,
- () -> cmpClient.createCertificate("data", "RA", csrModel, server, cert, notBefore, notAfter));
+ () -> cmpClient.createCertificate(csrModel, server, notBefore, notAfter));
}
private void setCsrModelAndServerValues(String iak, String rv, String externalCaUrl, Date notBefore, Date notAfter) {