diff options
author | Tomasz Wrobel <tomasz.wrobel@nokia.com> | 2022-12-05 21:44:02 +0100 |
---|---|---|
committer | Tomasz Wrobel <tomasz.wrobel@nokia.com> | 2022-12-06 08:49:31 +0100 |
commit | d4bd1587ce3ea956d8ee44dc7902050c528604c5 (patch) | |
tree | 7e6508b75566384702109aa5e2419eafcafa94ac | |
parent | aa199470f2bbaac66d09c80098c27392fee2d507 (diff) |
[SDK] Increase code coveredge
Issue-ID: DCAEGEN2-3165
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Change-Id: I76ba5e8cf4e5b1525ef7aab8bc9e18b46d540dab
-rw-r--r-- | Changelog.md | 2 | ||||
-rw-r--r-- | security/ssl/src/test/java/org/onap/dcaegen2/services/sdk/security/ssl/SslFactoryTest.java | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md index 81ad1232..3d6c993a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [1.9.1] - 2022/09/07 ### Added - [DCAEGEN2-3165] (https://jira.onap.org/browse/DCAEGEN2-3165) - Fix calculation of code coverage - - [DCAEGEN2-3165] (https://jira.onap.org/browse/DCAEGEN2-3165) - increase code coverage + - [DCAEGEN2-3165] (https://jira.onap.org/browse/DCAEGEN2-3165) - increase code coverage ## [1.9.0] - 2022/09/07 ### Added diff --git a/security/ssl/src/test/java/org/onap/dcaegen2/services/sdk/security/ssl/SslFactoryTest.java b/security/ssl/src/test/java/org/onap/dcaegen2/services/sdk/security/ssl/SslFactoryTest.java index 088c7219..e3605e21 100644 --- a/security/ssl/src/test/java/org/onap/dcaegen2/services/sdk/security/ssl/SslFactoryTest.java +++ b/security/ssl/src/test/java/org/onap/dcaegen2/services/sdk/security/ssl/SslFactoryTest.java @@ -28,6 +28,7 @@ import java.net.URISyntaxException; import java.nio.file.Paths; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.onap.dcaegen2.services.sdk.security.ssl.Passwords.fromResource; @@ -88,8 +89,30 @@ class SslFactoryTest { .hasMessageContaining("Keystore was tampered with, or password was incorrect"); } + @Test + void testCreateInsecureClient () { + assertThatCode(() -> sut.createInsecureClientContext()) + .doesNotThrowAnyException(); + } + + @Test + void testCreateSecureClientContextFromSecurityKeys() throws Exception { + // given + final SecurityKeys securityKeys = ImmutableSecurityKeys.builder() + .keyStore(keyStoreFromResource("/sample/cert.jks")) + .keyStorePassword(fromResource("/sample/jks.pass")) + .trustStore(keyStoreFromResource("/sample/trust.jks")) + .trustStorePassword(fromResource("/sample/trust.pass")) + .build(); + + // when + assertThatCode(() -> sut.createSecureClientContext(securityKeys)) + .doesNotThrowAnyException(); + } + private @NotNull SecurityKeysStore keyStoreFromResource(String resource) throws URISyntaxException { return SecurityKeysStore.fromPath( Paths.get(Passwords.class.getResource(resource).toURI())); } + } |