1 package org.openecomp.sdc.be.components.impl;
6 import org.apache.commons.math3.stat.descriptive.summary.Product;
8 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
9 import org.openecomp.sdc.be.model.Component;
10 import org.openecomp.sdc.be.model.ComponentInstance;
11 import org.openecomp.sdc.be.model.User;
12 import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
13 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
14 import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer;
15 import org.openecomp.sdc.exception.ResponseFormat;
17 import fj.data.Either;
20 public class ProductBusinessLogicTest {
22 private ProductBusinessLogic createTestSubject() {
23 return new ProductBusinessLogic();
27 public void testValidateProductNameExists() throws Exception {
28 ProductBusinessLogic testSubject;
29 String productName = "";
31 Either<Map<String, Boolean>, ResponseFormat> result;
34 testSubject = createTestSubject();
38 public void testSetDeploymentArtifactsPlaceHolder() throws Exception {
39 ProductBusinessLogic testSubject;
40 Component component = null;
44 testSubject = createTestSubject();
45 testSubject.setDeploymentArtifactsPlaceHolder(component, user);
49 public void testDeleteMarkedComponents() throws Exception {
50 ProductBusinessLogic testSubject;
51 Either<List<String>, ResponseFormat> result;
54 testSubject = createTestSubject();
59 public void testGetComponentInstanceBL() throws Exception {
60 ProductBusinessLogic testSubject;
61 ComponentInstanceBusinessLogic result;
64 testSubject = createTestSubject();
69 public void testGetComponentInstancesFilteredByPropertiesAndInputs() throws Exception {
70 ProductBusinessLogic testSubject;
71 String componentId = "";
72 ComponentTypeEnum componentTypeEnum = null;
74 String searchText = "";
75 Either<List<ComponentInstance>, ResponseFormat> result;
78 testSubject = createTestSubject();
83 public void testGetCacheManagerOperation() throws Exception {
84 ProductBusinessLogic testSubject;
85 ICacheMangerOperation result;
88 testSubject = createTestSubject();
93 public void testSetCacheManagerOperation() throws Exception {
94 ProductBusinessLogic testSubject;
95 ICacheMangerOperation cacheManagerOperation = null;
98 testSubject = createTestSubject();
99 testSubject.setCacheManagerOperation(cacheManagerOperation);
103 public void testGetUiComponentDataTransferByComponentId() throws Exception {
104 ProductBusinessLogic testSubject;
105 String componentId = "";
106 List<String> dataParamsToReturn = null;
107 Either<UiComponentDataTransfer, ResponseFormat> result;
110 testSubject = createTestSubject();
116 public void testCreateProduct() throws Exception {
117 ProductBusinessLogic testSubject;
118 Product product = null;
120 Either<Product, ResponseFormat> result;
123 testSubject = createTestSubject();
130 public void testCheckUnupdatableProductFields() throws Exception {
131 ProductBusinessLogic testSubject;
132 Product product = null;
135 testSubject = createTestSubject();
140 public void testValidateProductBeforeCreate() throws Exception {
141 ProductBusinessLogic testSubject;
142 Product product = null;
144 AuditingActionEnum actionEnum = null;
145 Either<Product, ResponseFormat> result;
148 testSubject = createTestSubject();
154 public void testValidateProductFieldsBeforeCreate() throws Exception {
155 ProductBusinessLogic testSubject;
157 Product product = null;
158 AuditingActionEnum actionEnum = null;
159 Either<Boolean, ResponseFormat> result;
162 testSubject = createTestSubject();
168 public void testValidateAndUpdateProductContactsList() throws Exception {
169 ProductBusinessLogic testSubject;
171 Product product = null;
172 AuditingActionEnum actionEnum = null;
173 Either<Boolean, ResponseFormat> result;
176 testSubject = createTestSubject();
182 public void testValidateGrouping() throws Exception {
183 ProductBusinessLogic testSubject;
185 Product product = null;
186 AuditingActionEnum actionEnum = null;
187 Either<Boolean, ResponseFormat> result;
190 testSubject = createTestSubject();
196 public void testGetProduct() throws Exception {
197 ProductBusinessLogic testSubject;
198 String productId = "";
200 Either<Product, ResponseFormat> result;
203 testSubject = createTestSubject();
209 public void testDeleteProduct() throws Exception {
210 ProductBusinessLogic testSubject;
211 String productId = "";
213 Either<Product, ResponseFormat> result;
216 testSubject = createTestSubject();
222 public void testValidateProductFullNameAndCleanup() throws Exception {
223 ProductBusinessLogic testSubject;
225 Product product = null;
226 AuditingActionEnum actionEnum = null;
227 Either<Boolean, ResponseFormat> result;
230 testSubject = createTestSubject();
236 public void testValidateProductNameAndCleanup() throws Exception {
237 ProductBusinessLogic testSubject;
239 Product product = null;
240 AuditingActionEnum actionEnum = null;
241 Either<Boolean, ResponseFormat> result;
244 testSubject = createTestSubject();
249 public void testValidateTagsListAndRemoveDuplicates() throws Exception {
250 ProductBusinessLogic testSubject;
252 Product product = null;
253 String oldProductName = "";
254 AuditingActionEnum actionEnum = null;
255 Either<Boolean, ResponseFormat> result;
258 testSubject = createTestSubject();
263 public void testUpdateProductMetadata() throws Exception {
264 ProductBusinessLogic testSubject;
265 String productId = "";
266 Product updatedProduct = null;
268 Either<Product, ResponseFormat> result;
271 testSubject = createTestSubject();
272 updatedProduct = null;
277 public void testValidateAndUpdateProductMetadata() throws Exception {
278 ProductBusinessLogic testSubject;
280 Product currentProduct = null;
281 Product updatedProduct = null;
282 Either<Product, ResponseFormat> result;
285 testSubject = createTestSubject();
291 public void testValidateAndUpdateProductName() throws Exception {
292 ProductBusinessLogic testSubject;
294 Product currentProduct = null;
295 Product updatedProduct = null;
296 Either<Boolean, ResponseFormat> result;
299 testSubject = createTestSubject();
305 public void testValidateAndUpdateFullName() throws Exception {
306 ProductBusinessLogic testSubject;
308 Product currentProduct = null;
309 Product updatedProduct = null;
310 Either<Boolean, ResponseFormat> result;
313 testSubject = createTestSubject();
319 public void testValidateAndUpdateCategory() throws Exception {
320 ProductBusinessLogic testSubject;
322 Product currentProduct = null;
323 Product updatedProduct = null;
324 Either<Boolean, ResponseFormat> result;
327 testSubject = createTestSubject();
333 public void testValidateAndUpdateContactList() throws Exception {
334 ProductBusinessLogic testSubject;
336 Product currentProduct = null;
337 Product updatedProduct = null;
338 Either<Boolean, ResponseFormat> result;
341 testSubject = createTestSubject();
347 public void testValidateAndUpdateTags() throws Exception {
348 ProductBusinessLogic testSubject;
350 Product currentProduct = null;
351 Product updatedProduct = null;
352 Either<Boolean, ResponseFormat> result;
355 testSubject = createTestSubject();
361 public void testValidateTagPattern() throws Exception {
362 ProductBusinessLogic testSubject;
367 testSubject = createTestSubject();
373 public void testGetProductByNameAndVersion() throws Exception {
374 ProductBusinessLogic testSubject;
375 String productName = "";
376 String productVersion = "";
378 Either<Product, ResponseFormat> result;
381 testSubject = createTestSubject();