aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test/java')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java27
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java7
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java4
3 files changed, 16 insertions, 22 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
index 7822bd8134..0d6922e3f2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
@@ -33,9 +33,7 @@ import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.contains;
import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.anyBoolean;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
@@ -53,7 +51,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -172,7 +169,7 @@ class ResourceImportManagerTest {
String jsonContent = ImportUtilsTest.loadFileNameToJsonString("normative-types-new-blockStorage.yml");
ImmutablePair<Resource, ActionStatus> createResource =
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
Resource resource = createResource.left;
testSetConstantMetaData(resource);
@@ -198,7 +195,7 @@ class ResourceImportManagerTest {
final String jsonContent = ImportUtilsTest.loadFileNameToJsonString("normative-types-new-blockStorage.yml");
ImmutablePair<Resource, ActionStatus> createResource =
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
assertNotNull(createResource);
Resource resource = createResource.left;
assertNotNull(resource);
@@ -300,7 +297,7 @@ class ResourceImportManagerTest {
String jsonContent = "this is an invalid yml!";
ComponentException errorInfoFromTest = null;
try {
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
} catch (ComponentException e) {
errorInfoFromTest = e;
}
@@ -323,7 +320,7 @@ class ResourceImportManagerTest {
String jsonContent = ImportUtilsTest.loadFileNameToJsonString("normative-types-new-webServer.yml");
ImmutablePair<Resource, ActionStatus> createResource =
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
Resource resource = createResource.left;
testSetCapabilities(resource);
@@ -343,7 +340,7 @@ class ResourceImportManagerTest {
String jsonContent = ImportUtilsTest.loadFileNameToJsonString("normative-types-new-port.yml");
ImmutablePair<Resource, ActionStatus> createResource =
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
testSetRequirements(createResource.left);
}
@@ -367,7 +364,7 @@ class ResourceImportManagerTest {
when(interfaceOperationBusinessLogic.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(interfaceTypes));
final ImmutablePair<Resource, ActionStatus> createResource =
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
assertSetInterfaceImplementation(createResource.left);
}
@@ -390,7 +387,7 @@ class ResourceImportManagerTest {
when(interfaceOperationBusinessLogic.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(interfaceTypes));
ImmutablePair<Resource, ActionStatus> createResource =
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
assertNotNull(createResource);
Resource resource = createResource.getLeft();
assertNotNull(resource);
@@ -427,7 +424,7 @@ class ResourceImportManagerTest {
when(interfaceOperationBusinessLogic.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(interfaceTypes));
ImmutablePair<Resource, ActionStatus> createResource =
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
assertNull(createResource.left.getInterfaces());
}
@@ -450,7 +447,7 @@ class ResourceImportManagerTest {
when(interfaceOperationBusinessLogic.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(interfaceTypes));
ImmutablePair<Resource, ActionStatus> createResource =
- importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
assertNull(createResource.left.getInterfaces());
}
@@ -471,7 +468,7 @@ class ResourceImportManagerTest {
String jsonContent = ImportUtilsTest.loadFileNameToJsonString("normative-types-new-blockStorage.yml");
var actualException = assertThrows(ByActionStatusComponentException.class,
- () -> importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false));
+ () -> importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false));
assertEquals(ActionStatus.COMPONENT_WITH_VENDOR_RELEASE_ALREADY_EXISTS, actualException.getActionStatus());
}
@@ -495,7 +492,7 @@ class ResourceImportManagerTest {
.createOrUpdateResourceByImport(any(Resource.class), any(User.class), eq(true), eq(true), eq(false), eq(null), eq(null), eq(false)))
.thenReturn(new ImmutablePair<>(new Resource(), ActionStatus.OK)).thenReturn(new ImmutablePair<>(new Resource(), ActionStatus.OK));
- importManager.importAllNormativeResource(allTypesToCreate, nodeTypesMetadataList, user, "", false, false);
+ importManager.importAllNormativeResource(allTypesToCreate, nodeTypesMetadataList, null, user, "", false, false);
verify(janusGraphDao).commit();
}
@@ -610,7 +607,7 @@ class ResourceImportManagerTest {
interfaces.put(interfaceDefinition.getType(), interfaceDefinition);
resource.setInterfaces(interfaces);
- return importManager.importNormativeResource(jsonContent, resourceMD, user, true, true, false);
+ return importManager.importNormativeResource(jsonContent, resourceMD, null, user, true, true, false);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
index e74160e69c..fc709ceaea 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
@@ -213,8 +213,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
when(serviceImportParseLogic.findNodeTypesArtifactsToHandle(any(Map.class), any(CsarInfo.class), any(Service.class)))
.thenReturn(Either.left(new HashMap<String, EnumMap<ArtifactsBusinessLogic.ArtifactOperationEnum, List<ArtifactDefinition>>>()));
doReturn(getParsedToscaYamlInfo()).when(csarBusinessLogic).getParsedToscaYamlInfo(anyString(), anyString(), any(), any(CsarInfo.class), any(), any(Service.class));
-// when(csarBusinessLogic.getParsedToscaYamlInfo(anyString(), anyString(), any(), any(CsarInfo.class), any(), any(Service.class)))
-// .thenReturn(getParsedToscaYamlInfo());
+ doReturn(getParsedToscaYamlInfo()).when(csarBusinessLogic).getParsedToscaYamlInfo(any(ServiceCsarInfo.class), any(Service.class));
when(serviceBusinessLogic.lockComponentByName(newService.getSystemName(), oldService, CREATE_RESOURCE)).thenReturn(Either.left(true));
when(toscaOperationFacade.getLatestResourceByToscaResourceName(anyString())).thenReturn(Either.left(createOldResource()));
when(serviceImportParseLogic.createServiceTransaction(oldService, csarInfo.getModifier(), false, AuditingActionEnum.CREATE_RESOURCE)).thenReturn(newService);
@@ -320,7 +319,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
assertNotNull(capabilityTypesMap.get("tosca.testcapabilitytypes.Name"));
ArgumentCaptor<Map<String, Object>> nodeTypes = ArgumentCaptor.forClass(Map.class);
- verify(resourceImportManager).importAllNormativeResource(nodeTypes.capture(), any(), any(), any(),
+ verify(resourceImportManager).importAllNormativeResource(nodeTypes.capture(), any(), any(), any(), any(),
anyBoolean(), anyBoolean());
Map<String, Object> nodeTypesMap = nodeTypes.getValue();
Map<String, Object> newUpdatedNodeType = (Map<String, Object>) nodeTypesMap.get(updatedNodeType);
@@ -676,8 +675,6 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
artifactDefinition.setArtifactName("artifactDefinition");
deploymentArtifacts.put("deploymentArtifacts", artifactDefinition);
preparedService.setDeploymentArtifacts(deploymentArtifacts);
- String nodeName = "org.openecomp.resource.derivedFrom.zxjTestImportServiceAb.test";
- Map<String, EnumMap<ArtifactsBusinessLogic.ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = new HashMap<>();
when(toscaOperationFacade.getToscaElement(anyString())).thenReturn(Either.left(createServiceObject(true)));
when(csarArtifactsAndGroupsBusinessLogic.updateResourceArtifactsFromCsar(any(CsarInfo.class), any(Service.class),
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java
index 7a7b07f260..19a877cb9c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java
@@ -206,7 +206,7 @@ class ResourceUploadServletTest extends JerseyTest {
when(servletUtils.getUserAdmin()).thenReturn(userBusinessLogic);
when(userBusinessLogic.getUser(anyString())).thenReturn(user);
when(resourceBusinessLogic.validatePropertiesDefaultValues(any())).thenReturn(true);
- when(resourceImportManager.importNormativeResource(anyString(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean()))
+ when(resourceImportManager.importNormativeResource(anyString(), any(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean()))
.thenReturn(new ImmutablePair<>(new Resource(), ActionStatus.CREATED));
when(modelBusinessLogic.findModel(modelName)).thenReturn(Optional.of(new Model(modelName)));
final var response = target().path(multipartPath).request(MediaType.APPLICATION_JSON)
@@ -223,7 +223,7 @@ class ResourceUploadServletTest extends JerseyTest {
when(servletUtils.getUserAdmin()).thenReturn(userBusinessLogic);
when(userBusinessLogic.getUser(anyString())).thenReturn(user);
when(resourceBusinessLogic.validatePropertiesDefaultValues(any())).thenReturn(true);
- when(resourceImportManager.importNormativeResource(anyString(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean()))
+ when(resourceImportManager.importNormativeResource(anyString(), any(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean()))
.thenReturn(new ImmutablePair<>(new Resource(), ActionStatus.CREATED));
final var response = target().path(multipartPath).request(MediaType.APPLICATION_JSON)
.header(Constants.USER_ID_HEADER, USER_ID)