catalog-be servlets refactoring
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / servlets / ServiceServletTest.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 javax.servlet.ServletContext;
26 import javax.servlet.http.HttpServletRequest;
27 import javax.ws.rs.core.Response;
28
29 import org.junit.Test;
30 import org.openecomp.sdc.be.components.impl.*;
31 import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction;
32 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
33 import org.openecomp.sdc.be.impl.ComponentsUtils;
34 import org.openecomp.sdc.be.impl.ServletUtils;
35 import org.openecomp.sdc.be.model.User;
36 import org.openecomp.sdc.be.user.UserBusinessLogic;
37 import org.openecomp.sdc.exception.ResponseFormat;
38
39 import com.google.common.base.Equivalence.Wrapper;
40 import com.google.common.util.concurrent.Service;
41
42 import fj.data.Either;
43
44 public class ServiceServletTest {
45
46         private ServiceServlet createTestSubject() {
47                 UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
48                 ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
49                 ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
50                 ServletUtils servletUtils = mock(ServletUtils.class);
51                 ResourceImportManager resourceImportManager = mock(ResourceImportManager.class);
52                 ServiceBusinessLogic serviceBusinessLogic = mock(ServiceBusinessLogic.class);
53                 ResourceBusinessLogic resourceBusinessLogic = mock(ResourceBusinessLogic.class);
54
55                 return new ServiceServlet(userBusinessLogic, componentInstanceBL, componentsUtils, servletUtils,
56                         resourceImportManager, serviceBusinessLogic, resourceBusinessLogic);
57         }
58
59         
60         @Test
61         public void testCreateService() throws Exception {
62                 ServiceServlet testSubject;
63                 String data = "";
64                 HttpServletRequest request = null;
65                 String userId = "";
66                 Response result;
67
68                 // default test
69                 testSubject = createTestSubject();
70                 
71         }
72
73         
74         @Test
75         public void testParseToService() throws Exception {
76                 ServiceServlet testSubject;
77                 String serviceJson = "";
78                 User user = null;
79                 Either<Service, ResponseFormat> result;
80
81                 // default test
82                 testSubject = createTestSubject();
83         }
84
85         
86         @Test
87         public void testValidateServiceName() throws Exception {
88                 ServiceServlet testSubject;
89                 String serviceName = "";
90                 HttpServletRequest request = null;
91                 String userId = "";
92                 Response result;
93
94                 // default test
95                 testSubject = createTestSubject();
96                 
97         }
98
99         
100         @Test
101         public void testGetComponentAuditRecords() throws Exception {
102                 ServiceServlet testSubject;
103                 String componentType = "";
104                 String componentUniqueId = "";
105                 HttpServletRequest request = null;
106                 String userId = "";
107                 Response result;
108
109                 // default test
110                 testSubject = createTestSubject();
111                 
112         }
113
114         
115         @Test
116         public void testFillUUIDAndVersion() throws Exception {
117         ServiceServlet testSubject;Wrapper<Response> responseWrapper = null;
118         Wrapper<String> uuidWrapper = null;
119         Wrapper<String> versionWrapper = null;
120         User user = null;
121         ComponentTypeEnum componentTypeEnum = null;
122         String componentUniqueId = "";
123         ServletContext context = null;
124         
125         
126         // default test
127         }
128
129         
130         @Test
131         public void testDeleteService() throws Exception {
132                 ServiceServlet testSubject;
133                 String serviceId = "";
134                 HttpServletRequest request = null;
135                 Response result;
136
137                 // default test
138                 testSubject = createTestSubject();
139                 
140         }
141
142         
143         @Test
144         public void testDeleteServiceByNameAndVersion() throws Exception {
145                 ServiceServlet testSubject;
146                 String serviceName = "";
147                 String version = "";
148                 HttpServletRequest request = null;
149                 Response result;
150
151                 // default test
152                 testSubject = createTestSubject();
153                 
154         }
155
156         
157         @Test
158         public void testUpdateServiceMetadata() throws Exception {
159                 ServiceServlet testSubject;
160                 String serviceId = "";
161                 String data = "";
162                 HttpServletRequest request = null;
163                 String userId = "";
164                 Response result;
165
166                 // default test
167                 testSubject = createTestSubject();
168                 
169         }
170
171         
172         @Test
173         public void testUpdateGroupInstancePropertyValues() throws Exception {
174                 ServiceServlet testSubject;
175                 String serviceId = "";
176                 String componentInstanceId = "";
177                 String groupInstanceId = "";
178                 String data = "";
179                 HttpServletRequest request = null;
180                 String userId = "";
181                 Response result;
182
183                 // default test
184                 testSubject = createTestSubject();
185                 
186         }
187
188         
189         @Test
190         public void testGetServiceById() throws Exception {
191                 ServiceServlet testSubject;
192                 String serviceId = "";
193                 HttpServletRequest request = null;
194                 String userId = "";
195                 Response result;
196
197                 // default test
198                 testSubject = createTestSubject();
199                 
200         }
201
202         
203         @Test
204         public void testGetServiceByNameAndVersion() throws Exception {
205                 ServiceServlet testSubject;
206                 String serviceName = "";
207                 String serviceVersion = "";
208                 HttpServletRequest request = null;
209                 String userId = "";
210                 Response result;
211
212                 // default test
213                 testSubject = createTestSubject();
214                 
215         }
216
217         
218         @Test
219         public void testUpdateServiceDistributionState() throws Exception {
220                 ServiceServlet testSubject;
221                 LifecycleChangeInfoWithAction jsonChangeInfo = null;
222                 String serviceId = "";
223                 String state = "";
224                 HttpServletRequest request = null;
225                 String userId = "";
226                 Response result;
227
228                 // default test
229                 testSubject = createTestSubject();
230                 
231         }
232
233         
234         @Test
235         public void testActivateDistribution() throws Exception {
236                 ServiceServlet testSubject;
237                 String serviceId = "";
238                 String env = "";
239                 HttpServletRequest request = null;
240                 String userId = "";
241                 Response result;
242
243                 // default test
244                 testSubject = createTestSubject();
245                 
246         }
247
248         
249         @Test
250         public void testMarkDistributionAsDeployed() throws Exception {
251                 ServiceServlet testSubject;
252                 String serviceId = "";
253                 String did = "";
254                 HttpServletRequest request = null;
255                 String userId = "";
256                 Response result;
257
258                 // default test
259                 testSubject = createTestSubject();
260                 
261         }
262
263         
264         @Test
265         public void testTempUrlToBeDeleted() throws Exception {
266                 ServiceServlet testSubject;
267                 String serviceId = "";
268                 HttpServletRequest request = null;
269                 String userId = "";
270                 Response result;
271
272                 // default test
273                 testSubject = createTestSubject();
274                 
275         }
276
277         
278         @Test
279         public void testDownloadServiceArtifact() throws Exception {
280                 ServiceServlet testSubject;
281                 String artifactName = "";
282                 HttpServletRequest request = null;
283                 Response result;
284
285                 // default test
286                 testSubject = createTestSubject();
287                 
288         }
289
290         
291         @Test
292         public void testExecuteCommand() throws Exception {
293                 ServiceServlet testSubject;
294                 String artifactName = "";
295                 Either<byte[], ResponseFormat> result;
296
297                 // default test
298                 testSubject = createTestSubject();
299         }
300 }