2 * Copyright 2017 ZTE Corporation.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 package org.onap.holmes.common.config;
\r
19 import static org.hamcrest.core.IsEqual.equalTo;
\r
20 import static org.junit.Assert.assertThat;
\r
21 import static org.junit.Assert.assertTrue;
\r
23 import org.junit.Test;
\r
25 public class MicroServiceConfigTest {
\r
28 public void getMsbServerAddrTest() {
\r
29 System.setProperty("MSB_ADDR", "test");
\r
30 assertThat("http://test", equalTo(MicroServiceConfig.getMsbServerAddr()));
\r
31 System.clearProperty("MSB_ADDR");
\r
35 public void getMsbServerIpTest() {
\r
36 System.setProperty("MSB_ADDR", "10.54.23.79");
\r
37 assertThat("10.54.23.79", equalTo(MicroServiceConfig.getMsbServerIp()));
\r
38 System.clearProperty("MSB_ADDR");
\r
42 public void getMsbPortTest() {
\r
43 System.setProperty("MSB_PORT", "110");
\r
44 assertTrue(110 == MicroServiceConfig.getMsbServerPort());
\r
45 System.clearProperty("MSB_PORT");
\r
49 public void getMsbPortTestNonnumeric() {
\r
50 System.setProperty("MSB_PORT", "test");
\r
51 assertTrue(80 == MicroServiceConfig.getMsbServerPort());
\r
52 System.clearProperty("MSB_PORT");
\r
56 public void getMsbPortTestNullValue() {
\r
57 assertTrue(80 == MicroServiceConfig.getMsbServerPort());
\r
61 public void getServiceIpTest() {
\r
62 System.setProperty("SERVICE_IP", "test");
\r
63 assertThat("test", equalTo(MicroServiceConfig.getServiceIp()));
\r
64 System.clearProperty("SERVICE_IP");
\r