summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model/src/test')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java33
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java48
2 files changed, 47 insertions, 34 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java
deleted file mode 100644
index 8ce7d8db57..0000000000
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.sdc.be.model;
-
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import org.junit.Test;
-
-public class UploadReqInfoTest {
-
- @Test
- public void shouldHaveValidGettersAndSetters() {
- assertThat(UploadReqInfo.class, hasValidGettersAndSetters());
- }
-}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java
index 5aa742a540..871a43016f 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverterTest.java
@@ -29,7 +29,6 @@
*/
package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
-
import java.util.HashMap;
import org.junit.jupiter.api.Test;
@@ -38,6 +37,7 @@ import org.mockito.InjectMocks;
import org.mockito.junit.jupiter.MockitoExtension;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
@@ -72,6 +72,9 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.tosca.ToscaType;
+import org.openecomp.sdc.be.ui.model.OperationUi;
+import org.openecomp.sdc.be.ui.model.PropertyAssignmentUi;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -277,6 +280,49 @@ public class ModelConverterTest {
}
@Test
+ void testConvertRelationTemplateToToscaRelation()
+ {
+ RequirementCapabilityRelDef reqCap = new RequirementCapabilityRelDef();
+ reqCap.setOriginUI(true);
+ reqCap.setFromNode("fromNode");
+ reqCap.setToNode("toNode");
+ List<CapabilityRequirementRelationship> list = new LinkedList<>();
+ CapabilityRequirementRelationship relationship = new CapabilityRequirementRelationship();
+ RelationshipInfo info = new RelationshipInfo();
+ info.setCapabilityOwnerId("capOwnerId");
+ info.setId("id");
+ info.setCapabilityUid("capUid");
+ info.setRequirementOwnerId("reqOwnerId");
+ info.setRequirementUid("reqUid");
+ info.setRequirement("req");
+ info.setCapability("cap");
+ RelationshipImpl relationshipImpl = new RelationshipImpl();
+ relationshipImpl.setType("type");
+ info.setRelationships(relationshipImpl);
+ relationship.setRelation(info);
+ OperationUi operationUi = new OperationUi();
+ operationUi.setInterfaceType("tosca.interfaces.relationship.Configure");
+ operationUi.setOperationType("add_source");
+ final ArtifactDataDefinition artifactDataDefinition = new ArtifactDataDefinition();
+ artifactDataDefinition.setArtifactName("impl");
+ operationUi.setImplementation(artifactDataDefinition);
+ PropertyAssignmentUi propertyAssignmentUi = new PropertyAssignmentUi();
+ propertyAssignmentUi.setName("strInput1");
+ propertyAssignmentUi.setType(ToscaType.STRING.getType());
+ propertyAssignmentUi.setValue("inputValue");
+ operationUi.setInputs(List.of(propertyAssignmentUi));
+ relationship.setOperations(List.of(operationUi));
+ list.add(relationship);
+ reqCap.setRelationships(list);
+
+ List<RelationshipInstDataDefinition> result = ModelConverter.convertRelationToToscaRelation(reqCap);
+ assertEquals(1, result.size());
+ assertEquals(false, result.get(0).getInterfaces().isEmpty());
+ assertEquals(false, result.get(0).getInterfaces().getListToscaDataDefinition().get(0).getOperations().isEmpty());
+ assertEquals(false, result.get(0).getInterfaces().getListToscaDataDefinition().get(0).getOperations().get("add_source").getInputs().isEmpty());
+ }
+
+ @Test
public void testConvertToMapOfMapCapabilityPropertiesonvertRelation()
{
Map<String, List<CapabilityDefinition>> capabilities = new HashMap<>();