aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java23
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java18
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java30
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java43
4 files changed, 50 insertions, 64 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
index 1b8fd42435..d5fe4f159e 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
@@ -21,8 +21,16 @@
*/
package org.openecomp.sdc.be.components;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
import com.google.common.collect.Sets;
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.ServletContext;
import org.junit.Before;
import org.mockito.Mockito;
import org.openecomp.sdc.ElementOperationMock;
@@ -36,7 +44,6 @@ import org.openecomp.sdc.be.components.impl.ServiceBusinessLogicTest;
import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic;
import org.openecomp.sdc.be.components.path.ForwardingPathValidator;
import org.openecomp.sdc.be.components.utils.ComponentBusinessLogicMock;
-import org.openecomp.sdc.be.components.validation.NodeFilterValidator;
import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
@@ -57,7 +64,6 @@ import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -73,15 +79,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.WebApplicationContext;
-import javax.servlet.ServletContext;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
-
public abstract class BaseServiceBusinessLogicTest extends ComponentBusinessLogicMock {
private static final Logger log = LoggerFactory.getLogger(ServiceBusinessLogicTest.class);
private static final String SERVICE_CATEGORY = "Mobility";
@@ -94,8 +91,6 @@ public abstract class BaseServiceBusinessLogicTest extends ComponentBusinessLogi
protected final ServiceDistributionValidation serviceDistributionValidation = Mockito.mock(ServiceDistributionValidation.class);
protected final ForwardingPathValidator forwardingPathValidator = Mockito.mock(ForwardingPathValidator.class);
protected final UiComponentDataConverter uiComponentDataConverter = Mockito.mock(UiComponentDataConverter.class);
- protected final NodeFilterOperation serviceFilterOperation = Mockito.mock(NodeFilterOperation.class);
- protected final NodeFilterValidator serviceFilterValidator = Mockito.mock(NodeFilterValidator.class);
private ServiceBusinessLogic bl;
private ResponseFormatManager responseManager = null;
private IElementOperation mockElementDao;
@@ -173,7 +168,7 @@ public abstract class BaseServiceBusinessLogicTest extends ComponentBusinessLogi
groupTypeOperation, groupBusinessLogic, interfaceOperation, interfaceLifecycleTypeOperation,
artifactsBusinessLogic, distributionEngine, componentInstanceBusinessLogic,
serviceDistributionValidation, forwardingPathValidator, uiComponentDataConverter,
- serviceFilterOperation, serviceFilterValidator, artifactToscaOperation, componentContactIdValidator, componentNameValidator,
+ artifactToscaOperation, componentContactIdValidator, componentNameValidator,
componentTagsValidator, componentValidator, componentIconValidator, componentProjectCodeValidator, componentDescriptionValidator);
bl.setUserAdmin(mockUserAdmin);
bl.setGraphLockOperation(graphLockOperation);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
index 5c135642a5..68fa486270 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
@@ -21,6 +21,12 @@
*/
package org.openecomp.sdc.be.components;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
import org.junit.Before;
import org.junit.Test;
@@ -37,7 +43,6 @@ import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
import org.openecomp.sdc.be.components.path.ForwardingPathValidator;
import org.openecomp.sdc.be.components.utils.ComponentBusinessLogicMock;
-import org.openecomp.sdc.be.components.validation.NodeFilterValidator;
import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter;
@@ -47,18 +52,11 @@ import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.DistributionStatusEnum;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.util.ThreadLocalsHolder;
import org.openecomp.sdc.exception.ResponseFormat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.when;
-
/**
* Created by chaya on 10/26/2017.
*/
@@ -71,8 +69,6 @@ public class ServiceDistributionBLTest extends ComponentBusinessLogicMock {
private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class);
private final ForwardingPathValidator forwardingPathValidator = Mockito.mock(ForwardingPathValidator.class);
private final UiComponentDataConverter uiComponentDataConverter = Mockito.mock(UiComponentDataConverter.class);
- private final NodeFilterOperation serviceFilterOperation = Mockito.mock(NodeFilterOperation.class);
- private final NodeFilterValidator serviceFilterValidator = Mockito.mock(NodeFilterValidator.class);
@InjectMocks
@@ -80,7 +76,7 @@ public class ServiceDistributionBLTest extends ComponentBusinessLogicMock {
groupTypeOperation, groupBusinessLogic, interfaceOperation, interfaceLifecycleTypeOperation,
artifactsBusinessLogic, distributionEngine, componentInstanceBusinessLogic,
serviceDistributionValidation, forwardingPathValidator, uiComponentDataConverter,
- serviceFilterOperation, serviceFilterValidator, artifactToscaOperation, componentContactIdValidator,
+ artifactToscaOperation, componentContactIdValidator,
componentNameValidator, componentTagsValidator, componentValidator, componentIconValidator,
componentProjectCodeValidator, componentDescriptionValidator);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java
index b812fd9187..a4a3b4d628 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java
@@ -20,7 +20,17 @@
package org.openecomp.sdc.be.components.impl;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import javax.servlet.ServletContext;
import org.junit.Before;
import org.mockito.Mockito;
import org.openecomp.sdc.ElementOperationMock;
@@ -29,7 +39,6 @@ import org.openecomp.sdc.be.components.distribution.engine.DistributionEngine;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic;
import org.openecomp.sdc.be.components.path.ForwardingPathValidator;
-import org.openecomp.sdc.be.components.validation.NodeFilterValidator;
import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.components.validation.component.ComponentContactIdValidator;
@@ -65,7 +74,6 @@ import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -80,17 +88,6 @@ import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.web.context.WebApplicationContext;
-import javax.servlet.ServletContext;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
-
public class ServiceBussinessLogicBaseTestSetup extends BaseBusinessLogicMock{
protected ServiceBusinessLogic bl;
@@ -119,8 +116,6 @@ public class ServiceBussinessLogicBaseTestSetup extends BaseBusinessLogicMock{
ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class);
ForwardingPathValidator forwardingPathValidator = Mockito.mock(ForwardingPathValidator.class);
UiComponentDataConverter uiComponentDataConverter = Mockito.mock(UiComponentDataConverter.class);
- protected final NodeFilterOperation serviceFilterOperation = Mockito.mock(NodeFilterOperation.class);
- protected final NodeFilterValidator serviceFilterValidator = Mockito.mock(NodeFilterValidator.class);
protected ServiceTypeValidator serviceTypeValidator = new ServiceTypeValidator(componentsUtils);
protected ServiceCategoryValidator serviceCategoryValidator = new ServiceCategoryValidator(componentsUtils, mockElementDao);
protected ServiceRoleValidator serviceRoleValidator = new ServiceRoleValidator(componentsUtils);
@@ -135,9 +130,6 @@ public class ServiceBussinessLogicBaseTestSetup extends BaseBusinessLogicMock{
protected final ComponentValidator componentValidator = Mockito.mock(ComponentValidator.class);
protected ServiceValidator serviceValidator = createServiceValidator();
-
-
-
protected User user = null;
protected Resource genericService = null;
@@ -218,7 +210,7 @@ public class ServiceBussinessLogicBaseTestSetup extends BaseBusinessLogicMock{
groupTypeOperation, groupBusinessLogic, interfaceOperation, interfaceLifecycleTypeOperation,
artifactBl, distributionEngine, componentInstanceBusinessLogic,
serviceDistributionValidation, forwardingPathValidator, uiComponentDataConverter,
- serviceFilterOperation, serviceFilterValidator, artifactToscaOperation, componentContactIdValidator,
+ artifactToscaOperation, componentContactIdValidator,
componentNameValidator, componentTagsValidator, componentValidator,
componentIconValidator, componentProjectCodeValidator, componentDescriptionValidator);
bl.setComponentContactIdValidator(componentContactIdValidator);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java
index f5b558e0d6..d801314c79 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java
@@ -20,9 +20,28 @@
package org.openecomp.sdc.be.servlets;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.nullable;
+import static org.mockito.Mockito.when;
+import static org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum.SERVICE_PARAM_NAME;
+
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import org.eclipse.jetty.http.HttpStatus;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.jersey.server.ResourceConfig;
@@ -33,6 +52,7 @@ import org.junit.Test;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ComponentNodeFilterBusinessLogic;
import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
import org.openecomp.sdc.be.components.impl.ResourceImportManager;
import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
@@ -55,26 +75,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.web.context.WebApplicationContext;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.nullable;
-import static org.mockito.Mockito.when;
-import static org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum.SERVICE_PARAM_NAME;
-
/**
* The test suite designed for test functionality of ComponentInstanceServlet class
*/
@@ -94,6 +94,7 @@ public class ComponentInstanceServletTest extends JerseyTest {
private static GroupBusinessLogic groupBusinessLogic;
private static ResourceImportManager resourceImportManager;
private static ServiceBusinessLogic serviceBusinessLogic;
+ private static ComponentNodeFilterBusinessLogic componentNodeFilterBusinessLogic;
@BeforeClass
public static void setup() {
@@ -261,6 +262,7 @@ public class ComponentInstanceServletTest extends JerseyTest {
bind(servletUtils).to(ServletUtils.class);
bind(resourceImportManager).to(ResourceImportManager.class);
bind(serviceBusinessLogic).to(ServiceBusinessLogic.class);
+ bind(componentNodeFilterBusinessLogic).to(ComponentNodeFilterBusinessLogic.class);
}
})
.property("contextConfig", context);
@@ -280,6 +282,7 @@ public class ComponentInstanceServletTest extends JerseyTest {
servletUtils = Mockito.mock(ServletUtils.class);
responseFormat = Mockito.mock(ResponseFormat.class);
serviceBusinessLogic = Mockito.mock(ServiceBusinessLogic.class);
+ componentNodeFilterBusinessLogic = Mockito.mock(ComponentNodeFilterBusinessLogic.class);
}
private static void stubMethods() {