catalog-be servlets refactoring
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / servlets / ResourcesServletTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. 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 static org.mockito.Mockito.mock;
24
25 import java.util.List;
26 import java.util.Map;
27
28 import javax.servlet.http.HttpServletRequest;
29 import javax.ws.rs.core.Response;
30
31 import org.junit.Test;
32 import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
33 import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
34 import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
35 import org.openecomp.sdc.be.components.impl.ResourceImportManager;
36 import org.openecomp.sdc.be.impl.ComponentsUtils;
37 import org.openecomp.sdc.be.impl.ServletUtils;
38 import org.openecomp.sdc.be.model.PropertyDefinition;
39 import org.openecomp.sdc.be.model.Resource;
40 import org.openecomp.sdc.be.model.User;
41 import org.openecomp.sdc.be.user.UserBusinessLogic;
42 import org.openecomp.sdc.exception.ResponseFormat;
43
44 import com.google.common.base.Equivalence.Wrapper;
45
46 import fj.data.Either;
47
48 public class ResourcesServletTest {
49
50         private ResourcesServlet createTestSubject() {
51                 UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
52                 ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
53                 ResourceBusinessLogic resourceBusinessLogic = mock(ResourceBusinessLogic.class);
54                 ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
55                 ServletUtils servletUtils = mock(ServletUtils.class);
56                 ResourceImportManager resourceImportManager = mock(ResourceImportManager.class);
57
58                 return new ResourcesServlet(userBusinessLogic, componentInstanceBL, resourceBusinessLogic, componentsUtils, servletUtils,
59                         resourceImportManager);
60         }
61
62         
63         @Test
64         public void testCreateResource() throws Exception {
65                 ResourcesServlet testSubject;
66                 String data = "";
67                 HttpServletRequest request = null;
68                 String userId = "";
69                 Response result;
70
71                 // default test
72                 testSubject = createTestSubject();
73                 
74         }
75
76         
77         @Test
78         public void testIsUIImport() throws Exception {
79                 ResourcesServlet testSubject;
80                 String data = "";
81                 boolean result;
82
83                 // default test
84                 testSubject = createTestSubject();
85         }
86
87         
88         @Test
89         public void testPerformUIImport() throws Exception {
90         ResourcesServlet testSubject;Wrapper<Response> responseWrapper = null;
91         String data = "";
92         HttpServletRequest request = null;
93         String userId = "";
94         String resourceUniqueId = "";
95         
96         
97         // default test
98         }
99
100         
101         @Test
102         public void testParseToResource() throws Exception {
103                 ResourcesServlet testSubject;
104                 String resourceJson = "";
105                 User user = null;
106                 Either<Resource, ResponseFormat> result;
107
108                 // default test
109                 testSubject = createTestSubject();
110                 
111         }
112
113         
114         @Test
115         public void testParseToLightResource() throws Exception {
116                 ResourcesServlet testSubject;
117                 String resourceJson = "";
118                 User user = null;
119                 Either<Resource, ResponseFormat> result;
120
121                 // default test
122                 testSubject = createTestSubject();
123                 
124         }
125
126         
127         @Test
128         public void testDeleteResource() throws Exception {
129                 ResourcesServlet testSubject;
130                 String resourceId = "";
131                 HttpServletRequest request = null;
132                 Response result;
133
134                 // default test
135                 testSubject = createTestSubject();
136                 
137         }
138
139         
140         @Test
141         public void testDeleteResourceByNameAndVersion() throws Exception {
142                 ResourcesServlet testSubject;
143                 String resourceName = "";
144                 String version = "";
145                 HttpServletRequest request = null;
146                 Response result;
147
148                 // default test
149                 testSubject = createTestSubject();
150                 
151         }
152
153         
154         @Test
155         public void testGetResourceById() throws Exception {
156                 ResourcesServlet testSubject;
157                 String resourceId = "";
158                 HttpServletRequest request = null;
159                 String userId = "";
160                 Response result;
161
162                 // default test
163                 testSubject = createTestSubject();
164                 
165         }
166
167         
168         @Test
169         public void testGetResourceByNameAndVersion() throws Exception {
170                 ResourcesServlet testSubject;
171                 String resourceName = "";
172                 String resourceVersion = "";
173                 HttpServletRequest request = null;
174                 String userId = "";
175                 Response result;
176
177                 // default test
178                 testSubject = createTestSubject();
179                 
180         }
181
182         
183         @Test
184         public void testValidateResourceName() throws Exception {
185                 ResourcesServlet testSubject;
186                 String resourceName = "";
187                 String resourceType = "";
188                 HttpServletRequest request = null;
189                 String userId = "";
190                 Response result;
191
192                 // default test
193                 testSubject = createTestSubject();
194                 
195         }
196
197         
198         @Test
199         public void testGetCertifiedAbstractResources() throws Exception {
200                 ResourcesServlet testSubject;
201                 HttpServletRequest request = null;
202                 String userId = "";
203                 Response result;
204
205                 // default test
206                 testSubject = createTestSubject();
207                 
208         }
209
210         
211         @Test
212         public void testGetCertifiedNotAbstractResources() throws Exception {
213                 ResourcesServlet testSubject;
214                 HttpServletRequest request = null;
215                 String userId = "";
216                 Response result;
217
218                 // default test
219                 testSubject = createTestSubject();
220                 
221         }
222
223         
224         @Test
225         public void testUpdateResourceMetadata() throws Exception {
226                 ResourcesServlet testSubject;
227                 String resourceId = "";
228                 String data = "";
229                 HttpServletRequest request = null;
230                 String userId = "";
231                 Response result;
232
233                 // default test
234                 testSubject = createTestSubject();
235                 
236         }
237
238         
239         @Test
240         public void testUpdateResource() throws Exception {
241                 ResourcesServlet testSubject;
242                 String data = "";
243                 HttpServletRequest request = null;
244                 String userId = "";
245                 String resourceId = "";
246                 Response result;
247
248                 // default test
249                 testSubject = createTestSubject();
250                 
251         }
252
253         
254         @Test
255         public void testConvertMapToList() throws Exception {
256                 Map<String, PropertyDefinition> properties = null;
257                 List<PropertyDefinition> result;
258
259                 // test 1
260                 properties = null;
261                 
262         }
263
264         
265         @Test
266         public void testGetResourceFromCsar() throws Exception {
267                 ResourcesServlet testSubject;
268                 HttpServletRequest request = null;
269                 String userId = "";
270                 String csarUUID = "";
271                 Response result;
272
273                 // default test
274                 testSubject = createTestSubject();
275                 
276         }
277 }