summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java24
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java84
2 files changed, 73 insertions, 35 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java
index ade46d8102..9efdc95bce 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java
@@ -28,6 +28,7 @@ import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -35,7 +36,9 @@ import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
public class ModelTestBase {
@@ -44,16 +47,23 @@ public class ModelTestBase {
protected static final String CONTAINER_NAME = "containerName";
public static void init() {
- String appConfigDir = "src/test/resources/config";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
- appConfigDir);
- configurationManager = new ConfigurationManager(configurationSource);
+ String appConfigDir = "src/test/resources/config";
+ ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
+ appConfigDir);
+ configurationManager = new ConfigurationManager(configurationSource);
- Configuration configuration = new Configuration();
+ Configuration configuration = new Configuration();
- configuration.setTitanInMemoryGraph(true);
+ configuration.setTitanInMemoryGraph(true);
- configurationManager.setConfiguration(configuration);
+ Map<String, Object> deploymentRIArtifacts = new HashMap<>();
+ ArtifactDataDefinition artifactInfo = new ArtifactDataDefinition();
+ Object artifactDataObj = new HashMap<String, Object>();
+ ((HashMap) artifactDataObj).put("1", artifactInfo);
+ deploymentRIArtifacts.put("VfHeatEnv", artifactDataObj);
+
+ configurationManager.setConfiguration(configuration);
+ configurationManager.getConfiguration().setDeploymentResourceInstanceArtifacts(deploymentRIArtifacts);
}
protected void removeGraphVertices(Either<TitanGraph, TitanOperationStatus> graphResult) {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java
index fcde5b2605..1822ad3500 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java
@@ -1,11 +1,42 @@
+/*
+
+ * Copyright (c) 2018 AT&T Intellectual Property.
+
+ *
+
+ * 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.
+
+ */
package org.openecomp.sdc.be.model.jsontitan.operations;
import com.google.common.collect.Lists;
import fj.data.Either;
+import org.mockito.Mock;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
@@ -15,6 +46,7 @@ import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import java.util.HashMap;
import java.util.List;
@@ -192,42 +224,38 @@ public class NodeTemplateOperationTest extends ModelTestBase {
return operation;
}
-
@Test
- public void testGetDefaultHeatTimeout() throws Exception {
+ public void testGetDefaultHeatTimeout() {
Integer result;
// default test
result = NodeTemplateOperation.getDefaultHeatTimeout();
}
-
-
-
-
-
-
-
-
-
-
-
@Test
- public void testPrepareInstDeploymentArtifactPerInstance() throws Exception {
- NodeTemplateOperation testSubject;
- Map<String, ArtifactDataDefinition> deploymentArtifacts = null;
- String componentInstanceId = "";
- User user = null;
- String envType = "";
- MapArtifactDataDefinition result;
-
- // test 1
- testSubject = createTestSubject();
- deploymentArtifacts = null;
- result = testSubject.prepareInstDeploymentArtifactPerInstance(deploymentArtifacts, componentInstanceId, user,
- envType);
- Assert.assertEquals(null, result);
- }
+ public void testPrepareInstDeploymentArtifactPerInstance() {
+ NodeTemplateOperation testSubject;
+ Map<String, Object> deploymentResourceArtifacts = new HashMap<>();
+ Map<String, ArtifactDataDefinition> deploymentArtifacts = new HashMap<>();
+ ArtifactDataDefinition artifactDataDefinition = new ArtifactDataDefinition();
+ artifactDataDefinition.setArtifactType("HEAT");
+ artifactDataDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT);
+ deploymentArtifacts.put("1", artifactDataDefinition);
+ deploymentResourceArtifacts.put("1", artifactDataDefinition);
+ String componentInstanceId = "componentInstanceId";
+ User user = new User();
+ user.setUserId("userId");
+ user.setFirstName("first");
+ user.setLastName("last");
+ String envType = "VfHeatEnv";
+ MapArtifactDataDefinition result;
+
+ testSubject = createTestSubject();
+
+ result = testSubject.prepareInstDeploymentArtifactPerInstance(deploymentArtifacts, componentInstanceId, user,
+ envType);
+ Assert.assertEquals(2, result.getMapToscaDataDefinition().size());
+ }