summaryrefslogtreecommitdiffstats
path: root/certService/src/test/java
diff options
context:
space:
mode:
authorMichal Banka <michal.banka@nokia.com>2020-02-28 16:38:44 +0100
committerMichal Banka <michal.banka@nokia.com>2020-03-11 13:51:20 +0100
commit92de5b463e3083dc0a21611c71491c18aeab3bb9 (patch)
tree86276f6ee81375c021d97ebca48112f00981de50 /certService/src/test/java
parent50ec01532a2c3816d964bf6b1b870968536a6fd7 (diff)
Fixed sonar issues in CSRMeta class
Signed-off-by: Michal Banka <michal.banka@nokia.com> Change-Id: Ia247ff2246b513521f880a55913ad92a8902aa3e Issue-ID: AAF-997
Diffstat (limited to 'certService/src/test/java')
-rw-r--r--certService/src/test/java/org/onap/aaf/certservice/certification/adapter/CSRMetaBuilderTest.java16
-rw-r--r--certService/src/test/java/org/onap/aaf/certservice/cmpv2Client/Cmpv2ClientTest.java21
2 files changed, 18 insertions, 19 deletions
diff --git a/certService/src/test/java/org/onap/aaf/certservice/certification/adapter/CSRMetaBuilderTest.java b/certService/src/test/java/org/onap/aaf/certservice/certification/adapter/CSRMetaBuilderTest.java
index d3f8cc65..adb89b31 100644
--- a/certService/src/test/java/org/onap/aaf/certservice/certification/adapter/CSRMetaBuilderTest.java
+++ b/certService/src/test/java/org/onap/aaf/certservice/certification/adapter/CSRMetaBuilderTest.java
@@ -72,14 +72,14 @@ public class CSRMetaBuilderTest {
CSRMeta createdCSRMeta = csrMetaBuilder.build(testCsrModel, testServer);
// Then
- assertThat(createdCSRMeta.password()).isEqualTo(testServer.getAuthentication().getIak());
- assertThat(createdCSRMeta.senderKid()).isEqualTo(testServer.getAuthentication().getRv());
- assertThat(createdCSRMeta.caUrl()).isEqualTo(testServer.getUrl());
- assertThat(createdCSRMeta.sans()).containsAll(testSans);
- assertThat(createdCSRMeta.keyPair().getPrivate()).isEqualTo(mockPrivateKey);
- assertThat(createdCSRMeta.keyPair().getPublic()).isEqualTo(mockPublicKey);
- assertThat(createdCSRMeta.x500Name()).isEqualTo(TEST_SUBJECT_DATA);
- assertThat(createdCSRMeta.issuerx500Name()).isEqualTo(TEST_SUBJECT_DATA);
+ assertThat(createdCSRMeta.getPassword()).isEqualTo(testServer.getAuthentication().getIak());
+ assertThat(createdCSRMeta.getSenderKid()).isEqualTo(testServer.getAuthentication().getRv());
+ assertThat(createdCSRMeta.getCaUrl()).isEqualTo(testServer.getUrl());
+ assertThat(createdCSRMeta.getSans()).containsAll(testSans);
+ assertThat(createdCSRMeta.getKeyPair().getPrivate()).isEqualTo(mockPrivateKey);
+ assertThat(createdCSRMeta.getKeyPair().getPublic()).isEqualTo(mockPublicKey);
+ assertThat(createdCSRMeta.getX500Name()).isEqualTo(TEST_SUBJECT_DATA);
+ assertThat(createdCSRMeta.getIssuerX500Name()).isEqualTo(TEST_SUBJECT_DATA);
}
private Cmpv2Server createTestServer() {
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 713a2d00..a2f3050f 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
@@ -89,7 +89,7 @@ class Cmpv2ClientTest {
KeyPairGenerator keyGenerator;
keyGenerator = KeyPairGenerator.getInstance("RSA", BouncyCastleProvider.PROVIDER_NAME);
keyGenerator.initialize(2048);
- keyPair = LoadKeyPair();
+ keyPair = loadKeyPair();
rdns = new ArrayList<>();
try {
rdns.add(new RDN("O=CommonCompany"));
@@ -99,7 +99,7 @@ class Cmpv2ClientTest {
initMocks(this);
}
- public KeyPair LoadKeyPair()
+ public KeyPair loadKeyPair()
throws IOException, NoSuchAlgorithmException, InvalidKeySpecException,
NoSuchProviderException {
@@ -307,16 +307,15 @@ class Cmpv2ClientTest {
Date notBefore,
Date notAfter) {
csrMeta = new CSRMeta(rdns);
- csrMeta.cn(cn);
- csrMeta.san(san);
- csrMeta.password(password);
- csrMeta.email(email);
- csrMeta.issuerCn(issuerCn);
+ csrMeta.setCn(cn);
+ csrMeta.addSan(san);
+ csrMeta.setPassword(password);
+ csrMeta.setEmail(email);
+ csrMeta.setIssuerCn(issuerCn);
when(kpg.generateKeyPair()).thenReturn(keyPair);
- csrMeta.keypair();
- csrMeta.caUrl(externalCaUrl);
- csrMeta.senderKid(senderKid);
-
+ csrMeta.getKeyPairOrGenerateIfNull();
+ csrMeta.setCaUrl(externalCaUrl);
+ csrMeta.setSenderKid(senderKid);
this.notBefore = notBefore;
this.notAfter = notAfter;
}