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.controlloop.participant.http.utils;
24 import java.util.List;
26 import java.util.UUID;
27 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
28 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
29 import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigurationEntity;
30 import org.onap.policy.clamp.controlloop.participant.http.main.models.RestParams;
31 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
33 public class CommonTestData {
35 private static final String TEST_KEY_NAME = "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement";
39 * Get a controlLoop Element.
40 * @return controlLoopElement object
42 public ControlLoopElement getControlLoopElement() {
43 ControlLoopElement element = new ControlLoopElement();
44 element.setId(UUID.randomUUID());
45 element.setDefinition(new ToscaConceptIdentifier(TEST_KEY_NAME, "1.0.1"));
46 element.setOrderedState(ControlLoopOrderedState.PASSIVE);
52 * @return Map of query params
54 public Map<String, String> getQueryParams() {
55 return Map.of("name", "dummy", "version", "1.0");
60 * @return Map of path params
62 public Map<String, Object> getPathParams() {
63 return Map.of("id", "123", "name", "dummy");
67 * Rest params with GET request.
68 * @return RestParams obj
70 public RestParams restParamsWithGet() {
71 return new RestParams(
72 new ToscaConceptIdentifier("getRequest", "1.0"),
83 * Rest params with POST request.
84 * @return RestParams obj
86 public RestParams restParamsWithPost() {
87 return new RestParams(
88 new ToscaConceptIdentifier("postRequest", "1.0"),
99 * Rest params with POST request.
100 * @return RestParams obj
102 public RestParams restParamsWithInvalidPost() {
103 return new RestParams(
104 new ToscaConceptIdentifier("postRequest", "1.0"),
115 * Get invalid configuration entity.
116 * @return ConfigurationEntity obj
118 public ConfigurationEntity getInvalidConfigurationEntity() {
119 return new ConfigurationEntity(
120 new ToscaConceptIdentifier("config1", "1.0.1"),
121 List.of(restParamsWithGet(), restParamsWithInvalidPost())
126 * Get configuration entity.
127 * @return ConfigurationEntity obj
129 public ConfigurationEntity getConfigurationEntity() {
130 return new ConfigurationEntity(
131 new ToscaConceptIdentifier("config1", "1.0.1"),
132 List.of(restParamsWithGet(), restParamsWithPost())
137 * Get controlloop id.
138 * @return ToscaConceptIdentifier controlLoopId
140 public ToscaConceptIdentifier getControlLoopId() {
141 return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
145 * Get headers for config request.
146 * @return Map of headers
148 public Map<String, String> getHeaders() {
149 return Map.of("Content-Type", "application/json", "Accept", "application/json");