2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021-2022 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";
37 public static final UUID AC_ID = UUID.randomUUID();
40 * Get a automationComposition Element.
42 * @return automationCompositionElement object
44 public AutomationCompositionElement getAutomationCompositionElement() {
45 AutomationCompositionElement element = new AutomationCompositionElement();
46 element.setId(UUID.randomUUID());
47 element.setDefinition(new ToscaConceptIdentifier(TEST_KEY_NAME, "1.0.1"));
48 element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
55 * @return Map of query params
57 public Map<String, String> getQueryParams() {
58 return Map.of("name", "dummy", "version", "1.0");
64 * @return Map of path params
66 public Map<String, Object> getPathParams() {
67 return Map.of("id", "123", "name", "dummy");
71 * Rest params with GET request.
73 * @return RestParams obj
75 public RestParams restParamsWithGet() {
76 return new RestParams(new ToscaConceptIdentifier("getRequest", "1.0"), "GET", "get", 200, null,
77 getQueryParams(), null);
81 * Rest params with POST request.
83 * @return RestParams obj
85 public RestParams restParamsWithPost() {
86 return new RestParams(new ToscaConceptIdentifier("postRequest", "1.0"), "POST", "post", 200, null,
87 getQueryParams(), "Test body");
91 * Rest params with POST request.
93 * @return RestParams obj
95 public RestParams restParamsWithInvalidPost() {
96 return new RestParams(new ToscaConceptIdentifier("postRequest", "1.0"), "POST", "post/{id}/{name}", 200,
97 getPathParams(), getQueryParams(), "Test body");
101 * Get invalid configuration entity.
103 * @return ConfigurationEntity obj
105 public ConfigurationEntity getInvalidConfigurationEntity() {
106 return new ConfigurationEntity(new ToscaConceptIdentifier("config1", "1.0.1"),
107 List.of(restParamsWithGet(), restParamsWithInvalidPost()));
111 * Get configuration entity.
113 * @return ConfigurationEntity obj
115 public ConfigurationEntity getConfigurationEntity() {
116 return new ConfigurationEntity(new ToscaConceptIdentifier("config1", "1.0.1"),
117 List.of(restParamsWithGet(), restParamsWithPost()));
121 * Get automation composition id.
123 * @return UUID automationCompositionId
125 public UUID getAutomationCompositionId() {
130 * Get headers for config request.
132 * @return Map of headers
134 public Map<String, String> getHeaders() {
135 return Map.of("Content-Type", "application/json", "Accept", "application/json");