diff options
author | 2020-03-12 06:22:36 +0000 | |
---|---|---|
committer | 2020-03-12 06:22:36 +0000 | |
commit | bfc5c800d8a93c54d44f667bcc4b4b999cf1d656 (patch) | |
tree | 932b0600bd0fb0cf27463316ab7148522d23bb8a /certService/src/test/java | |
parent | 49d24dbe4cfd591cdf2af0f0f753a9e64cce824f (diff) | |
parent | 92de5b463e3083dc0a21611c71491c18aeab3bb9 (diff) |
Merge "Fixed sonar issues in CSRMeta class"
Diffstat (limited to 'certService/src/test/java')
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; } |