From be11dee889f5a740d584458b62804e5fd4296e53 Mon Sep 17 00:00:00 2001 From: s00370346 Date: Thu, 14 Mar 2019 15:06:40 +0530 Subject: Issue-ID: DCAEGEN2-1055 Generic RestConfCollector Change-Id: I1800affa2b34cbb7487c0d8411e078adec5a0c48 Signed-off-by: s00370346 --- .../onap/dcae/controller/ConfigCBSSourceTest.java | 151 +++++++++++++++++++++ .../dcae/controller/ConfigFilesFacadeTest.java | 140 +++++++++++++++++++ .../controller/ConfigLoaderIntegrationE2ETest.java | 98 +++++++++++++ .../onap/dcae/controller/ConfigParsingTest.java | 79 +++++++++++ .../dcae/controller/EnvPropertiesReaderTest.java | 69 ++++++++++ .../org/onap/dcae/controller/EnvPropsTest.java | 41 ++++++ 6 files changed, 578 insertions(+) create mode 100644 src/test/java/org/onap/dcae/controller/ConfigCBSSourceTest.java create mode 100644 src/test/java/org/onap/dcae/controller/ConfigFilesFacadeTest.java create mode 100644 src/test/java/org/onap/dcae/controller/ConfigLoaderIntegrationE2ETest.java create mode 100644 src/test/java/org/onap/dcae/controller/ConfigParsingTest.java create mode 100644 src/test/java/org/onap/dcae/controller/EnvPropertiesReaderTest.java create mode 100644 src/test/java/org/onap/dcae/controller/EnvPropsTest.java (limited to 'src/test/java/org/onap/dcae/controller') diff --git a/src/test/java/org/onap/dcae/controller/ConfigCBSSourceTest.java b/src/test/java/org/onap/dcae/controller/ConfigCBSSourceTest.java new file mode 100644 index 0000000..5c8593e --- /dev/null +++ b/src/test/java/org/onap/dcae/controller/ConfigCBSSourceTest.java @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.dcaegen2.restconfcollector + * ================================================================================ + * Copyright (C) 2018-2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.dcae.controller; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.assertj.core.api.Java6Assertions.assertThat; +import static org.onap.dcae.TestingUtilities.assertFailureHasInfo; +import static org.onap.dcae.controller.ConfigSource.getAppConfig; + +import io.vavr.control.Try; +import org.json.JSONObject; +import org.junit.Test; +import org.onap.dcae.WiremockBasedTest; + + +public class ConfigCBSSourceTest extends WiremockBasedTest { + + @Test + public void shouldReturnValidAppConfiguration() { + // given + String sampleConfigForVES = "{\"collector.rcc.service.port\": 8686}"; + + stubConsulToReturnLocalAddressOfCBS(); + stubCBSToReturnAppConfig(sampleConfigForVES); + + // when + Try actual = tryToGetConfig(); + + // then + assertThat(actual.get().toString()).isEqualTo(new JSONObject(sampleConfigForVES).toString()); + } + + @Test + public void shouldReturnFailureOnFailureToCommunicateWithConsul() { + // given + stubFor(get(urlEqualTo("/v1/catalog/service/CBSName")) + .willReturn(aResponse().withStatus(400))); + + // when + Try actual = tryToGetConfig(); + + // then + assertFailureHasInfo(actual, "HTTP", "Consul", "400", + "http://localhost:" + wireMockRule.port() + "/v1/catalog/service/CBSName"); + } + + @Test + public void shouldReturnFailureOnBadJsonFromConsul() { + // given + stubFor(get(urlEqualTo("/v1/catalog/service/CBSName")) + .willReturn(aResponse().withStatus(200).withBody("[{"))); + + // when + Try actual = tryToGetConfig(); + + // then + assertFailureHasInfo(actual, "JSON", "array", "[{"); + } + + @Test + public void shouldReturnFailureOnInvalidCatalogFormat() { + // given + String notAListCatalog = "" + + "{" + + "\"ServiceAddress\":\"localhost\"," + + "\"ServicePort\":" + wireMockRule.port() + + "}"; + + stubFor(get(urlEqualTo("/v1/catalog/service/CBSName")) + .willReturn(aResponse().withStatus(200).withBody(notAListCatalog))); + + // when + Try actual = tryToGetConfig(); + + // then + assertFailureHasInfo(actual, "JSON", "array", notAListCatalog); + } + + + @Test + public void shouldReturnFailureIfConfigIsMissingRequiredProperties() { + // given + String actualConf = "{\"ServicePort\":" + wireMockRule.port() + "}"; + String asCatalog = "[" + actualConf + "]"; + + stubFor(get(urlEqualTo("/v1/catalog/service/CBSName")) + .willReturn(aResponse().withStatus(200).withBody(asCatalog))); + + // when + Try actual = tryToGetConfig(); + + // then + assertFailureHasInfo(actual, "ServiceAddress", "ServicePort", "missing", actualConf); + } + + + @Test + public void shouldReturnFailureOnFailureToCommunicateWithCBS() { + // given + stubFor(get(urlEqualTo("/v1/catalog/service/CBSName")) + .willReturn(aResponse().withStatus(200).withBody(validLocalCBSConf()))); + stubFor(get(urlEqualTo("/service_component/restconfcollector")) + .willReturn(aResponse().withStatus(400))); + + // when + Try actual = tryToGetConfig(); + + // then + assertFailureHasInfo(actual, "HTTP", "CBS", "400", + "http://localhost:" + wireMockRule.port() + "/service_component/restconfcollector"); + } + + @Test + public void shouldReturnFailureIfAppIsInvalidJsonDocument() { + // given + String invalidAppConf = "[$"; + stubConsulToReturnLocalAddressOfCBS(); + stubCBSToReturnAppConfig(invalidAppConf); + + // when + Try actual = tryToGetConfig(); + + // then + assertFailureHasInfo(actual, "JSON", "document", invalidAppConf); + } + + private Try tryToGetConfig() { + return getAppConfig(new EnvProps("http", "localhost", wireMockRule.port(), "http", "CBSName", "restconfcollector")); + } +} + diff --git a/src/test/java/org/onap/dcae/controller/ConfigFilesFacadeTest.java b/src/test/java/org/onap/dcae/controller/ConfigFilesFacadeTest.java new file mode 100644 index 0000000..4130ceb --- /dev/null +++ b/src/test/java/org/onap/dcae/controller/ConfigFilesFacadeTest.java @@ -0,0 +1,140 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.dcaegen2.restconfcollector + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Nokia. All rights reserved. + * Copyright (C) 2018-2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.dcae.controller; + +import static io.vavr.API.Map; +import static io.vavr.API.Some; +import static org.assertj.core.api.Assertions.assertThat; +import static org.onap.dcae.TestingUtilities.assertFailureHasInfo; +import static org.onap.dcae.TestingUtilities.assertJSONObjectsEqual; +import static org.onap.dcae.TestingUtilities.createTemporaryFile; +import static org.onap.dcae.TestingUtilities.readFile; +import static org.onap.dcae.TestingUtilities.readJSONFromFile; + +import io.vavr.collection.Map; +import io.vavr.control.Try; +import java.nio.file.Path; +import java.nio.file.Paths; +import org.json.JSONObject; +import org.junit.Test; + +public class ConfigFilesFacadeTest { + + private static final Path NON_EXISTENT = Paths.get("/non-existent"); + private static final ConfigFilesFacade TO_NON_EXISTENT_POINTING_FACADE = new ConfigFilesFacade(NON_EXISTENT, + NON_EXISTENT); + + @Test + public void shouldReadPropertyFile() { + // given + Path temporaryFile = createTemporaryFile("some.property=10"); + + // when + ConfigFilesFacade configFilesFacade = new ConfigFilesFacade(temporaryFile, temporaryFile); + + Try> propertiesConfigurations = configFilesFacade.readCollectorProperties(); + + // then + assertThat(propertiesConfigurations.isSuccess()).isTrue(); + assertThat(propertiesConfigurations.get().containsKey("some.property")).isTrue(); + assertThat(propertiesConfigurations.get().get("some.property")).isEqualTo(Some("10")); + } + + + @Test + public void shouldReadDMaaPFile() { + // given + Path temporaryFile = createTemporaryFile("{}"); + + // when + ConfigFilesFacade configFilesFacade = new ConfigFilesFacade(temporaryFile, temporaryFile); + + Try dMaaPConfiguration = configFilesFacade.readDMaaPConfiguration(); + + // then + assertThat(dMaaPConfiguration.isSuccess()).isTrue(); + assertThat(dMaaPConfiguration.get().toString()).isEqualTo("{}"); + } + + @Test + public void shouldWriteDMaaPConf() { + // given + Path temporaryFile = createTemporaryFile("{}"); + JSONObject desiredConf = new JSONObject("{\"key\": 1}"); + + // when + ConfigFilesFacade configFilesFacade = new ConfigFilesFacade(temporaryFile, temporaryFile); + + Try propertiesConfigurations = configFilesFacade.writeDMaaPConfiguration(desiredConf); + + // then + assertThat(propertiesConfigurations.isSuccess()).isTrue(); + assertJSONObjectsEqual(readJSONFromFile(temporaryFile), desiredConf); + } + + + @Test + public void shouldWriteProperties() { + // given + Path temporaryFile = createTemporaryFile("{}"); + + // when + ConfigFilesFacade configFilesFacade = new ConfigFilesFacade(temporaryFile, temporaryFile); + Try propertiesConfigurations = configFilesFacade.writeProperties(Map("prop1", "hi")); + + // then + assertThat(propertiesConfigurations.isSuccess()).isTrue(); + assertThat(readFile(temporaryFile).trim()).isEqualTo("prop1 = hi"); + } + + @Test + public void shouldContainPropertiesPathInCaseOfFailures() { + Try> result = TO_NON_EXISTENT_POINTING_FACADE.readCollectorProperties(); + assertThat(result.isFailure()).isTrue(); + assertFailureHasInfo(result, NON_EXISTENT.toString()); + } + + @Test + public void shouldContainDMaaPPathPathInCaseOfFailures() { + Try result = TO_NON_EXISTENT_POINTING_FACADE.readDMaaPConfiguration(); + assertThat(result.isFailure()).isTrue(); + assertFailureHasInfo(result, NON_EXISTENT.toString()); + } + + @Test + public void shouldContainPropertiesPathPathInCaseOfFailuresOnWrite() { + // given + Try result = TO_NON_EXISTENT_POINTING_FACADE.writeProperties(Map("any", "any")); + assertThat(result.isFailure()).isTrue(); + assertFailureHasInfo(result, NON_EXISTENT.toString()); + } + + @Test + public void shouldContainDMaaPPathPathInCaseOfFailuresOnWrite() { + // given + Try result = TO_NON_EXISTENT_POINTING_FACADE.writeDMaaPConfiguration(new JSONObject()); + assertThat(result.isFailure()).isTrue(); + assertFailureHasInfo(result, NON_EXISTENT.toString()); + } + +} + diff --git a/src/test/java/org/onap/dcae/controller/ConfigLoaderIntegrationE2ETest.java b/src/test/java/org/onap/dcae/controller/ConfigLoaderIntegrationE2ETest.java new file mode 100644 index 0000000..730a98d --- /dev/null +++ b/src/test/java/org/onap/dcae/controller/ConfigLoaderIntegrationE2ETest.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.dcaegen2.restconfcollector + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Nokia. All rights reserved. + * Copyright (C) 2018-2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.dcae.controller; + +import static io.vavr.API.Map; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; +import static org.onap.dcae.TestingUtilities.createTemporaryFile; +import static org.onap.dcae.TestingUtilities.readFile; +import static org.onap.dcae.TestingUtilities.readJSONFromFile; +import static org.onap.dcae.common.publishing.VavrUtils.f; + +import java.nio.file.Path; +import java.nio.file.Paths; +import org.json.JSONObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.dcae.ApplicationSettings; +import org.onap.dcae.RestConfCollector; +import org.onap.dcae.WiremockBasedTest; +import org.onap.dcae.common.publishing.DMaaPConfigurationParser; +import org.onap.dcae.common.publishing.EventPublisher; + +public class ConfigLoaderIntegrationE2ETest extends WiremockBasedTest { + + @Test + public void testSuccessfulE2EFlow() { + // given +// Path dMaaPConfigFile = createTemporaryFile("{}"); +// Path collectorPropertiesFile = createTemporaryFile(""); +// Path dMaaPConfigSource = Paths.get("src/test/resources/testParseDMaaPCredentialsGen2.json"); +// JSONObject dMaaPConf = readJSONFromFile(dMaaPConfigSource); +// stubConsulToReturnLocalAddressOfCBS(); +// stubCBSToReturnAppConfig(f("{\"collector.port\": 8686, \"streams_publishes\": %s}}", dMaaPConf)); +// +// EventPublisher eventPublisherMock = mock(EventPublisher.class); +// +// Mockito.mock(RestConfCollector.class); +// ConfigFilesFacade configFilesFacade = new ConfigFilesFacade(dMaaPConfigFile, collectorPropertiesFile); +// ConfigLoader configLoader = new ConfigLoader(eventPublisherMock::reconfigure, configFilesFacade, ConfigSource::getAppConfig, () -> wiremockBasedEnvProps()); +// configLoader.updateConfig(); +// +// // then +// assertThat(readJSONFromFile(dMaaPConfigSource).toString()).isEqualTo(dMaaPConf.toString()); +// assertThat(readFile(collectorPropertiesFile).trim()).isEqualTo("collector.port = 8686"); +// verify(eventPublisherMock, times(1)).reconfigure( +// DMaaPConfigurationParser.parseToDomainMapping(dMaaPConf).get() +// ); + } + + @Test + public void shouldNotReconfigureNotOverwriteIfConfigurationHasNotChanged() { + // given + Path dMaaPConfigFile = createTemporaryFile("{}"); + Path collectorPropertiesFile = createTemporaryFile(""); + JSONObject dMaaPConf = readJSONFromFile(Paths.get("src/test/resources/testParseDMaaPCredentialsGen2.json")); + stubConsulToReturnLocalAddressOfCBS(); + stubCBSToReturnAppConfig(f("{\"collector.port\": 8686, \"streams_publishes\": %s}}", dMaaPConf)); + EventPublisher eventPublisherMock = mock(EventPublisher.class); + ConfigFilesFacade configFilesFacade = new ConfigFilesFacade(dMaaPConfigFile, collectorPropertiesFile); + configFilesFacade.writeProperties(Map("collector.port", "8686")); + configFilesFacade.writeDMaaPConfiguration(dMaaPConf); + + // when + ConfigLoader configLoader = new ConfigLoader(eventPublisherMock::reconfigure, configFilesFacade, ConfigSource::getAppConfig, () -> wiremockBasedEnvProps()); + configLoader.updateConfig(); + + // then + verifyZeroInteractions(eventPublisherMock); + } + +} \ No newline at end of file diff --git a/src/test/java/org/onap/dcae/controller/ConfigParsingTest.java b/src/test/java/org/onap/dcae/controller/ConfigParsingTest.java new file mode 100644 index 0000000..7792b71 --- /dev/null +++ b/src/test/java/org/onap/dcae/controller/ConfigParsingTest.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.dcaegen2.restconfcollector + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Nokia. All rights reserved. + * Copyright (C) 2018-2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.dcae.controller; + + +import static io.vavr.API.Map; +import static org.assertj.core.api.Assertions.assertThat; +import static org.onap.dcae.TestingUtilities.assertJSONObjectsEqual; +import static org.onap.dcae.TestingUtilities.readJSONFromFile; + +import io.vavr.collection.Map; +import io.vavr.control.Option; + +import java.nio.file.Path; +import java.nio.file.Paths; +import org.json.JSONObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.Silent.class) +public class ConfigParsingTest { + + @Test + public void shouldReturnDMaaPConfig() { + JSONObject dMaaPConf = new JSONObject("{\"auth-credentials-present\": {\"aaf_username\": \"sampleUser\",\"dmaap_info\": {\"topic_url\": \"http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV\",},\"aaf_password\": \"samplePassword\"}}"); + JSONObject root = new JSONObject(); + root.put("key1", "someProperty"); + root.put("key2", "someProperty"); + root.put("streams_publishes", dMaaPConf); + + Option dMaaPConfig = ConfigParsing.getDMaaPConfig(root); + + assertThat(dMaaPConfig.isEmpty()).isFalse(); + assertJSONObjectsEqual(dMaaPConfig.get(), dMaaPConf); + } + + @Test + public void shouldReturnEmptyIfDMaaPConfigIsInvalid() { + JSONObject root = new JSONObject(); + root.put("streams_publishes", 1); + + Option dMaaPConfig = ConfigParsing.getDMaaPConfig(root); + + assertThat(dMaaPConfig.isEmpty()).isTrue(); + } + + @Test + public void getProperties() { + JSONObject dMaaPConf = new JSONObject("{\"auth-credentials-present\": {\"aaf_username\": \"sampleUser\",\"dmaap_info\": {\"topic_url\": \"http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV\",},\"aaf_password\": \"samplePassword\"}}"); + JSONObject root = new JSONObject(); + root.put("key1", "someProperty"); + root.put("key2", "someProperty"); + root.put("streams_publishes", dMaaPConf); + + Map properties = ConfigParsing.getProperties(root); + assertThat(properties).isEqualTo(Map("key1", "someProperty", "key2", "someProperty")); + } +} \ No newline at end of file diff --git a/src/test/java/org/onap/dcae/controller/EnvPropertiesReaderTest.java b/src/test/java/org/onap/dcae/controller/EnvPropertiesReaderTest.java new file mode 100644 index 0000000..2e215a7 --- /dev/null +++ b/src/test/java/org/onap/dcae/controller/EnvPropertiesReaderTest.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.dcaegen2.restconfcollector + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Nokia. All rights reserved. + * Copyright (C) 2018-2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.dcae.controller; + +import static io.vavr.API.Map; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.onap.dcae.controller.EnvPropertiesReader.readEnvProps; + +import io.vavr.collection.Map; +import org.junit.Test; + + +public class EnvPropertiesReaderTest { + + @Test + public void shouldReturnEmptyOnMissingConsulHost() { + Map envs = Map( + "CONFIG_BINDING_SERVICE", "doesNotMatter", + "HOSTNAME", "doesNotMatter"); + assertTrue(readEnvProps(envs).isEmpty()); + } + + @Test + public void shouldReturnEmptyOnMissingCBSName() { + Map envs = Map( + "CONSUL_HOST", "doesNotMatter", + "HOSTNAME", "doesNotMatter"); + assertTrue(readEnvProps(envs).isEmpty()); + } + + @Test + public void shouldReturnEmptyOnMissingVESAppName() { + Map envs = Map( + "CONSUL_HOST", "doesNotMatter", + "CONFIG_BINDING_SERVICE", "doesNotMatter"); + assertTrue(readEnvProps(envs).isEmpty()); + } + + @Test + public void shouldReturnSomeOfAllProperties() { + Map envs = Map( + "CONSUL_HOST", "doesNotMatter", + "HOSTNAME", "doesNotMatter", + "CONFIG_BINDING_SERVICE", "doesNotMatter"); + assertFalse(readEnvProps(envs).isEmpty()); + } + +} + diff --git a/src/test/java/org/onap/dcae/controller/EnvPropsTest.java b/src/test/java/org/onap/dcae/controller/EnvPropsTest.java new file mode 100644 index 0000000..e9c194e --- /dev/null +++ b/src/test/java/org/onap/dcae/controller/EnvPropsTest.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.dcaegen2.restconfcollector + * ================================================================================ + * Copyright (C) 2018-2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.dcae.controller; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; +import junit.framework.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.onap.dcae.common.Format; + + +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static org.junit.Assert.assertEquals; + +public class EnvPropsTest { + @Rule + public WireMockRule wireMockRule = new WireMockRule( + wireMockConfig().dynamicPort().dynamicHttpsPort().keystorePath(null)); + @Test + public void fromString() { + Assert.assertEquals(new EnvProps("http", "localhost", wireMockRule.port(), "http", "CBSName", "restconfcollector").equals(new EnvProps("http", "localhost", wireMockRule.port(), "http", "CBSName", "restconfcollector")), true); + } +} \ No newline at end of file -- cgit 1.2.3-korg