summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-05-28 12:29:13 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-06-14 08:01:13 +0000
commitab6a90df6444ef7282fe9de8fe8107641bf7082f (patch)
tree19f8005ddac7ff4ee6ee8a893384a028f5ff4e44 /catalog-model/src/test
parent68a8c007e2bb9c1e79357432fbaa0336774327d7 (diff)
Support adding capability types to model
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3612 Change-Id: I5d3713ba420c2392dd232b5651aef4d51560ab4a
Diffstat (limited to 'catalog-model/src/test')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
index 5391410431..af4715fd62 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
@@ -49,6 +49,7 @@ import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
+import org.openecomp.sdc.be.model.Model;
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.PropertyConstraint;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -73,6 +74,9 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
@Resource(name = "capability-type-operation")
private CapabilityTypeOperation capabilityTypeOperation;
+
+ @Resource(name = "model-operation")
+ private ModelOperation modelOperation;
@BeforeClass
public static void setupBeforeClass() {
@@ -123,6 +127,40 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
assertEquals("check returned error", StorageOperationStatus.SCHEMA_VIOLATION, addCapabilityType2.right().value());
}
+
+ @Test
+ public void testAddCapabilityTypeWithModel() {
+
+ CapabilityTypeDefinition capabilityTypeDefinition = new CapabilityTypeDefinition();
+ capabilityTypeDefinition.setDescription("desc1");
+ capabilityTypeDefinition.setType("tosca.capabilities.Container1");
+ capabilityTypeDefinition.setModel("testModel");
+
+ Model model = new Model("testModel");
+ modelOperation.createModel(model , true);
+
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
+ assertTrue("check capability type added", addCapabilityType1.isLeft());
+
+ CapabilityTypeDefinition capabilityTypeAdded = addCapabilityType1.left().value();
+ compareBetweenCreatedToSent(capabilityTypeDefinition, capabilityTypeAdded);
+
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> capabilityTypeByUid = capabilityTypeOperation.getCapabilityTypeByUid(capabilityTypeAdded.getUniqueId());
+ compareBetweenCreatedToSent(capabilityTypeByUid.left().value(), capabilityTypeDefinition);
+
+ CapabilityTypeDefinition capabilityTypeWithDerivedFrom = new CapabilityTypeDefinition();
+ capabilityTypeWithDerivedFrom.setDescription("desc2");
+ capabilityTypeWithDerivedFrom.setType("tosca.capabilities.Container2");
+ capabilityTypeWithDerivedFrom.setDerivedFrom("tosca.capabilities.Container1");
+ capabilityTypeWithDerivedFrom.setModel("testModel");
+
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType2 = capabilityTypeOperation.addCapabilityType(capabilityTypeWithDerivedFrom, true);
+ assertTrue("check capability type added", addCapabilityType2.isLeft());
+
+ capabilityTypeAdded = addCapabilityType2.left().value();
+ compareBetweenCreatedToSent(capabilityTypeWithDerivedFrom, capabilityTypeAdded);
+
+ }
@Test
public void testAddDerviedCapabilityType() {
@@ -500,6 +538,7 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
assertTrue(compareValue(x.getDerivedFrom(), y.getDerivedFrom()));
assertTrue(compareValue(x.getType(), y.getType()));
assertTrue(compareValue(x.getDescription(), y.getDescription()));
+ assertTrue(compareValue(x.getModel(), y.getModel()));
}