diff options
8 files changed, 2171 insertions, 1 deletions
diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml index 373ae996a8..621330a61a 100644 --- a/catalog-be/pom.xml +++ b/catalog-be/pom.xml @@ -666,8 +666,16 @@ <artifactId>cucumber-junit</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>${jmockit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> - + <build> <finalName>${project.artifactId}-${project.version}</finalName> diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java new file mode 100644 index 0000000000..5c8b90544e --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java @@ -0,0 +1,52 @@ +package org.openecomp.sdc.be.components.health; + +import static org.junit.Assert.*; +import java.util.*; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.api.HealthCheckInfo; +import org.apache.commons.lang3.tuple.Pair; + +public class HealthCheckBusinessLogicTest { + + private HealthCheckBusinessLogic createTestSubject() { + return new HealthCheckBusinessLogic(); + } + + @Test + public void testAnyStatusChanged() throws Exception { + HealthCheckBusinessLogic testSubject; + List<HealthCheckInfo> beHealthCheckInfos = null; + List<HealthCheckInfo> prevBeHealthCheckInfos = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + beHealthCheckInfos = null; + prevBeHealthCheckInfos = null; + result = testSubject.anyStatusChanged(beHealthCheckInfos, prevBeHealthCheckInfos); + Assert.assertEquals(false, result); + + // test 2 + testSubject = createTestSubject(); + prevBeHealthCheckInfos = null; + beHealthCheckInfos = null; + result = testSubject.anyStatusChanged(beHealthCheckInfos, prevBeHealthCheckInfos); + Assert.assertEquals(false, result); + + // test 3 + testSubject = createTestSubject(); + beHealthCheckInfos = null; + prevBeHealthCheckInfos = null; + result = testSubject.anyStatusChanged(beHealthCheckInfos, prevBeHealthCheckInfos); + Assert.assertEquals(false, result); + + // test 4 + testSubject = createTestSubject(); + prevBeHealthCheckInfos = null; + beHealthCheckInfos = null; + result = testSubject.anyStatusChanged(beHealthCheckInfos, prevBeHealthCheckInfos); + Assert.assertEquals(false, result); + } + +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ComponentsUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ComponentsUtilsTest.java new file mode 100644 index 0000000000..52e9230711 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ComponentsUtilsTest.java @@ -0,0 +1,854 @@ +package org.openecomp.sdc.be.impl; + +import java.util.EnumMap; +import java.util.List; + +import javax.annotation.Generated; +import javax.servlet.http.HttpServletRequest; + +import org.apache.tinkerpop.gremlin.structure.T; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.graph.datatype.AdditionalInformationEnum; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import org.openecomp.sdc.be.model.CapabilityTypeDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ConsumerDefinition; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.GroupTypeDefinition; +import org.openecomp.sdc.be.model.PolicyTypeDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; +import org.openecomp.sdc.be.tosca.ToscaError; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; +import org.openecomp.sdc.common.impl.ExternalConfiguration; +import org.openecomp.sdc.common.impl.FSConfigurationSource; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; +import mockit.Deencapsulation; + +public class ComponentsUtilsTest { + + private ComponentsUtils createTestSubject() { + return new ComponentsUtils(new AuditingManager(new AuditingDao(), new AuditCassandraDao())); + } + + @Before + public void init(){ + String appConfigDir = "src/test/resources/config/catalog-be"; + ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); + ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); + ComponentsUtils componentsUtils = new ComponentsUtils(Mockito.mock(AuditingManager.class)); + } + + @Test + public void testGetAuditingManager() throws Exception { + ComponentsUtils testSubject; + AuditingManager result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAuditingManager(); + } + + + + + @Test + public void testConvertJsonToObjectUsingObjectMapper() throws Exception { + ComponentsUtils testSubject; + String data = ""; + User user = null; + Class<T> clazz = null; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum typeEnum = null; + Either<T, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertJsonToObjectUsingObjectMapper(data, user, clazz, actionEnum, typeEnum); + } + + + @Test + public void testGetResponseFormat() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + String[] params = new String[] { "" }; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponseFormat(actionStatus, params); + } + + + @Test + public void testGetResponseFormat_1() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageStatus = null; + String[] params = new String[] { "" }; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponseFormat(storageStatus, params); + } + + + @Test + public void testConvertToResponseFormatOrNotFoundErrorToEmptyList() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageOperationStatus = StorageOperationStatus.ARTIFACT_NOT_FOUND; + Either<List<T>, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertToResponseFormatOrNotFoundErrorToEmptyList(storageOperationStatus); + } + + + @Test + public void testGetResponseFormatByResource() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + Resource resource = new Resource(); + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.getResponseFormatByResource(actionStatus, resource); + } + + + @Test + public void testGetResponseFormatByResource_1() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + String resourceName = ""; + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + resourceName = null; + result = testSubject.getResponseFormatByResource(actionStatus, resourceName); + + // test 2 + testSubject = createTestSubject(); + resourceName = ""; + result = testSubject.getResponseFormatByResource(actionStatus, resourceName); + } + + + @Test + public void testGetResponseFormatByCapabilityType() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + CapabilityTypeDefinition capabilityType = new CapabilityTypeDefinition(); + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.getResponseFormatByCapabilityType(actionStatus, capabilityType); + } + + + @Test + public void testGetResponseFormatByElement() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + T obj = null; + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + obj = null; + result = testSubject.getResponseFormatByElement(actionStatus, obj); + } + + + @Test + public void testGetResponseFormatByUser() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + User user = null; + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + user = null; + result = testSubject.getResponseFormatByUser(actionStatus, user); + } + + + @Test + public void testGetResponseFormatByUserId() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + String userId = ""; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponseFormatByUserId(actionStatus, userId); + } + + + @Test + public void testGetResponseFormatByDE() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + String serviceId = ""; + String envName = ""; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponseFormatByDE(actionStatus, serviceId, envName); + } + + + @Test + public void testGetResponseFormatByArtifactId() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + String artifactId = ""; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponseFormatByArtifactId(actionStatus, artifactId); + } + + + @Test + public void testGetInvalidContentErrorAndAudit() throws Exception { + ComponentsUtils testSubject; + User user = null; + String resourceName = ""; + AuditingActionEnum actionEnum = null; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvalidContentErrorAndAudit(user, resourceName, actionEnum); + } + + @Test + public void testGetInvalidContentErrorAndAuditComponent() throws Exception { + ComponentsUtils testSubject; + User user = null; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum typeEnum = null; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvalidContentErrorAndAuditComponent(user, actionEnum, typeEnum); + } + + + + @Test + public void testAuditResource_1() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + String resourceName = ""; + AuditingActionEnum actionEnum = null; + + // default test + testSubject = createTestSubject(); + testSubject.auditResource(responseFormat, modifier, resourceName, actionEnum); + } + + + + @Test + public void testAuditResource_3() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Resource resource = null; + String resourceName = ""; + AuditingActionEnum actionEnum = null; + + // default test + testSubject = createTestSubject(); + testSubject.auditResource(responseFormat, modifier, resource, resourceName, actionEnum); + } + + + @Test + public void testAuditResource_4() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Resource resource = null; + String resourceName = ""; + AuditingActionEnum actionEnum = null; + ResourceAuditData prevResFields = null; + String currentArtifactUuid = ""; + String artifactData = ""; + + // test 1 + testSubject = createTestSubject(); + actionEnum = null; + testSubject.auditResource(responseFormat, modifier, resource, resourceName, actionEnum, prevResFields, + currentArtifactUuid, artifactData); + } + + + + + + + + @Test + public void testConvertFromStorageResponse() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = null; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponse(storageResponse); + } + + + @Test + public void testConvertFromStorageResponse_1() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = null; + ComponentTypeEnum type = null; + ActionStatus result; + + // test 1 + testSubject = createTestSubject(); + storageResponse = null; + result = testSubject.convertFromStorageResponse(storageResponse, type); + } + + + @Test + public void testConvertFromToscaError() throws Exception { + ComponentsUtils testSubject; + ToscaError toscaError = null; + ActionStatus result; + + // test 1 + testSubject = createTestSubject(); + toscaError = null; + result = testSubject.convertFromToscaError(toscaError); + } + + + @Test + public void testConvertFromStorageResponseForCapabilityType() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.CANNOT_UPDATE_EXISTING_ENTITY; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForCapabilityType(storageResponse); + } + + + @Test + public void testConvertFromStorageResponseForLifecycleType() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForLifecycleType(storageResponse); + } + + + @Test + public void testConvertFromStorageResponseForResourceInstance() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + boolean isRelation = false; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForResourceInstance(storageResponse, isRelation); + } + + + @Test + public void testGetResponseFormatForResourceInstance() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + String serviceName = ""; + String resourceInstanceName = ""; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponseFormatForResourceInstance(actionStatus, serviceName, resourceInstanceName); + } + + + @Test + public void testGetResponseFormatForResourceInstanceProperty() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + String resourceInstanceName = ""; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponseFormatForResourceInstanceProperty(actionStatus, resourceInstanceName); + } + + + @Test + public void testConvertFromStorageResponseForResourceInstanceProperty() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForResourceInstanceProperty(storageResponse); + } + + + @Test + public void testAuditComponent() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Component component = null; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum type = null; + ResourceAuditData prevComponent = null; + String comment = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditComponent(responseFormat, modifier, component, actionEnum, type, prevComponent, comment); + } + + + @Test + public void testAuditComponentAdmin() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Component component = null; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum type = null; + + // default test + testSubject = createTestSubject(); + testSubject.auditComponentAdmin(responseFormat, modifier, component, actionEnum, type); + } + + + @Test + public void testAuditComponentAdmin_1() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Component component = null; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum type = null; + ResourceAuditData prevComponent = null; + + // default test + testSubject = createTestSubject(); + testSubject.auditComponentAdmin(responseFormat, modifier, component, actionEnum, type, prevComponent); + } + + + @Test + public void testAuditComponent_1() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Component component = null; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum type = null; + ResourceAuditData prevComponent = null; + + // default test + testSubject = createTestSubject(); + testSubject.auditComponent(responseFormat, modifier, component, actionEnum, type, prevComponent); + } + + + @Test + public void testAuditComponent_2() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + AuditingActionEnum actionEnum = null; + String compName = ""; + ComponentTypeEnum type = null; + String comment = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditComponent(responseFormat, modifier, actionEnum, compName, type, comment); + } + + + @Test + public void testAuditComponent_3() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Component component = null; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum type = null; + ResourceAuditData prevComponent = null; + ResourceAuditData currComponent = null; + + // default test + testSubject = createTestSubject(); + testSubject.auditComponent(responseFormat, modifier, component, actionEnum, type, prevComponent, currComponent); + } + + + @Test + public void testAuditComponent_4() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Component component = null; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum type = null; + ResourceAuditData prevComponent = null; + ResourceAuditData currComponent = null; + String compName = ""; + String comment = ""; + String artifactData = ""; + String did = ""; + + // test 1 + testSubject = createTestSubject(); + actionEnum = null; + testSubject.auditComponent(responseFormat, modifier, component, actionEnum, type, prevComponent, currComponent, + compName, comment, artifactData, did); + } + + + @Test + public void testAuditDistributionEngine() throws Exception { + ComponentsUtils testSubject; + AuditingActionEnum actionEnum = AuditingActionEnum.ADD_CATEGORY; + String environmentName = ""; + String topicName = ""; + String role = ""; + String apiKey = ""; + String status = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditDistributionEngine(actionEnum, environmentName, topicName, role, apiKey, status); + } + + + + + @Test + public void testAuditDistributionNotification() throws Exception { + ComponentsUtils testSubject; + AuditingActionEnum actionEnum = AuditingActionEnum.ADD_CATEGORY; + String serviceUUID = ""; + String resourceName = ""; + String resourceType = ""; + String currVersion = ""; + String modifierUid = ""; + String modifierName = ""; + String environmentName = ""; + String currState = ""; + String topicName = ""; + String distributionId = ""; + String description = ""; + String status = ""; + String workloadContext = ""; + String tenant = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditDistributionNotification(actionEnum, serviceUUID, resourceName, resourceType, currVersion, + modifierUid, modifierName, environmentName, currState, topicName, distributionId, description, status, + workloadContext, tenant); + } + + + @Test + public void testAuditDistributionStatusNotification() throws Exception { + ComponentsUtils testSubject; + AuditingActionEnum actionEnum = AuditingActionEnum.ADD_CATEGORY; + String distributionId = ""; + String consumerId = ""; + String topicName = ""; + String resourceUrl = ""; + String statusTime = ""; + String status = ""; + String errorReason = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditDistributionStatusNotification(actionEnum, distributionId, consumerId, topicName, resourceUrl, + statusTime, status, errorReason); + } + + + @Test + public void testAuditGetUebCluster() throws Exception { + ComponentsUtils testSubject; + AuditingActionEnum actionEnum = AuditingActionEnum.ACTIVATE_SERVICE_BY_API; + String consumerId = ""; + String statusTime = ""; + String status = ""; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditGetUebCluster(actionEnum, consumerId, statusTime, status, description); + } + + + @Test + public void testAuditMissingInstanceId() throws Exception { + ComponentsUtils testSubject; + AuditingActionEnum actionEnum = AuditingActionEnum.ADD_CATEGORY; + String status = ""; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditMissingInstanceId(actionEnum, status, description); + } + + + @Test + public void testAuditTopicACLKeys() throws Exception { + ComponentsUtils testSubject; + AuditingActionEnum actionEnum = AuditingActionEnum.ADD_USER; + String envName = ""; + String topicName = ""; + String role = ""; + String apiPublicKey = ""; + String status = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditTopicACLKeys(actionEnum, envName, topicName, role, apiPublicKey, status); + } + + + @Test + public void testAuditRegisterOrUnRegisterEvent() throws Exception { + ComponentsUtils testSubject; + AuditingActionEnum actionEnum = AuditingActionEnum.ACTIVATE_SERVICE_BY_API; + String consumerId = ""; + String apiPublicKey = ""; + String envName = ""; + String status = ""; + String statusDesc = ""; + String notifTopicName = ""; + String statusTopicName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.auditRegisterOrUnRegisterEvent(actionEnum, consumerId, apiPublicKey, envName, status, statusDesc, + notifTopicName, statusTopicName); + } + + + @Test + public void testAuditServiceDistributionDeployed() throws Exception { + ComponentsUtils testSubject; + AuditingActionEnum actionEnum = AuditingActionEnum.ACTIVATE_SERVICE_BY_API; + String serviceName = ""; + String serviceVersion = ""; + String serviceUUID = ""; + String distributionId = ""; + String status = ""; + String desc = ""; + User modifier = new User(); + + // default test + testSubject = createTestSubject(); + testSubject.auditServiceDistributionDeployed(actionEnum, serviceName, serviceVersion, serviceUUID, + distributionId, status, desc, modifier); + } + + + @Test + public void testValidateStringNotEmpty() throws Exception { + ComponentsUtils testSubject; + String value = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validateStringNotEmpty(value); + } + + + @Test + public void testConvertFromStorageResponseForAdditionalInformation() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForAdditionalInformation(storageResponse); + } + + + @Test + public void testConvertFromResultStatusEnum() throws Exception { + ComponentsUtils testSubject; + ResultStatusEnum resultStatus = ResultStatusEnum.ELEMENT_NOT_FOUND; + JsonPresentationFields elementType = null; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromResultStatusEnum(resultStatus, elementType); + } + + + @Test + public void testGetResponseFormatAdditionalProperty() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + AdditionalInfoParameterInfo additionalInfoParameterInfo = null; + NodeTypeEnum nodeType = null; + AdditionalInformationEnum labelOrValue = null; + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + additionalInfoParameterInfo = null; + result = testSubject.getResponseFormatAdditionalProperty(actionStatus, additionalInfoParameterInfo, nodeType, + labelOrValue); + + // test 2 + testSubject = createTestSubject(); + labelOrValue = null; + result = testSubject.getResponseFormatAdditionalProperty(actionStatus, additionalInfoParameterInfo, nodeType, + labelOrValue); + } + + + @Test + public void testGetResponseFormatAdditionalProperty_1() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + ResponseFormat result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponseFormatAdditionalProperty(actionStatus); + } + + + @Test + public void testConvertFromStorageResponseForConsumer() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForConsumer(storageResponse); + } + + + @Test + public void testConvertFromStorageResponseForGroupType() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForGroupType(storageResponse); + } + + + @Test + public void testConvertFromStorageResponseForDataType() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForDataType(storageResponse); + } + + + @Test + public void testGetResponseFormatByGroupType() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + GroupTypeDefinition groupType = null; + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + groupType = null; + result = testSubject.getResponseFormatByGroupType(actionStatus, groupType); + } + + + @Test + public void testGetResponseFormatByPolicyType() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.ACCEPTED; + PolicyTypeDefinition policyType = new PolicyTypeDefinition(); + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.getResponseFormatByPolicyType(actionStatus, policyType); + } + + + @Test + public void testGetResponseFormatByDataType() throws Exception { + ComponentsUtils testSubject; + ActionStatus actionStatus = ActionStatus.AAI_ARTIFACT_GENERATION_FAILED; + DataTypeDefinition dataType = null; + List<String> properties = null; + ResponseFormat result; + + // test 1 + testSubject = createTestSubject(); + dataType = null; + result = testSubject.getResponseFormatByDataType(actionStatus, dataType, properties); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java new file mode 100644 index 0000000000..2861ecd2c9 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java @@ -0,0 +1,488 @@ +package org.openecomp.sdc.be.model; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; + +public class ComponentParametersViewTest { + + private ComponentParametersView createTestSubject() { + return new ComponentParametersView(); + } + + + @Test + public void testFilter() throws Exception { + ComponentParametersView testSubject; + Component component = null; + ComponentTypeEnum componentType = ComponentTypeEnum.RESOURCE; + Component result; + + // default test + testSubject = createTestSubject(); + result = testSubject.filter(component, componentType); + } + + + @Test + public void testDisableAll() throws Exception { + ComponentParametersView testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.disableAll(); + } + + + @Test + public void testIsIgnoreGroups() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreGroups(); + } + + + @Test + public void testSetIgnoreGroups() throws Exception { + ComponentParametersView testSubject; + boolean ignoreGroups = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreGroups(ignoreGroups); + } + + + @Test + public void testIsIgnoreComponentInstances() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreComponentInstances(); + } + + + @Test + public void testSetIgnoreComponentInstances() throws Exception { + ComponentParametersView testSubject; + boolean ignoreComponentInstances = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreComponentInstances(ignoreComponentInstances); + } + + + @Test + public void testIsIgnoreProperties() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreProperties(); + } + + + @Test + public void testSetIgnoreProperties() throws Exception { + ComponentParametersView testSubject; + boolean ignoreProperties = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreProperties(ignoreProperties); + } + + + @Test + public void testIsIgnoreCapabilities() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreCapabilities(); + } + + + @Test + public void testSetIgnoreCapabilities() throws Exception { + ComponentParametersView testSubject; + boolean ignoreCapabilities = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreCapabilities(ignoreCapabilities); + } + + + @Test + public void testIsIgnoreRequirements() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreRequirements(); + } + + + @Test + public void testSetIgnoreRequirements() throws Exception { + ComponentParametersView testSubject; + boolean ignoreRequirements = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreRequirements(ignoreRequirements); + } + + + @Test + public void testIsIgnoreCategories() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreCategories(); + } + + + @Test + public void testSetIgnoreCategories() throws Exception { + ComponentParametersView testSubject; + boolean ignoreCategories = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreCategories(ignoreCategories); + } + + + @Test + public void testIsIgnoreAllVersions() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreAllVersions(); + } + + + @Test + public void testSetIgnoreAllVersions() throws Exception { + ComponentParametersView testSubject; + boolean ignoreAllVersions = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreAllVersions(ignoreAllVersions); + } + + + @Test + public void testIsIgnoreAdditionalInformation() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreAdditionalInformation(); + } + + + @Test + public void testSetIgnoreAdditionalInformation() throws Exception { + ComponentParametersView testSubject; + boolean ignoreAdditionalInformation = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreAdditionalInformation(ignoreAdditionalInformation); + } + + + @Test + public void testIsIgnoreArtifacts() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreArtifacts(); + } + + + @Test + public void testSetIgnoreArtifacts() throws Exception { + ComponentParametersView testSubject; + boolean ignoreArtifacts = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreArtifacts(ignoreArtifacts); + } + + + @Test + public void testIsIgnoreComponentInstancesProperties() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreComponentInstancesProperties(); + } + + + @Test + public void testSetIgnoreComponentInstancesProperties() throws Exception { + ComponentParametersView testSubject; + boolean ignoreComponentInstancesProperties = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreComponentInstancesProperties(ignoreComponentInstancesProperties); + } + + + @Test + public void testIsIgnoreComponentInstancesInputs() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreComponentInstancesInputs(); + } + + + @Test + public void testSetIgnoreComponentInstancesInputs() throws Exception { + ComponentParametersView testSubject; + boolean ignoreComponentInstancesInputs = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreComponentInstancesInputs(ignoreComponentInstancesInputs); + } + + + @Test + public void testIsIgnoreInterfaces() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreInterfaces(); + } + + + @Test + public void testSetIgnoreInterfaces() throws Exception { + ComponentParametersView testSubject; + boolean ignoreInterfaces = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreInterfaces(ignoreInterfaces); + } + + + @Test + public void testIsIgnoreAttributesFrom() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreAttributesFrom(); + } + + + @Test + public void testSetIgnoreAttributesFrom() throws Exception { + ComponentParametersView testSubject; + boolean ignoreAttributesFrom = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreAttributesFrom(ignoreAttributesFrom); + } + + + @Test + public void testIsIgnoreComponentInstancesAttributesFrom() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreComponentInstancesAttributesFrom(); + } + + + @Test + public void testSetIgnoreComponentInstancesAttributesFrom() throws Exception { + ComponentParametersView testSubject; + boolean ignoreComponentInstancesAttributesFrom = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreComponentInstancesAttributesFrom(ignoreComponentInstancesAttributesFrom); + } + + + @Test + public void testIsIgnoreDerivedFrom() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreDerivedFrom(); + } + + + @Test + public void testSetIgnoreDerivedFrom() throws Exception { + ComponentParametersView testSubject; + boolean ignoreDerivedFrom = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreDerivedFrom(ignoreDerivedFrom); + } + + + @Test + public void testIsIgnoreUsers() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreUsers(); + } + + + @Test + public void testSetIgnoreUsers() throws Exception { + ComponentParametersView testSubject; + boolean ignoreUsers = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreUsers(ignoreUsers); + } + + + @Test + public void testIsIgnoreInputs() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreInputs(); + } + + + @Test + public void testSetIgnoreInputs() throws Exception { + ComponentParametersView testSubject; + boolean ignoreInputs = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreInputs(ignoreInputs); + } + + + @Test + public void testIsIgnoreCapabiltyProperties() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreCapabiltyProperties(); + } + + + @Test + public void testSetIgnoreCapabiltyProperties() throws Exception { + ComponentParametersView testSubject; + boolean ignoreCapabiltyProperties = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreCapabiltyProperties(ignoreCapabiltyProperties); + } + + + @Test + public void testIsIgnoreForwardingPath() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnoreForwardingPath(); + } + + + @Test + public void testSetIgnoreForwardingPath() throws Exception { + ComponentParametersView testSubject; + boolean ignoreServicePath = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnoreForwardingPath(ignoreServicePath); + } + + + @Test + public void testIsIgnorePolicies() throws Exception { + ComponentParametersView testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIgnorePolicies(); + } + + + @Test + public void testSetIgnorePolicies() throws Exception { + ComponentParametersView testSubject; + boolean ignorePolicies = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIgnorePolicies(ignorePolicies); + } + + + @Test + public void testDetectParseFlag() throws Exception { + ComponentParametersView testSubject; + JsonParseFlagEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.detectParseFlag(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java new file mode 100644 index 0000000000..0814a6f30f --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java @@ -0,0 +1,420 @@ +package org.openecomp.sdc.be.model; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; + +public class ResourceTest { + + private Resource createTestSubject() { + return new Resource(); + } + + + @Test + public void testGetDerivedFrom() throws Exception { + Resource testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDerivedFrom(); + } + + + @Test + public void testSetDerivedFrom() throws Exception { + Resource testSubject; + List<String> derivedFrom = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDerivedFrom(derivedFrom); + } + + + @Test + public void testGetDerivedList() throws Exception { + Resource testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDerivedList(); + } + + + @Test + public void testSetDerivedList() throws Exception { + Resource testSubject; + List<String> derivedList = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDerivedList(derivedList); + } + + + @Test + public void testGetProperties() throws Exception { + Resource testSubject; + List<PropertyDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + Resource testSubject; + List<PropertyDefinition> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + + @Test + public void testGetAttributes() throws Exception { + Resource testSubject; + List<PropertyDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAttributes(); + } + + + @Test + public void testSetAttributes() throws Exception { + Resource testSubject; + List<PropertyDefinition> attributes = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAttributes(attributes); + } + + + @Test + public void testGetInterfaces() throws Exception { + Resource testSubject; + Map<String, InterfaceDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInterfaces(); + } + + + @Test + public void testSetInterfaces() throws Exception { + Resource testSubject; + Map<String, InterfaceDefinition> interfaces = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInterfaces(interfaces); + } + + + @Test + public void testIsAbstract() throws Exception { + Resource testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isAbstract(); + } + + + @Test + public void testSetAbstract() throws Exception { + Resource testSubject; + Boolean isAbstract = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAbstract(isAbstract); + } + + + @Test + public void testGetDefaultCapabilities() throws Exception { + Resource testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDefaultCapabilities(); + } + + + @Test + public void testSetDefaultCapabilities() throws Exception { + Resource testSubject; + List<String> defaultCapabilities = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDefaultCapabilities(defaultCapabilities); + } + + + @Test + public void testGetCost() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCost(); + } + + + @Test + public void testSetCost() throws Exception { + Resource testSubject; + String cost = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCost(cost); + } + + + @Test + public void testGetLicenseType() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLicenseType(); + } + + + @Test + public void testSetLicenseType() throws Exception { + Resource testSubject; + String licenseType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLicenseType(licenseType); + } + + + @Test + public void testGetInterfaceOperations() throws Exception { + Resource testSubject; + Map<String, InterfaceOperationDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInterfaceOperations(); + } + + + @Test + public void testSetInterfaceOperations() throws Exception { + Resource testSubject; + Map<String, InterfaceOperationDataDefinition> interfaceOperations = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInterfaceOperations(interfaceOperations); + } + + + @Test + public void testHashCode() throws Exception { + Resource testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + Resource testSubject; + Object obj = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + obj = null; + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + } + + + @Test + public void testToString() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + + @Test + public void testGetToscaResourceName() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaResourceName(); + } + + + @Test + public void testSetToscaResourceName() throws Exception { + Resource testSubject; + String toscaResourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaResourceName(toscaResourceName); + } + + + @Test + public void testGetResourceType() throws Exception { + Resource testSubject; + ResourceTypeEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceType(); + } + + + @Test + public void testSetResourceType() throws Exception { + Resource testSubject; + ResourceTypeEnum resourceType = null; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceType(resourceType); + } + + + @Test + public void testSetVendorName() throws Exception { + Resource testSubject; + String vendorName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVendorName(vendorName); + } + + + @Test + public void testSetVendorRelease() throws Exception { + Resource testSubject; + String vendorRelease = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVendorRelease(vendorRelease); + } + + + @Test + public void testSetResourceVendorModelNumber() throws Exception { + Resource testSubject; + String resourceVendorModelNumber = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVendorModelNumber(resourceVendorModelNumber); + } + + + @Test + public void testGetVendorName() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVendorName(); + } + + + @Test + public void testGetVendorRelease() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVendorRelease(); + } + + + @Test + public void testGetResourceVendorModelNumber() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVendorModelNumber(); + } + + + @Test + public void testAssetType() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.assetType(); + } + + + @Test + public void testShouldGenerateInputs() throws Exception { + Resource testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.shouldGenerateInputs(); + } + + + @Test + public void testDeriveFromGeneric() throws Exception { + Resource testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deriveFromGeneric(); + } + + + +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ServiceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ServiceTest.java new file mode 100644 index 0000000000..ac2ad4d196 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ServiceTest.java @@ -0,0 +1,253 @@ +package org.openecomp.sdc.be.model; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; + +@Generated(value = "org.junit-tools-1.0.6") +public class ServiceTest { + + private Service createTestSubject() { + return new Service(); + } + + + @Test + public void testGetServiceApiArtifacts() throws Exception { + Service testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceApiArtifacts(); + } + + + @Test + public void testSetServiceApiArtifacts() throws Exception { + Service testSubject; + Map<String, ArtifactDefinition> serviceApiArtifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceApiArtifacts(serviceApiArtifacts); + } + + + @Test + public void testGetProjectCode() throws Exception { + Service testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProjectCode(); + } + + + @Test + public void testGetForwardingPaths() throws Exception { + Service testSubject; + Map<String, ForwardingPathDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getForwardingPaths(); + } + + + @Test + public void testSetForwardingPaths() throws Exception { + Service testSubject; + Map<String, ForwardingPathDataDefinition> forwardingPaths = null; + + // default test + testSubject = createTestSubject(); + testSubject.setForwardingPaths(forwardingPaths); + } + + + @Test + public void testAddForwardingPath() throws Exception { + Service testSubject; + ForwardingPathDataDefinition forwardingPathDataDefinition = new ForwardingPathDataDefinition(); + ForwardingPathDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.addForwardingPath(forwardingPathDataDefinition); + } + + + @Test + public void testSetProjectCode() throws Exception { + Service testSubject; + String projectName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setProjectCode(projectName); + } + + + @Test + public void testGetDistributionStatus() throws Exception { + Service testSubject; + DistributionStatusEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDistributionStatus(); + } + + + @Test + public void testSetDistributionStatus() throws Exception { + Service testSubject; + DistributionStatusEnum distributionStatus = null; + + // test 1 + testSubject = createTestSubject(); + distributionStatus = null; + testSubject.setDistributionStatus(distributionStatus); + } + + + @Test + public void testSetEcompGeneratedNaming() throws Exception { + Service testSubject; + Boolean ecompGeneratedNaming = null; + + // default test + testSubject = createTestSubject(); + testSubject.setEcompGeneratedNaming(ecompGeneratedNaming); + } + + + @Test + public void testIsEcompGeneratedNaming() throws Exception { + Service testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isEcompGeneratedNaming(); + } + + + @Test + public void testSetNamingPolicy() throws Exception { + Service testSubject; + String namingPolicy = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setNamingPolicy(namingPolicy); + } + + + @Test + public void testGetNamingPolicy() throws Exception { + Service testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNamingPolicy(); + } + + + @Test + public void testGetEnvironmentContext() throws Exception { + Service testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEnvironmentContext(); + } + + + @Test + public void testSetEnvironmentContext() throws Exception { + Service testSubject; + String environmentContext = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEnvironmentContext(environmentContext); + } + + + @Test + public void testSetServiceType() throws Exception { + Service testSubject; + String serviceType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceType(serviceType); + } + + + @Test + public void testGetServiceType() throws Exception { + Service testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceType(); + } + + + @Test + public void testSetServiceRole() throws Exception { + Service testSubject; + String serviceRole = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceRole(serviceRole); + } + + + @Test + public void testGetServiceRole() throws Exception { + Service testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceRole(); + } + + + + + + @Test + public void testToString() throws Exception { + Service testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + + @Test + public void testSetSpecificComponetTypeArtifacts() throws Exception { + Service testSubject; + Map<String, ArtifactDefinition> specificComponentTypeArtifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setSpecificComponetTypeArtifacts(specificComponentTypeArtifacts); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java new file mode 100644 index 0000000000..5a98146832 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java @@ -0,0 +1,88 @@ +package org.openecomp.sdc.be.model.cache; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.ImmutableTriple; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.cassandra.ComponentCassandraDao; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.resources.data.ComponentCacheData; +import org.slf4j.Logger; + +import fj.data.Either; + +public class ComponentCacheTest { + ComponentCassandraDao componentCassandraDao = Mockito.mock(ComponentCassandraDao.class); + + ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); + Configuration configuration = Mockito.mock(Configuration.class); + + Logger logger = Mockito.mock(Logger.class); + + @InjectMocks + ComponentCache componentCache = new ComponentCache(); + + private ComponentCache createTestSubject() { + return componentCache; + } + + @Before + public void initMocks() { + MockitoAnnotations.initMocks(this); + } + + + + + @Test + public void testIsEnabled() throws Exception { + boolean result; + + // default test + result = componentCache.isEnabled(); + } + + @Test + public void testSetEnabled() throws Exception { + boolean enabled = false; + + // default test + componentCache.setEnabled(enabled); + } + + + + @Test + public void testGetAllComponentIdTimeAndType() throws Exception { + Either<List<ComponentCacheData>, ActionStatus> result; + + // default test + result = componentCache.getAllComponentIdTimeAndType(); + } + + + @Test + public void testDeleteComponentFromCache() throws Exception { + ComponentCache testSubject; + String id = ""; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteComponentFromCache(id); + } +}
\ No newline at end of file @@ -84,6 +84,7 @@ <!--TESTING--> <mockito.version>2.12.0</mockito.version> + <jmockit.version>1.33</jmockit.version> <junit.version>4.12</junit.version> <assertj.version>3.8.0</assertj.version> <testng.version>6.9.10</testng.version> @@ -146,6 +147,12 @@ <artifactId>mockito-core</artifactId> <version>${mockito.version}</version> </dependency> + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>${jmockit.version}</version> + </dependency> + <dependency> <groupId>com.github.tomakehurst</groupId> |