diff options
Diffstat (limited to 'sdc-distribution-client/src/test/java/org/onap')
5 files changed, 27 insertions, 10 deletions
diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpClientFactoryTest.java b/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpClientFactoryTest.java index 2292fc4..3ee2d02 100644 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpClientFactoryTest.java +++ b/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpClientFactoryTest.java @@ -41,8 +41,10 @@ class HttpClientFactoryTest { TestConfiguration config = spy(new TestConfiguration()); HttpClientFactory httpClientFactory = new HttpClientFactory(config); when(config.activateServerTLSAuth()).thenReturn(true); - when(config.getKeyStorePath()).thenReturn("src/test/resources/sdc-client.jks"); - when(config.getKeyStorePassword()).thenReturn("Aa123456"); + when(config.getKeyStorePath()).thenReturn("src/test/resources/sdc-user-keystore.jks"); + when(config.getKeyStorePassword()).thenReturn("zreRDCnNLsZ7"); + when(config.getTrustStorePath()).thenReturn("src/test/resources/sdc-user-truststore.jks"); + when(config.getTrustStorePassword()).thenReturn("changeit"); Pair<String, CloseableHttpClient> client = httpClientFactory.createInstance(); SSLConnectionSocketFactory sslsf = spy(SSLConnectionSocketFactory.getSocketFactory()); CredentialsProvider credsProvider = new BasicCredentialsProvider(); diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/http/SdcConnectorClientTest.java b/sdc-distribution-client/src/test/java/org/onap/sdc/http/SdcConnectorClientTest.java index e449c4c..b2c1128 100644 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/http/SdcConnectorClientTest.java +++ b/sdc-distribution-client/src/test/java/org/onap/sdc/http/SdcConnectorClientTest.java @@ -87,7 +87,10 @@ public class SdcConnectorClientTest { when(conf.getUser()).thenReturn("user"); when(conf.getPassword()).thenReturn("password"); when(conf.isUseHttpsWithSDC()).thenReturn(true); - + when(conf.getKeyStorePath()).thenReturn("src/test/resources/sdc-user-keystore.jks"); + when(conf.getKeyStorePassword()).thenReturn("zreRDCnNLsZ7"); + when(conf.getTrustStorePath()).thenReturn("src/test/resources/sdc-user-truststore.jks"); + when(conf.getTrustStorePassword()).thenReturn("changeit"); when(conf.activateServerTLSAuth()).thenReturn(false); final HttpSdcClient httpClient = new HttpSdcClient(conf); SdcConnectorClient client = new SdcConnectorClient(conf, httpClient); diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/KafkaCommonConfigTest.java b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/KafkaCommonConfigTest.java index 36730b5..a60a785 100644 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/KafkaCommonConfigTest.java +++ b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/KafkaCommonConfigTest.java @@ -35,8 +35,7 @@ public class KafkaCommonConfigTest { @Test public void testConsumerPropertiesNoSSL(){ - List<String> msgBusAddress = new ArrayList<>(); - msgBusAddress.add("address1"); + String msgBusAddress = "address1"; testConfigNoSSL.setMsgBusAddress(msgBusAddress); KafkaCommonConfig kafkaCommonConfig = new KafkaCommonConfig(testConfigNoSSL); Properties consumerProperties = kafkaCommonConfig.getConsumerProperties(); @@ -45,8 +44,7 @@ public class KafkaCommonConfigTest { @Test public void testProducerPropertiesWithSSL(){ - List<String> msgBusAddress = new ArrayList<>(); - msgBusAddress.add("address1"); + String msgBusAddress = "address1"; testConfigWithSSL.setMsgBusAddress(msgBusAddress); KafkaCommonConfig kafkaCommonConfig = new KafkaCommonConfig(testConfigWithSSL); Properties consumerProperties = kafkaCommonConfig.getProducerProperties(); diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/SdcKafkaTest.java b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/SdcKafkaTest.java index c0c60a8..a4d348c 100644 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/SdcKafkaTest.java +++ b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/SdcKafkaTest.java @@ -57,7 +57,7 @@ class SdcKafkaTest { startKafkaService(); KafkaTestUtils utils = new KafkaTestUtils(kafkaTestCluster); utils.createTopic(topicName, 1, (short) 1); - configuration.setMsgBusAddress(Collections.singletonList(kafkaTestCluster.getKafkaConnectString())); + configuration.setMsgBusAddress(kafkaTestCluster.getKafkaConnectString()); } @AfterAll diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java index a132cd0..b75d231 100644 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java +++ b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java @@ -42,6 +42,8 @@ public class TestConfiguration implements IConfiguration { private final int kafkaConsumerSessionTimeout; private String keyStorePath; private String keyStorePassword; + private String trustStorePath; + private String trustStorePassword; private boolean activateServerTLSAuth; private boolean isFilterInEmptyResources; private boolean useHttpsWithSDC; @@ -66,8 +68,10 @@ public class TestConfiguration implements IConfiguration { this.relevantArtifactTypes = new ArrayList<>(); this.relevantArtifactTypes.add(ArtifactTypeEnum.HEAT.name()); this.user = "mso-user"; - this.keyStorePath = "etc/sdc-client.jks"; - this.keyStorePassword = "Aa123456"; + this.keyStorePath = "src/test/resources/etc/sdc-user-keystore.jks"; + this.keyStorePassword = "zreRDCnNLsZ7"; + this.trustStorePath = "src/test/resources/etc/sdc-user-truststore.jks"; + this.trustStorePassword = "changeit"; this.activateServerTLSAuth = true; this.isFilterInEmptyResources = false; this.useHttpsWithSDC = true; @@ -155,6 +159,16 @@ public class TestConfiguration implements IConfiguration { return keyStorePassword; } + @Override + public String getTrustStorePath() { + return trustStorePath; + } + + @Override + public String getTrustStorePassword() { + return trustStorePassword; + } + public String getConsumerID() { return consumerID; } |