summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java12
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java25
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java20
4 files changed, 29 insertions, 34 deletions
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java
index b547aef2f9..77d0f59846 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,17 +21,17 @@
package org.openecomp.sdc.asdctool.migration.core.execution;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import org.openecomp.sdc.asdctool.migration.DummyMigrationFactory;
import org.openecomp.sdc.asdctool.migration.core.task.Migration;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
-public class MigrationExecutorImplTest {
+class MigrationExecutorImplTest {
@Test
- public void testExecuteMigration() {
+ void testExecuteMigration() {
MigrationExecutionResult execute = new MigrationExecutorImpl().execute(DummyMigrationFactory.SUCCESSFUL_MIGRATION);
assertMigrationTaskEntryByMigrationExecutionResult(execute, DummyMigrationFactory.SUCCESSFUL_MIGRATION);
}
@@ -43,7 +43,7 @@ public class MigrationExecutorImplTest {
assertEquals(executionResult.getTaskName(), migration.getClass().getName());
assertEquals(executionResult.getVersion(), migration.getVersion());
assertEquals(executionResult.getDescription(), migration.description());
- assertNotNull(executionResult.getExecutionTime());
+ assertTrue(executionResult.getExecutionTime() >= 0);
}
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
index 22f5de64d5..52d8ce976d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
@@ -144,6 +144,8 @@ class ExternalRefServletTest extends JerseyTest {
System.currentTimeMillis());
@Mock
+ private IdMapper idMapper;
+ @Mock
public WebAppContextWrapper webAppContextWrapper;
@Mock
private ServletContext servletContext;
@@ -182,7 +184,6 @@ class ExternalRefServletTest extends JerseyTest {
@BeforeAll
public void setup() {
- MockitoAnnotations.initMocks(this);
//Needed for User Authorization
//========================================================================================================================
@@ -238,6 +239,7 @@ class ExternalRefServletTest extends JerseyTest {
@BeforeEach
public void before() throws Exception {
super.setUp();
+ MockitoAnnotations.openMocks(this);
when(resourceComponentMock.getVersion()).thenReturn(VERSION);
when(resourceComponentMock.getUniqueId()).thenReturn(resourceVertexUuid);
@@ -663,8 +665,6 @@ class ExternalRefServletTest extends JerseyTest {
private GraphVertex resourceVertex;
private ExternalReferencesOperation externalReferenceOperation;
private HealingJanusGraphDao janusGraphDao;
- @Mock
- private IdMapper idMapper;
@Bean
ExternalRefsServlet externalRefsServlet() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
index 2b00668a74..4b55a730fb 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
@@ -360,7 +360,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
componentInstanceList.add(ci);
component.setComponentInstances(componentInstanceList);
- when(toscaOperationFacade.getToscaFullElement(eq("name"))).thenReturn(Either.left(component));
+ when(toscaOperationFacade.getToscaFullElement("name")).thenReturn(Either.left(component));
Either<ImmutablePair<ToscaTemplate, Map<String, Component>>, ToscaError> result;
result = Deencapsulation.invoke(testSubject, "fillImports", component, toscaTemplate);
@@ -368,11 +368,11 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
verify(toscaOperationFacade, times(1)).getToscaFullElement("name");
Assert.assertTrue(result.isLeft());
ToscaTemplate toscaTemplateRes = result.left().value().left;
- Assert.assertTrue(toscaTemplateRes.getImports().size() == 8);
+ Assert.assertEquals(8 , toscaTemplateRes.getImports().size());
Assert.assertNotNull(toscaTemplateRes.getImports().get(6).get("resource-TestResourceName-interface"));
Assert.assertNotNull(toscaTemplateRes.getImports().get(7).get("resource-TestResourceName"));
- Assert.assertTrue(toscaTemplateRes.getDependencies().size() == 1);
- Assert.assertNotNull(toscaTemplateRes.getDependencies().get(0).getLeft().equals("name.name2"));
+ Assert.assertEquals(1 , toscaTemplateRes.getDependencies().size());
+ Assert.assertEquals("name.name2",toscaTemplateRes.getDependencies().get(0).getLeft());
}
@Test
@@ -530,10 +530,9 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
ci.setOriginType(OriginTypeEnum.ServiceProxy);
ci.setSourceModelUid("modelName");
- when(toscaOperationFacade.getToscaFullElement(eq("name"))).thenReturn(Either.left(component));
+ when(toscaOperationFacade.getToscaFullElement("name")).thenReturn(Either.left(component));
- when(toscaOperationFacade.getToscaFullElement(eq("modelName")))
- .thenReturn(Either.left(new Service()));
+ when(toscaOperationFacade.getToscaFullElement("modelName")).thenReturn(Either.left(new Service()));
// default test
Deencapsulation.invoke(testSubject, "createDependency", componentCache, imports, dependecies, ci);
@@ -1486,7 +1485,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
// test return false
result = Deencapsulation.invoke(testSubject, "isRequirementBelongToRelation", originComponent,
reqAndRelationshipPair, requirement, fromInstanceId);
- Assert.assertNotNull(result);
+ Assert.assertFalse(result);
}
@Test
@@ -1501,7 +1500,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
// default test return true
result = Deencapsulation.invoke(testSubject, "isRequirementBelongToRelation", originComponent,
reqAndRelationshipPair, requirement, fromInstanceId);
- Assert.assertNotNull(result);
+ Assert.assertTrue(result);
}
@Test
@@ -1519,7 +1518,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
// default test
result = Deencapsulation.invoke(testSubject, "isRequirementBelongToOwner", reqAndRelationshipPair, requirement,
fromInstanceId, originComponent);
- Assert.assertNotNull(result);
+ Assert.assertFalse(result);
}
@Test
@@ -1531,7 +1530,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
component = new Service();
result = Deencapsulation.invoke(testSubject, "isCvfc", component);
- Assert.assertNotNull(result);
+ Assert.assertFalse(result);
}
@Test
@@ -1577,8 +1576,8 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
result = Deencapsulation.invoke(testSubject, "convertToNodeTemplateArtifacts", container);
Assert.assertNotNull(result);
Assert.assertTrue(MapUtils.isNotEmpty(result));
- Assert.assertTrue(result.get("test_art").getFile().equals("test_file"));
- Assert.assertTrue(result.get("test_art").getType().equals("test_type"));
+ Assert.assertEquals("test_file",result.get("test_art").getFile());
+ Assert.assertEquals("test_type",result.get("test_art").getType());
}
@Test
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
index 083483be1b..c5b82dc295 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
@@ -23,9 +23,10 @@ package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import static java.util.Objects.requireNonNull;
import static org.apache.commons.collections.CollectionUtils.isEmpty;
import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
-import static org.janusgraph.core.attribute.Contain.NOT_IN;
import static org.janusgraph.core.attribute.Text.REGEX;
-import static org.openecomp.sdc.be.dao.janusgraph.JanusGraphUtils.buildNotInPredicate;
+
+import com.vdurmont.semver4j.Semver;
+import com.vdurmont.semver4j.Semver.SemverType;
import fj.data.Either;
import java.util.ArrayList;
import java.util.Arrays;
@@ -58,7 +59,6 @@ import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
@@ -79,7 +79,6 @@ import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
-import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.PromoteVersionEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -121,14 +120,11 @@ import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.model.utils.GroupUtils;
import org.openecomp.sdc.be.resources.data.ComponentMetadataData;
-import org.openecomp.sdc.be.resources.data.GroupTypeData;
import org.openecomp.sdc.common.jsongraph.util.CommonUtility;
import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.ValidationUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import com.vdurmont.semver4j.Semver;
-import com.vdurmont.semver4j.Semver.SemverType;
@org.springframework.stereotype.Component("tosca-operation-facade")
@@ -482,18 +478,18 @@ public class ToscaOperationFacade {
}
private Map<String, Entry<JanusGraphPredicate, Object>> getVendorVersionPredicate(final String vendorRelease) {
- Map<String, Entry<JanusGraphPredicate, Object>> predicateCriteria = new HashMap<>();
- if (vendorRelease != null && vendorRelease != "1.0") {
+ Map<String, Entry<JanusGraphPredicate, Object>> predicateCriteria = new HashMap<>();
+ if (!"1.0".equals(vendorRelease)) {
String[] vendorReleaseElements = vendorRelease.split("\\.");
if (vendorReleaseElements.length > 0) {
String regex = ".*\"vendorRelease\":\"";
- for (int i = 0; i <vendorReleaseElements.length; i++) {
+ for (int i = 0; i < vendorReleaseElements.length; i++) {
regex += vendorReleaseElements[i];
- regex += i < vendorReleaseElements.length -1 ? "\\." : "\".*";
+ regex += i < vendorReleaseElements.length - 1 ? "\\." : "\".*";
}
predicateCriteria.put("metadata", new HashMap.SimpleEntry<>(REGEX, regex));
}
- }
+ }
return predicateCriteria;
}