Change to enable SDC list type input
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / servlets / InputsServletTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 Fujitsu Limited. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.servlets;
22
23 import fj.data.Either;
24 import org.glassfish.jersey.server.ResourceConfig;
25 import org.glassfish.grizzly.http.util.HttpStatus;
26 import org.junit.Before;
27 import org.junit.Test;
28 import org.mockito.ArgumentCaptor;
29 import org.openecomp.sdc.be.components.impl.DataTypeBusinessLogic;
30 import org.openecomp.sdc.be.components.impl.InputsBusinessLogic;
31 import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder;
32 import org.openecomp.sdc.be.dao.api.ActionStatus;
33 import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
34 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
35 import org.openecomp.sdc.be.impl.ComponentsUtils;
36 import org.openecomp.sdc.be.impl.ServletUtils;
37 import org.openecomp.sdc.be.impl.WebAppContextWrapper;
38 import org.openecomp.sdc.be.model.ComponentInstInputsMap;
39 import org.openecomp.sdc.be.model.ComponentInstListInput;
40 import org.openecomp.sdc.be.model.ComponentInstancePropInput;
41 import org.openecomp.sdc.be.model.DataTypeDefinition;
42 import org.openecomp.sdc.be.model.InputDefinition;
43 import org.openecomp.sdc.be.model.User;
44 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
45 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
46 import org.openecomp.sdc.common.api.Constants;
47 import org.openecomp.sdc.exception.ResponseFormat;
48 import org.springframework.web.context.WebApplicationContext;
49
50 import javax.servlet.ServletContext;
51 import javax.servlet.http.HttpSession;
52 import javax.ws.rs.client.Entity;
53 import javax.ws.rs.client.Invocation;
54 import javax.ws.rs.core.MediaType;
55 import javax.ws.rs.core.Response;
56 import java.util.ArrayList;
57 import java.util.Collections;
58 import java.util.HashMap;
59 import java.util.List;
60 import java.util.Map;
61
62 import static org.assertj.core.api.Assertions.assertThat;
63 import static org.mockito.ArgumentMatchers.any;
64 import static org.mockito.ArgumentMatchers.eq;
65 import static org.mockito.Mockito.*;
66
67 public class InputsServletTest extends JerseySpringBaseTest {
68
69     /* Constants */
70     private static final String RESOURCE_ID = "serviceId";
71     private static final String USER_ID = "userId";
72     private static final String COMPONENT_INSTANCE_ID = "instanceId";
73     private static final String COMPONENT_ID = "componentId";
74     private static final String INSTANCE_INPUT_ID = "inputId";
75     private static final String LISTINPUT_NAME = "listInput";
76     private static final String LISTINPUT_SCHEMA_TYPE = "org.onap.datatypes.listinput";
77     private static final String LISTINPUT_PROP1_NAME = "prop1";
78     private static final String LISTINPUT_PROP1_TYPE = "string";
79     private static final String LISTINPUT_PROP2_NAME = "prop2";
80     private static final String LISTINPUT_PROP2_TYPE = "integer";
81
82     /* Test subject */
83     private InputsServletForTest testSubject;
84
85     /* Mocks */
86     private InputsBusinessLogic inputsBusinessLogic;
87     private DataTypeBusinessLogic dataTypeBusinessLogic;
88     private HttpSession httpSession;
89     private ServletContext servletContext;
90     private WebApplicationContext webApplicationContext;
91     private ComponentsUtils componentsUtils;
92     private ServletUtils servletUtils;
93
94     /**
95      * This class extends the original InputsServlet
96      * and provides methods to inject mocks
97      */
98     class InputsServletForTest extends InputsServlet {
99         public void setComponentsUtils(ComponentsUtils componentsUtils) {
100             this.componentsUtils = componentsUtils;
101         }
102
103         public void setServletUtils(ServletUtils servletUtils) {
104             this.servletUtils = servletUtils;
105         }
106     }
107
108     @Override
109     @Before
110     public void setUp() throws Exception {
111         super.setUp();
112         inputsBusinessLogic = mock(InputsBusinessLogic.class);
113         dataTypeBusinessLogic = mock(DataTypeBusinessLogic.class);
114         servletContext = mock(ServletContext.class);
115         httpSession = mock(HttpSession.class);
116         webApplicationContext = mock(WebApplicationContext.class);
117         componentsUtils = mock(ComponentsUtils.class);
118         servletUtils = mock(ServletUtils.class);
119         when(request.getSession()).thenReturn(httpSession);
120         when(httpSession.getServletContext()).thenReturn(servletContext);
121         when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(new WebAppContextWrapper());
122         when(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)).thenReturn(webApplicationContext);
123         when(webApplicationContext.getBean(InputsBusinessLogic.class)).thenReturn(inputsBusinessLogic);
124         when(webApplicationContext.getBean(DataTypeBusinessLogic.class)).thenReturn(dataTypeBusinessLogic);
125         testSubject.setComponentsUtils(componentsUtils);
126         testSubject.setServletUtils(servletUtils);
127         when(servletUtils.getComponentsUtils()).thenReturn(componentsUtils);
128     }
129
130
131     @Override
132     protected ResourceConfig configure() {
133         testSubject = new InputsServletForTest();
134         return super.configure().register(testSubject);
135     }
136
137
138     private InputDefinition setUpListInput() {
139         InputDefinition listInput = new InputDefinition();
140         listInput.setName(LISTINPUT_NAME);
141         listInput.setType("list");
142         SchemaDefinition listInputSchema = new SchemaDefinition();
143         listInputSchema.setProperty(new PropertyDataDefinitionBuilder()
144                 .setType(LISTINPUT_SCHEMA_TYPE)
145                 .setIsRequired(false)
146                 .build()
147         );
148         listInput.setSchema(listInputSchema);
149         return listInput;
150     }
151
152     private ComponentInstListInput setUpCreateListInputParams() {
153         ComponentInstListInput componentInstListInput = new ComponentInstListInput();
154
155         // Create a "list input"
156         InputDefinition listInput = setUpListInput();
157         componentInstListInput.setListInput(listInput);
158
159         // Create ComponentInstancePropInputs
160         // for inputs in the ComponentInstance
161         Map<String, List<ComponentInstancePropInput>> propInputsListMap = new HashMap<>();
162         // Add 2 PropInputs. property owner is COMPONENT_INSTANCE_ID
163         List<ComponentInstancePropInput> propInputsList = new ArrayList<>();
164         ComponentInstancePropInput propInput = new ComponentInstancePropInput();
165         propInput.setName(LISTINPUT_PROP1_NAME);
166         propInput.setType(LISTINPUT_PROP1_TYPE);
167         propInput.setUniqueId(COMPONENT_INSTANCE_ID + "." + LISTINPUT_PROP1_NAME);
168         propInputsList.add(propInput);
169         propInput = new ComponentInstancePropInput();
170         propInput.setName(LISTINPUT_PROP2_NAME);
171         propInput.setType(LISTINPUT_PROP2_TYPE);
172         propInput.setUniqueId(COMPONENT_INSTANCE_ID + "." + LISTINPUT_PROP2_NAME);
173         propInputsList.add(propInput);
174         propInputsListMap.put(COMPONENT_INSTANCE_ID, propInputsList);
175         ComponentInstInputsMap componentInstInputsMap = new ComponentInstInputsMap();
176         componentInstInputsMap.setComponentInstanceInputsMap(propInputsListMap);
177         componentInstListInput.setComponentInstInputsMap(componentInstInputsMap);
178
179         return componentInstListInput;
180     }
181
182     @Test
183     public void test_createListInput_success() throws Exception {
184         ComponentInstListInput requestBodyObj = setUpCreateListInputParams();
185         Entity<ComponentInstListInput> entity = Entity.entity(requestBodyObj, MediaType.APPLICATION_JSON);
186
187         // for parseToComponentInstListInput
188         when(componentsUtils.convertJsonToObjectUsingObjectMapper(any(), any(), eq(ComponentInstListInput.class),
189                 eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.SERVICE)))
190                 .thenReturn(Either.left(requestBodyObj));
191
192         when(inputsBusinessLogic.createListInput(eq(USER_ID), eq(RESOURCE_ID), eq(ComponentTypeEnum.SERVICE),
193                 any(), eq(true), eq(false)))
194                 .thenReturn(Either.left(Collections.emptyList()));
195         when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
196
197         Response response = buildCreateListInputCall().post(entity);
198         assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200.getStatusCode());
199         verify(inputsBusinessLogic, times(1)).createListInput(USER_ID, RESOURCE_ID,
200                 ComponentTypeEnum.SERVICE, requestBodyObj, true, false);
201     }
202
203     @Test
204     public void test_createListInput_fail_parse() throws Exception {
205         ComponentInstListInput requestBodyObj = setUpCreateListInputParams();
206         Entity<ComponentInstListInput> entity = Entity.entity(requestBodyObj, MediaType.APPLICATION_JSON);
207
208         // for parseToComponentInstListInput
209         ArgumentCaptor<User> userCaptor = ArgumentCaptor.forClass(User.class);
210         when(componentsUtils.convertJsonToObjectUsingObjectMapper(any(), userCaptor.capture(), eq(ComponentInstListInput.class),
211                 eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.SERVICE)))
212                 .thenReturn(Either.right(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode())));
213
214         when(inputsBusinessLogic.createListInput(eq(USER_ID), eq(RESOURCE_ID), eq(ComponentTypeEnum.SERVICE),
215                 any(), eq(true), eq(false)))
216                 .thenReturn(Either.left(Collections.emptyList()));
217
218         Response response = buildCreateListInputCall().post(entity);
219         assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400.getStatusCode());
220         verify(componentsUtils, times(1))
221                 .convertJsonToObjectUsingObjectMapper(any(), any(), eq(ComponentInstListInput.class),
222                 eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.SERVICE));
223         assertThat(userCaptor.getValue().getUserId()).isEqualTo(USER_ID);
224         verify(inputsBusinessLogic, never()).createListInput(USER_ID, RESOURCE_ID,
225                 ComponentTypeEnum.SERVICE, requestBodyObj, true, false);
226     }
227
228
229     @Test
230     public void test_createListInput_fail_createInput() throws Exception {
231         ComponentInstListInput requestBodyObj = setUpCreateListInputParams();
232         Entity<ComponentInstListInput> entity = Entity.entity(requestBodyObj, MediaType.APPLICATION_JSON);
233
234         // for parseToComponentInstListInput
235         ArgumentCaptor<User> userCaptor = ArgumentCaptor.forClass(User.class);
236         when(componentsUtils.convertJsonToObjectUsingObjectMapper(any(), userCaptor.capture(), eq(ComponentInstListInput.class),
237                 eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.SERVICE)))
238                 .thenReturn(Either.left(requestBodyObj));
239
240         when(inputsBusinessLogic.createListInput(eq(USER_ID), eq(RESOURCE_ID), eq(ComponentTypeEnum.SERVICE),
241                 any(), eq(true), eq(false)))
242                 .thenReturn(Either.right(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode())));
243
244         Response response = buildCreateListInputCall().post(entity);
245         assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400.getStatusCode());
246         verify(inputsBusinessLogic, times(1))
247                 .createListInput(eq(USER_ID), eq(RESOURCE_ID), eq(ComponentTypeEnum.SERVICE),
248                         any(), eq(true), eq(false));
249     }
250
251
252     @Test
253     public void test_createListInput_fail_exception() throws Exception {
254         ComponentInstListInput requestBodyObj = setUpCreateListInputParams();
255         Entity<ComponentInstListInput> entity = Entity.entity(requestBodyObj, MediaType.APPLICATION_JSON);
256
257         when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode()));
258
259         Response response = buildCreateListInputCall().post(entity);
260         assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400.getStatusCode());
261     }
262
263     @Test
264     public void test_getDataType_success() throws Exception {
265         when(dataTypeBusinessLogic.getPrivateDataType(eq(RESOURCE_ID),eq(LISTINPUT_SCHEMA_TYPE))).thenReturn(Either.left(new DataTypeDefinition()));
266
267         ResponseFormat responseFormat = new ResponseFormat();
268         responseFormat.setStatus(HttpStatus.OK_200.getStatusCode());
269         when(componentsUtils.getResponseFormat(eq(ActionStatus.OK))).thenReturn(responseFormat);
270
271         Response response = buildGetDataTypeCall().get();
272         assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200.getStatusCode());
273     }
274
275     @Test
276     public void test_getDataType_fail() throws Exception {
277         when(dataTypeBusinessLogic.getPrivateDataType(eq(RESOURCE_ID),eq(LISTINPUT_SCHEMA_TYPE))).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
278
279         ResponseFormat responseFormat = new ResponseFormat();
280         responseFormat.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500.getStatusCode());
281         when(componentsUtils.convertFromStorageResponse(eq(StorageOperationStatus.BAD_REQUEST))).thenReturn(ActionStatus.GENERAL_ERROR);
282         when(componentsUtils.getResponseFormat(eq(ActionStatus.GENERAL_ERROR))).thenReturn(responseFormat);
283
284         Response response = buildGetDataTypeCall().get();
285         assertThat(response.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR_500.getStatusCode());
286     }
287
288     @Test
289     public void test_getDataType_fail_exception() throws Exception {
290         when(dataTypeBusinessLogic.getPrivateDataType(eq(RESOURCE_ID),eq(LISTINPUT_SCHEMA_TYPE))).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
291         when(componentsUtils.getResponseFormat(eq(ActionStatus.GENERAL_ERROR))).thenReturn(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode()));
292
293         Response response = buildGetDataTypeCall().get();
294         assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400.getStatusCode());
295     }
296
297     @Test
298     public void test_getDataTypes_success() throws Exception {
299         when(dataTypeBusinessLogic.getPrivateDataTypes(eq(RESOURCE_ID))).thenReturn(Either.left(Collections.emptyList()));
300
301         ResponseFormat responseFormat = new ResponseFormat();
302         responseFormat.setStatus(HttpStatus.OK_200.getStatusCode());
303         when(componentsUtils.getResponseFormat(eq(ActionStatus.OK))).thenReturn(responseFormat);
304
305         Response response = buildGetDataTypesCall().get();
306         assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200.getStatusCode());
307     }
308
309     @Test
310     public void test_getDataTypes_fail() throws Exception {
311         when(dataTypeBusinessLogic.getPrivateDataTypes(eq(RESOURCE_ID))).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
312
313         ResponseFormat responseFormat = new ResponseFormat();
314         responseFormat.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500.getStatusCode());
315         when(componentsUtils.convertFromStorageResponse(eq(StorageOperationStatus.BAD_REQUEST))).thenReturn(ActionStatus.GENERAL_ERROR);
316         when(componentsUtils.getResponseFormat(eq(ActionStatus.GENERAL_ERROR))).thenReturn(responseFormat);
317
318         Response response = buildGetDataTypesCall().get();
319         assertThat(response.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR_500.getStatusCode());
320     }
321
322     @Test
323     public void test_getDataTypes_fail_exception() throws Exception {
324         when(dataTypeBusinessLogic.getPrivateDataType(eq(RESOURCE_ID),eq(LISTINPUT_SCHEMA_TYPE))).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
325         when(componentsUtils.getResponseFormat(eq(ActionStatus.GENERAL_ERROR))).thenReturn(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode()));
326
327         Response response = buildGetDataTypesCall().get();
328         assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400.getStatusCode());
329     }
330
331
332     @Test
333     public void test_deleteDataType_success() throws Exception {
334         when(dataTypeBusinessLogic.deletePrivateDataType(RESOURCE_ID, LISTINPUT_SCHEMA_TYPE)).thenReturn(Either.left(new DataTypeDefinition()));
335
336         when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
337
338         Response response = buildGetDataTypeCall().delete();
339         assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200.getStatusCode());
340     }
341
342     @Test
343     public void test_deleteDataType_failure_exception() throws Exception {
344         when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
345         when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(new ResponseFormat(HttpStatus.INTERNAL_SERVER_ERROR_500.getStatusCode()));
346         Response response = buildGetDataTypeCall().delete();
347         assertThat(response.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR_500.getStatusCode());
348         verify(componentsUtils, never()).getResponseFormat(ActionStatus.OK);
349     }
350
351     @Test
352     public void test_deleteDataType_failure_notFound() throws Exception {
353         when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
354         when(dataTypeBusinessLogic.deletePrivateDataType(RESOURCE_ID, LISTINPUT_SCHEMA_TYPE)).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
355         when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.NOT_FOUND)).thenReturn(ActionStatus.ARTIFACT_NOT_FOUND);
356         when(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND)).thenReturn(new ResponseFormat(HttpStatus.NOT_FOUND_404.getStatusCode()));
357         Response response = buildGetDataTypeCall().delete();
358         assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND_404.getStatusCode());
359         verify(componentsUtils, never()).getResponseFormat(ActionStatus.OK);
360     }
361
362     @Test
363     public void test_deleteInput_success() throws Exception {
364         when(inputsBusinessLogic.deleteInput(RESOURCE_ID, USER_ID, LISTINPUT_NAME))
365                 .thenReturn(Either.left(new InputDefinition()));
366         when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
367
368         // invoke delete call
369         Response response = target("/v1/catalog/services/{id}/delete/{inputId}/input")
370                 .resolveTemplate("id", RESOURCE_ID)
371                 .resolveTemplate("inputId", LISTINPUT_NAME)
372                 .request(MediaType.APPLICATION_JSON)
373                 .header(Constants.USER_ID_HEADER, USER_ID)
374                 .delete();
375         assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200.getStatusCode());
376         verify(inputsBusinessLogic, times(1)).deleteInput(RESOURCE_ID, USER_ID, LISTINPUT_NAME);
377     }
378
379
380     @Test
381     public void test_deleteInput_failure_deleteInput() throws Exception {
382         when(inputsBusinessLogic.deleteInput(RESOURCE_ID, USER_ID, LISTINPUT_NAME))
383                 .thenReturn(Either.right(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode())));
384         when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
385
386         // invoke delete call
387         Response response = target("/v1/catalog/services/{id}/delete/{inputId}/input")
388                 .resolveTemplate("id", RESOURCE_ID)
389                 .resolveTemplate("inputId", LISTINPUT_NAME)
390                 .request(MediaType.APPLICATION_JSON)
391                 .header(Constants.USER_ID_HEADER, USER_ID)
392                 .delete();
393         assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400.getStatusCode());
394         verify(componentsUtils, never()).getResponseFormat(ActionStatus.OK);
395     }
396
397
398     @Test
399     public void test_deleteInput_failure_exception() throws Exception {
400         when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
401         when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode()));
402
403         // invoke delete call
404         Response response = target("/v1/catalog/services/{id}/delete/{inputId}/input")
405                 .resolveTemplate("id", RESOURCE_ID)
406                 .resolveTemplate("inputId", LISTINPUT_NAME)
407                 .request(MediaType.APPLICATION_JSON)
408                 .header(Constants.USER_ID_HEADER, USER_ID)
409                 .delete();
410         assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST_400.getStatusCode());
411         verify(componentsUtils, never()).getResponseFormat(ActionStatus.OK);
412     }
413
414
415     private Invocation.Builder buildCreateListInputCall() {
416         return target("/v1/catalog/services/{id}/create/listInput")
417                 .resolveTemplate("id", RESOURCE_ID)
418                 .request(MediaType.APPLICATION_JSON)
419                 .header(Constants.USER_ID_HEADER, USER_ID);
420     }
421
422     private Invocation.Builder buildGetDataTypeCall() {
423         return target("/v1/catalog/services/{id}/dataType/{dataTypeName}")
424                 .resolveTemplate("id", RESOURCE_ID)
425                 .resolveTemplate("dataTypeName", LISTINPUT_SCHEMA_TYPE)
426                 .request(MediaType.APPLICATION_JSON)
427                 .header(Constants.USER_ID_HEADER, USER_ID);
428     }
429
430     private Invocation.Builder buildGetDataTypesCall() {
431         return target("/v1/catalog/services/{id}/dataTypes")
432                 .resolveTemplate("id", RESOURCE_ID)
433                 .request(MediaType.APPLICATION_JSON)
434                 .header(Constants.USER_ID_HEADER, USER_ID);
435     }
436
437 }