2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 Nordix Foundation.
4 * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.clamp.acm.participant.http.utils;
24 import java.util.List;
26 import java.util.UUID;
27 import org.onap.policy.clamp.acm.participant.http.main.models.ConfigurationEntity;
28 import org.onap.policy.clamp.acm.participant.http.main.models.RestParams;
29 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
30 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
31 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
33 public class CommonTestData {
35 private static final String TEST_KEY_NAME =
36 "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement";
39 * Get a automationComposition Element.
41 * @return automationCompositionElement object
43 public AutomationCompositionElement getAutomationCompositionElement() {
44 AutomationCompositionElement element = new AutomationCompositionElement();
45 element.setId(UUID.randomUUID());
46 element.setDefinition(new ToscaConceptIdentifier(TEST_KEY_NAME, "1.0.1"));
47 element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
54 * @return Map of query params
56 public Map<String, String> getQueryParams() {
57 return Map.of("name", "dummy", "version", "1.0");
63 * @return Map of path params
65 public Map<String, Object> getPathParams() {
66 return Map.of("id", "123", "name", "dummy");
70 * Rest params with GET request.
72 * @return RestParams obj
74 public RestParams restParamsWithGet() {
75 return new RestParams(new ToscaConceptIdentifier("getRequest", "1.0"), "GET", "get", 200, null,
76 getQueryParams(), null);
80 * Rest params with POST request.
82 * @return RestParams obj
84 public RestParams restParamsWithPost() {
85 return new RestParams(new ToscaConceptIdentifier("postRequest", "1.0"), "POST", "post", 200, null,
86 getQueryParams(), "Test body");
90 * Rest params with POST request.
92 * @return RestParams obj
94 public RestParams restParamsWithInvalidPost() {
95 return new RestParams(new ToscaConceptIdentifier("postRequest", "1.0"), "POST", "post/{id}/{name}", 200,
96 getPathParams(), getQueryParams(), "Test body");
100 * Get invalid configuration entity.
102 * @return ConfigurationEntity obj
104 public ConfigurationEntity getInvalidConfigurationEntity() {
105 return new ConfigurationEntity(new ToscaConceptIdentifier("config1", "1.0.1"),
106 List.of(restParamsWithGet(), restParamsWithInvalidPost()));
110 * Get configuration entity.
112 * @return ConfigurationEntity obj
114 public ConfigurationEntity getConfigurationEntity() {
115 return new ConfigurationEntity(new ToscaConceptIdentifier("config1", "1.0.1"),
116 List.of(restParamsWithGet(), restParamsWithPost()));
120 * Get automation composition id.
122 * @return ToscaConceptIdentifier automationCompositionId
124 public ToscaConceptIdentifier getAutomationCompositionId() {
125 return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
129 * Get headers for config request.
131 * @return Map of headers
133 public Map<String, String> getHeaders() {
134 return Map.of("Content-Type", "application/json", "Accept", "application/json");