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