aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java45
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java147
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java19
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java8
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java744
5 files changed, 381 insertions, 582 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
index a38095a3ce..e9756b6c4e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
@@ -57,9 +57,7 @@ public class Resource extends Component {
private List<PropertyDefinition> attributes;
- private Map<String, InterfaceInstanceDataDefinition> instInterfaces;
-
- private List<String> defaultCapabilities;
+ private String toscaVersion;
public Resource() {
super(new ResourceMetadataDefinition());
@@ -75,16 +73,6 @@ public class Resource extends Component {
this.getComponentMetadataDefinition().getMetadataDataDefinition().setComponentType(ComponentTypeEnum.RESOURCE);
}
- @Override
- public List<PropertyDefinition> getProperties() {
- return properties;
- }
-
- @Override
- public void setProperties(List<PropertyDefinition> properties) {
- this.properties = properties;
- }
-
public Boolean isAbstract() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition()
.getMetadataDataDefinition())
@@ -115,7 +103,6 @@ public class Resource extends Component {
.setLicenseType(licenseType);
}
-
public String getToscaResourceName() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
.getToscaResourceName();
@@ -136,36 +123,36 @@ public class Resource extends Component {
.setResourceType(resourceType);
}
- public void setVendorName(String vendorName) {
- ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setVendorName(vendorName);
- }
-
- public void setVendorRelease(String vendorRelease) {
- ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setVendorRelease(vendorRelease);
- }
-
- public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
- ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition()).
- setResourceVendorModelNumber(resourceVendorModelNumber);
- }
-
public String getVendorName() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
.getVendorName();
}
+ public void setVendorName(String vendorName) {
+ ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
+ .setVendorName(vendorName);
+ }
+
public String getVendorRelease() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
.getVendorRelease();
}
+ public void setVendorRelease(String vendorRelease) {
+ ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
+ .setVendorRelease(vendorRelease);
+ }
+
public String getResourceVendorModelNumber() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
.getResourceVendorModelNumber();
}
+ public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
+ ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition()).
+ setResourceVendorModelNumber(resourceVendorModelNumber);
+ }
+
@Override
public String fetchGenericTypeToscaNameFromConfig() {
String result = super.fetchGenericTypeToscaNameFromConfig();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
index 28efb308b6..d6d3347000 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
@@ -20,6 +20,12 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import lombok.Getter;
+import lombok.Setter;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
@@ -35,25 +41,21 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
import org.openecomp.sdc.common.log.api.ILogConfiguration;
import org.slf4j.MDC;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
+@Getter
+@Setter
public abstract class ToscaElement {
protected Map<String, Object> metadata;
protected List<CategoryDefinition> categories;
protected Map<String, ArtifactDataDefinition> toscaArtifacts;
+ protected ToscaElementTypeEnum toscaType;
private Map<String, ArtifactDataDefinition> artifacts;
private Map<String, ArtifactDataDefinition> deploymentArtifacts;
private Map<String, AdditionalInfoParameterDataDefinition> additionalInformation;
private Map<String, PropertyDataDefinition> properties;
private Map<String, ListCapabilityDataDefinition> capabilities;
- private Map<String, MapPropertiesDataDefinition> capabiltiesProperties;
+ private Map<String, MapPropertiesDataDefinition> capabilitiesProperties;
private Map<String, ListRequirementDataDefinition> requirements;
-
- protected ToscaElementTypeEnum toscaType;
// User
private String creatorUserId;
private String creatorFullName;
@@ -61,101 +63,12 @@ public abstract class ToscaElement {
private String lastUpdaterFullName;
private Map<String, String> allVersions;
+ private String toscaVersion;
public ToscaElement(ToscaElementTypeEnum toscaType){
this.toscaType = toscaType;
}
- public Map<String, Object> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, Object> metadata) {
- this.metadata = metadata;
- }
-
- public List<CategoryDefinition> getCategories() {
- return categories;
- }
-
- public void setCategories(List<CategoryDefinition> categories) {
- this.categories = categories;
- }
- public Map<String, ArtifactDataDefinition> getToscaArtifacts() {
- return toscaArtifacts;
- }
-
- public void setToscaArtifacts(Map<String, ArtifactDataDefinition> toscaArtifacts) {
- this.toscaArtifacts = toscaArtifacts;
- }
-
- public ToscaElementTypeEnum getToscaType() {
- return toscaType;
- }
-
- public void setToscaType(ToscaElementTypeEnum toscaType) {
- this.toscaType = toscaType;
- }
- public Map<String, ArtifactDataDefinition> getArtifacts() {
- return artifacts;
- }
-
- public void setArtifacts(Map<String, ArtifactDataDefinition> artifacts) {
- this.artifacts = artifacts;
- }
-
- public Map<String, ArtifactDataDefinition> getDeploymentArtifacts() {
- return deploymentArtifacts;
- }
-
- public void setDeploymentArtifacts(Map<String, ArtifactDataDefinition> deploymentArtifacts) {
- this.deploymentArtifacts = deploymentArtifacts;
- }
- public Map<String, AdditionalInfoParameterDataDefinition> getAdditionalInformation() {
- return additionalInformation;
- }
- public void setAdditionalInformation(Map<String, AdditionalInfoParameterDataDefinition> additionalInformation) {
- this.additionalInformation = additionalInformation;
- }
- public Map<String, PropertyDataDefinition> getProperties() {
- return properties;
- }
- public void setProperties(Map<String, PropertyDataDefinition> properties) {
- this.properties = properties;
- }
-
- public Map<String, String> getAllVersions() {
- return allVersions;
- }
-
- public void setAllVersions(Map<String, String> allVersions) {
- this.allVersions = allVersions;
- }
-
- public Map<String, ListCapabilityDataDefinition> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(Map<String, ListCapabilityDataDefinition> capabilities) {
- this.capabilities = capabilities;
- }
-
- public Map<String, ListRequirementDataDefinition> getRequirements() {
- return requirements;
- }
-
- public void setRequirements(Map<String, ListRequirementDataDefinition> requirements) {
- this.requirements = requirements;
- }
-
- public Map<String, MapPropertiesDataDefinition> getCapabilitiesProperties() {
- return capabiltiesProperties;
- }
-
- public void setCapabilitiesProperties(Map<String, MapPropertiesDataDefinition> capabiltiesProperties) {
- this.capabiltiesProperties = capabiltiesProperties;
- }
-
// metadata properties
// ----------------------------
public Object getMetadataValue(JsonPresentationFields name) {
@@ -294,42 +207,16 @@ public abstract class ToscaElement {
return (Long)archiveTime;
}
- public void setArchiveTime(Long archiveTime) { setMetadataValue(JsonPresentationFields.ARCHIVE_TIME, archiveTime); }
-
- public Boolean isVspArchived() { return (Boolean) getMetadataValue(JsonPresentationFields.IS_VSP_ARCHIVED); }
-
- public void setVspArchived(Boolean vspArchived) { setMetadataValue(JsonPresentationFields.IS_VSP_ARCHIVED, vspArchived); }
-
- public String getCreatorUserId() {
- return creatorUserId;
- }
-
- public void setCreatorUserId(String creatorUserId) {
- this.creatorUserId = creatorUserId;
- }
-
- public String getCreatorFullName() {
- return creatorFullName;
- }
-
- public void setCreatorFullName(String creatorFullName) {
- this.creatorFullName = creatorFullName;
- }
-
- public String getLastUpdaterUserId() {
- return lastUpdaterUserId;
- }
-
- public void setLastUpdaterUserId(String lastUpdaterUserId) {
- this.lastUpdaterUserId = lastUpdaterUserId;
+ public void setArchiveTime(Long archiveTime) {
+ setMetadataValue(JsonPresentationFields.ARCHIVE_TIME, archiveTime);
}
- public String getLastUpdaterFullName() {
- return lastUpdaterFullName;
+ public Boolean isVspArchived() {
+ return (Boolean) getMetadataValue(JsonPresentationFields.IS_VSP_ARCHIVED);
}
- public void setLastUpdaterFullName(String lastUpdaterFullName) {
- this.lastUpdaterFullName = lastUpdaterFullName;
+ public void setVspArchived(Boolean vspArchived) {
+ setMetadataValue(JsonPresentationFields.IS_VSP_ARCHIVED, vspArchived);
}
public void generateUUID() {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
index e973400963..ec1185a706 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
@@ -24,7 +24,6 @@ import java.lang.reflect.Type;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
-
import org.apache.commons.collections.CollectionUtils;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -60,6 +59,7 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
+import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum;
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;
@@ -170,7 +170,7 @@ public abstract class ToscaElementOperation extends BaseOperation {
}
if (result == null) {
createdToscaElementVertex = createNextVersionRes.left().value();
- Map<EdgePropertyEnum, Object> properties = new HashMap<>();
+ final Map<EdgePropertyEnum, Object> properties = new EnumMap<>(EdgePropertyEnum.class);
properties.put(EdgePropertyEnum.STATE, createdToscaElementVertex.getMetadataProperty(GraphPropertyEnum.STATE));
status = janusGraphDao
.createEdge(user.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.STATE, properties);
@@ -321,7 +321,10 @@ public abstract class ToscaElementOperation extends BaseOperation {
nodeTypeVertex.setUniqueId(toscaElement.getUniqueId());
nodeTypeVertex.setType(toscaElement.getComponentType());
-
+ final String toscaVersion = toscaElement.getToscaVersion();
+ if (toscaVersion != null) {
+ nodeTypeVertex.setJsonMetadataField(JsonPresentationFields.TOSCA_DEFINITIONS_VERSION, toscaVersion);
+ }
}
protected StorageOperationStatus assosiateToUsers(GraphVertex nodeTypeVertex, ToscaElement toscaElement) {
@@ -729,7 +732,7 @@ public abstract class ToscaElementOperation extends BaseOperation {
List<T> components = new ArrayList<>();
List<T> componentsPerUser;
- HashSet<String> ids = new HashSet<String>();
+ final Set<String> ids = new HashSet<>();
Either<List<GraphVertex>, JanusGraphOperationStatus> childrenVertecies = janusGraphDao.getChildrenVertices(userV, EdgeLabelEnum.STATE, JsonParseFlagEnum.NoParse);
if (childrenVertecies.isRight() && childrenVertecies.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Failed to fetch children vertices for user {} by edge {} error {}", userV.getMetadataProperty(GraphPropertyEnum.USERID), EdgeLabelEnum.STATE, childrenVertecies.right().value());
@@ -918,9 +921,15 @@ public abstract class ToscaElementOperation extends BaseOperation {
break;
}
- Map<String, Object> jsonMetada = componentV.getMetadataJson();
if (toscaElement != null) {
+ final Map<String, Object> jsonMetada = componentV.getMetadataJson();
toscaElement.setMetadata(jsonMetada);
+ if (jsonMetada != null) {
+ final Object toscaVersion = jsonMetada.get(ToscaTagNamesEnum.TOSCA_VERSION.getElementName());
+ if (toscaVersion != null) {
+ toscaElement.setToscaVersion((String) toscaVersion);
+ }
+ }
}
return (T) toscaElement;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
index c16c8a98e5..ae854254c2 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
@@ -246,6 +246,10 @@ public class ModelConverter {
resource.setDerivedList(nodeType.getDerivedList());
resource.setDerivedFromMapOfIdToName(nodeType.getDerivedFromMapOfIdToName());
resource.setAbstract((Boolean) nodeType.getMetadataValue(JsonPresentationFields.IS_ABSTRACT));
+ final String toscaVersion = nodeType.getToscaVersion();
+ if (toscaVersion != null) {
+ resource.setToscaVersion(toscaVersion);
+ }
convertAttributes(nodeType, resource);
convertCapabilities(nodeType, resource);
convertRequirements(nodeType, resource);
@@ -798,6 +802,10 @@ public class ModelConverter {
nodeType.setDerivedFrom(resource.getDerivedFrom());
nodeType.setDerivedList(resource.getDerivedList());
nodeType.setResourceType(resource.getResourceType());
+ final String toscaVersion = resource.getToscaVersion();
+ if (toscaVersion != null) {
+ nodeType.setToscaVersion(toscaVersion);
+ }
convertCommonToscaData(component, nodeType);
convertAdditionalInformation(component, nodeType);
convertArtifacts(resource, nodeType);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java
index c53e4e00bb..bb72c53033 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.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.
@@ -28,421 +28,329 @@ import org.junit.Test;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.unittests.utils.ModelConfDependentTest;
-public class ResourceTest extends ModelConfDependentTest{
-
- private Resource createTestSubject() {
- return new Resource();
- }
-
- @Test
- public void testCtor() throws Exception {
- ComponentMetadataDefinition componentMetadataDefinition = new ResourceMetadataDefinition();
- new Resource(componentMetadataDefinition);
- }
-
- @Test
- public void testGetDerivedFrom() throws Exception {
- Resource testSubject;
- List<String> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDerivedFrom();
- }
-
-
- @Test
- public void testSetDerivedFrom() throws Exception {
- Resource testSubject;
- List<String> derivedFrom = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDerivedFrom(derivedFrom);
- }
-
-
- @Test
- public void testGetDerivedList() throws Exception {
- Resource testSubject;
- List<String> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDerivedList();
- }
-
-
- @Test
- public void testSetDerivedList() throws Exception {
- Resource testSubject;
- List<String> derivedList = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDerivedList(derivedList);
- }
-
-
- @Test
- public void testGetProperties() throws Exception {
- Resource testSubject;
- List<PropertyDefinition> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getProperties();
- }
-
-
- @Test
- public void testSetProperties() throws Exception {
- Resource testSubject;
- List<PropertyDefinition> properties = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setProperties(properties);
- }
-
-
- @Test
- public void testGetAttributes() throws Exception {
- Resource testSubject;
- List<PropertyDefinition> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAttributes();
- }
-
-
- @Test
- public void testSetAttributes() throws Exception {
- Resource testSubject;
- List<PropertyDefinition> attributes = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAttributes(attributes);
- }
-
-
- @Test
- public void testGetInterfaces() throws Exception {
- Resource testSubject;
- Map<String, InterfaceDefinition> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getInterfaces();
- }
-
-
- @Test
- public void testSetInterfaces() throws Exception {
- Resource testSubject;
- Map<String, InterfaceDefinition> interfaces = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setInterfaces(interfaces);
- }
-
-
- @Test
- public void testIsAbstract() throws Exception {
- Resource testSubject;
- Boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isAbstract();
- }
-
-
- @Test
- public void testSetAbstract() throws Exception {
- Resource testSubject;
- Boolean isAbstract = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAbstract(isAbstract);
- }
-
-
- @Test
- public void testGetDefaultCapabilities() throws Exception {
- Resource testSubject;
- List<String> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDefaultCapabilities();
- }
-
-
- @Test
- public void testSetDefaultCapabilities() throws Exception {
- Resource testSubject;
- List<String> defaultCapabilities = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDefaultCapabilities(defaultCapabilities);
- }
-
-
- @Test
- public void testGetCost() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getCost();
- }
-
-
- @Test
- public void testSetCost() throws Exception {
- Resource testSubject;
- String cost = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setCost(cost);
- }
-
-
- @Test
- public void testGetLicenseType() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getLicenseType();
- }
-
-
- @Test
- public void testSetLicenseType() throws Exception {
- Resource testSubject;
- String licenseType = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setLicenseType(licenseType);
- }
-
-
- @Test
- public void testHashCode() throws Exception {
- Resource testSubject;
- int result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.hashCode();
- }
-
-
- @Test
- public void testEquals() throws Exception {
- Resource testSubject;
- Object obj = null;
- boolean result;
-
- // test 1
- testSubject = createTestSubject();
- result = testSubject.equals(obj);
- Assert.assertEquals(false, result);
- obj = new Object();
- result = testSubject.equals(obj);
- Assert.assertEquals(false, result);
- result = testSubject.equals(testSubject);
- Assert.assertEquals(true, result);
-
- Resource testSubject2 = createTestSubject();
- result = testSubject.equals(testSubject2);
- Assert.assertEquals(true, result);
- }
-
-
- @Test
- public void testToString() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
-
-
- @Test
- public void testGetToscaResourceName() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getToscaResourceName();
- }
-
-
- @Test
- public void testSetToscaResourceName() throws Exception {
- Resource testSubject;
- String toscaResourceName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setToscaResourceName(toscaResourceName);
- }
-
-
- @Test
- public void testGetResourceType() throws Exception {
- Resource testSubject;
- ResourceTypeEnum result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResourceType();
- }
-
-
- @Test
- public void testSetResourceType() throws Exception {
- Resource testSubject;
- ResourceTypeEnum resourceType = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResourceType(resourceType);
- }
-
-
- @Test
- public void testSetVendorName() throws Exception {
- Resource testSubject;
- String vendorName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setVendorName(vendorName);
- }
-
-
- @Test
- public void testSetVendorRelease() throws Exception {
- Resource testSubject;
- String vendorRelease = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setVendorRelease(vendorRelease);
- }
-
-
- @Test
- public void testSetResourceVendorModelNumber() throws Exception {
- Resource testSubject;
- String resourceVendorModelNumber = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResourceVendorModelNumber(resourceVendorModelNumber);
- }
-
-
- @Test
- public void testGetVendorName() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getVendorName();
- }
-
-
- @Test
- public void testGetVendorRelease() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getVendorRelease();
- }
-
-
- @Test
- public void testGetResourceVendorModelNumber() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResourceVendorModelNumber();
- }
-
- @Test
- public void testFetchGenericTypeToscaNameFromConfig() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.fetchGenericTypeToscaNameFromConfig();
- }
-
- @Test
- public void testAssetType() throws Exception {
- Resource testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.assetType();
- }
-
-
- @Test
- public void testShouldGenerateInputs() throws Exception {
- Resource testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.shouldGenerateInputs();
- }
-
-
- @Test
- public void testDeriveFromGeneric() throws Exception {
- Resource testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.deriveFromGeneric();
- }
-
- @Test
- public void testGroupRelationsByInstanceName() throws Exception {
- Resource testSubject;
- Map<String, List<RequirementCapabilityRelDef>> result;
-
- // default test
- testSubject = createTestSubject();
- Resource resource = new Resource();
- resource.setComponentInstancesRelations(new LinkedList<RequirementCapabilityRelDef>());
- result = testSubject.groupRelationsFromCsarByInstanceName(resource);
- }
+public class ResourceTest extends ModelConfDependentTest {
+
+ private Resource createTestSubject() {
+ return new Resource();
+ }
+
+ @Test
+ public void testCtor() throws Exception {
+ ComponentMetadataDefinition componentMetadataDefinition = new ResourceMetadataDefinition();
+ new Resource(componentMetadataDefinition);
+ }
+
+ @Test
+ public void testGetProperties() throws Exception {
+ Resource testSubject;
+ List<PropertyDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getProperties();
+ }
+
+ @Test
+ public void testSetProperties() throws Exception {
+ Resource testSubject;
+ List<PropertyDefinition> properties = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setProperties(properties);
+ }
+
+ @Test
+ public void testGetAttributes() throws Exception {
+ Resource testSubject;
+ List<PropertyDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getAttributes();
+ }
+
+ @Test
+ public void testSetAttributes() throws Exception {
+ Resource testSubject;
+ List<PropertyDefinition> attributes = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setAttributes(attributes);
+ }
+
+ @Test
+ public void testGetInterfaces() throws Exception {
+ Resource testSubject;
+ Map<String, InterfaceDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getInterfaces();
+ }
+
+ @Test
+ public void testSetInterfaces() throws Exception {
+ Resource testSubject;
+ Map<String, InterfaceDefinition> interfaces = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setInterfaces(interfaces);
+ }
+
+ @Test
+ public void testIsAbstract() throws Exception {
+ Resource testSubject;
+ Boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.isAbstract();
+ }
+
+ @Test
+ public void testSetAbstract() throws Exception {
+ Resource testSubject;
+ Boolean isAbstract = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setAbstract(isAbstract);
+ }
+
+ @Test
+ public void testGetCost() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getCost();
+ }
+
+ @Test
+ public void testSetCost() throws Exception {
+ Resource testSubject;
+ String cost = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setCost(cost);
+ }
+
+ @Test
+ public void testGetLicenseType() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getLicenseType();
+ }
+
+ @Test
+ public void testSetLicenseType() throws Exception {
+ Resource testSubject;
+ String licenseType = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setLicenseType(licenseType);
+ }
+
+ @Test
+ public void testHashCode() throws Exception {
+ Resource testSubject;
+ int result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.hashCode();
+ }
+
+ @Test
+ public void testEquals() throws Exception {
+ Resource testSubject;
+ Object obj = null;
+ boolean result;
+
+ // test 1
+ testSubject = createTestSubject();
+ result = testSubject.equals(obj);
+ Assert.assertEquals(false, result);
+ obj = new Object();
+ result = testSubject.equals(obj);
+ Assert.assertEquals(false, result);
+ result = testSubject.equals(testSubject);
+ Assert.assertEquals(true, result);
+
+ Resource testSubject2 = createTestSubject();
+ result = testSubject.equals(testSubject2);
+ Assert.assertEquals(true, result);
+ }
+
+ @Test
+ public void testToString() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.toString();
+ }
+
+ @Test
+ public void testGetToscaResourceName() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getToscaResourceName();
+ }
+
+ @Test
+ public void testSetToscaResourceName() throws Exception {
+ Resource testSubject;
+ String toscaResourceName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setToscaResourceName(toscaResourceName);
+ }
+
+ @Test
+ public void testGetResourceType() throws Exception {
+ Resource testSubject;
+ ResourceTypeEnum result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceType();
+ }
+
+ @Test
+ public void testSetResourceType() throws Exception {
+ Resource testSubject;
+ ResourceTypeEnum resourceType = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceType(resourceType);
+ }
+
+ @Test
+ public void testSetVendorName() throws Exception {
+ Resource testSubject;
+ String vendorName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setVendorName(vendorName);
+ }
+
+ @Test
+ public void testSetVendorRelease() throws Exception {
+ Resource testSubject;
+ String vendorRelease = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setVendorRelease(vendorRelease);
+ }
+
+ @Test
+ public void testSetResourceVendorModelNumber() throws Exception {
+ Resource testSubject;
+ String resourceVendorModelNumber = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceVendorModelNumber(resourceVendorModelNumber);
+ }
+
+ @Test
+ public void testGetVendorName() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getVendorName();
+ }
+
+ @Test
+ public void testGetVendorRelease() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getVendorRelease();
+ }
+
+ @Test
+ public void testGetResourceVendorModelNumber() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceVendorModelNumber();
+ }
+
+ @Test
+ public void testFetchGenericTypeToscaNameFromConfig() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.fetchGenericTypeToscaNameFromConfig();
+ }
+
+ @Test
+ public void testAssetType() throws Exception {
+ Resource testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.assetType();
+ }
+
+ @Test
+ public void testShouldGenerateInputs() throws Exception {
+ Resource testSubject;
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.shouldGenerateInputs();
+ }
+
+ @Test
+ public void testDeriveFromGeneric() throws Exception {
+ Resource testSubject;
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.deriveFromGeneric();
+ }
+
+ @Test
+ public void testGroupRelationsByInstanceName() throws Exception {
+ Resource testSubject;
+ Map<String, List<RequirementCapabilityRelDef>> result;
+
+ // default test
+ testSubject = createTestSubject();
+ Resource resource = new Resource();
+ resource.setComponentInstancesRelations(new LinkedList<RequirementCapabilityRelDef>());
+ result = testSubject.groupRelationsFromCsarByInstanceName(resource);
+ }
}