diff options
author | Yuli Shlosberg <ys9693@att.com> | 2018-05-01 15:35:23 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-05-01 13:10:23 +0000 |
commit | d1bfb427915c303e40a43195e9219b9c3a566ecc (patch) | |
tree | f1a01b2634120fbf50503ac30d2a3f873ca819ed | |
parent | d74d87cd27afca784a8ed582b6b7015a8a8d243a (diff) |
new unit tests for sdc-dao
Change-Id: Ic25eacbfdbaa8ebcffa8d3f0625ee860c98a2894
Issue-ID: SDC-1170
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
10 files changed, 889 insertions, 0 deletions
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/es/ElasticSearchClientTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/es/ElasticSearchClientTest.java new file mode 100644 index 0000000000..b5c971496b --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/es/ElasticSearchClientTest.java @@ -0,0 +1,112 @@ +package org.openecomp.sdc.be.dao.es; + +import javax.annotation.Generated; + +import org.elasticsearch.client.Client; +import org.junit.Test; + +@Generated(value = "org.junit-tools-1.0.6") +public class ElasticSearchClientTest { + + private ElasticSearchClient createTestSubject() { + return new ElasticSearchClient(); + } + + @Test + public void testClose() throws Exception { + ElasticSearchClient testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.close(); + } + + + @Test + public void testGetClient() throws Exception { + ElasticSearchClient testSubject; + Client result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getClient(); + } + + + @Test + public void testGetServerHost() throws Exception { + ElasticSearchClient testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServerHost(); + } + + + @Test + public void testGetServerPort() throws Exception { + ElasticSearchClient testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServerPort(); + } + + + @Test + public void testSetClusterName() throws Exception { + ElasticSearchClient testSubject; + String clusterName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setClusterName(clusterName); + } + + + @Test + public void testSetLocal() throws Exception { + ElasticSearchClient testSubject; + String strIsLocal = ""; + + // test 1 + testSubject = createTestSubject(); + strIsLocal = null; + testSubject.setLocal(strIsLocal); + + // test 2 + testSubject = createTestSubject(); + strIsLocal = ""; + testSubject.setLocal(strIsLocal); + } + + + @Test + public void testIsTransportClient() throws Exception { + ElasticSearchClient testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isTransportClient(); + } + + + @Test + public void testSetTransportClient() throws Exception { + ElasticSearchClient testSubject; + String strIsTransportclient = ""; + + // test 1 + testSubject = createTestSubject(); + strIsTransportclient = null; + testSubject.setTransportClient(strIsTransportclient); + + // test 2 + testSubject = createTestSubject(); + strIsTransportclient = ""; + testSubject.setTransportClient(strIsTransportclient); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java new file mode 100644 index 0000000000..4ccf9c6cbb --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java @@ -0,0 +1,364 @@ +package org.openecomp.sdc.be.dao.jsongraph; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.DAOTitanStrategy; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.dao.titan.TitanGraphClient; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.common.impl.ExternalConfiguration; +import org.openecomp.sdc.common.impl.FSConfigurationSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.thinkaurelius.titan.core.TitanGraph; + +import fj.data.Either; + +public class TitanDaoTest { + + + private static Logger logger = LoggerFactory.getLogger(TitanDaoTest.class); + + + + private TitanDao createTestSubject() { + TitanGraphClient client = new TitanGraphClient(new DAOTitanStrategy()); + client.createGraph(); + return new TitanDao(client); + } + @Before + public void init(){ + String appConfigDir = "src/test/resources/config/catalog-dao"; + ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); + ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); + + + + } + + + @Test + public void testCommit() throws Exception { + TitanDao testSubject; + TitanOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.commit(); + } + + + @Test + public void testRollback() throws Exception { + TitanDao testSubject; + TitanOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.rollback(); + } + + + @Test + public void testGetGraph() throws Exception { + TitanDao testSubject; + Either<TitanGraph, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGraph(); + } + + + + + + @Test + public void testGetVertexByPropertyAndLabel() throws Exception { + TitanDao testSubject; + GraphPropertyEnum name = null; + Object value = null; + VertexTypeEnum label = null; + Either<GraphVertex, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVertexByPropertyAndLabel(name, value, label); + } + + + + + + + @Test + public void testGetVertexByPropertyAndLabel_1() throws Exception { + TitanDao testSubject; + GraphPropertyEnum name = null; + Object value = null; + VertexTypeEnum label = null; + JsonParseFlagEnum parseFlag = null; + Either<GraphVertex, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVertexByPropertyAndLabel(name, value, label, parseFlag); + } + + + @Test + public void testGetVertexById() throws Exception { + TitanDao testSubject; + String id = ""; + Either<GraphVertex, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVertexById(id); + } + + + @Test + public void testGetVertexById_1() throws Exception { + TitanDao testSubject; + String id = ""; + JsonParseFlagEnum parseFlag = null; + Either<GraphVertex, TitanOperationStatus> result; + + // test 1 + testSubject = createTestSubject(); + id = null; + result = testSubject.getVertexById(id, parseFlag); + + // test 2 + testSubject = createTestSubject(); + id = ""; + result = testSubject.getVertexById(id, parseFlag); + } + + + + + + + + + + + + + + + @Test + public void testGetVertexProperties() throws Exception { + TitanDao testSubject; + Element element = null; + Map<GraphPropertyEnum, Object> result; + + // test 1 + testSubject = createTestSubject(); + element = null; + result = testSubject.getVertexProperties(element); + } + + + @Test + public void testGetEdgeProperties() throws Exception { + TitanDao testSubject; + Element element = null; + Map<EdgePropertyEnum, Object> result; + + // test 1 + testSubject = createTestSubject(); + element = null; + result = testSubject.getEdgeProperties(element); + } + + + + + + @Test + public void testGetByCriteria() throws Exception { + TitanDao testSubject; + VertexTypeEnum type = null; + Map<GraphPropertyEnum, Object> props = null; + Either<List<GraphVertex>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getByCriteria(type, props); + } + + + @Test + public void testGetByCriteria_1() throws Exception { + TitanDao testSubject; + VertexTypeEnum type = null; + Map<GraphPropertyEnum, Object> props = null; + JsonParseFlagEnum parseFlag = null; + Either<List<GraphVertex>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getByCriteria(type, props, parseFlag); + } + + + @Test + public void testGetByCriteria_2() throws Exception { + TitanDao testSubject; + VertexTypeEnum type = null; + Map<GraphPropertyEnum, Object> props = null; + Map<GraphPropertyEnum, Object> hasNotProps = null; + JsonParseFlagEnum parseFlag = null; + Either<List<GraphVertex>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getByCriteria(type, props, hasNotProps, parseFlag); + } + + + @Test + public void testGetCatalogVerticies() throws Exception { + TitanDao testSubject; + Either<Iterator<Vertex>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCatalogVerticies(); + } + + + + + + + + + + + + + + + + + @Test + public void testGetParentVertecies_1() throws Exception { + TitanDao testSubject; + Vertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either<List<Vertex>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getParentVertecies(parentVertex, edgeLabel, parseFlag); + } + + + + + @Test + public void testGetChildrenVertecies_1() throws Exception { + TitanDao testSubject; + Vertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either<List<Vertex>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getChildrenVertecies(parentVertex, edgeLabel, parseFlag); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Test + public void testUpdateVertexMetadataPropertiesWithJson() throws Exception { + TitanDao testSubject; + Vertex vertex = null; + Map<GraphPropertyEnum, Object> properties = null; + TitanOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.updateVertexMetadataPropertiesWithJson(vertex, properties); + } + + + + + + + @Test + public void testGetProperty_1() throws Exception { + TitanDao testSubject; + Edge edge = null; + EdgePropertyEnum key = null; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperty(edge, key); + } + + + + + + @Test + public void testGetBelongingEdgeByCriteria_1() throws Exception { + TitanDao testSubject; + String parentId = ""; + EdgeLabelEnum label = null; + Map<GraphPropertyEnum, Object> properties = null; + Either<Edge, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getBelongingEdgeByCriteria(parentId, label, properties); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/titan/TitanUtilsTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/titan/TitanUtilsTest.java new file mode 100644 index 0000000000..d40a64e57a --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/titan/TitanUtilsTest.java @@ -0,0 +1,25 @@ +package org.openecomp.sdc.be.dao.titan; + +import java.util.Collection; +import java.util.Map; + +import javax.annotation.Generated; + +import org.apache.tinkerpop.gremlin.structure.T; +import org.junit.Test; + +import com.thinkaurelius.titan.graphdb.query.TitanPredicate; + +import java.util.Map.Entry; +public class TitanUtilsTest { + + @Test + public void testBuildNotInPredicate() throws Exception { + String propKey = ""; + Collection<T> notInCollection = null; + Map<String, Entry<TitanPredicate, Object>> result; + + // default test + result = TitanUtils.buildNotInPredicate(propKey, notInCollection); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java new file mode 100644 index 0000000000..ade07e3cbc --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java @@ -0,0 +1,81 @@ +package org.openecomp.sdc.be.resources.data.auditing.model; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; + +@Generated(value = "org.junit-tools-1.0.6") +public class CommonAuditDataTest { + + private CommonAuditData createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + return newBuilder.build(); + } + + + + + @Test + public void testGetStatus() throws Exception { + CommonAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatus(); + } + + + @Test + public void testGetDescription() throws Exception { + CommonAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testGetRequestId() throws Exception { + CommonAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequestId(); + } + + + @Test + public void testGetServiceInstanceId() throws Exception { + CommonAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceInstanceId(); + } + + + @Test + public void testSetServiceInstanceId() throws Exception { + CommonAuditData testSubject; + String serviceInstanceId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceInstanceId(serviceInstanceId); + } + + + @Test + public void testNewBuilder() throws Exception { + Builder result; + + // default test + result = CommonAuditData.newBuilder(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionDataTest.java new file mode 100644 index 0000000000..606e219b39 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionDataTest.java @@ -0,0 +1,35 @@ +package org.openecomp.sdc.be.resources.data.auditing.model; + +import javax.annotation.Generated; + +import org.junit.Test; + +@Generated(value = "org.junit-tools-1.0.6") +public class DistributionDataTest { + + private DistributionData createTestSubject() { + return new DistributionData("", ""); + } + + + @Test + public void testGetConsumerId() throws Exception { + DistributionData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getConsumerId(); + } + + + @Test + public void testGetResourceUrl() throws Exception { + DistributionData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceUrl(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditDataTest.java new file mode 100644 index 0000000000..fcbec32cc0 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditDataTest.java @@ -0,0 +1,46 @@ +package org.openecomp.sdc.be.resources.data.auditing.model; + +import javax.annotation.Generated; + +import org.junit.Test; + +@Generated(value = "org.junit-tools-1.0.6") +public class OperationalEnvAuditDataTest { + + private OperationalEnvAuditData createTestSubject() { + return new OperationalEnvAuditData("", "", ""); + } + + + @Test + public void testGetEnvId() throws Exception { + OperationalEnvAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEnvId(); + } + + + @Test + public void testGetVnfWorkloadContext() throws Exception { + OperationalEnvAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVnfWorkloadContext(); + } + + + @Test + public void testGetTenant() throws Exception { + OperationalEnvAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTenant(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java new file mode 100644 index 0000000000..0246068deb --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java @@ -0,0 +1,68 @@ +package org.openecomp.sdc.be.resources.data.auditing.model; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder; + +@Generated(value = "org.junit-tools-1.0.6") +public class ResourceAuditDataTest { + + private ResourceAuditData createTestSubject() { + Builder newBuilder = ResourceAuditData.newBuilder(); + return newBuilder.build(); + } + + + @Test + public void testNewBuilder() throws Exception { + Builder result; + + // default test + result = ResourceAuditData.newBuilder(); + } + + + @Test + public void testGetArtifactUuid() throws Exception { + ResourceAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactUuid(); + } + + + @Test + public void testGetState() throws Exception { + ResourceAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getState(); + } + + + @Test + public void testGetVersion() throws Exception { + ResourceAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testGetDistributionStatus() throws Exception { + ResourceAuditData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDistributionStatus(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/CategoryDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/CategoryDataTest.java new file mode 100644 index 0000000000..1072635fcc --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/CategoryDataTest.java @@ -0,0 +1,60 @@ +package org.openecomp.sdc.be.resources.data.category; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.category.CategoryDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; + +public class CategoryDataTest { + + private CategoryData createTestSubject() { + return new CategoryData(NodeTypeEnum.AdditionalInfoParameters); + } + + + @Test + public void testGetUniqueId() throws Exception { + CategoryData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + + @Test + public void testGetCategoryDataDefinition() throws Exception { + CategoryData testSubject; + CategoryDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategoryDataDefinition(); + } + + + @Test + public void testToGraphMap() throws Exception { + CategoryData testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toGraphMap(); + } + + + @Test + public void testToString() throws Exception { + CategoryData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/GroupingDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/GroupingDataTest.java new file mode 100644 index 0000000000..c79db7a582 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/GroupingDataTest.java @@ -0,0 +1,49 @@ +package org.openecomp.sdc.be.resources.data.category; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.category.GroupingDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; + +public class GroupingDataTest { + + private GroupingData createTestSubject() { + return new GroupingData(NodeTypeEnum.AdditionalInfoParameters); + } + + + @Test + public void testGetGroupingDataDefinition() throws Exception { + GroupingData testSubject; + GroupingDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupingDataDefinition(); + } + + + @Test + public void testGetUniqueId() throws Exception { + GroupingData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + + @Test + public void testToGraphMap() throws Exception { + GroupingData testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toGraphMap(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/SubCategoryDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/SubCategoryDataTest.java new file mode 100644 index 0000000000..de9752f9ff --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/SubCategoryDataTest.java @@ -0,0 +1,49 @@ +package org.openecomp.sdc.be.resources.data.category; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.category.SubCategoryDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; + +public class SubCategoryDataTest { + + private SubCategoryData createTestSubject() { + return new SubCategoryData(NodeTypeEnum.AdditionalInfoParameters); + } + + + @Test + public void testGetSubCategoryDataDefinition() throws Exception { + SubCategoryData testSubject; + SubCategoryDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubCategoryDataDefinition(); + } + + + @Test + public void testGetUniqueId() throws Exception { + SubCategoryData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + + @Test + public void testToGraphMap() throws Exception { + SubCategoryData testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toGraphMap(); + } +}
\ No newline at end of file |