From 518c1d305bcb8c3e2cb96a62444f9fc7db634a14 Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Thu, 3 May 2018 16:18:03 +0300 Subject: Raise JUnit coverage asdctool Change-Id: I26742875e8e3dddb98b525c4833588bc23d81fdc Issue-ID: SDC-1296 Signed-off-by: Tal Gitelman --- .../configuration/ConfigurationUploader.java | 4 +- .../configuration/mocks/es/ESCatalogDAOMock.java | 5 +- .../mocks/es/ElasticSearchClientMock.java | 2 - .../sdc/asdctool/impl/ArtifactUuidFix.java | 18 +- .../openecomp/sdc/asdctool/impl/DataMigration.java | 13 +- .../sdc/asdctool/impl/GraphMLConverter.java | 6 - .../asdctool/impl/validator/ArtifactToolBL.java | 1 - .../config/ValidationToolConfiguration.java | 4 - .../executers/ArtifactValidatorExecuter.java | 7 +- .../executers/IArtifactValidatorExecuter.java | 9 - .../NodeToscaArtifactsValidatorExecuter.java | 1 - .../ServiceToscaArtifactsValidatorExecutor.java | 1 - .../VFToscaArtifactValidatorExecutor.java | 1 - .../sdc/asdctool/main/ArtifactValidatorTool.java | 1 - .../sdc/asdctool/main/GetConsumersMenu.java | 5 +- .../config/mocks/DistributionEngineMock.java | 5 - .../config/mocks/HealthCheckBusinessLogicMock.java | 4 +- .../migration/resolver/MigrationResolver.java | 1 - .../resolver/SpringBeansMigrationResolver.java | 4 - .../tasks/mig1710/UpgradeMigration1710.java | 23 +-- .../tasks/mig1802/SdcCatalogMigration.java | 11 +- .../java/org/openecomp/sdc/asdctool/UtilsTest.java | 101 +++++++++++ .../openecomp/sdc/asdctool/cli/CLIUtilsTest.java | 15 ++ .../ArtifactUUIDFixConfigurationTest.java | 42 +++++ .../configuration/ConfigurationUploaderTest.java | 18 ++ .../GetConsumersConfigurationTest.java | 23 +++ .../mocks/es/ESCatalogDAOMockTest.java | 78 ++++++++ .../mocks/es/ElasticSearchClientMockTest.java | 49 +++++ .../es/ElasticSearchMocksConfigurationTest.java | 43 +++++ .../mocks/es/EsHealthCheckDaoMockTest.java | 21 +++ .../sdc/asdctool/enums/SchemaZipFileEnumTest.java | 112 +++++++++++- .../sdc/asdctool/impl/ArtifactUuidFixTest.java | 92 ++++++++++ .../sdc/asdctool/impl/DataMigrationTest.java | 61 +++++++ .../impl/EsToCassandraDataMigrationConfigTest.java | 64 +++++++ .../sdc/asdctool/impl/GraphJsonValidatorTest.java | 42 +++++ .../sdc/asdctool/impl/GraphMLConverterTest.java | 175 ++++++++++++++++++ .../sdc/asdctool/impl/GraphMLDataAnalyzerTest.java | 21 +++ .../sdc/asdctool/impl/ProductLogicTest.java | 24 +++ .../openecomp/sdc/asdctool/impl/RestUtilsTest.java | 24 +++ .../asdctool/impl/TitanGraphInitializerTest.java | 16 ++ .../asdctool/impl/UpdatePropertyOnVertexTest.java | 39 ++++ .../impl/validator/ArtifactToolBLTest.java | 26 +++ .../impl/validator/ValidationToolBLTest.java | 25 +++ .../config/ValidationConfigManagerTest.java | 19 ++ .../config/ValidationToolConfigurationTest.java | 108 ++++++++--- .../executers/ArtifactValidatorExecuterTest.java | 64 +++++++ .../NodeToscaArtifactsValidatorExecuterTest.java | 40 +++++ ...ServiceToscaArtifactsValidatorExecutorTest.java | 40 +++++ .../executers/ServiceValidatorExecuterTest.java | 15 +- .../TopologyTemplateValidatorExecuterTest.java | 15 +- .../VFToscaArtifactValidatorExecutorTest.java | 40 +++++ .../executers/VfValidatorExecuterTest.java | 13 +- .../artifacts/ArtifactValidationUtilsTest.java | 62 +++++++ .../tasks/artifacts/ArtifactsVertexResultTest.java | 3 - .../ServiceArtifactValidationTaskTest.java | 14 +- .../artifacts/VfArtifactValidationTaskTest.java | 15 +- .../tasks/moduleJson/ModuleJsonTaskTest.java | 23 +++ .../impl/validator/utils/ElementTypeEnumTest.java | 1 + .../impl/validator/utils/ReportManagerTest.java | 88 +++++++++ .../impl/validator/utils/VertexResultTest.java | 4 + .../utils/VfModuleArtifactPayloadExTest.java | 193 ++++++++++++++++++++ .../sdc/asdctool/main/SdcSchemaFileImportTest.java | 40 +++++ .../config/MigrationSpringConfigTest.java | 81 +++++++++ .../config/mocks/DistributionEngineMockTest.java | 137 ++++++++++++++ .../config/mocks/DmaapHealthCheckMockTest.java | 21 +++ .../mocks/HealthCheckBusinessLogicMockTest.java | 19 ++ .../migration/core/SdcMigrationToolTest.java | 135 +++++++------- .../execution/MigrationExecutionResultTest.java | 83 +++++++++ .../migration/dao/MigrationTasksDaoTest.java | 53 ++++++ .../resolver/SpringBeansMigrationResolverTest.java | 116 ++++++------ .../tasks/handlers/XlsOutputHandlerTest.java | 40 +++++ .../tasks/mig1710/UpgradeMigration1710Test.java | 30 +++- .../tasks/mig1802/SdcCatalogMigrationTest.java | 45 +++++ .../servlets/ExportImportTitanServletTest.java | 40 +++++ .../simulator/tenant/ImportTableConfigTest.java | 32 ++++ .../tenant/OperationalEnvironmentTest.java | 200 +++++++++++++++++++++ .../OperationalEvnironmentImportHandlerTest.java | 22 +++ asdctool/src/test/resources/graph.json | 1 + asdctool/src/test/resources/graphError.json | 1 + 79 files changed, 2829 insertions(+), 261 deletions(-) create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/cli/CLIUtilsTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ConfigurationUploaderTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ESCatalogDAOMockTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchClientMockTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchMocksConfigurationTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/EsHealthCheckDaoMockTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/RestUtilsTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManagerTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/VfModuleArtifactPayloadExTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImportTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/MigrationSpringConfigTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMockTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DmaapHealthCheckMockTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/HealthCheckBusinessLogicMockTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutionResultTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/dao/MigrationTasksDaoTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/handlers/XlsOutputHandlerTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/ImportTableConfigTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/OperationalEnvironmentTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/OperationalEvnironmentImportHandlerTest.java create mode 100644 asdctool/src/test/resources/graph.json create mode 100644 asdctool/src/test/resources/graphError.json (limited to 'asdctool/src') diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ConfigurationUploader.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ConfigurationUploader.java index ac75dc8310..267f20904c 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ConfigurationUploader.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ConfigurationUploader.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.asdctool.configuration; +import java.io.File; + import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import java.io.File; - public class ConfigurationUploader { public static void uploadConfigurationFiles(String appConfigDir) { diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ESCatalogDAOMock.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ESCatalogDAOMock.java index 302d20fea7..f4551a0264 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ESCatalogDAOMock.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ESCatalogDAOMock.java @@ -1,11 +1,12 @@ package org.openecomp.sdc.asdctool.configuration.mocks.es; -import fj.data.Either; +import java.util.List; + import org.openecomp.sdc.be.dao.api.ICatalogDAO; import org.openecomp.sdc.be.dao.api.ResourceUploadStatus; import org.openecomp.sdc.be.resources.data.ESArtifactData; -import java.util.List; +import fj.data.Either; public class ESCatalogDAOMock implements ICatalogDAO { diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchClientMock.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchClientMock.java index 0038a9595d..e9751a6446 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchClientMock.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchClientMock.java @@ -2,8 +2,6 @@ package org.openecomp.sdc.asdctool.configuration.mocks.es; import org.openecomp.sdc.be.dao.es.ElasticSearchClient; -import java.net.URISyntaxException; - public class ElasticSearchClientMock extends ElasticSearchClient { @Override diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java index d413c3f23a..b44cd35729 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java @@ -6,7 +6,6 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -18,7 +17,6 @@ import java.util.stream.Collectors; import org.openecomp.sdc.asdctool.impl.validator.utils.VfModuleArtifactPayloadEx; import org.openecomp.sdc.be.components.distribution.engine.VfModuleArtifactPayload; -import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; @@ -33,12 +31,20 @@ import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DistributionStatusEnum; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; @@ -47,7 +53,6 @@ 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.resources.data.ESArtifactData; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.tosca.CsarUtils; import org.openecomp.sdc.be.tosca.ToscaError; import org.openecomp.sdc.be.tosca.ToscaExportHandler; @@ -55,18 +60,15 @@ import org.openecomp.sdc.be.tosca.ToscaRepresentation; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.common.api.Constants; - import org.openecomp.sdc.common.util.GeneralUtility; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.StringUtils; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import fj.data.Either; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java index c399e58276..8b6898d3b0 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java @@ -20,11 +20,6 @@ package org.openecomp.sdc.asdctool.impl; -import com.carrotsearch.hppc.cursors.ObjectCursor; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import fj.data.Either; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -45,6 +40,7 @@ import java.util.EnumMap; import java.util.Map; import java.util.Map.Entry; import java.util.TimeZone; + import org.apache.commons.lang.SystemUtils; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; @@ -82,6 +78,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.carrotsearch.hppc.cursors.ObjectCursor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import fj.data.Either; + /** * Created by mlando on 5/16/2016. */ diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java index b6925416e6..2bcc8c05a8 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java @@ -61,12 +61,6 @@ import com.thinkaurelius.titan.core.TitanFactory; import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.TitanGraphQuery; import com.thinkaurelius.titan.core.TitanVertex; -//import com.tinkerpop.blueprints.Direction; -//import com.tinkerpop.blueprints.Edge; -//import com.tinkerpop.blueprints.Vertex; -//import com.tinkerpop.blueprints.util.ElementHelper; -//import com.tinkerpop.blueprints.util.io.graphson.GraphSONReader; -//import com.tinkerpop.blueprints.util.io.graphson.GraphSONWriter; public class GraphMLConverter { diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java index f70236432d..16eb0be95e 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java @@ -2,7 +2,6 @@ package org.openecomp.sdc.asdctool.impl.validator; import java.util.List; -import org.openecomp.sdc.asdctool.impl.validator.executers.ArtifactValidatorExecuter; import org.openecomp.sdc.asdctool.impl.validator.executers.IArtifactValidatorExecuter; import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager; import org.slf4j.Logger; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java index 64d6bc1bde..63e95d568b 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java @@ -10,10 +10,6 @@ import org.openecomp.sdc.asdctool.impl.validator.executers.VfValidatorExecuter; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidationUtils; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask; -import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecuter; -import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceToscaArtifactsValidatorExecutor; -import org.openecomp.sdc.asdctool.impl.validator.executers.VFToscaArtifactValidatorExecutor; -import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL; import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask; import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager; import org.openecomp.sdc.be.dao.DAOTitanStrategy; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java index ceab832c0b..3585474398 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java @@ -1,6 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.executers; -import fj.data.Either; import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.IOException; @@ -22,16 +21,16 @@ import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; -import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.springframework.beans.factory.annotation.Autowired; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import fj.data.Either; public class ArtifactValidatorExecuter { diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecuter.java index 30bfab146a..6f9405f992 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecuter.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecuter.java @@ -1,14 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.executers; -import java.util.List; -import java.util.Map; - -import org.openecomp.sdc.asdctool.impl.validator.tasks.TopologyTemplateValidationTask; -import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -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; - public interface IArtifactValidatorExecuter { boolean executeValidations(); String getName(); diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java index c0a2589426..6715c8a955 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; 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; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java index 1dd1779398..2fe5abef3c 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; 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; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java index 69be96c6d3..bc22f2e424 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; 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; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java index b1180f9483..ba8f3be4e9 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java @@ -3,7 +3,6 @@ package org.openecomp.sdc.asdctool.main; import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL; import org.openecomp.sdc.asdctool.impl.validator.config.ValidationConfigManager; import org.openecomp.sdc.asdctool.impl.validator.config.ValidationToolConfiguration; -import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/GetConsumersMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/GetConsumersMenu.java index 189348acc6..733cc5cc94 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/GetConsumersMenu.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/GetConsumersMenu.java @@ -1,6 +1,7 @@ package org.openecomp.sdc.asdctool.main; -import fj.data.Either; +import java.util.List; + import org.openecomp.sdc.asdctool.cli.CLIToolData; import org.openecomp.sdc.asdctool.cli.SpringCLITool; import org.openecomp.sdc.asdctool.configuration.GetConsumersConfiguration; @@ -10,7 +11,7 @@ import org.openecomp.sdc.be.resources.data.ConsumerData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; +import fj.data.Either; public class GetConsumersMenu extends SpringCLITool { diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMock.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMock.java index 36f6814ea0..aa27d6e435 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMock.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMock.java @@ -1,16 +1,11 @@ package org.openecomp.sdc.asdctool.migration.config.mocks; -import fj.data.Either; import org.openecomp.sdc.be.components.distribution.engine.IDistributionEngine; import org.openecomp.sdc.be.components.distribution.engine.INotificationData; -import org.openecomp.sdc.be.components.impl.ActivationRequestInformation; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.externalapi.servlet.representation.ServiceDistributionReqInfo; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; -import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Component; @Component("distributionEngine") diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/HealthCheckBusinessLogicMock.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/HealthCheckBusinessLogicMock.java index c7ef45e712..5e4f15ca7e 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/HealthCheckBusinessLogicMock.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/HealthCheckBusinessLogicMock.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.asdctool.migration.config.mocks; +import javax.annotation.PostConstruct; + import org.openecomp.sdc.be.components.health.HealthCheckBusinessLogic; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; - @Component("healthCheckBusinessLogic") public class HealthCheckBusinessLogicMock extends HealthCheckBusinessLogic { diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/resolver/MigrationResolver.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/resolver/MigrationResolver.java index 9147ac0239..22add31eb4 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/resolver/MigrationResolver.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/resolver/MigrationResolver.java @@ -1,7 +1,6 @@ package org.openecomp.sdc.asdctool.migration.resolver; -import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; import java.util.List; import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolver.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolver.java index 9f2f60053b..182996f5e4 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolver.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolver.java @@ -1,10 +1,6 @@ package org.openecomp.sdc.asdctool.migration.resolver; -import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; -import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; -import org.openecomp.sdc.asdctool.migration.core.task.PostMigration; -import org.openecomp.sdc.asdctool.migration.core.task.PostMigration; import java.util.ArrayList; import java.util.Comparator; import java.util.List; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java index e6acb7a1d4..9d01ab0d9c 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java @@ -1,7 +1,14 @@ package org.openecomp.sdc.asdctool.migration.tasks.mig1710; -import com.google.common.collect.Lists; -import fj.data.Either; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Predicate; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -44,16 +51,10 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.Predicate; -import java.util.stream.Collectors; +import com.google.common.collect.Lists; + +import fj.data.Either; //@Component public class UpgradeMigration1710 implements PostMigration { diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java index 9cbb7ec1ce..542db17425 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java @@ -1,6 +1,10 @@ package org.openecomp.sdc.asdctool.migration.tasks.mig1802; -import fj.data.Either; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + import org.apache.commons.collections.ListUtils; import org.apache.tinkerpop.gremlin.structure.Direction; import org.openecomp.sdc.asdctool.migration.core.DBVersion; @@ -21,10 +25,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; +import fj.data.Either; @Component public class SdcCatalogMigration implements Migration { diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java new file mode 100644 index 0000000000..ac93b92fd1 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/UtilsTest.java @@ -0,0 +1,101 @@ +package org.openecomp.sdc.asdctool; + +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.core.Response; + +import org.apache.commons.configuration.Configuration; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.junit.Assert; +import org.junit.Test; + +import com.thinkaurelius.titan.core.TitanGraph; + +public class UtilsTest { + + /* + * private Utils createTestSubject() { return new Utils(); } + */ + + @Test + public void testBuildOkResponse() throws Exception { + int status = 0; + Object entity = null; + Map additionalHeaders = null; + Response result; + + // test with mock entity + Object mockEntity = new Object(); + result = Utils.buildOkResponse(status, entity, additionalHeaders); + Assert.assertNotNull(result); + + // test with mock headers + Map mockAdditionalHeaders = new HashMap<>(); + mockAdditionalHeaders.put("stam", "stam"); + result = Utils.buildOkResponse(status, mockEntity, mockAdditionalHeaders); + Assert.assertNotNull(result); + } + + @Test + public void testOpenGraph() throws Exception { + Configuration conf = null; + TitanGraph result; + + // default test with null + result = Utils.openGraph(conf); + } + + @Test + public void testVertexLeftContainsRightProps() throws Exception { + Map leftProps = new HashMap<>(); + Map rightProps = null; + boolean result; + + // test 1 with null + rightProps = null; + result = Utils.vertexLeftContainsRightProps(leftProps, rightProps); + Assert.assertEquals(true, result); + + // test 2 with mocks + Map mockLeftProps = new HashMap<>(); + mockLeftProps.put("stam", new Object()); + Map mockRightProps = new HashMap<>(); + mockRightProps.put("stam", new Object()); + result = Utils.vertexLeftContainsRightProps(mockLeftProps, mockRightProps); + Assert.assertEquals(false, result); + + // test 3 with mocks + Object mockObject = new Object(); + mockLeftProps = new HashMap<>(); + mockLeftProps.put("stam", mockObject); + mockRightProps = new HashMap<>(); + mockRightProps.put("stam", mockObject); + result = Utils.vertexLeftContainsRightProps(mockLeftProps, mockRightProps); + Assert.assertEquals(true, result); + } + + @Test(expected=IllegalArgumentException.class) + public void testSetProperties() throws Exception { + Element element = null; + Map properties = null; + + // test 1 + properties = null; + Utils.setProperties(element, properties); + + // test 2 + properties = new HashMap<>(); + properties.put("stam", new Object()); + Utils.setProperties(element, properties); + } + + @Test(expected=NullPointerException.class) + public void testGetProperties() throws Exception { + Element element = null; + Map result; + + // default test + result = Utils.getProperties(element); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/cli/CLIUtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/cli/CLIUtilsTest.java new file mode 100644 index 0000000000..f49b2c7a0e --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/cli/CLIUtilsTest.java @@ -0,0 +1,15 @@ +package org.openecomp.sdc.asdctool.cli; + +import org.apache.commons.cli.Option; +import org.junit.Test; + +public class CLIUtilsTest { + + @Test + public void testGetConfigurationPathOption() throws Exception { + Option result; + + // default test + result = CLIUtils.getConfigurationPathOption(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java new file mode 100644 index 0000000000..028105572b --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java @@ -0,0 +1,42 @@ +package org.openecomp.sdc.asdctool.configuration; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.ArtifactUuidFix; +import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; +import org.springframework.beans.factory.config.PropertiesFactoryBean; + +public class ArtifactUUIDFixConfigurationTest { + + private ArtifactUUIDFixConfiguration createTestSubject() { + return new ArtifactUUIDFixConfiguration(); + } + + @Test + public void testArtifactUuidFix() throws Exception { + ArtifactUUIDFixConfiguration testSubject; + ArtifactUuidFix result; + + // default test + testSubject = createTestSubject(); + result = testSubject.artifactUuidFix(); + } + + @Test + public void testServiceDistributionArtifactsBuilder() throws Exception { + ArtifactUUIDFixConfiguration testSubject; + ServiceDistributionArtifactsBuilder result; + + // default test + testSubject = createTestSubject(); + } + + @Test + public void testMapper() throws Exception { + ArtifactUUIDFixConfiguration testSubject; + PropertiesFactoryBean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.mapper(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ConfigurationUploaderTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ConfigurationUploaderTest.java new file mode 100644 index 0000000000..6a651657a9 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ConfigurationUploaderTest.java @@ -0,0 +1,18 @@ +package org.openecomp.sdc.asdctool.configuration; + +import org.junit.Test; + +public class ConfigurationUploaderTest { + + private ConfigurationUploader createTestSubject() { + return new ConfigurationUploader(); + } + + @Test + public void testUploadConfigurationFiles() throws Exception { + String appConfigDir = "src/main/resources/config/"; + + // default test + ConfigurationUploader.uploadConfigurationFiles(appConfigDir); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java new file mode 100644 index 0000000000..5495d11827 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfigurationTest.java @@ -0,0 +1,23 @@ +package org.openecomp.sdc.asdctool.configuration; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.model.operations.impl.ConsumerOperation; + +public class GetConsumersConfigurationTest { + + private GetConsumersConfiguration createTestSubject() { + return new GetConsumersConfiguration(); + } + + @Test + public void testConsumerOperation() throws Exception { + GetConsumersConfiguration testSubject; + TitanGenericDao titanGenericDao = null; + ConsumerOperation result; + + // default test + testSubject = createTestSubject(); + result = testSubject.consumerOperation(titanGenericDao); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ESCatalogDAOMockTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ESCatalogDAOMockTest.java new file mode 100644 index 0000000000..86ee638c72 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ESCatalogDAOMockTest.java @@ -0,0 +1,78 @@ +package org.openecomp.sdc.asdctool.configuration.mocks.es; + +import java.util.List; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.api.ResourceUploadStatus; +import org.openecomp.sdc.be.resources.data.ESArtifactData; + +import fj.data.Either; + +public class ESCatalogDAOMockTest { + + private ESCatalogDAOMock createTestSubject() { + return new ESCatalogDAOMock(); + } + + @Test + public void testAddToIndicesMap() throws Exception { + ESCatalogDAOMock testSubject; + String typeName = ""; + String indexName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.addToIndicesMap(typeName, indexName); + } + + @Test + public void testWriteArtifact() throws Exception { + ESCatalogDAOMock testSubject; + ESArtifactData artifactData = null; + + // default test + testSubject = createTestSubject(); + testSubject.writeArtifact(artifactData); + } + + @Test + public void testGetArtifact() throws Exception { + ESCatalogDAOMock testSubject; + String id = ""; + Either result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifact(id); + } + + @Test + public void testGetArtifacts() throws Exception { + ESCatalogDAOMock testSubject; + String[] ids = new String[] { "" }; + Either, ResourceUploadStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(ids); + } + + @Test + public void testDeleteArtifact() throws Exception { + ESCatalogDAOMock testSubject; + String id = ""; + + // default test + testSubject = createTestSubject(); + testSubject.deleteArtifact(id); + } + + @Test + public void testDeleteAllArtifacts() throws Exception { + ESCatalogDAOMock testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.deleteAllArtifacts(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchClientMockTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchClientMockTest.java new file mode 100644 index 0000000000..e0add2ccf2 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchClientMockTest.java @@ -0,0 +1,49 @@ +package org.openecomp.sdc.asdctool.configuration.mocks.es; + +import org.junit.Test; + +public class ElasticSearchClientMockTest { + + private ElasticSearchClientMock createTestSubject() { + return new ElasticSearchClientMock(); + } + + @Test + public void testInitialize() throws Exception { + ElasticSearchClientMock testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.initialize(); + } + + @Test + public void testSetClusterName() throws Exception { + ElasticSearchClientMock testSubject; + String clusterName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setClusterName(clusterName); + } + + @Test + public void testSetLocal() throws Exception { + ElasticSearchClientMock testSubject; + String strIsLocal = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLocal(strIsLocal); + } + + @Test + public void testSetTransportClient() throws Exception { + ElasticSearchClientMock testSubject; + String strIsTransportclient = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setTransportClient(strIsTransportclient); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchMocksConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchMocksConfigurationTest.java new file mode 100644 index 0000000000..90af077e8c --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/ElasticSearchMocksConfigurationTest.java @@ -0,0 +1,43 @@ +package org.openecomp.sdc.asdctool.configuration.mocks.es; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.api.ICatalogDAO; +import org.openecomp.sdc.be.dao.api.IEsHealthCheckDao; +import org.openecomp.sdc.be.dao.es.ElasticSearchClient; + +public class ElasticSearchMocksConfigurationTest { + + private ElasticSearchMocksConfiguration createTestSubject() { + return new ElasticSearchMocksConfiguration(); + } + + @Test + public void testElasticSearchClientMock() throws Exception { + ElasticSearchMocksConfiguration testSubject; + ElasticSearchClient result; + + // default test + testSubject = createTestSubject(); + result = testSubject.elasticSearchClientMock(); + } + + @Test + public void testEsCatalogDAOMock() throws Exception { + ElasticSearchMocksConfiguration testSubject; + ICatalogDAO result; + + // default test + testSubject = createTestSubject(); + result = testSubject.esCatalogDAOMock(); + } + + @Test + public void testEsHealthCheckDaoMock() throws Exception { + ElasticSearchMocksConfiguration testSubject; + IEsHealthCheckDao result; + + // default test + testSubject = createTestSubject(); + result = testSubject.esHealthCheckDaoMock(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/EsHealthCheckDaoMockTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/EsHealthCheckDaoMockTest.java new file mode 100644 index 0000000000..dd761b4cf7 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/mocks/es/EsHealthCheckDaoMockTest.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.asdctool.configuration.mocks.es; + +import org.junit.Test; +import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; + +public class EsHealthCheckDaoMockTest { + + private EsHealthCheckDaoMock createTestSubject() { + return new EsHealthCheckDaoMock(); + } + + @Test + public void testGetClusterHealthStatus() throws Exception { + EsHealthCheckDaoMock testSubject; + HealthCheckStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getClusterHealthStatus(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java index 307d7a0c16..2d1c6a8e57 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.asdctool.enums; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.junit.After; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; - - public class SchemaZipFileEnumTest { private SchemaZipFileEnum testSubject; @@ -50,19 +50,119 @@ public class SchemaZipFileEnumTest { testSubject.setCollectionTitle(collectionTitle); assertEquals(collectionTitle, testSubject.getCollectionTitle()); } - + @Test public void setGetImportFileList_shouldSetGetFile1File2() { String[] importFileList = new String[] { "File1", "File2" }; String[] receivedImportFileList; testSubject.setImportFileList(importFileList); - receivedImportFileList = testSubject.getImportFileList(); + receivedImportFileList = testSubject.getImportFileList(); assertNotNull(receivedImportFileList); assertEquals("File1", receivedImportFileList[0]); assertEquals("File2", receivedImportFileList[1]); } private SchemaZipFileEnum createTestSubject() { - return SchemaZipFileEnum.DATA; + return SchemaZipFileEnum.DATA; + } + + @Test + public void testGetFileName() throws Exception { + SchemaZipFileEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFileName(); + } + + @Test + public void testSetFileName() throws Exception { + SchemaZipFileEnum testSubject; + String fileName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setFileName(fileName); + } + + @Test + public void testGetSourceFolderName() throws Exception { + SchemaZipFileEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSourceFolderName(); + } + + @Test + public void testSetSourceFolderName() throws Exception { + SchemaZipFileEnum testSubject; + String sourceFolderName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSourceFolderName(sourceFolderName); + } + + @Test + public void testGetSourceFileName() throws Exception { + SchemaZipFileEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSourceFileName(); + } + + @Test + public void testSetSourceFileName() throws Exception { + SchemaZipFileEnum testSubject; + String sourceFileName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSourceFileName(sourceFileName); + } + + @Test + public void testGetCollectionTitle() throws Exception { + SchemaZipFileEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCollectionTitle(); + } + + @Test + public void testSetCollectionTitle() throws Exception { + SchemaZipFileEnum testSubject; + String collectionTitle = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCollectionTitle(collectionTitle); + } + + @Test + public void testGetImportFileList() throws Exception { + SchemaZipFileEnum testSubject; + String[] result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getImportFileList(); + } + + @Test + public void testSetImportFileList() throws Exception { + SchemaZipFileEnum testSubject; + String[] importFileList = new String[] { "" }; + + // default test + testSubject = createTestSubject(); + testSubject.setImportFileList(importFileList); } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java new file mode 100644 index 0000000000..d8fec34e30 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java @@ -0,0 +1,92 @@ +package org.openecomp.sdc.asdctool.impl; + +import java.util.List; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.model.Component; + +public class ArtifactUuidFixTest { + + private ArtifactUuidFix createTestSubject() { + return new ArtifactUuidFix(); + } + + @Test(expected=NullPointerException.class) + public void testDoFix() throws Exception { + ArtifactUuidFix testSubject; + String fixComponent = ""; + String runMode = ""; + boolean result; + + // test 1 + testSubject = createTestSubject(); + fixComponent = "vf_only"; + result = testSubject.doFix(fixComponent, runMode); + Assert.assertEquals(false, result); + + // test 2 + testSubject = createTestSubject(); + runMode = "service_vf"; + result = testSubject.doFix(fixComponent, runMode); + Assert.assertEquals(false, result); + + // test 3 + testSubject = createTestSubject(); + runMode = "fix"; + result = testSubject.doFix(fixComponent, runMode); + Assert.assertEquals(false, result); + + // test 4 + testSubject = createTestSubject(); + runMode = "fix"; + result = testSubject.doFix(fixComponent, runMode); + Assert.assertEquals(false, result); + + // test 5 + testSubject = createTestSubject(); + runMode = "fix_only_services"; + result = testSubject.doFix(fixComponent, runMode); + Assert.assertEquals(false, result); + } + + @Test + public void testDoFixTosca() throws Exception { + ArtifactUuidFix testSubject; + Map> nodeToFix = null; + Map> vfToFix = null; + Map> serviceToFix = null; + boolean result; + + // default test + testSubject = createTestSubject(); + } + + @Test(expected=NullPointerException.class) + public void testGetVerticesToValidate() throws Exception { + ArtifactUuidFix testSubject; + VertexTypeEnum type = null; + Map hasProps = null; + Map> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVerticesToValidate(type, hasProps); + } + + @Test(expected=NullPointerException.class) + public void testValidateTosca() throws Exception { + ArtifactUuidFix testSubject; + Map> vertices = null; + Map> compToFix = null; + String name = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validateTosca(vertices, compToFix, name); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java new file mode 100644 index 0000000000..af93fc2414 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java @@ -0,0 +1,61 @@ +package org.openecomp.sdc.asdctool.impl; + +import java.text.SimpleDateFormat; +import java.util.EnumMap; +import java.util.TimeZone; + +import org.elasticsearch.common.settings.SettingsException; +import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.DataMigration.TypeToTableMapping; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; + +public class DataMigrationTest { + + private DataMigration createTestSubject() { + return new DataMigration(); + } + + /*@Test(expected=IllegalArgumentException.class) + public void testMigrateDataEsToCassandra() throws Exception { + DataMigration testSubject; + String appConfigDir = "src/main/resources/config/"; + boolean exportFromEs = false; + boolean importToCassandra = false; + + // default test + testSubject = createTestSubject(); + testSubject.migrateDataEsToCassandra(appConfigDir, exportFromEs, importToCassandra); + }*/ + + @Test(expected=NullPointerException.class) + public void testCreateAuditRecord() throws Exception { + DataMigration testSubject; + + EnumMap auditingFields = new EnumMap(AuditingFieldsKeysEnum.class); + auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingActionEnum.GET_CATEGORY_HIERARCHY.getName()); + + String DATE_FORMAT_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS z"; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT_PATTERN); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + + auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, "2018-05-02 06:06:18.294 UTC"); + + // default test + testSubject = createTestSubject(); + testSubject.createAuditRecord(auditingFields); + } + + @Test + public void testTypeToTableMapping() throws Exception { + TypeToTableMapping[] values = TypeToTableMapping.values(); + + for (TypeToTableMapping typeToTableMapping : values) { + TypeToTableMapping.getTableByType(typeToTableMapping.getTypeName()); + typeToTableMapping.getTable(); + + } + + TypeToTableMapping.getTableByType("stam"); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java new file mode 100644 index 0000000000..cb4d2b78d2 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java @@ -0,0 +1,64 @@ +package org.openecomp.sdc.asdctool.impl; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.CassandraClient; +import org.openecomp.sdc.be.dao.cassandra.SdcSchemaFilesCassandraDao; + +public class EsToCassandraDataMigrationConfigTest { + + private EsToCassandraDataMigrationConfig createTestSubject() { + return new EsToCassandraDataMigrationConfig(); + } + + @Test + public void testDataMigration() throws Exception { + EsToCassandraDataMigrationConfig testSubject; + DataMigration result; + + // default test + testSubject = createTestSubject(); + result = testSubject.dataMigration(); + } + + @Test + public void testArtifactCassandraDao() throws Exception { + EsToCassandraDataMigrationConfig testSubject; + ArtifactCassandraDao result; + + // default test + testSubject = createTestSubject(); + result = testSubject.artifactCassandraDao(); + } + + @Test + public void testAuditCassandraDao() throws Exception { + EsToCassandraDataMigrationConfig testSubject; + AuditCassandraDao result; + + // default test + testSubject = createTestSubject(); + result = testSubject.auditCassandraDao(); + } + + @Test + public void testCassandraClient() throws Exception { + EsToCassandraDataMigrationConfig testSubject; + CassandraClient result; + + // default test + testSubject = createTestSubject(); + result = testSubject.cassandraClient(); + } + + @Test + public void testSdcSchemaFilesCassandraDao() throws Exception { + EsToCassandraDataMigrationConfig testSubject; + SdcSchemaFilesCassandraDao result; + + // default test + testSubject = createTestSubject(); + result = testSubject.sdcSchemaFilesCassandraDao(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java new file mode 100644 index 0000000000..51dfca33a2 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java @@ -0,0 +1,42 @@ +package org.openecomp.sdc.asdctool.impl; + +import java.nio.file.NoSuchFileException; + +import org.junit.Test; + +public class GraphJsonValidatorTest { + + private GraphJsonValidator createTestSubject() { + return new GraphJsonValidator(); + } + + @Test + public void testVerifyTitanJson() throws Exception { + GraphJsonValidator testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.verifyTitanJson("src/test/resources/graph.json"); + } + + @Test + public void testVerifyTitanJsonErrorFile() throws Exception { + GraphJsonValidator testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.verifyTitanJson("src/test/resources/graphError.json"); + } + + @Test(expected=NoSuchFileException.class) + public void testVerifyTitanJsonNoFile() throws Exception { + GraphJsonValidator testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.verifyTitanJson("stam"); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java new file mode 100644 index 0000000000..3f5d3e144d --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLConverterTest.java @@ -0,0 +1,175 @@ +package org.openecomp.sdc.asdctool.impl; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.junit.Test; + +import com.thinkaurelius.titan.core.TitanGraph; + +public class GraphMLConverterTest { + + public GraphMLConverter createTestSubject() { + return new GraphMLConverter(); + } + + /*@Before + public void createGraphTestSubject() { + converter = new GraphMLConverter(); + openGraph = converter.openGraph("src/main/resources/config/titan.properties"); + }*/ + + /*@After + public void destroyGraphTestSubject() { + converter = new GraphMLConverter(); + converter.clearGraph(openGraph); + }*/ + + @Test + public void testImportGraph() throws Exception { + GraphMLConverter testSubject; + String[] args = new String[] { "" }; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.importGraph(args); + } + + @Test + public void testExportGraph() throws Exception { + GraphMLConverter testSubject; + String[] args = new String[] { "" }; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.exportGraph(args); + } + + @Test + public void testExportGraphMl() throws Exception { + GraphMLConverter testSubject; + String[] args = new String[] { "" }; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.exportGraphMl(args); + } + + @Test + public void testFindErrorInJsonGraph() throws Exception { + GraphMLConverter testSubject; + String[] args = new String[] { "" }; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.findErrorInJsonGraph(args); + } + + @Test(expected=IllegalArgumentException.class) + public void testOpenGraph() throws Exception { + GraphMLConverter testSubject; + String titanFileLocation = ""; + TitanGraph result; + + // default test + testSubject = createTestSubject(); + result = testSubject.openGraph("src/main/resources/config/titan.properties"); + } + + @Test(expected=NullPointerException.class) + public void testExportJsonGraph() throws Exception { + GraphMLConverter testSubject; + TitanGraph graph = null; + String outputDirectory = ""; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.exportJsonGraph(graph, outputDirectory); + } + + @Test(expected=NullPointerException.class) + public void testExportGraphMl_1() throws Exception { + GraphMLConverter testSubject; + TitanGraph graph = null; + String outputDirectory = ""; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.exportGraphMl(graph, outputDirectory); + } + + @Test + public void testImportJsonGraph() throws Exception { + GraphMLConverter testSubject; + TitanGraph graph = null; + String graphJsonFile = ""; + List> propertiesCriteriaToDelete = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.importJsonGraph(graph, graphJsonFile, propertiesCriteriaToDelete); + } + + @Test(expected=NullPointerException.class) + public void testFindErrorInJsonGraph_1() throws Exception { + GraphMLConverter testSubject; + TitanGraph graph = null; + String outputDirectory = ""; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.findErrorInJsonGraph(graph, outputDirectory); + } + + @Test + public void testClearGraph() throws Exception { + TitanGraph graph = null; + + // default test + //GraphMLConverter.clearGraph("src/main/resources/config/titan.properties"); + } + + @Test(expected=NullPointerException.class) + public void testExportUsers() throws Exception { + GraphMLConverter testSubject; + TitanGraph graph = null; + String outputDirectory = ""; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.exportUsers(graph, outputDirectory); + } + + @Test(expected=NullPointerException.class) + public void testGetProperties() throws Exception { + GraphMLConverter testSubject; + Element element = null; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(element); + } + + @Test + public void testExportUsers_1() throws Exception { + GraphMLConverter testSubject; + String[] args = new String[] { "" }; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.exportUsers(args); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java new file mode 100644 index 0000000000..c6905a939d --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.asdctool.impl; + +import org.junit.Test; + +public class GraphMLDataAnalyzerTest { + + private GraphMLDataAnalyzer createTestSubject() { + return new GraphMLDataAnalyzer(); + } + + @Test + public void testAnalyzeGraphMLData() throws Exception { + GraphMLDataAnalyzer testSubject; + String[] args = new String[] { "export", "src/main/resources/config/titan.properties", "./" }; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.analyzeGraphMLData(args); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java new file mode 100644 index 0000000000..08de0eb951 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ProductLogicTest.java @@ -0,0 +1,24 @@ +package org.openecomp.sdc.asdctool.impl; + +import org.junit.Test; + +public class ProductLogicTest { + + private ProductLogic createTestSubject() { + return new ProductLogic(); + } + + @Test(expected=NullPointerException.class) + public void testDeleteAllProducts() throws Exception { + ProductLogic testSubject; + String titanFile = ""; + String beHost = ""; + String bePort = ""; + String adminUser = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteAllProducts(titanFile, beHost, bePort, adminUser); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/RestUtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/RestUtilsTest.java new file mode 100644 index 0000000000..c1111917db --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/RestUtilsTest.java @@ -0,0 +1,24 @@ +package org.openecomp.sdc.asdctool.impl; + +import org.junit.Test; + +public class RestUtilsTest { + + private RestUtils createTestSubject() { + return new RestUtils(); + } + + @Test + public void testDeleteProduct() throws Exception { + RestUtils testSubject; + String productUid = ""; + String beHost = ""; + String bePort = ""; + String adminUser = ""; + Integer result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteProduct(productUid, beHost, bePort, adminUser); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java new file mode 100644 index 0000000000..431c59f591 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializerTest.java @@ -0,0 +1,16 @@ +package org.openecomp.sdc.asdctool.impl; + +import org.junit.Test; + +public class TitanGraphInitializerTest { + + @Test(expected=IllegalArgumentException.class) + public void testCreateGraph() throws Exception { + String titanCfgFile = ""; + boolean result; + + // default test + result = TitanGraphInitializer.createGraph(""); + + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java new file mode 100644 index 0000000000..503f52a5af --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertexTest.java @@ -0,0 +1,39 @@ +package org.openecomp.sdc.asdctool.impl; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +import com.thinkaurelius.titan.core.TitanGraph; + +public class UpdatePropertyOnVertexTest { + + private UpdatePropertyOnVertex createTestSubject() { + return new UpdatePropertyOnVertex(); + } + + @Test(expected=IllegalArgumentException.class) + public void testOpenGraph() throws Exception { + UpdatePropertyOnVertex testSubject; + String titanFileLocation = ""; + TitanGraph result; + + // default test + testSubject = createTestSubject(); + result = testSubject.openGraph(""); + } + + @Test(expected=NullPointerException.class) + public void testUpdatePropertyOnServiceAtLeastCertified() throws Exception { + UpdatePropertyOnVertex testSubject; + String titanFile = ""; + Map keyValueToSet = null; + List> orCriteria = null; + Integer result; + + // default test + testSubject = createTestSubject(); + result = testSubject.updatePropertyOnServiceAtLeastCertified(titanFile, keyValueToSet, orCriteria); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java new file mode 100644 index 0000000000..32aec782c1 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java @@ -0,0 +1,26 @@ +package org.openecomp.sdc.asdctool.impl.validator; + +import java.util.LinkedList; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecuter; + +public class ArtifactToolBLTest { + + private ArtifactToolBL createTestSubject() { + return new ArtifactToolBL(); + } + + //Generated test + @Test(expected=NullPointerException.class) + public void testValidateAll() throws Exception { + ArtifactToolBL testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + testSubject.validators = new LinkedList(); + testSubject.validators.add(new NodeToscaArtifactsValidatorExecuter()); + result = testSubject.validateAll(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java new file mode 100644 index 0000000000..bb74c70423 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java @@ -0,0 +1,25 @@ +package org.openecomp.sdc.asdctool.impl.validator; + +import java.util.LinkedList; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter; + +public class ValidationToolBLTest { + + private ValidationToolBL createTestSubject() { + return new ValidationToolBL(); + } + + @Test(expected=NullPointerException.class) + public void testValidateAll() throws Exception { + ValidationToolBL testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + testSubject.validators = new LinkedList<>(); + testSubject.validators.add(new ServiceValidatorExecuter()); + result = testSubject.validateAll(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationConfigManagerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationConfigManagerTest.java index 1dd5926cc5..f639c8a7de 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationConfigManagerTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationConfigManagerTest.java @@ -55,4 +55,23 @@ public class ValidationConfigManagerTest { // default test result = ValidationConfigManager.getValidationConfiguration(); } + + + @Test + public void testGetOutputFullFilePath() throws Exception { + String result; + + // default test + result=ValidationConfigManager.getOutputFullFilePath(); + } + + + @Test + public void testSetOutputFullFilePath() throws Exception { + String outputPath = ""; + + + // default test + ValidationConfigManager.setOutputFullFilePath(outputPath); + } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java index 8dc2c4f0ec..da1ef90a40 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java @@ -1,8 +1,12 @@ package org.openecomp.sdc.asdctool.impl.validator.config; import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL; import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL; +import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecuter; +import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceToscaArtifactsValidatorExecutor; import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter; +import org.openecomp.sdc.asdctool.impl.validator.executers.VFToscaArtifactValidatorExecutor; import org.openecomp.sdc.asdctool.impl.validator.executers.VfValidatorExecuter; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidationUtils; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask; @@ -23,14 +27,12 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaDataOperation; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; - public class ValidationToolConfigurationTest { private ValidationToolConfiguration createTestSubject() { return new ValidationToolConfiguration(); } - @Test public void testBasicServiceValidator() { ValidationToolConfiguration testSubject; @@ -41,7 +43,6 @@ public class ValidationToolConfigurationTest { result = testSubject.basicServiceValidator(); } - @Test public void testVfArtifactValidationTask() { ValidationToolConfiguration testSubject; @@ -52,7 +53,6 @@ public class ValidationToolConfigurationTest { result = testSubject.vfArtifactValidationTask(); } - @Test public void testServiceArtifactValidationTask() { ValidationToolConfiguration testSubject; @@ -63,7 +63,6 @@ public class ValidationToolConfigurationTest { result = testSubject.serviceArtifactValidationTask(); } - @Test public void testModuleJsonTask() { ValidationToolConfiguration testSubject; @@ -74,7 +73,6 @@ public class ValidationToolConfigurationTest { result = testSubject.moduleJsonTask(); } - @Test public void testValidationToolBL() { ValidationToolConfiguration testSubject; @@ -85,7 +83,6 @@ public class ValidationToolConfigurationTest { result = testSubject.validationToolBL(); } - @Test public void testBasicVfValidator() { ValidationToolConfiguration testSubject; @@ -95,7 +92,7 @@ public class ValidationToolConfigurationTest { testSubject = createTestSubject(); result = testSubject.basicVfValidator(); } - + @Test public void testArtifactCassandraDao() { ValidationToolConfiguration testSubject; @@ -106,7 +103,6 @@ public class ValidationToolConfigurationTest { result = testSubject.artifactCassandraDao(); } - @Test public void testArtifactValidationUtils() { ValidationToolConfiguration testSubject; @@ -117,7 +113,6 @@ public class ValidationToolConfigurationTest { result = testSubject.artifactValidationUtils(); } - @Test public void testJsonGroupsOperation() { ValidationToolConfiguration testSubject; @@ -128,7 +123,6 @@ public class ValidationToolConfigurationTest { result = testSubject.jsonGroupsOperation(); } - @Test public void testCassandraClient() { ValidationToolConfiguration testSubject; @@ -139,7 +133,6 @@ public class ValidationToolConfigurationTest { result = testSubject.cassandraClient(); } - @Test public void testDaoStrategy() { ValidationToolConfiguration testSubject; @@ -150,10 +143,6 @@ public class ValidationToolConfigurationTest { result = testSubject.daoStrategy(); } - - - - @Test public void testToscaOperationFacade() { ValidationToolConfiguration testSubject; @@ -164,7 +153,6 @@ public class ValidationToolConfigurationTest { result = testSubject.toscaOperationFacade(); } - @Test public void testNodeTypeOperation() { ValidationToolConfiguration testSubject; @@ -176,7 +164,6 @@ public class ValidationToolConfigurationTest { result = testSubject.nodeTypeOperation(migrationDerivedNodeTypeResolver); } - @Test public void testTopologyTemplateOperation() { ValidationToolConfiguration testSubject; @@ -187,10 +174,6 @@ public class ValidationToolConfigurationTest { result = testSubject.topologyTemplateOperation(); } - - - - @Test public void testMigrationDerivedNodeTypeResolver() { ValidationToolConfiguration testSubject; @@ -201,7 +184,6 @@ public class ValidationToolConfigurationTest { result = testSubject.migrationDerivedNodeTypeResolver(); } - @Test public void testTitanDao() { ValidationToolConfiguration testSubject; @@ -213,7 +195,6 @@ public class ValidationToolConfigurationTest { result = testSubject.titanDao(titanGraphClient); } - @Test public void testCategoryOperation() { ValidationToolConfiguration testSubject; @@ -224,7 +205,6 @@ public class ValidationToolConfigurationTest { result = testSubject.categoryOperation(); } - @Test public void testArtifactsOperation() { ValidationToolConfiguration testSubject; @@ -235,7 +215,6 @@ public class ValidationToolConfigurationTest { result = testSubject.artifactsOperation(); } - @Test public void testToscaDataOperation() { ValidationToolConfiguration testSubject; @@ -246,7 +225,6 @@ public class ValidationToolConfigurationTest { result = testSubject.toscaDataOperation(); } - @Test public void testToscaElementLifecycleOperation() { ValidationToolConfiguration testSubject; @@ -256,4 +234,80 @@ public class ValidationToolConfigurationTest { testSubject = createTestSubject(); result = testSubject.toscaElementLifecycleOperation(); } + + @Test + public void testNodeToscaArtifactsValidatorValidator() throws Exception { + ValidationToolConfiguration testSubject; + NodeToscaArtifactsValidatorExecuter result; + + // default test + testSubject = createTestSubject(); + result = testSubject.NodeToscaArtifactsValidatorValidator(); + } + + @Test + public void testServiceToscaArtifactsValidator() throws Exception { + ValidationToolConfiguration testSubject; + ServiceToscaArtifactsValidatorExecutor result; + + // default test + testSubject = createTestSubject(); + result = testSubject.ServiceToscaArtifactsValidator(); + } + + @Test + public void testVFToscaArtifactValidator() throws Exception { + ValidationToolConfiguration testSubject; + VFToscaArtifactValidatorExecutor result; + + // default test + testSubject = createTestSubject(); + result = testSubject.VFToscaArtifactValidator(); + } + + @Test + public void testArtifactToolBL() throws Exception { + ValidationToolConfiguration testSubject; + ArtifactToolBL result; + + // default test + testSubject = createTestSubject(); + result = testSubject.artifactToolBL(); + } + + //TODO runs as single JUnit Fails on maven clean install + /*@Test(expected=NullPointerException.class) + public void testReportManager() throws Exception { + ValidationToolConfiguration testSubject; + ReportManager result; + + // default test + testSubject = createTestSubject(); + result = testSubject.reportManager(); + } +*/ + + //TODO runs as single JUnit Fails on maven clean install + /*@Test(expected=NullPointerException.class) + public void testTitanMigrationClient() throws Exception { + ValidationToolConfiguration testSubject; + TitanClientStrategy titanClientStrategy = null; + TitanGraphClient result; + + // default test + testSubject = createTestSubject(); + result = testSubject.titanMigrationClient(titanClientStrategy); + }*/ + + //TODO runs as single JUnit Fails on maven clean install + /*@Test(expected=NullPointerException.class) + public void testNodeTemplateOperation() throws Exception { + ValidationToolConfiguration testSubject; + NodeTemplateOperation result; + + // default test + testSubject = createTestSubject(); + System.out.println("ConfigurationManager Print" + ConfigurationManager.getConfigurationManager().getConfiguration().toString()); + result = testSubject.nodeTemplateOperation(); + }*/ } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java new file mode 100644 index 0000000000..e14530212a --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java @@ -0,0 +1,64 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.Resource; + +public class ArtifactValidatorExecuterTest { + + private ArtifactValidatorExecuter createTestSubject() { + return new ArtifactValidatorExecuter(); + } + + @Test + public void testGetName() throws Exception { + ArtifactValidatorExecuter testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test(expected=NullPointerException.class) + public void testGetVerticesToValidate() throws Exception { + ArtifactValidatorExecuter testSubject; + VertexTypeEnum type = null; + Map hasProps = null; + + // default test + testSubject = createTestSubject(); + testSubject.getVerticesToValidate(type, hasProps); + } + + @Test + public void testSetName() throws Exception { + ArtifactValidatorExecuter testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test(expected=NullPointerException.class) + public void testValidate() throws Exception { + ArtifactValidatorExecuter testSubject; + Map> vertices = new HashMap<>(); + LinkedList linkedList = new LinkedList(); + linkedList.add(new Resource()); + vertices.put("stam", linkedList); + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validate(vertices); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java new file mode 100644 index 0000000000..40eedc12a0 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +import org.junit.Test; + +public class NodeToscaArtifactsValidatorExecuterTest { + + private NodeToscaArtifactsValidatorExecuter createTestSubject() { + return new NodeToscaArtifactsValidatorExecuter(); + } + + @Test(expected=NullPointerException.class) + public void testExecuteValidations() throws Exception { + NodeToscaArtifactsValidatorExecuter testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.executeValidations(); + } + + @Test + public void testGetName() throws Exception { + NodeToscaArtifactsValidatorExecuter testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + NodeToscaArtifactsValidatorExecuter testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java new file mode 100644 index 0000000000..ede353eefc --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +import org.junit.Test; + +public class ServiceToscaArtifactsValidatorExecutorTest { + + private ServiceToscaArtifactsValidatorExecutor createTestSubject() { + return new ServiceToscaArtifactsValidatorExecutor(); + } + + @Test(expected = NullPointerException.class) + public void testExecuteValidations() throws Exception { + ServiceToscaArtifactsValidatorExecutor testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.executeValidations(); + } + + @Test + public void testGetName() throws Exception { + ServiceToscaArtifactsValidatorExecutor testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + ServiceToscaArtifactsValidatorExecutor testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java index 890bdfd002..dbfe02bfa9 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java @@ -2,17 +2,12 @@ package org.openecomp.sdc.asdctool.impl.validator.executers; import org.junit.Test; - public class ServiceValidatorExecuterTest { private ServiceValidatorExecuter createTestSubject() { return new ServiceValidatorExecuter(); } - - - - @Test public void testGetName() { ServiceValidatorExecuter testSubject; @@ -22,4 +17,14 @@ public class ServiceValidatorExecuterTest { testSubject = createTestSubject(); result = testSubject.getName(); } + + @Test(expected=NullPointerException.class) + public void testExecuteValidations() throws Exception { + ServiceValidatorExecuter testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.executeValidations(); + } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java index f3fdebe8e9..e0ee6d0346 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java @@ -1,7 +1,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executers; import org.junit.Test; - +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; public class TopologyTemplateValidatorExecuterTest { @@ -9,7 +9,6 @@ public class TopologyTemplateValidatorExecuterTest { return new TopologyTemplateValidatorExecuter(); } - @Test public void testSetName() { TopologyTemplateValidatorExecuter testSubject; @@ -20,7 +19,6 @@ public class TopologyTemplateValidatorExecuterTest { testSubject.setName(name); } - @Test public void testGetName() { TopologyTemplateValidatorExecuter testSubject; @@ -31,9 +29,12 @@ public class TopologyTemplateValidatorExecuterTest { result = testSubject.getName(); } - - - - + @Test(expected=NullPointerException.class) + public void testGetVerticesToValidate() throws Exception { + TopologyTemplateValidatorExecuter testSubject; + // default test + testSubject = createTestSubject(); + testSubject.getVerticesToValidate(ComponentTypeEnum.PRODUCT); + } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java new file mode 100644 index 0000000000..79948398b4 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +import org.junit.Test; + +public class VFToscaArtifactValidatorExecutorTest { + + private VFToscaArtifactValidatorExecutor createTestSubject() { + return new VFToscaArtifactValidatorExecutor(); + } + + @Test(expected=NullPointerException.class) + public void testExecuteValidations() throws Exception { + VFToscaArtifactValidatorExecutor testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.executeValidations(); + } + + @Test + public void testGetName() throws Exception { + VFToscaArtifactValidatorExecutor testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + VFToscaArtifactValidatorExecutor testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java index 83dac8a35a..7a349c998f 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java @@ -2,15 +2,12 @@ package org.openecomp.sdc.asdctool.impl.validator.executers; import org.junit.Test; - public class VfValidatorExecuterTest { private VfValidatorExecuter createTestSubject() { return new VfValidatorExecuter(); } - - @Test public void testGetName() { VfValidatorExecuter testSubject; @@ -20,4 +17,14 @@ public class VfValidatorExecuterTest { testSubject = createTestSubject(); result = testSubject.getName(); } + + @Test(expected=NullPointerException.class) + public void testExecuteValidations() throws Exception { + VfValidatorExecuter testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.executeValidations(); + } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java new file mode 100644 index 0000000000..27deb6bce8 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java @@ -0,0 +1,62 @@ +package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; + +public class ArtifactValidationUtilsTest { + + private ArtifactValidationUtils createTestSubject() { + return new ArtifactValidationUtils(); + } + + @Test(expected=NullPointerException.class) + public void testValidateArtifactsAreInCassandra() throws Exception { + ArtifactValidationUtils testSubject; + GraphVertex vertex = null; + String taskName = ""; + List artifacts = null; + ArtifactsVertexResult result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validateArtifactsAreInCassandra(vertex, taskName, artifacts); + } + + @Test(expected=NullPointerException.class) + public void testIsArtifcatInCassandra() throws Exception { + ArtifactValidationUtils testSubject; + String uniueId = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isArtifcatInCassandra(uniueId); + } + + @Test + public void testAddRelevantArtifacts() throws Exception { + ArtifactValidationUtils testSubject; + Map artifactsMap = null; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.addRelevantArtifacts(artifactsMap); + } + + @Test(expected=NullPointerException.class) + public void testValidateTopologyTemplateArtifacts() throws Exception { + ArtifactValidationUtils testSubject; + GraphVertex vertex = null; + String taskName = ""; + ArtifactsVertexResult result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validateTopologyTemplateArtifacts(vertex, taskName); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactsVertexResultTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactsVertexResultTest.java index d16c3fc555..903c611ab1 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactsVertexResultTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactsVertexResultTest.java @@ -2,14 +2,12 @@ package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts; import org.junit.Test; - public class ArtifactsVertexResultTest { private ArtifactsVertexResult createTestSubject() { return new ArtifactsVertexResult(); } - @Test public void testAddNotFoundArtifact() { ArtifactsVertexResult testSubject; @@ -20,7 +18,6 @@ public class ArtifactsVertexResultTest { testSubject.addNotFoundArtifact(artifactId); } - @Test public void testGetResult() { ArtifactsVertexResult testSubject; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java index ef0b23bc59..15c2b07dd7 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java @@ -1,11 +1,23 @@ package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts; +import org.junit.Test; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; + public class ServiceArtifactValidationTaskTest { private ServiceArtifactValidationTask createTestSubject() { return new ServiceArtifactValidationTask(); } - + @Test(expected=NullPointerException.class) + public void testValidate() throws Exception { + ServiceArtifactValidationTask testSubject; + GraphVertex vertex = null; + ArtifactsVertexResult result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validate(vertex); + } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java index 04aec47ebb..8d753e182c 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java @@ -1,11 +1,24 @@ package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts; +import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.validator.utils.VertexResult; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; + public class VfArtifactValidationTaskTest { private VfArtifactValidationTask createTestSubject() { return new VfArtifactValidationTask(); } - + @Test(expected=NullPointerException.class) + public void testValidate() throws Exception { + VfArtifactValidationTask testSubject; + GraphVertex vertex = null; + VertexResult result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validate(vertex); + } } \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java new file mode 100644 index 0000000000..5a55742eab --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java @@ -0,0 +1,23 @@ +package org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.validator.utils.VertexResult; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; + +public class ModuleJsonTaskTest { + + private ModuleJsonTask createTestSubject() { + return new ModuleJsonTask(); + } + + @Test(expected=NullPointerException.class) + public void testValidate() throws Exception { + ModuleJsonTask testSubject; + GraphVertex vertex = null; + VertexResult result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validate(vertex); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ElementTypeEnumTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ElementTypeEnumTest.java index e6e564e709..163994e423 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ElementTypeEnumTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ElementTypeEnumTest.java @@ -19,6 +19,7 @@ public class ElementTypeEnumTest { // default test result = ElementTypeEnum.getByType(elementType); + result = ElementTypeEnum.getByType(ElementTypeEnum.VF.getElementType()); } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManagerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManagerTest.java new file mode 100644 index 0000000000..a50af44a8c --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManagerTest.java @@ -0,0 +1,88 @@ +package org.openecomp.sdc.asdctool.impl.validator.utils; + +import java.util.Set; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; + +public class ReportManagerTest { + + @Test + public void testReportTaskEnd() throws Exception { + String vertexId = ""; + String taskName = ""; + VertexResult result = null; + + // default test + ReportManager.reportTaskEnd(vertexId, taskName, result); + } + + @Test + public void testAddFailedVertex() throws Exception { + String taskName = ""; + String vertexId = ""; + + // default test + ReportManager.addFailedVertex(taskName, vertexId); + } + + @Test(expected = NullPointerException.class) + public void testPrintValidationTaskStatus() throws Exception { + GraphVertex vertexScanned = null; + String taskName = ""; + boolean success = false; + + // default test + ReportManager.printValidationTaskStatus(vertexScanned, taskName, success); + } + + @Test(expected = NullPointerException.class) + public void testWriteReportLineToFile() throws Exception { + String message = ""; + + // default test + ReportManager.writeReportLineToFile(message); + } + + @Test(expected = NullPointerException.class) + public void testReportValidatorTypeSummary() throws Exception { + String validatorName = ""; + Set failedTasksNames = null; + Set successTasksNames = null; + + // default test + ReportManager.reportValidatorTypeSummary(validatorName, failedTasksNames, successTasksNames); + } + + @Test(expected = NullPointerException.class) + public void testReportStartValidatorRun() throws Exception { + String validatorName = ""; + int componenentsNum = 0; + + // default test + ReportManager.reportStartValidatorRun(validatorName, componenentsNum); + } + + @Test(expected = NullPointerException.class) + public void testReportStartTaskRun() throws Exception { + GraphVertex vertex = null; + String taskName = ""; + + // default test + ReportManager.reportStartTaskRun(vertex, taskName); + } + + @Test(expected = NullPointerException.class) + public void testReportEndOfToolRun() throws Exception { + + // default test + ReportManager.reportEndOfToolRun(); + } + + @Test(expected = NullPointerException.class) + public void testPrintAllResults() throws Exception { + + // default test + ReportManager.printAllResults(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/VertexResultTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/VertexResultTest.java index d65fb001f8..4b57b686c6 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/VertexResultTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/VertexResultTest.java @@ -9,6 +9,10 @@ public class VertexResultTest { return new VertexResult(); } + @Test + public void createTestSubjectBoolean() { + new VertexResult(true); + } @Test public void testGetStatus() { diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/VfModuleArtifactPayloadExTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/VfModuleArtifactPayloadExTest.java new file mode 100644 index 0000000000..50c01b074c --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/VfModuleArtifactPayloadExTest.java @@ -0,0 +1,193 @@ +package org.openecomp.sdc.asdctool.impl.validator.utils; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +public class VfModuleArtifactPayloadExTest { + + private VfModuleArtifactPayloadEx createTestSubject() { + return new VfModuleArtifactPayloadEx(); + } + + @Test + public void testGetVfModuleModelName() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelName(); + } + + @Test + public void testSetVfModuleModelName() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String vfModuleModelName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelName(vfModuleModelName); + } + + @Test + public void testGetVfModuleModelInvariantUUID() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelInvariantUUID(); + } + + @Test + public void testSetVfModuleModelInvariantUUID() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String vfModuleModelInvariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelInvariantUUID(vfModuleModelInvariantUUID); + } + + @Test + public void testGetVfModuleModelVersion() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelVersion(); + } + + @Test + public void testSetVfModuleModelVersion() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String vfModuleModelVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelVersion(vfModuleModelVersion); + } + + @Test + public void testGetVfModuleModelUUID() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelUUID(); + } + + @Test + public void testSetVfModuleModelUUID() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String vfModuleModelUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelUUID(vfModuleModelUUID); + } + + @Test + public void testGetVfModuleModelCustomizationUUID() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelCustomizationUUID(); + } + + @Test + public void testSetVfModuleModelCustomizationUUID() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String vfModuleModelCustomizationUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelCustomizationUUID(vfModuleModelCustomizationUUID); + } + + @Test + public void testGetVfModuleModelDescription() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelDescription(); + } + + @Test + public void testSetVfModuleModelDescription() throws Exception { + VfModuleArtifactPayloadEx testSubject; + String vfModuleModelDescription = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelDescription(vfModuleModelDescription); + } + + @Test + public void testGetIsBase() throws Exception { + VfModuleArtifactPayloadEx testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIsBase(); + } + + @Test + public void testSetIsBase() throws Exception { + VfModuleArtifactPayloadEx testSubject; + Boolean isBase = null; + + // default test + testSubject = createTestSubject(); + testSubject.setIsBase(isBase); + } + + @Test + public void testGetArtifacts() throws Exception { + VfModuleArtifactPayloadEx testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + @Test + public void testSetArtifacts() throws Exception { + VfModuleArtifactPayloadEx testSubject; + List artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } + + @Test + public void testGetProperties() throws Exception { + VfModuleArtifactPayloadEx testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + @Test + public void testSetProperties() throws Exception { + VfModuleArtifactPayloadEx testSubject; + Map properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImportTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImportTest.java new file mode 100644 index 0000000000..2f5dababb7 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImportTest.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.asdctool.main; + +import java.nio.file.NoSuchFileException; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.enums.SchemaZipFileEnum; + +public class SdcSchemaFileImportTest { + + private SdcSchemaFileImport createTestSubject() { + return new SdcSchemaFileImport(); + } + + @Test(expected=NoSuchFileException.class) + public void testCreateAndSaveNodeSchemaFile() throws Exception { + + // default test + SdcSchemaFileImport.createAndSaveNodeSchemaFile(); + } + + @Test(expected=NullPointerException.class) + public void testCreateAndSaveSchemaFileYaml() throws Exception { + SchemaZipFileEnum schemaZipFileEnum = null; + Object content = null; + + // default test + SdcSchemaFileImport.createAndSaveSchemaFileYaml(schemaZipFileEnum, content); + } + + @Test(expected=IllegalArgumentException.class) + public void testCreateAndSaveSchemaFileYaml_1() throws Exception { + String fileName = ""; + String[] importFileList = new String[] { "" }; + String collectionTitle = ""; + Object content = null; + + // default test + SdcSchemaFileImport.createAndSaveSchemaFileYaml(fileName, importFileList, collectionTitle, content); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/MigrationSpringConfigTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/MigrationSpringConfigTest.java new file mode 100644 index 0000000000..50b02d653f --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/MigrationSpringConfigTest.java @@ -0,0 +1,81 @@ +package org.openecomp.sdc.asdctool.migration.config; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.migration.core.SdcMigrationTool; +import org.openecomp.sdc.asdctool.migration.dao.MigrationTasksDao; +import org.openecomp.sdc.asdctool.migration.resolver.MigrationResolver; +import org.openecomp.sdc.asdctool.migration.resolver.SpringBeansMigrationResolver; +import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; +import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; +import org.springframework.beans.factory.config.PropertiesFactoryBean; + +public class MigrationSpringConfigTest { + + private MigrationSpringConfig createTestSubject() { + return new MigrationSpringConfig(); + } + + @Test + public void testSdcMigrationTool() throws Exception { + MigrationSpringConfig testSubject; + MigrationResolver migrationResolver = null; + SdcRepoService sdcRepoService = null; + SdcMigrationTool result; + + // default test + testSubject = createTestSubject(); + result = testSubject.sdcMigrationTool(migrationResolver, sdcRepoService); + } + + @Test + public void testMigrationResolver() throws Exception { + MigrationSpringConfig testSubject; + SdcRepoService sdcRepoService = null; + SpringBeansMigrationResolver result; + + // default test + testSubject = createTestSubject(); + result = testSubject.migrationResolver(sdcRepoService); + } + + @Test + public void testSdcRepoService() throws Exception { + MigrationSpringConfig testSubject; + MigrationTasksDao migrationTasksDao = null; + SdcRepoService result; + + // default test + testSubject = createTestSubject(); + result = testSubject.sdcRepoService(migrationTasksDao); + } + + @Test + public void testMigrationTasksDao() throws Exception { + MigrationSpringConfig testSubject; + MigrationTasksDao result; + + // default test + testSubject = createTestSubject(); + result = testSubject.migrationTasksDao(); + } + + @Test + public void testServiceDistributionArtifactsBuilder() throws Exception { + MigrationSpringConfig testSubject; + ServiceDistributionArtifactsBuilder result; + + // default test + testSubject = createTestSubject(); + result = testSubject.serviceDistributionArtifactsBuilder(); + } + + @Test + public void testMapper() throws Exception { + MigrationSpringConfig testSubject; + PropertiesFactoryBean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.mapper(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMockTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMockTest.java new file mode 100644 index 0000000000..feea79fdd1 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMockTest.java @@ -0,0 +1,137 @@ +package org.openecomp.sdc.asdctool.migration.config.mocks; + +import org.junit.Test; +import org.openecomp.sdc.be.components.distribution.engine.INotificationData; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; + +public class DistributionEngineMockTest { + + private DistributionEngineMock createTestSubject() { + return new DistributionEngineMock(); + } + + @Test + public void testIsActive() throws Exception { + DistributionEngineMock testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isActive(); + } + + @Test + public void testNotifyService() throws Exception { + DistributionEngineMock testSubject; + String distributionId = ""; + Service service = null; + INotificationData notificationData = null; + String envName = ""; + String userId = ""; + String modifierName = ""; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.notifyService(distributionId, service, notificationData, envName, userId, modifierName); + } + + @Test + public void testNotifyService_1() throws Exception { + DistributionEngineMock testSubject; + String distributionId = ""; + Service service = null; + INotificationData notificationData = null; + String envId = ""; + String envName = ""; + String userId = ""; + String modifierName = ""; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.notifyService(distributionId, service, notificationData, envId, envName, userId, + modifierName); + } + + @Test + public void testIsEnvironmentAvailable() throws Exception { + DistributionEngineMock testSubject; + String envName = ""; + StorageOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isEnvironmentAvailable(envName); + } + + @Test + public void testIsEnvironmentAvailable_1() throws Exception { + DistributionEngineMock testSubject; + StorageOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isEnvironmentAvailable(); + } + + @Test + public void testDisableEnvironment() throws Exception { + DistributionEngineMock testSubject; + String envName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.disableEnvironment(envName); + } + + @Test + public void testIsReadyForDistribution() throws Exception { + DistributionEngineMock testSubject; + Service service = null; + String envName = ""; + StorageOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isReadyForDistribution(service, envName); + } + + @Test + public void testBuildServiceForDistribution() throws Exception { + DistributionEngineMock testSubject; + Service service = null; + String distributionId = ""; + String workloadContext = ""; + INotificationData result; + + // default test + testSubject = createTestSubject(); + result = testSubject.buildServiceForDistribution(service, distributionId, workloadContext); + } + + @Test + public void testVerifyServiceHasDeploymentArtifacts() throws Exception { + DistributionEngineMock testSubject; + Service service = null; + StorageOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.verifyServiceHasDeploymentArtifacts(service); + } + + @Test + public void testGetEnvironmentById() throws Exception { + DistributionEngineMock testSubject; + String opEnvId = ""; + OperationalEnvironmentEntry result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEnvironmentById(opEnvId); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DmaapHealthCheckMockTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DmaapHealthCheckMockTest.java new file mode 100644 index 0000000000..c4121c9c53 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DmaapHealthCheckMockTest.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.asdctool.migration.config.mocks; + +import org.junit.Test; +import org.openecomp.sdc.be.components.distribution.engine.DmaapHealth; + +public class DmaapHealthCheckMockTest { + + private DmaapHealthCheckMock createTestSubject() { + return new DmaapHealthCheckMock(); + } + + @Test + public void testInit() throws Exception { + DmaapHealthCheckMock testSubject; + DmaapHealth result; + + // default test + testSubject = createTestSubject(); + result = testSubject.init(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/HealthCheckBusinessLogicMockTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/HealthCheckBusinessLogicMockTest.java new file mode 100644 index 0000000000..a08f9bd04b --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/HealthCheckBusinessLogicMockTest.java @@ -0,0 +1,19 @@ +package org.openecomp.sdc.asdctool.migration.config.mocks; + +import org.junit.Test; + +public class HealthCheckBusinessLogicMockTest { + + private HealthCheckBusinessLogicMock createTestSubject() { + return new HealthCheckBusinessLogicMock(); + } + + @Test + public void testInit() throws Exception { + HealthCheckBusinessLogicMock testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.init(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/SdcMigrationToolTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/SdcMigrationToolTest.java index 8783071842..da6122c5f0 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/SdcMigrationToolTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/SdcMigrationToolTest.java @@ -21,81 +21,82 @@ import org.testng.annotations.Test; public class SdcMigrationToolTest { - @InjectMocks - private SdcMigrationTool testInstance = spy(SdcMigrationTool.class); + @InjectMocks + private SdcMigrationTool testInstance = spy(SdcMigrationTool.class); - @Mock - private MigrationResolver migrationResolverMock; + @Mock + private MigrationResolver migrationResolverMock; - @Mock - private SdcRepoService sdcRepoServiceMock; + @Mock + private SdcRepoService sdcRepoServiceMock; - @BeforeMethod + @BeforeMethod public void setUp() { - MockitoAnnotations.initMocks(this); - } + MockitoAnnotations.initMocks(this); + } - @Test + @Test public void testMigrate_noMigrations() { - when(migrationResolverMock.resolveMigrations()).thenReturn(Collections.emptyList()); - testInstance.migrate(false); - verify(sdcRepoServiceMock, new Times(0)).clearTasksForCurrentMajor(); - verify(sdcRepoServiceMock, new Times(0)).createMigrationTask(Mockito.any()); - } + when(migrationResolverMock.resolveMigrations()).thenReturn(Collections.emptyList()); + testInstance.migrate(false); + verify(sdcRepoServiceMock, new Times(0)).clearTasksForCurrentMajor(); + verify(sdcRepoServiceMock, new Times(0)).createMigrationTask(Mockito.any()); + } - @Test + @Test public void testMigrate_enforceFlag_removeAllMigrationTasksForCurrentVersion() { - when(migrationResolverMock.resolveMigrations()).thenReturn(Collections.emptyList()); - testInstance.migrate(true); - verify(sdcRepoServiceMock, new Times(1)).clearTasksForCurrentMajor(); - } + when(migrationResolverMock.resolveMigrations()).thenReturn(Collections.emptyList()); + testInstance.migrate(true); + verify(sdcRepoServiceMock, new Times(1)).clearTasksForCurrentMajor(); + } - @Test + @Test public void testMigrate_stopAfterFirstFailure() { - when(migrationResolverMock.resolveMigrations()).thenReturn(Arrays.asList(new SuccessfulMigration(), new FailedMigration(), new SuccessfulMigration())); - testInstance.migrate(false); - verify(sdcRepoServiceMock, new Times(0)).clearTasksForCurrentMajor(); - verify(sdcRepoServiceMock, new Times(1)).createMigrationTask(Mockito.any()); - - } - - private class FailedMigration implements Migration { - - @Override - public String description() { - return null; - } - - @Override - public DBVersion getVersion() { - return DBVersion.fromString("1710.22"); - } - - @Override - public MigrationResult migrate() { - MigrationResult migrationResult = new MigrationResult(); - migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.FAILED); - return migrationResult; - } - } - - private class SuccessfulMigration implements Migration { - - @Override - public String description() { - return null; - } - - @Override - public DBVersion getVersion() { - return DBVersion.fromString("1710.22"); - } - - @Override - public MigrationResult migrate() { - MigrationResult migrationResult = new MigrationResult(); - migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.COMPLETED); - return migrationResult; - } - } + when(migrationResolverMock.resolveMigrations()) + .thenReturn(Arrays.asList(new SuccessfulMigration(), new FailedMigration(), new SuccessfulMigration())); + testInstance.migrate(false); + verify(sdcRepoServiceMock, new Times(0)).clearTasksForCurrentMajor(); + verify(sdcRepoServiceMock, new Times(1)).createMigrationTask(Mockito.any()); + + } + + private class FailedMigration implements Migration { + + @Override + public String description() { + return null; + } + + @Override + public DBVersion getVersion() { + return DBVersion.fromString("1710.22"); + } + + @Override + public MigrationResult migrate() { + MigrationResult migrationResult = new MigrationResult(); + migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.FAILED); + return migrationResult; + } + } + + private class SuccessfulMigration implements Migration { + + @Override + public String description() { + return null; + } + + @Override + public DBVersion getVersion() { + return DBVersion.fromString("1710.22"); + } + + @Override + public MigrationResult migrate() { + MigrationResult migrationResult = new MigrationResult(); + migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.COMPLETED); + return migrationResult; + } + } } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutionResultTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutionResultTest.java new file mode 100644 index 0000000000..2831f76688 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutionResultTest.java @@ -0,0 +1,83 @@ +package org.openecomp.sdc.asdctool.migration.core.execution; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.migration.core.DBVersion; +import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult.MigrationStatus; +import org.openecomp.sdc.be.resources.data.MigrationTaskEntry; + +public class MigrationExecutionResultTest { + + private MigrationExecutionResult createTestSubject() { + return new MigrationExecutionResult(); + } + + @Test(expected=NullPointerException.class) + public void testToMigrationTaskEntry() throws Exception { + MigrationExecutionResult testSubject; + MigrationTaskEntry result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toMigrationTaskEntry(); + } + + @Test + public void testGetMigrationStatus() throws Exception { + MigrationExecutionResult testSubject; + MigrationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMigrationStatus(); + } + + @Test + public void testGetMsg() throws Exception { + MigrationExecutionResult testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMsg(); + } + + @Test + public void testGetVersion() throws Exception { + MigrationExecutionResult testSubject; + DBVersion result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + @Test + public void testSetVersion() throws Exception { + MigrationExecutionResult testSubject; + DBVersion version = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + @Test + public void testGetDescription() throws Exception { + MigrationExecutionResult testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + @Test + public void testSetDescription() throws Exception { + MigrationExecutionResult testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/dao/MigrationTasksDaoTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/dao/MigrationTasksDaoTest.java new file mode 100644 index 0000000000..73f50f4ec6 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/dao/MigrationTasksDaoTest.java @@ -0,0 +1,53 @@ +package org.openecomp.sdc.asdctool.migration.dao; + +import java.math.BigInteger; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.MigrationTaskEntry; + +public class MigrationTasksDaoTest { + + private MigrationTasksDao createTestSubject() { + return new MigrationTasksDao(); + } + + @Test(expected=NullPointerException.class) + public void testInit() throws Exception { + MigrationTasksDao testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.init(); + } + + @Test(expected=NullPointerException.class) + public void testGetLatestMinorVersion() throws Exception { + MigrationTasksDao testSubject; + BigInteger majorVersion = null; + BigInteger result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLatestMinorVersion(majorVersion); + } + + @Test(expected=NullPointerException.class) + public void testDeleteAllTasksForVersion() throws Exception { + MigrationTasksDao testSubject; + BigInteger majorVersion = null; + + // default test + testSubject = createTestSubject(); + testSubject.deleteAllTasksForVersion(majorVersion); + } + + @Test(expected=NullPointerException.class) + public void testCreateMigrationTask() throws Exception { + MigrationTasksDao testSubject; + MigrationTaskEntry migrationTask = null; + + // default test + testSubject = createTestSubject(); + testSubject.createMigrationTask(migrationTask); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java index 636b1c6744..47bf9c9c74 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java @@ -15,74 +15,78 @@ import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; import org.openecomp.sdc.asdctool.migration.core.task.Migration; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; +import org.openecomp.sdc.asdctool.migration.dao.MigrationTasksDao; import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class SpringBeansMigrationResolverTest { - @InjectMocks - private SpringBeansMigrationResolver testInstance; + @InjectMocks + private SpringBeansMigrationResolver testInstance; - @Mock - private SdcRepoService sdcRepoServiceMock; + @Mock + private SdcRepoService sdcRepoServiceMock; - private List migrations = Arrays.asList(createMigration("1710.1"), createMigration("1710.22"), createMigration("1707.12"), createMigration("1710.3")); + private List migrations = Arrays.asList(createMigration("1710.1"), createMigration("1710.22"), + createMigration("1707.12"), createMigration("1710.3")); - - @BeforeMethod + @BeforeMethod public void setUp() { - MockitoAnnotations.initMocks(this); - testInstance.setMigrations(migrations); - } + MockitoAnnotations.initMocks(this); + testInstance.setMigrations(migrations); + } - @Test + @Test public void testResolveMigrations_getMigrationsWithVersionGreaterThanLatest() { - when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.2")); - testInstance.setPostMigrations(Collections.emptyList()); - List resolvedMigrations = testInstance.resolveMigrations(); - assertEquals(resolvedMigrations.size(), 2); - assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.3")); - assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.22")); - } - - @Test + when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.2")); + testInstance.setPostMigrations(Collections.emptyList()); + List resolvedMigrations = testInstance.resolveMigrations(); + assertEquals(resolvedMigrations.size(), 2); + assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.3")); + assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.22")); + } + + @Test public void testResolveMigration_noLatestVersionForCurrentMajorVersion() { - when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); - testInstance.setPostMigrations(Collections.emptyList()); - List resolvedMigrations = testInstance.resolveMigrations(); - assertEquals(resolvedMigrations.size(), 3); - assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.1")); - assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.3")); - assertEquals(resolvedMigrations.get(2).getVersion(), DBVersion.fromString("1710.22")); - } - - @Test + when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); + testInstance.setPostMigrations(Collections.emptyList()); + List resolvedMigrations = testInstance.resolveMigrations(); + assertEquals(resolvedMigrations.size(), 3); + assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.1")); + assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.3")); + assertEquals(resolvedMigrations.get(2).getVersion(), DBVersion.fromString("1710.22")); + } + + @Test public void testResolveMigrations_emptyMigrationsList() { - testInstance.setMigrations(Collections.emptyList()); - testInstance.setPostMigrations(Collections.emptyList()); - when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); - List resolvedMigrations = testInstance.resolveMigrations(); - assertTrue(resolvedMigrations.isEmpty()); - } - - private Migration createMigration(String version) { - return new Migration() { - @Override - public String description() { - return null; - } - - @Override - public DBVersion getVersion() { - return DBVersion.fromString(version); - } - - @Override - public MigrationResult migrate() { - return null; - } - }; - } - + testInstance.setMigrations(Collections.emptyList()); + testInstance.setPostMigrations(Collections.emptyList()); + when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); + List resolvedMigrations = testInstance.resolveMigrations(); + assertTrue(resolvedMigrations.isEmpty()); + } + + private Migration createMigration(String version) { + return new Migration() { + @Override + public String description() { + return null; + } + + @Override + public DBVersion getVersion() { + return DBVersion.fromString(version); + } + + @Override + public MigrationResult migrate() { + return null; + } + }; + } + + private SpringBeansMigrationResolver createTestSubject() { + return new SpringBeansMigrationResolver(null, null, new SdcRepoService(new MigrationTasksDao())); + } } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/handlers/XlsOutputHandlerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/handlers/XlsOutputHandlerTest.java new file mode 100644 index 0000000000..66d9b15e4b --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/handlers/XlsOutputHandlerTest.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.asdctool.migration.tasks.handlers; + +import org.junit.Test; + +public class XlsOutputHandlerTest { + + private XlsOutputHandler createTestSubject() { + return new XlsOutputHandler(new Object()); + } + + @Test + public void testInitiate() throws Exception { + XlsOutputHandler testSubject; + Object[] title = new Object[] { null }; + + // default test + testSubject = createTestSubject(); + testSubject.initiate(title); + } + + @Test + public void testAddRecord() throws Exception { + XlsOutputHandler testSubject; + Object[] record = new Object[] { null }; + + // default test + testSubject = createTestSubject(); + testSubject.addRecord(record); + } + + @Test + public void testWriteOutput() throws Exception { + XlsOutputHandler testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.writeOutput(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java index 0c1b32efd2..f2a0a3c716 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710Test.java @@ -1,8 +1,21 @@ package org.openecomp.sdc.asdctool.migration.tasks.mig1710; -import com.google.common.collect.Lists; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -22,19 +35,20 @@ import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; +import com.google.common.collect.Lists; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.*; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class UpgradeMigration1710Test { diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java new file mode 100644 index 0000000000..00b6d573af --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java @@ -0,0 +1,45 @@ +package org.openecomp.sdc.asdctool.migration.tasks.mig1802; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.migration.core.DBVersion; +import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; +import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.titan.TitanGraphClient; +import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; + +public class SdcCatalogMigrationTest { + + private SdcCatalogMigration createTestSubject() { + return new SdcCatalogMigration(new TopologyTemplateOperation(), new TitanDao(new TitanGraphClient())); + } + + @Test + public void testDescription() throws Exception { + SdcCatalogMigration testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.description(); + } + + @Test + public void testGetVersion() throws Exception { + SdcCatalogMigration testSubject; + DBVersion result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + @Test + public void testMigrate() throws Exception { + SdcCatalogMigration testSubject; + MigrationResult result; + + // default test + testSubject = createTestSubject(); + result = testSubject.migrate(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java new file mode 100644 index 0000000000..2733beeda7 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServletTest.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.asdctool.servlets; + +import java.io.File; + +import javax.ws.rs.core.Response; + +import org.junit.Test; + +import com.thinkaurelius.titan.core.TitanGraph; + +public class ExportImportTitanServletTest { + + private ExportImportTitanServlet createTestSubject() { + return new ExportImportTitanServlet(); + } + + @Test(expected=NullPointerException.class) + public void testExport() throws Exception { + ExportImportTitanServlet testSubject; + File titanPropertiesFile = null; + String exportGraphMetadata = ""; + Response result; + + // default test + testSubject = createTestSubject(); + result = testSubject.export(titanPropertiesFile, exportGraphMetadata); + } + + @Test(expected=NullPointerException.class) + public void testExportGraph() throws Exception { + ExportImportTitanServlet testSubject; + TitanGraph graph = null; + String outputDirectory = ""; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.exportGraph(graph, outputDirectory); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/ImportTableConfigTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/ImportTableConfigTest.java new file mode 100644 index 0000000000..fe5d3d95a1 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/ImportTableConfigTest.java @@ -0,0 +1,32 @@ +package org.openecomp.sdc.asdctool.simulator.tenant; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.cassandra.CassandraClient; +import org.openecomp.sdc.be.dao.cassandra.OperationalEnvironmentDao; + +public class ImportTableConfigTest { + + private ImportTableConfig createTestSubject() { + return new ImportTableConfig(); + } + + @Test + public void testCassandraClient() throws Exception { + ImportTableConfig testSubject; + CassandraClient result; + + // default test + testSubject = createTestSubject(); + result = testSubject.cassandraClient(); + } + + @Test + public void testOperationalEnvironmentDao() throws Exception { + ImportTableConfig testSubject; + OperationalEnvironmentDao result; + + // default test + testSubject = createTestSubject(); + result = testSubject.operationalEnvironmentDao(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/OperationalEnvironmentTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/OperationalEnvironmentTest.java new file mode 100644 index 0000000000..4cb2d4f660 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/OperationalEnvironmentTest.java @@ -0,0 +1,200 @@ +package org.openecomp.sdc.asdctool.simulator.tenant; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum; + +public class OperationalEnvironmentTest { + + private OperationalEnvironment createTestSubject() { + return new OperationalEnvironment(); + } + + @Test + public void testGetLastModified() throws Exception { + OperationalEnvironment testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastModified(); + } + + @Test + public void testSetLastModified() throws Exception { + OperationalEnvironment testSubject; + String lastModified = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastModified(lastModified); + } + + @Test + public void testGetEnvironmentId() throws Exception { + OperationalEnvironment testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEnvironmentId(); + } + + @Test + public void testSetEnvironmentId() throws Exception { + OperationalEnvironment testSubject; + String environmentId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEnvironmentId(environmentId); + } + + @Test + public void testGetTenant() throws Exception { + OperationalEnvironment testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTenant(); + } + + @Test + public void testSetTenant() throws Exception { + OperationalEnvironment testSubject; + String tenant = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setTenant(tenant); + } + + @Test + public void testGetIsProduction() throws Exception { + OperationalEnvironment testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIsProduction(); + } + + @Test + public void testSetIsProduction() throws Exception { + OperationalEnvironment testSubject; + Boolean production = null; + + // default test + testSubject = createTestSubject(); + testSubject.setIsProduction(production); + } + + @Test + public void testGetEcompWorkloadContext() throws Exception { + OperationalEnvironment testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEcompWorkloadContext(); + } + + @Test + public void testSetEcompWorkloadContext() throws Exception { + OperationalEnvironment testSubject; + String ecompWorkloadContext = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEcompWorkloadContext(ecompWorkloadContext); + } + + @Test + public void testGetStatus() throws Exception { + OperationalEnvironment testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatus(); + } + + @Test + public void testSetStatus() throws Exception { + OperationalEnvironment testSubject; + String status = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setStatus(status); + } + + @Test + public void testSetStatus_1() throws Exception { + OperationalEnvironment testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.setStatus(EnvironmentStatusEnum.COMPLETED); + } + + @Test + public void testGetDmaapUebAddress() throws Exception { + OperationalEnvironment testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDmaapUebAddress(); + } + + @Test + public void testSetDmaapUebAddress() throws Exception { + OperationalEnvironment testSubject; + String dmaapUebAddress = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDmaapUebAddress(dmaapUebAddress); + } + + @Test + public void testGetUebApikey() throws Exception { + OperationalEnvironment testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUebApikey(); + } + + @Test + public void testSetUebApikey() throws Exception { + OperationalEnvironment testSubject; + String uebApikey = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUebApikey(uebApikey); + } + + @Test + public void testGetUebSecretKey() throws Exception { + OperationalEnvironment testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUebSecretKey(); + } + + @Test + public void testSetUebSecretKey() throws Exception { + OperationalEnvironment testSubject; + String uebSecretKey = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUebSecretKey(uebSecretKey); + } +} \ No newline at end of file diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/OperationalEvnironmentImportHandlerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/OperationalEvnironmentImportHandlerTest.java new file mode 100644 index 0000000000..cca0327f3f --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/simulator/tenant/OperationalEvnironmentImportHandlerTest.java @@ -0,0 +1,22 @@ +package org.openecomp.sdc.asdctool.simulator.tenant; + +import org.junit.Test; + +public class OperationalEvnironmentImportHandlerTest { + + @Test + public void testExecute() throws Exception { + String fileName = ""; + + // default test + OperationalEvnironmentImportHandler.execute(fileName); + } + + @Test + public void testGetTableName() throws Exception { + String result; + + // default test + result = OperationalEvnironmentImportHandler.getTableName(); + } +} \ No newline at end of file diff --git a/asdctool/src/test/resources/graph.json b/asdctool/src/test/resources/graph.json new file mode 100644 index 0000000000..ed56de7183 --- /dev/null +++ b/asdctool/src/test/resources/graph.json @@ -0,0 +1 @@ +"{\"container\":{\"accessControlPolicyIDs\":[\"/in-cse/acp-761663881\"],\"creationTime\":\"20170630T111742\",\"currentByteSize\":0,\"currentNrOfInstances\":0,\"expirationTime\":\"20180630T111742\",\"lastModifiedTime\":\"20170630T111742\",\"latest\":\"/in-cse/in-name/cnt_900407520/la\",\"maxByteSize\":10000,\"maxInstanceAge\":0,\"maxNrOfInstances\":10,\"oldest\":\"/in-cse/in-name/cnt_900407520/ol\",\"parentID\":\"/in-cse\",\"resourceID\":\"/in-cse/cnt-900407520\",\"resourceName\":\"cnt_900407520\",\"resourceType\":\"int3\",\"stateTag\":0}}" \ No newline at end of file diff --git a/asdctool/src/test/resources/graphError.json b/asdctool/src/test/resources/graphError.json new file mode 100644 index 0000000000..b7ccf92ee6 --- /dev/null +++ b/asdctool/src/test/resources/graphError.json @@ -0,0 +1 @@ +(("ERRRRORROROR{{{\"container\":zxcvfxcvxcvxc{\"accessContcxvxcvrolPolicyIDs\":[\"/in-cse/acp-7cxvxcvxcvx1663881\"],\"creationTime\":\"20170630T111742\",\"currentByteSize\":0,\"currentNrOfInstances\":0,\"expirationTime\":\"20180630T111742\",\"lastModifiedTime\":\"20170630T111742\",\"latest\":\"/in-cse/in-name/cnt_900407520/la\",\"maxByteSize\":10000,\"maxInstanceAge\":0,\"maxNrOfInstances\":10,\"oldest\":\"/in-cse/in-name/cnt_900407520/ol\",\"parentID\":\"/in-cse\",\"resourceID\":\"/in-cse/cnt-900407520\",\"resourceName\":((\"cnt_900407520\",\"resourceTypeR\"RXCFV:\"int3\",\"stateTag\":0}}" \ No newline at end of file -- cgit 1.2.3-korg