From 287481cb94f4ba0b72a520fba1e05daea95ba431 Mon Sep 17 00:00:00 2001 From: Yuli Shlosberg Date: Thu, 19 Oct 2017 19:50:28 +0300 Subject: add more unit tests to BE components Change-Id: I23a72857d669f03e8cb7e543c006fed3318670b0 Issue-Id: SDC-467 Signed-off-by: Yuli Shlosberg (cherry picked from commit 6dc570c66839fe239b63f1aa8da489c520fb215d) --- .../java/org/openecomp/sdc/be/dao/AccountTest.java | 80 ++++++ .../be/dao/cassandra/AuditCassandraDaoTest.java | 154 +++++++++++ .../dao/cassandra/ComponentCassandraDaoTest.java | 55 ++++ .../cassandra/SdcSchemaFilesCassandraDaoTest.java | 55 ++++ .../dao/cassandra/schema/SdcSchemaUtilsTest.java | 38 +++ .../sdc/be/dao/cassandra/schema/TableTest.java | 24 ++ .../tables/CategoryEventTableDescriptionTest.java | 9 - .../tables/DistribStatusEventTableDescTest.java | 8 - .../tables/ResAdminEventTableDescriptionTest.java | 8 - .../tables/UserAdminEventTableDescriptionTest.java | 9 - .../sdc/be/dao/jsongraph/GraphVertexTest.java | 204 ++++++++++++++ .../sdc/be/dao/jsongraph/TitanDaoTest.java | 300 +++++++++++++++++++++ .../be/dao/jsongraph/types/EdgeLabelEnumTest.java | 34 +++ .../dao/jsongraph/types/EdgePropertyEnumTest.java | 34 +++ .../be/dao/jsongraph/types/VertexTypeEnumTest.java | 45 ++++ .../sdc/be/dao/model/FacetedSearchFacetTest.java | 57 ++++ 16 files changed, 1080 insertions(+), 34 deletions(-) create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/AuditCassandraDaoTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDaoTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDaoTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtilsTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/TableTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertexTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnumTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacetTest.java (limited to 'catalog-dao/src/test/java') diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java new file mode 100644 index 0000000000..81a2b41946 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java @@ -0,0 +1,80 @@ +package org.openecomp.sdc.be.dao; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class AccountTest { + + private Account createTestSubject() { + return new Account(); + } + + + @Test + public void testGetName() throws Exception { + Account testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testSetName() throws Exception { + Account testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testGetEmail() throws Exception { + Account testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEmail(); + } + + + @Test + public void testSetEmail() throws Exception { + Account testSubject; + String email = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEmail(email); + } + + + @Test + public void testEquals() throws Exception { + Account testSubject; + Object other = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(other); + } + + + @Test + public void testHashCode() throws Exception { + Account testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/AuditCassandraDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/AuditCassandraDaoTest.java new file mode 100644 index 0000000000..6936f4e5be --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/AuditCassandraDaoTest.java @@ -0,0 +1,154 @@ +package org.openecomp.sdc.be.dao.cassandra; + +import java.util.List; + +import javax.annotation.Generated; + +import org.apache.tinkerpop.gremlin.structure.T; +import org.junit.Test; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionDeployEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionNotificationEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionStatusEvent; +import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent; + +import fj.data.Either; + + +public class AuditCassandraDaoTest { + + private AuditCassandraDao createTestSubject() { + return new AuditCassandraDao(); + } + + + + + + + + @Test + public void testGetListOfDistributionStatuses() throws Exception { + AuditCassandraDao testSubject; + String did = ""; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getListOfDistributionStatuses(did); + } + + + @Test + public void testGetDistributionDeployByStatus() throws Exception { + AuditCassandraDao testSubject; + String did = ""; + String action = ""; + String status = ""; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDistributionDeployByStatus(did, action, status); + } + + + @Test + public void testGetDistributionRequest() throws Exception { + AuditCassandraDao testSubject; + String did = ""; + String action = ""; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDistributionRequest(did, action); + } + + + @Test + public void testGetDistributionNotify() throws Exception { + AuditCassandraDao testSubject; + String did = ""; + String action = ""; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDistributionNotify(did, action); + } + + + @Test + public void testGetByServiceInstanceId() throws Exception { + AuditCassandraDao testSubject; + String serviceInstanceId = ""; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getByServiceInstanceId(serviceInstanceId); + } + + + @Test + public void testGetServiceDistributionStatusesList() throws Exception { + AuditCassandraDao testSubject; + String serviceInstanceId = ""; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceDistributionStatusesList(serviceInstanceId); + } + + + @Test + public void testGetAuditByServiceIdAndPrevVersion() throws Exception { + AuditCassandraDao testSubject; + String serviceInstanceId = ""; + String prevVersion = ""; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAuditByServiceIdAndPrevVersion(serviceInstanceId, prevVersion); + } + + + @Test + public void testGetAuditByServiceIdAndCurrVersion() throws Exception { + AuditCassandraDao testSubject; + String serviceInstanceId = ""; + String currVersion = ""; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAuditByServiceIdAndCurrVersion(serviceInstanceId, currVersion); + } + + + @Test + public void testIsTableEmpty() throws Exception { + AuditCassandraDao testSubject; + String tableName = ""; + Either result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isTableEmpty(tableName); + } + + + @Test + public void testDeleteAllAudit() throws Exception { + AuditCassandraDao testSubject; + CassandraOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteAllAudit(); + } +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDaoTest.java new file mode 100644 index 0000000000..f4f9fd5fc2 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDaoTest.java @@ -0,0 +1,55 @@ +package org.openecomp.sdc.be.dao.cassandra; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Generated; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.resources.data.ComponentCacheData; + +import fj.data.Either; + + +public class ComponentCassandraDaoTest { + + private ComponentCassandraDao createTestSubject() { + return new ComponentCassandraDao(); + } + + @Test + public void testGetAllComponentIdTimeAndType() throws Exception { + ComponentCassandraDao testSubject; + Either, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllComponentIdTimeAndType(); + } + + + + + + + + @Test + public void testIsTableEmpty() throws Exception { + ComponentCassandraDao testSubject; + String tableName = ""; + Either result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isTableEmpty(tableName); + } + + + + + +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDaoTest.java new file mode 100644 index 0000000000..141aeebc5d --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDaoTest.java @@ -0,0 +1,55 @@ +package org.openecomp.sdc.be.dao.cassandra; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData; + +import fj.data.Either; + + +public class SdcSchemaFilesCassandraDaoTest { + + private SdcSchemaFilesCassandraDao createTestSubject() { + return new SdcSchemaFilesCassandraDao(); + } + + + + @Test + public void testGetSpecificSchemaFiles() throws Exception { + SdcSchemaFilesCassandraDao testSubject; + String sdcreleasenum = ""; + String conformancelevel = ""; + Either, CassandraOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSpecificSchemaFiles(sdcreleasenum, conformancelevel); + } + + + @Test + public void testDeleteAllArtifacts() throws Exception { + SdcSchemaFilesCassandraDao testSubject; + CassandraOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteAllArtifacts(); + } + + + @Test + public void testIsTableEmpty() throws Exception { + SdcSchemaFilesCassandraDao testSubject; + String tableName = ""; + Either result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isTableEmpty(tableName); + } +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtilsTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtilsTest.java new file mode 100644 index 0000000000..f4844a9800 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtilsTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.be.dao.cassandra.schema; + +import javax.annotation.Generated; + +import org.junit.Test; + +import com.datastax.driver.core.Cluster; + + +public class SdcSchemaUtilsTest { + + private SdcSchemaUtils createTestSubject() { + return new SdcSchemaUtils(); + } + + + + + + @Test + public void testExecuteStatement() throws Exception { + String statement = ""; + boolean result; + + // default test + result = SdcSchemaUtils.executeStatement(statement); + } + + + @Test + public void testExecuteStatements() throws Exception { + String[] statements = new String[] { "" }; + boolean result; + + // default test + result = SdcSchemaUtils.executeStatements(statements); + } +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/TableTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/TableTest.java new file mode 100644 index 0000000000..3c891c97f3 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/TableTest.java @@ -0,0 +1,24 @@ +package org.openecomp.sdc.be.dao.cassandra.schema; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class TableTest { + + private Table createTestSubject() { + return Table.ARTIFACT; + } + + + @Test + public void testGetTableDescription() throws Exception { + Table testSubject; + ITableDescription result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTableDescription(); + } +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescriptionTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescriptionTest.java index c83595d591..4f12640b1f 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescriptionTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescriptionTest.java @@ -40,15 +40,6 @@ public class CategoryEventTableDescriptionTest { } - @Test - public void testGetColumnDescription() throws Exception { - CategoryEventTableDescription testSubject; - Map> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getColumnDescription(); - } @Test diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDescTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDescTest.java index 23b7301a68..e4defc068c 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDescTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDescTest.java @@ -40,15 +40,7 @@ public class DistribStatusEventTableDescTest { } - @Test - public void testGetColumnDescription() throws Exception { - DistribStatusEventTableDesc testSubject; - Map> result; - // default test - testSubject = createTestSubject(); - result = testSubject.getColumnDescription(); - } @Test diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescriptionTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescriptionTest.java index 68b06e1b66..6e6afb7424 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescriptionTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescriptionTest.java @@ -40,15 +40,7 @@ public class ResAdminEventTableDescriptionTest { } - @Test - public void testGetColumnDescription() throws Exception { - ResAdminEventTableDescription testSubject; - Map> result; - // default test - testSubject = createTestSubject(); - result = testSubject.getColumnDescription(); - } @Test diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAdminEventTableDescriptionTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAdminEventTableDescriptionTest.java index 1efb68c1a9..66f6861f83 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAdminEventTableDescriptionTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAdminEventTableDescriptionTest.java @@ -40,15 +40,6 @@ public class UserAdminEventTableDescriptionTest { } - @Test - public void testGetColumnDescription() throws Exception { - UserAdminEventTableDescription testSubject; - Map> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getColumnDescription(); - } @Test diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertexTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertexTest.java new file mode 100644 index 0000000000..9a8b67dbd0 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertexTest.java @@ -0,0 +1,204 @@ +package org.openecomp.sdc.be.dao.jsongraph; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +import com.thinkaurelius.titan.core.TitanVertex; + + +public class GraphVertexTest { + + private GraphVertex createTestSubject() { + return new GraphVertex(); + } + + + @Test + public void testGetUniqueId() throws Exception { + GraphVertex testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + + @Test + public void testSetUniqueId() throws Exception { + GraphVertex testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + + @Test + public void testGetJson() throws Exception { + GraphVertex testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getJson(); + } + + + @Test + public void testSetJson() throws Exception { + GraphVertex testSubject; + Map json = null; + + // default test + testSubject = createTestSubject(); + testSubject.setJson(json); + } + + + @Test + public void testGetVertex() throws Exception { + GraphVertex testSubject; + TitanVertex result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVertex(); + } + + + @Test + public void testSetVertex() throws Exception { + GraphVertex testSubject; + TitanVertex vertex = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVertex(vertex); + } + + + @Test + public void testGetLabel() throws Exception { + GraphVertex testSubject; + VertexTypeEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLabel(); + } + + + @Test + public void testSetLabel() throws Exception { + GraphVertex testSubject; + VertexTypeEnum label = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLabel(label); + } + + + + @Test + public void testAddMetadataProperty() throws Exception { + GraphVertex testSubject; + GraphPropertyEnum propName = null; + Object propValue = null; + + // test 1 + testSubject = createTestSubject(); + propValue = null; + testSubject.addMetadataProperty(propName, propValue); + } + + + @Test + public void testGetMetadataProperty() throws Exception { + GraphVertex testSubject; + GraphPropertyEnum metadataProperty = null; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadataProperty(metadataProperty); + } + + + @Test + public void testGetMetadataProperties() throws Exception { + GraphVertex testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadataProperties(); + } + + + @Test + public void testSetMetadataProperties() throws Exception { + GraphVertex testSubject; + Map metadataProperties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadataProperties(metadataProperties); + } + + + @Test + public void testGetMetadataJson() throws Exception { + GraphVertex testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadataJson(); + } + + + @Test + public void testSetMetadataJson() throws Exception { + GraphVertex testSubject; + Map metadataJson = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadataJson(metadataJson); + } + + + + + @Test + public void testGetJsonMetadataField() throws Exception { + GraphVertex testSubject; + JsonPresentationFields field = null; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getJsonMetadataField(field); + } + + + @Test + public void testUpdateMetadataJsonWithCurrentMetadataProperties() throws Exception { + GraphVertex testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.updateMetadataJsonWithCurrentMetadataProperties(); + } +} \ 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..bf059219c2 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java @@ -0,0 +1,300 @@ +package org.openecomp.sdc.be.dao.jsongraph; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; +import javax.lang.model.element.Element; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.junit.Assert; +import org.junit.Test; +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 com.datastax.driver.core.schemabuilder.SchemaBuilder.Direction; +import com.google.common.collect.Multiset.Entry; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanGraphQuery; +import com.thinkaurelius.titan.core.TitanVertex; + +import fj.data.Either; + + +public class TitanDaoTest { + + private TitanDao createTestSubject() { + return new TitanDao(new TitanGraphClient()); + } + + + @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 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 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 result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVertexByPropertyAndLabel(name, value, label, parseFlag); + } + + + @Test + public void testGetVertexById() throws Exception { + TitanDao testSubject; + String id = ""; + Either result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVertexById(id); + } + + + + + + + + + + + + + + + + + + @Test + public void testGetByCriteria() throws Exception { + TitanDao testSubject; + VertexTypeEnum type = null; + Map props = null; + Either, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getByCriteria(type, props); + } + + + @Test + public void testGetByCriteria_1() throws Exception { + TitanDao testSubject; + VertexTypeEnum type = null; + Map props = null; + JsonParseFlagEnum parseFlag = null; + Either, 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 props = null; + Map hasNotProps = null; + JsonParseFlagEnum parseFlag = null; + Either, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getByCriteria(type, props, hasNotProps, parseFlag); + } + + + + + + @Test + public void testGetChildVertex() throws Exception { + TitanDao testSubject; + GraphVertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getChildVertex(parentVertex, edgeLabel, parseFlag); + } + + + @Test + public void testGetParentVertex() throws Exception { + TitanDao testSubject; + GraphVertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getParentVertex(parentVertex, edgeLabel, parseFlag); + } + + + @Test + public void testGetChildrenVertecies() throws Exception { + TitanDao testSubject; + GraphVertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getChildrenVertecies(parentVertex, edgeLabel, parseFlag); + } + + + @Test + public void testGetParentVertecies() throws Exception { + TitanDao testSubject; + GraphVertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getParentVertecies(parentVertex, edgeLabel, parseFlag); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + @Test + public void testUpdateVertexMetadataPropertiesWithJson() throws Exception { + TitanDao testSubject; + Vertex vertex = null; + Map 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 properties = null; + Either 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/jsongraph/types/EdgeLabelEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnumTest.java new file mode 100644 index 0000000000..6b50f6e806 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnumTest.java @@ -0,0 +1,34 @@ +package org.openecomp.sdc.be.dao.jsongraph.types; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class EdgeLabelEnumTest { + + private EdgeLabelEnum createTestSubject() { + return EdgeLabelEnum.ARTIFACTS; + } + + + @Test + public void testGetEdgeLabelEnum() throws Exception { + String name = ""; + EdgeLabelEnum result; + + // default test + result = EdgeLabelEnum.getEdgeLabelEnum(name); + } + + + @Test + public void testIsInstanceArtifactsLabel() throws Exception { + EdgeLabelEnum testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isInstanceArtifactsLabel(); + } +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java new file mode 100644 index 0000000000..544a9ce38b --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java @@ -0,0 +1,34 @@ +package org.openecomp.sdc.be.dao.jsongraph.types; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class EdgePropertyEnumTest { + + private EdgePropertyEnum createTestSubject() { + return EdgePropertyEnum.STATE; + } + + + @Test + public void testGetProperty() throws Exception { + EdgePropertyEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperty(); + } + + + @Test + public void testGetByProperty() throws Exception { + String property = ""; + EdgePropertyEnum result; + + // default test + result = EdgePropertyEnum.getByProperty(property); + } +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java new file mode 100644 index 0000000000..ed924bda04 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java @@ -0,0 +1,45 @@ +package org.openecomp.sdc.be.dao.jsongraph.types; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class VertexTypeEnumTest { + + private VertexTypeEnum createTestSubject() { + return VertexTypeEnum.ADDITIONAL_INFORMATION; + } + + + @Test + public void testGetName() throws Exception { + VertexTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testGetClassOfJson() throws Exception { + VertexTypeEnum testSubject; + Class result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getClassOfJson(); + } + + + @Test + public void testGetByName() throws Exception { + String name = ""; + VertexTypeEnum result; + + // default test + result = VertexTypeEnum.getByName(name); + } +} \ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacetTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacetTest.java new file mode 100644 index 0000000000..18dffacfe2 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacetTest.java @@ -0,0 +1,57 @@ +package org.openecomp.sdc.be.dao.model; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class FacetedSearchFacetTest { + + private FacetedSearchFacet createTestSubject() { + return new FacetedSearchFacet("", 0); + } + + + @Test + public void testGetFacetValue() throws Exception { + FacetedSearchFacet testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFacetValue(); + } + + + @Test + public void testSetFacetValue() throws Exception { + FacetedSearchFacet testSubject; + String facetValue = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setFacetValue(facetValue); + } + + + @Test + public void testGetCount() throws Exception { + FacetedSearchFacet testSubject; + long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCount(); + } + + + @Test + public void testSetCount() throws Exception { + FacetedSearchFacet testSubject; + long count = 555; + + // default test + testSubject = createTestSubject(); + testSubject.setCount(count); + } +} \ No newline at end of file -- cgit 1.2.3-korg