Standalone TCA with EELF Logger
[dcaegen2/analytics/tca-gen2.git] / dcae-analytics / dcae-analytics-model / src / test / java / org / onap / dcae / analytics / model / util / json / mixin / configbindingservice / ConsulConfigBindingServiceQueryResponseMixinTest.java
1 /*
2  * ================================================================================
3  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * ============LICENSE_END=========================================================
17  *
18  */
19
20 package org.onap.dcae.analytics.model.util.json.mixin.configbindingservice;
21
22 import static org.assertj.core.api.Assertions.assertThat;
23 import static org.onap.dcae.analytics.model.util.json.AnalyticsModelJsonConversion.ANALYTICS_MODEL_OBJECT_MAPPER;
24 import static org.onap.dcae.analytics.model.util.json.AnalyticsModelJsonConversion
25         .CONFIG_BINDING_SERVICE_LIST_JSON_FUNCTION;
26
27 import java.util.List;
28
29 import org.junit.jupiter.api.DisplayName;
30 import org.junit.jupiter.api.Test;
31 import org.onap.dcae.analytics.model.BaseAnalyticsModelTest;
32 import org.onap.dcae.analytics.model.configbindingservice.ConsulConfigBindingServiceQueryResponse;
33
34 /**
35  * Consul Config Binding Service Query Response Mixin Test.
36  *
37  * @author Rajiv Singla
38  */
39 class ConsulConfigBindingServiceQueryResponseMixinTest extends BaseAnalyticsModelTest {
40
41
42     @Test
43     @DisplayName("Test Config Service Bindings JSON conversions")
44     void testConfigServiceBindingsConversions() throws Exception {
45
46         List<ConsulConfigBindingServiceQueryResponse> configServiceBindings =
47                 assertJsonConversions(TestFileLocation.CONFIG_SERVICE_BINDINGS_JSON,
48                         CONFIG_BINDING_SERVICE_LIST_JSON_FUNCTION, ANALYTICS_MODEL_OBJECT_MAPPER);
49
50         assertThat(configServiceBindings).isNotNull();
51         assertThat(configServiceBindings.size()).as("There should be only 1 binding config").isEqualTo(1);
52
53         final ConsulConfigBindingServiceQueryResponse configBindingServiceQueryResponse = configServiceBindings.get(0);
54         assertThat(configBindingServiceQueryResponse.getAddress())
55                 .as("Config Service Binding ServiceAddress must be 135.25.108.161").isEqualTo("135.25.108.161");
56         assertThat(configBindingServiceQueryResponse.getServicePort())
57                 .as("Config Service Binding ServicePort must be 32769").isEqualTo(32769);
58         assertThat(configBindingServiceQueryResponse.getDynamicProperties())
59                 .as("Dynamic Properties must be empty if all bindings are successful").isEmpty();
60     }
61
62 }