2 * ============LICENSE_START=======================================================
3 * org.onap.dcaegen2.collectors.ves
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2018 Nokia. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.dcae.controller;
24 import static io.vavr.API.Map;
25 import static org.junit.Assert.assertFalse;
26 import static org.junit.Assert.assertTrue;
27 import static org.onap.dcae.controller.EnvPropertiesReader.readEnvProps;
29 import io.vavr.collection.Map;
30 import org.junit.Test;
33 public class EnvPropertiesReaderTest {
36 public void shouldReturnEmptyOnMissingConsulHost() {
37 Map<String, String> envs = Map(
38 "CONFIG_BINDING_SERVICE", "doesNotMatter",
39 "HOSTNAME", "doesNotMatter");
40 assertTrue(readEnvProps(envs).isEmpty());
44 public void shouldReturnEmptyOnMissingCBSName() {
45 Map<String, String> envs = Map(
46 "CONSUL_HOST", "doesNotMatter",
47 "HOSTNAME", "doesNotMatter");
48 assertTrue(readEnvProps(envs).isEmpty());
52 public void shouldReturnEmptyOnMissingVESAppName() {
53 Map<String, String> envs = Map(
54 "CONSUL_HOST", "doesNotMatter",
55 "CONFIG_BINDING_SERVICE", "doesNotMatter");
56 assertTrue(readEnvProps(envs).isEmpty());
60 public void shouldReturnSomeOfAllProperties() {
61 Map<String, String> envs = Map(
62 "CONSUL_HOST", "doesNotMatter",
63 "HOSTNAME", "doesNotMatter",
64 "CONFIG_BINDING_SERVICE", "doesNotMatter");
65 assertFalse(readEnvProps(envs).isEmpty());