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
9 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.dcae.analytics.model.util.json.mixin.configbindingservice;
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;
27 import java.util.List;
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;
35 * Consul Config Binding Service Query Response Mixin Test.
37 * @author Rajiv Singla
39 class ConsulConfigBindingServiceQueryResponseMixinTest extends BaseAnalyticsModelTest {
43 @DisplayName("Test Config Service Bindings JSON conversions")
44 void testConfigServiceBindingsConversions() throws Exception {
46 List<ConsulConfigBindingServiceQueryResponse> configServiceBindings =
47 assertJsonConversions(TestFileLocation.CONFIG_SERVICE_BINDINGS_JSON,
48 CONFIG_BINDING_SERVICE_LIST_JSON_FUNCTION, ANALYTICS_MODEL_OBJECT_MAPPER);
50 assertThat(configServiceBindings).isNotNull();
51 assertThat(configServiceBindings.size()).as("There should be only 1 binding config").isEqualTo(1);
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();