2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 Nokia Intellectual Property. All rights
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============================================
20 * ===================================================================
24 package org.onap.clamp.clds.sdc.controller.installer;
26 import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
27 import static org.mockito.Mockito.mock;
28 import static org.mockito.Mockito.when;
30 import com.google.gson.JsonObject;
31 import java.io.IOException;
32 import org.junit.Test;
33 import org.onap.clamp.clds.util.JsonUtils;
34 import org.onap.clamp.clds.util.ResourceFileUtil;
36 public class CsarInstallerImplTest {
39 public void shouldReturnInputParametersFromBlueprint() throws IOException {
41 String expectedBlueprintInputsText = "{\"aaiEnrichmentHost\":\"aai.onap.svc.cluster.local\""
42 + ",\"aaiEnrichmentPort\":\"8443\""
43 + ",\"enableAAIEnrichment\":true"
44 + ",\"dmaap_host\":\"message-router\""
45 + ",\"dmaap_port\":\"3904\""
46 + ",\"enableRedisCaching\":false"
47 + ",\"redisHosts\":\"dcae-redis:6379\""
48 + ",\"tag_version\":\"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0\""
49 + ",\"consul_host\":\"consul-server\""
50 + ",\"consul_port\":\"8500\",\"cbs_host\":\"{\\\"test\\\":"
51 + "{\\\"test\\\":\\\"test\\\"}}\",\"cbs_port\":\"10000\""
52 + ",\"external_port\":\"32010\",\"policy_id\":\"AUTO_GENERATED_POLICY_ID_AT_SUBMIT\"}";
54 JsonObject expectedBlueprintInputs = JsonUtils.GSON.fromJson(expectedBlueprintInputsText, JsonObject.class);
55 String dceaBlueprint = ResourceFileUtil.getResourceAsString("tosca/dcea_blueprint.yml");
56 BlueprintArtifact blueprintArtifact = mock(BlueprintArtifact.class);
57 when(blueprintArtifact.getDcaeBlueprint()).thenReturn(dceaBlueprint);
58 CsarInstallerImpl csarInstaller = new CsarInstallerImpl();
61 String parametersInJson = csarInstaller.getAllBlueprintParametersInJson(blueprintArtifact);
64 assertThat(JsonUtils.GSON.fromJson(parametersInJson, JsonObject.class)).isEqualTo(expectedBlueprintInputs);