diff options
Diffstat (limited to 'catalog-be/src/test')
44 files changed, 5323 insertions, 365 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java index d8b82da396..95845c3660 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java @@ -20,7 +20,19 @@ package org.openecomp.sdc.be.components; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletContext; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Before; import org.junit.Ignore; @@ -70,15 +82,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ServiceBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/TestSuite.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/TestSuite.java new file mode 100644 index 0000000000..712e16d97a --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/TestSuite.java @@ -0,0 +1,12 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ DistributionEngineInitTaskTest.class, DistributionEngineConfigTest.class, DistributionEngineHealthCheckTest.class, + VfModuleArtifactPayloadTest.class }) +public class TestSuite { // nothing +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayloadTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayloadTest.java new file mode 100644 index 0000000000..1bc8c47f8c --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayloadTest.java @@ -0,0 +1,66 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.GroupInstanceProperty; + + +public class VfModuleArtifactPayloadTest { + + private VfModuleArtifactPayload createTestSubject() { + return new VfModuleArtifactPayload(new GroupDefinition()); + } + + + + + @Test + public void testGetArtifacts() throws Exception { + VfModuleArtifactPayload testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testSetArtifacts() throws Exception { + VfModuleArtifactPayload testSubject; + List<String> artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } + + + @Test + public void testGetProperties() throws Exception { + VfModuleArtifactPayload testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + VfModuleArtifactPayload testSubject; + List<GroupInstanceProperty> properties = new ArrayList<>(); + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java index c47400bcdb..796a426e26 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java @@ -20,7 +20,10 @@ package org.openecomp.sdc.be.components.impl; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; import java.lang.reflect.Method; @@ -29,11 +32,14 @@ import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.servlet.ServletContext; import org.apache.commons.lang3.tuple.ImmutablePair; +import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -50,25 +56,42 @@ import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentMetadataDefinition; +import org.openecomp.sdc.be.model.CsarInfo; import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupProperty; +import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.NodeTypeInfo; +import org.openecomp.sdc.be.model.ParsedToscaYamlInfo; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.UploadCapInfo; +import org.openecomp.sdc.be.model.UploadComponentInstanceInfo; +import org.openecomp.sdc.be.model.UploadReqInfo; +import org.openecomp.sdc.be.model.UploadResourceInfo; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; +import org.openecomp.sdc.be.model.category.CategoryDefinition; +import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation; 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.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IPropertyOperation; @@ -79,12 +102,15 @@ import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.tosca.CsarUtils.NonMetaArtifactInfo; +import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; +import org.openecomp.sdc.be.user.IUserBusinessLogic; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; +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.common.util.GeneralUtility; @@ -94,6 +120,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; +import com.att.nsa.cambria.test.support.CambriaBatchingPublisherMock.Entry; + import fj.data.Either; public class ResourceBusinessLogicTest { @@ -107,10 +135,10 @@ public class ResourceBusinessLogicTest { public static final String UPDATED_SUBCATEGORY = "Gateway"; public static final String RESOURCE_NAME = "My-Resource_Name with space"; - private static final String GENERIC_VF_NAME = "org.openecomp.resource.abstract.nodes.VF"; - private static final String GENERIC_VFC_NAME = "org.openecomp.resource.abstract.nodes.VFC"; - private static final String GENERIC_PNF_NAME = "org.openecomp.resource.abstract.nodes.PNF"; - + private static final String GENERIC_VF_NAME = "org.openecomp.resource.abstract.nodes.VF"; + private static final String GENERIC_VFC_NAME = "org.openecomp.resource.abstract.nodes.VFC"; + private static final String GENERIC_PNF_NAME = "org.openecomp.resource.abstract.nodes.PNF"; + final ServletContext servletContext = Mockito.mock(ServletContext.class); IAuditingManager iAuditingManager = null; IElementOperation mockElementDao; @@ -157,7 +185,8 @@ public class ResourceBusinessLogicTest { // Init Configuration String appConfigDir = "src/test/resources/config/catalog-be"; - ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); + ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), + appConfigDir); ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); // Elements @@ -175,30 +204,38 @@ public class ResourceBusinessLogicTest { // Servlet Context attributes when(servletContext.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).thenReturn(configurationManager); - when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(webAppContextWrapper); + when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)) + .thenReturn(webAppContextWrapper); when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webAppContext); when(webAppContext.getBean(IElementOperation.class)).thenReturn(mockElementDao); Either<Integer, StorageOperationStatus> eitherCountRoot = Either.left(1); Either<Boolean, StorageOperationStatus> eitherFalse = Either.left(true); - when(toscaOperationFacade.validateComponentNameExists("Root", ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)).thenReturn(eitherFalse); + when(toscaOperationFacade.validateComponentNameExists("Root", ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)) + .thenReturn(eitherFalse); Either<Boolean, StorageOperationStatus> eitherCountExist = Either.left(true); - when(toscaOperationFacade.validateComponentNameExists("alreadyExists", ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCountExist); - + when(toscaOperationFacade.validateComponentNameExists("alreadyExists", ResourceTypeEnum.VFC, + ComponentTypeEnum.RESOURCE)).thenReturn(eitherCountExist); + Either<Boolean, StorageOperationStatus> eitherCount = Either.left(false); - when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); - when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.VF, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); - when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.PNF, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); - + when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.VFC, + ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); + when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.VF, + ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); + when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.PNF, + ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); + Either<Boolean, StorageOperationStatus> validateDerivedExists = Either.left(true); when(toscaOperationFacade.validateToscaResourceNameExists("Root")).thenReturn(validateDerivedExists); - + Either<Boolean, StorageOperationStatus> validateDerivedNotExists = Either.left(false); when(toscaOperationFacade.validateToscaResourceNameExists("kuku")).thenReturn(validateDerivedNotExists); - when(graphLockOperation.lockComponent(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource))).thenReturn(StorageOperationStatus.OK); - when(graphLockOperation.lockComponentByName(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource))).thenReturn(StorageOperationStatus.OK); - + when(graphLockOperation.lockComponent(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource))) + .thenReturn(StorageOperationStatus.OK); + when(graphLockOperation.lockComponentByName(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource))) + .thenReturn(StorageOperationStatus.OK); + // createResource resourceResponse = createResourceObject(true); Either<Resource, StorageOperationStatus> eitherCreate = Either.left(resourceResponse); @@ -287,7 +324,7 @@ public class ResourceBusinessLogicTest { if (afterCreate) { resource.setName(resource.getName()); resource.setVersion("0.1"); - + resource.setUniqueId(resource.getName().toLowerCase() + ":" + resource.getVersion()); resource.setCreatorUserId(user.getUserId()); resource.setCreatorFullName(user.getFirstName() + " " + user.getLastName()); @@ -305,7 +342,8 @@ public class ResourceBusinessLogicTest { @Test public void testHappyScenario() { Resource resource = createResourceObject(false); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); if (createResponse.isRight()) { assertEquals(new Integer(200), createResponse.right().value().getStatus()); @@ -317,15 +355,17 @@ public class ResourceBusinessLogicTest { public void testUpdateHappyScenario() { Resource resource = createResourceObjectCsar(true); setCanWorkOnResource(resource); - + Either<Resource, StorageOperationStatus> resourceLinkedToCsarRes = Either.left(resource); - when(toscaOperationFacade.getLatestComponentByCsarOrName(ComponentTypeEnum.RESOURCE, resource.getCsarUUID(), resource.getSystemName())).thenReturn(resourceLinkedToCsarRes); + when(toscaOperationFacade.getLatestComponentByCsarOrName(ComponentTypeEnum.RESOURCE, resource.getCsarUUID(), + resource.getSystemName())).thenReturn(resourceLinkedToCsarRes); Either<Boolean, StorageOperationStatus> validateDerivedExists = Either.left(true); when(toscaOperationFacade.validateToscaResourceNameExists("Root")).thenReturn(validateDerivedExists); - + Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> updateResponse = bl.validateAndUpdateResourceFromCsar(resource, user, null, null, resource.getUniqueId()); + Either<Resource, ResponseFormat> updateResponse = bl.validateAndUpdateResourceFromCsar(resource, user, null, + null, resource.getUniqueId()); if (updateResponse.isRight()) { assertEquals(new Integer(200), updateResponse.right().value().getStatus()); } @@ -353,7 +393,7 @@ public class ResourceBusinessLogicTest { testTagsExceedsLimitCreate(); testTagsNoServiceName(); testInvalidTag(); - + testContactIdTooLong(); testContactIdWrongFormatCreate(); testResourceContactIdEmpty(); @@ -381,15 +421,18 @@ public class ResourceBusinessLogicTest { resourceExist.setName(resourceName); resourceExist.getTags().add(resourceName); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); - assertResponse(createResponse, ActionStatus.COMPONENT_NAME_ALREADY_EXIST, ComponentTypeEnum.RESOURCE.getValue(), resourceName); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); + assertResponse(createResponse, ActionStatus.COMPONENT_NAME_ALREADY_EXIST, ComponentTypeEnum.RESOURCE.getValue(), + resourceName); } private void testResourceNameEmpty() { Resource resourceExist = createResourceObject(false); resourceExist.setName(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertResponse(createResponse, ActionStatus.MISSING_COMPONENT_NAME, ComponentTypeEnum.RESOURCE.getValue()); } @@ -399,9 +442,11 @@ public class ResourceBusinessLogicTest { String tooLongResourceName = "zCRCAWjqte0DtgcAAMmcJcXeNubeX1p1vOZNTShAHOYNAHvV3iK"; resourceExccedsNameLimit.setName(tooLongResourceName); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_NAME_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), + "" + ValidationUtils.COMPONENT_NAME_MAX_LENGTH); } private void testResourceNameWrongFormat() { @@ -410,7 +455,8 @@ public class ResourceBusinessLogicTest { String nameWrongFormat = "ljg?fd"; resource.setName(nameWrongFormat); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_COMPONENT_NAME, ComponentTypeEnum.RESOURCE.getValue()); } @@ -431,9 +477,11 @@ public class ResourceBusinessLogicTest { resourceExccedsDescLimit.setDescription(tooLongResourceDesc); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsDescLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsDescLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, + ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH); } private void testResourceDescNotEnglish() { @@ -442,29 +490,35 @@ public class ResourceBusinessLogicTest { String notEnglishDesc = "\uC2B5"; notEnglish.setDescription(notEnglishDesc); - Either<Resource, ResponseFormat> createResponse = bl.createResource(notEnglish, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(notEnglish, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_DESCRIPTION, ComponentTypeEnum.RESOURCE.getValue()); + assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_DESCRIPTION, + ComponentTypeEnum.RESOURCE.getValue()); } private void testResourceDescriptionEmpty() { Resource resourceExist = createResourceObject(false); resourceExist.setDescription(""); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_DESCRIPTION, ComponentTypeEnum.RESOURCE.getValue()); + assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_DESCRIPTION, + ComponentTypeEnum.RESOURCE.getValue()); } private void testResourceDescriptionMissing() { Resource resourceExist = createResourceObject(false); resourceExist.setDescription(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_DESCRIPTION, ComponentTypeEnum.RESOURCE.getValue()); + assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_DESCRIPTION, + ComponentTypeEnum.RESOURCE.getValue()); } // Resource description - end // Resource icon start @@ -473,7 +527,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setIcon(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_ICON, ComponentTypeEnum.RESOURCE.getValue()); @@ -483,7 +538,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setIcon("kjk3453^&"); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_ICON, ComponentTypeEnum.RESOURCE.getValue()); @@ -493,10 +549,12 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setIcon("dsjfhskdfhskjdhfskjdhkjdhfkshdfksjsdkfhsdfsdfsdfsfsdfsf"); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_ICON_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.ICON_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_ICON_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), + "" + ValidationUtils.ICON_MAX_LENGTH); } // Resource icon end @@ -505,7 +563,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setTags(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_TAGS); @@ -515,7 +574,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setTags(new ArrayList<String>()); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_TAGS); @@ -571,9 +631,11 @@ public class ResourceBusinessLogicTest { resourceExccedsNameLimit.setTags(tagsList); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT, "" + ValidationUtils.TAG_LIST_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT, + "" + ValidationUtils.TAG_LIST_MAX_LENGTH); } @@ -587,9 +649,11 @@ public class ResourceBusinessLogicTest { resourceExccedsNameLimit.setTags(tagsList); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_SINGLE_TAG_EXCEED_LIMIT, "" + ValidationUtils.TAG_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_SINGLE_TAG_EXCEED_LIMIT, + "" + ValidationUtils.TAG_MAX_LENGTH); } @@ -600,7 +664,8 @@ public class ResourceBusinessLogicTest { tagsList.add(tag1); serviceExccedsNameLimit.setTags(tagsList); - Either<Resource, ResponseFormat> createResponse = bl.createResource(serviceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(serviceExccedsNameLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_TAGS_NO_COMP_NAME); @@ -613,7 +678,8 @@ public class ResourceBusinessLogicTest { tagsList.add(tag1); serviceExccedsNameLimit.setTags(tagsList); - Either<Resource, ResponseFormat> createResponse = bl.createResource(serviceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(serviceExccedsNameLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_FIELD_FORMAT, new String[] { "Resource", "tag" }); @@ -621,14 +687,15 @@ public class ResourceBusinessLogicTest { // Resource tags - stop // Resource contact start - + private void testContactIdTooLong() { Resource resourceContactId = createResourceObject(false); // 59 chars instead of 50 String contactIdTooLong = "thisNameIsVeryLongAndExeccedsTheNormalLengthForContactId"; resourceContactId.setContactId(contactIdTooLong); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceContactId, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceContactId, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); } @@ -639,7 +706,8 @@ public class ResourceBusinessLogicTest { String contactIdFormatWrong = "yrt134!!!"; resourceContactId.setContactId(contactIdFormatWrong); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceContactId, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceContactId, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); } @@ -648,7 +716,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setContactId(""); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); @@ -658,7 +727,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setContactId(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); @@ -669,19 +739,23 @@ public class ResourceBusinessLogicTest { String tooLongVendorName = "h1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9E"; resourceExccedsVendorNameLimit.setVendorName(tooLongVendorName); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsVendorNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsVendorNameLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.VENDOR_NAME_EXCEEDS_LIMIT, "" + ValidationUtils.VENDOR_NAME_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.VENDOR_NAME_EXCEEDS_LIMIT, + "" + ValidationUtils.VENDOR_NAME_MAX_LENGTH); } - + private void testResourceVendorModelNumberExceedsLimit() { Resource resourceExccedsVendorModelNumberLimit = createResourceObject(false); String tooLongVendorModelNumber = "h1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9E"; resourceExccedsVendorModelNumberLimit.setResourceVendorModelNumber(tooLongVendorModelNumber); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsVendorModelNumberLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsVendorModelNumberLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.RESOURCE_VENDOR_MODEL_NUMBER_EXCEEDS_LIMIT, "" + ValidationUtils.RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.RESOURCE_VENDOR_MODEL_NUMBER_EXCEEDS_LIMIT, + "" + ValidationUtils.RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH); } private void testVendorNameWrongFormatCreate() { @@ -690,7 +764,8 @@ public class ResourceBusinessLogicTest { String nameWrongFormat = "ljg*fd"; resource.setVendorName(nameWrongFormat); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_VENDOR_NAME); } @@ -701,7 +776,8 @@ public class ResourceBusinessLogicTest { String nameWrongFormat = "1>2"; resource.setVendorRelease(nameWrongFormat); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_VENDOR_RELEASE); @@ -712,16 +788,19 @@ public class ResourceBusinessLogicTest { String tooLongVendorRelease = "h1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9E"; resourceExccedsNameLimit.setVendorRelease(tooLongVendorRelease); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT, "" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT, + "" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH); } private void testResourceVendorNameMissing() { Resource resourceExist = createResourceObject(false); resourceExist.setVendorName(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_VENDOR_NAME); @@ -731,7 +810,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setVendorRelease(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_VENDOR_RELEASE); @@ -743,7 +823,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setCategories(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_CATEGORY, ComponentTypeEnum.RESOURCE.getValue()); @@ -755,7 +836,8 @@ public class ResourceBusinessLogicTest { resourceExist.setCategories(null); resourceExist.addCategory("koko", "koko"); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CATEGORY, ComponentTypeEnum.RESOURCE.getValue()); @@ -774,7 +856,8 @@ public class ResourceBusinessLogicTest { String licenseType = "User"; createResourceObject.setCost(cost); createResourceObject.setLicenseType(licenseType); - Either<Resource, ResponseFormat> createResponse = bl.createResource(createResourceObject, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(createResourceObject, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); if (createResponse.isRight()) { assertEquals(new Integer(200), createResponse.right().value().getStatus()); @@ -790,7 +873,8 @@ public class ResourceBusinessLogicTest { String cost = "12356,464"; resourceCost.setCost(cost); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceCost, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceCost, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_CONTENT); } @@ -803,7 +887,8 @@ public class ResourceBusinessLogicTest { String licenseType = "cpu"; resourceLicenseType.setLicenseType(licenseType); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceLicenseType, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceLicenseType, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_CONTENT); } @@ -815,7 +900,8 @@ public class ResourceBusinessLogicTest { List<String> list = null; resourceExist.setDerivedFrom(list); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_DERIVED_FROM_TEMPLATE); @@ -825,7 +911,8 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setDerivedFrom(new ArrayList<String>()); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_DERIVED_FROM_TEMPLATE); @@ -837,18 +924,21 @@ public class ResourceBusinessLogicTest { derivedFrom.add("kuku"); resourceExist.setDerivedFrom(derivedFrom); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.PARENT_RESOURCE_NOT_FOUND); } // Derived from stop - private void assertResponse(Either<Resource, ResponseFormat> createResponse, ActionStatus expectedStatus, String... variables) { + private void assertResponse(Either<Resource, ResponseFormat> createResponse, ActionStatus expectedStatus, + String... variables) { ResponseFormat expectedResponse = responseManager.getResponseFormat(expectedStatus, variables); ResponseFormat actualResponse = createResponse.right().value(); assertEquals(expectedResponse.getStatus(), actualResponse.getStatus()); - assertEquals("assert error description", expectedResponse.getFormattedMessage(), actualResponse.getFormattedMessage()); + assertEquals("assert error description", expectedResponse.getFormattedMessage(), + actualResponse.getFormattedMessage()); } // UPDATE tests - start @@ -867,8 +957,9 @@ public class ResourceBusinessLogicTest { Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_COMPONENT_NAME, ComponentTypeEnum.RESOURCE.getValue()); @@ -887,11 +978,12 @@ public class ResourceBusinessLogicTest { String name = "ljg"; updatedResource.setName(name); resource.setVersion("1.0"); - + Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.RESOURCE_NAME_CANNOT_BE_CHANGED); @@ -912,9 +1004,11 @@ public class ResourceBusinessLogicTest { Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_NAME_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), + "" + ValidationUtils.COMPONENT_NAME_MAX_LENGTH); } @Test @@ -930,9 +1024,11 @@ public class ResourceBusinessLogicTest { updatedResource.setName(resourceName); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(updatedResource); when(toscaOperationFacade.updateToscaElement(updatedResource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_NAME_ALREADY_EXIST, ComponentTypeEnum.RESOURCE.getValue(), resourceName); + assertResponse(createResponse, ActionStatus.COMPONENT_NAME_ALREADY_EXIST, ComponentTypeEnum.RESOURCE.getValue(), + resourceName); } // @@ -958,9 +1054,11 @@ public class ResourceBusinessLogicTest { updatedResource.setDescription(tooLongResourceDesc); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, + ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH); } @@ -979,7 +1077,8 @@ public class ResourceBusinessLogicTest { Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_ICON, ComponentTypeEnum.RESOURCE.getValue()); @@ -1002,7 +1101,8 @@ public class ResourceBusinessLogicTest { ; Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.RESOURCE_ICON_CANNOT_BE_CHANGED); @@ -1066,10 +1166,12 @@ public class ResourceBusinessLogicTest { updatedResource.setTags(tagsList); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT, "" + ValidationUtils.TAG_LIST_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT, + "" + ValidationUtils.TAG_LIST_MAX_LENGTH); } @Test @@ -1086,7 +1188,8 @@ public class ResourceBusinessLogicTest { updatedResource.setVendorName(nameWrongFormat); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_VENDOR_NAME); @@ -1108,7 +1211,8 @@ public class ResourceBusinessLogicTest { ; Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.RESOURCE_VENDOR_NAME_CANNOT_BE_CHANGED); @@ -1127,9 +1231,11 @@ public class ResourceBusinessLogicTest { updatedResource.setVendorRelease(tooLongVendorRelease); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), + updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT, "" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT, + "" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH); } @Ignore @@ -1147,7 +1253,8 @@ public class ResourceBusinessLogicTest { updatedResource.setContactId(contactIdTooLong); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, + user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); @@ -1168,7 +1275,8 @@ public class ResourceBusinessLogicTest { updatedResource.addCategory(badCategory, "fikt"); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, + user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CATEGORY, ComponentTypeEnum.RESOURCE.getValue()); @@ -1190,7 +1298,8 @@ public class ResourceBusinessLogicTest { ; Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, + user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.RESOURCE_CATEGORY_CANNOT_BE_CHANGED); @@ -1211,7 +1320,8 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(list); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, + user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_DERIVED_FROM_TEMPLATE); @@ -1230,7 +1340,8 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(new ArrayList<String>()); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, + user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_DERIVED_FROM_TEMPLATE); @@ -1251,7 +1362,8 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(derivedFrom); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, + user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.PARENT_RESOURCE_NOT_FOUND); @@ -1266,13 +1378,16 @@ public class ResourceBusinessLogicTest { // this is in order to prevent failing with 403 earlier Either<Component, StorageOperationStatus> eitherUpdate = Either.left(setCanWorkOnResource(resource)); when(toscaOperationFacade.getToscaElement(resource.getUniqueId())).thenReturn(eitherUpdate); - + Either<Boolean, StorageOperationStatus> isToscaNameExtending = Either.left(true); - when(toscaOperationFacade.validateToscaResourceNameExtends(Mockito.anyString(), Mockito.anyString())).thenReturn(isToscaNameExtending); - - Either<Map<String, PropertyDefinition>, StorageOperationStatus> findPropertiesOfNode = Either.left(new HashMap<>()); - when(propertyOperation.deleteAllPropertiesAssociatedToNode(Mockito.any(NodeTypeEnum.class), Mockito.anyString())).thenReturn(findPropertiesOfNode); - + when(toscaOperationFacade.validateToscaResourceNameExtends(Mockito.anyString(), Mockito.anyString())) + .thenReturn(isToscaNameExtending); + + Either<Map<String, PropertyDefinition>, StorageOperationStatus> findPropertiesOfNode = Either + .left(new HashMap<>()); + when(propertyOperation.deleteAllPropertiesAssociatedToNode(Mockito.any(NodeTypeEnum.class), + Mockito.anyString())).thenReturn(findPropertiesOfNode); + resource.setVersion("1.0"); ArrayList<String> derivedFrom = new ArrayList<String>(); @@ -1280,10 +1395,11 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(derivedFrom); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(updatedResource); when(toscaOperationFacade.updateToscaElement(updatedResource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, + user, false); assertTrue(createResponse.isLeft()); } - + @Test public void testResourceTemplateCertify_UPDATE_SAD() { Resource resource = createResourceObject(true); @@ -1293,7 +1409,7 @@ public class ResourceBusinessLogicTest { // this is in order to prevent failing with 403 earlier Either<Component, StorageOperationStatus> eitherUpdate = Either.left(setCanWorkOnResource(resource)); when(toscaOperationFacade.getToscaElement(resource.getUniqueId())).thenReturn(eitherUpdate); - + Either<Boolean, StorageOperationStatus> isToscaNameExtending = Either.left(false); when(toscaOperationFacade.validateToscaResourceNameExtends(Mockito.anyString(), Mockito.anyString())) .thenReturn(isToscaNameExtending); @@ -1305,8 +1421,8 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(derivedFrom); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, - false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, + user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.PARENT_RESOURCE_DOES_NOT_EXTEND); @@ -1317,22 +1433,28 @@ public class ResourceBusinessLogicTest { public void createOrUpdateResourceAlreadyCheckout() { Resource resourceExist = createResourceObject(false); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); createResponse.left().value().setLastUpdaterUserId(user.getUserId()); assertTrue(createResponse.isLeft()); Either<Component, StorageOperationStatus> getLatestResult = Either.left(createResponse.left().value()); when(toscaOperationFacade.getLatestByName(resourceExist.getName())).thenReturn(getLatestResult); - when(toscaOperationFacade.overrideComponent(Mockito.any(Component.class), Mockito.any(Component.class))).thenReturn(getLatestResult); + when(toscaOperationFacade.overrideComponent(Mockito.any(Component.class), Mockito.any(Component.class))) + .thenReturn(getLatestResult); Resource resourceToUpdtae = createResourceObject(false); - Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl.createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); + Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl + .createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); assertTrue(createOrUpdateResource.isLeft()); - Mockito.verify(toscaOperationFacade, Mockito.times(1)).overrideComponent(Mockito.any(Resource.class), Mockito.any(Resource.class)); - Mockito.verify(lifecycleBl, Mockito.times(0)).changeState(Mockito.anyString(), Mockito.eq(user), Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.anyBoolean(), Mockito.anyBoolean()); + Mockito.verify(toscaOperationFacade, Mockito.times(1)).overrideComponent(Mockito.any(Resource.class), + Mockito.any(Resource.class)); + Mockito.verify(lifecycleBl, Mockito.times(0)).changeState(Mockito.anyString(), Mockito.eq(user), + Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), + Mockito.anyBoolean(), Mockito.anyBoolean()); } @@ -1340,27 +1462,34 @@ public class ResourceBusinessLogicTest { public void createOrUpdateResourceCertified() { Resource resourceExist = createResourceObject(false); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isLeft()); Resource certifiedResource = createResponse.left().value(); certifiedResource.setLifecycleState(LifecycleStateEnum.CERTIFIED); certifiedResource.setVersion("1.0"); - Either<Component, StorageOperationStatus> getLatestResult = Either.left(certifiedResource); when(toscaOperationFacade.getLatestByName(resourceExist.getName())).thenReturn(getLatestResult); - when(toscaOperationFacade.overrideComponent(Mockito.any(Component.class), Mockito.any(Component.class))).thenReturn(getLatestResult); + when(toscaOperationFacade.overrideComponent(Mockito.any(Component.class), Mockito.any(Component.class))) + .thenReturn(getLatestResult); - when(lifecycleBl.changeState(Mockito.anyString(), Mockito.eq(user), Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.anyBoolean(), Mockito.anyBoolean())).thenReturn(createResponse); + when(lifecycleBl.changeState(Mockito.anyString(), Mockito.eq(user), + Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), + Mockito.anyBoolean(), Mockito.anyBoolean())).thenReturn(createResponse); Resource resourceToUpdtae = createResourceObject(false); - Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl.createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); + Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl + .createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); assertTrue(createOrUpdateResource.isLeft()); - Mockito.verify(toscaOperationFacade, Mockito.times(1)).overrideComponent(Mockito.any(Component.class), Mockito.any(Component.class)); - Mockito.verify(lifecycleBl, Mockito.times(1)).changeState(Mockito.anyString(), Mockito.eq(user), Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.anyBoolean(), Mockito.anyBoolean()); + Mockito.verify(toscaOperationFacade, Mockito.times(1)).overrideComponent(Mockito.any(Component.class), + Mockito.any(Component.class)); + Mockito.verify(lifecycleBl, Mockito.times(1)).changeState(Mockito.anyString(), Mockito.eq(user), + Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), + Mockito.anyBoolean(), Mockito.anyBoolean()); } @@ -1371,14 +1500,20 @@ public class ResourceBusinessLogicTest { Either<Component, StorageOperationStatus> getLatestResult = Either.right(StorageOperationStatus.NOT_FOUND); when(toscaOperationFacade.getLatestByName(resourceToUpdtae.getName())).thenReturn(getLatestResult); - Either<Component, StorageOperationStatus> getLatestToscaNameResult = Either.right(StorageOperationStatus.NOT_FOUND); - when(toscaOperationFacade.getLatestByToscaResourceName(resourceToUpdtae.getToscaResourceName())).thenReturn(getLatestToscaNameResult); + Either<Component, StorageOperationStatus> getLatestToscaNameResult = Either + .right(StorageOperationStatus.NOT_FOUND); + when(toscaOperationFacade.getLatestByToscaResourceName(resourceToUpdtae.getToscaResourceName())) + .thenReturn(getLatestToscaNameResult); - Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl.createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); + Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl + .createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); assertTrue(createOrUpdateResource.isLeft()); - Mockito.verify(toscaOperationFacade, Mockito.times(0)).overrideComponent(Mockito.any(Component.class), Mockito.any(Component.class)); - Mockito.verify(lifecycleBl, Mockito.times(0)).changeState(Mockito.anyString(), Mockito.eq(user), Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.anyBoolean(), Mockito.anyBoolean()); + Mockito.verify(toscaOperationFacade, Mockito.times(0)).overrideComponent(Mockito.any(Component.class), + Mockito.any(Component.class)); + Mockito.verify(lifecycleBl, Mockito.times(0)).changeState(Mockito.anyString(), Mockito.eq(user), + Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), + Mockito.anyBoolean(), Mockito.anyBoolean()); } @@ -1422,358 +1557,381 @@ public class ResourceBusinessLogicTest { assertTrue(validatePropertiesDefaultValues.isRight()); } -// @Test -// public void testDeleteMarkedResourcesNoResources() { -// List<GraphVertex> ids = new ArrayList<>(); -// Either<List<GraphVertex>, StorageOperationStatus> eitherNoResources = Either.left(ids); -// when(topologyTemplateOperation.getAllComponentsMarkedForDeletion(ComponentTypeEnum.RESOURCE)).thenReturn(eitherNoResources); -// -// Either<List<String>, ResponseFormat> deleteMarkedResources = bl.deleteMarkedComponents(); -// assertTrue(deleteMarkedResources.isLeft()); -// assertTrue(deleteMarkedResources.left().value().isEmpty()); -// -// Mockito.verify(artifactManager, Mockito.times(0)).deleteAllComponentArtifactsIfNotOnGraph(Mockito.anyList()); -// -// } -// -// @Test -// public void testDeleteMarkedResources() { -// List<String> ids = new ArrayList<String>(); -// String resourceInUse = "123"; -// ids.add(resourceInUse); -// String resourceFree = "456"; -// ids.add(resourceFree); -// Either<List<String>, StorageOperationStatus> eitherNoResources = Either.left(ids); -// when(toscaOperationFacade.getAllComponentsMarkedForDeletion()).thenReturn(eitherNoResources); -// -// Either<Boolean, StorageOperationStatus> resourceInUseResponse = Either.left(true); -// Either<Boolean, StorageOperationStatus> resourceFreeResponse = Either.left(false); -// -// List<ArtifactDefinition> artifacts = new ArrayList<ArtifactDefinition>(); -// Either<List<ArtifactDefinition>, StorageOperationStatus> getArtifactsResponse = Either.left(artifacts); -// when(toscaOperationFacade.getComponentArtifactsForDelete(resourceFree, NodeTypeEnum.Resource, true)).thenReturn(getArtifactsResponse); -// -// when(toscaOperationFacade.isComponentInUse(resourceFree)).thenReturn(resourceFreeResponse); -// when(toscaOperationFacade.isComponentInUse(resourceInUse)).thenReturn(resourceInUseResponse); -// -// Either<Component, StorageOperationStatus> eitherDelete = Either.left(new Resource()); -// when(toscaOperationFacade.deleteToscaComponent(resourceFree)).thenReturn(eitherDelete); -// -// when(artifactManager.deleteAllComponentArtifactsIfNotOnGraph(artifacts)).thenReturn(StorageOperationStatus.OK); -// List<String> deletedComponents = new ArrayList<>(); -// deletedComponents.add(resourceFree); -// when(toscaOperationFacade.deleteMarkedElements(ComponentTypeEnum.RESOURCE)).thenReturn(Either.left(deletedComponents)); -// -// Either<List<String>, ResponseFormat> deleteMarkedResources = bl.deleteMarkedComponents(); -// assertTrue(deleteMarkedResources.isLeft()); -// List<String> resourceIdList = deleteMarkedResources.left().value(); -// assertFalse(resourceIdList.isEmpty()); -// assertTrue(resourceIdList.contains(resourceFree)); -// assertFalse(resourceIdList.contains(resourceInUse)); -// -// Mockito.verify(artifactManager, Mockito.times(1)).deleteAllComponentArtifactsIfNotOnGraph(artifacts); -// } + // @Test + // public void testDeleteMarkedResourcesNoResources() { + // List<GraphVertex> ids = new ArrayList<>(); + // Either<List<GraphVertex>, StorageOperationStatus> eitherNoResources = + // Either.left(ids); + // when(topologyTemplateOperation.getAllComponentsMarkedForDeletion(ComponentTypeEnum.RESOURCE)).thenReturn(eitherNoResources); + // + // Either<List<String>, ResponseFormat> deleteMarkedResources = + // bl.deleteMarkedComponents(); + // assertTrue(deleteMarkedResources.isLeft()); + // assertTrue(deleteMarkedResources.left().value().isEmpty()); + // + // Mockito.verify(artifactManager, + // Mockito.times(0)).deleteAllComponentArtifactsIfNotOnGraph(Mockito.anyList()); + // + // } + // + // @Test + // public void testDeleteMarkedResources() { + // List<String> ids = new ArrayList<String>(); + // String resourceInUse = "123"; + // ids.add(resourceInUse); + // String resourceFree = "456"; + // ids.add(resourceFree); + // Either<List<String>, StorageOperationStatus> eitherNoResources = + // Either.left(ids); + // when(toscaOperationFacade.getAllComponentsMarkedForDeletion()).thenReturn(eitherNoResources); + // + // Either<Boolean, StorageOperationStatus> resourceInUseResponse = + // Either.left(true); + // Either<Boolean, StorageOperationStatus> resourceFreeResponse = + // Either.left(false); + // + // List<ArtifactDefinition> artifacts = new ArrayList<ArtifactDefinition>(); + // Either<List<ArtifactDefinition>, StorageOperationStatus> + // getArtifactsResponse = Either.left(artifacts); + // when(toscaOperationFacade.getComponentArtifactsForDelete(resourceFree, + // NodeTypeEnum.Resource, true)).thenReturn(getArtifactsResponse); + // + // when(toscaOperationFacade.isComponentInUse(resourceFree)).thenReturn(resourceFreeResponse); + // when(toscaOperationFacade.isComponentInUse(resourceInUse)).thenReturn(resourceInUseResponse); + // + // Either<Component, StorageOperationStatus> eitherDelete = Either.left(new + // Resource()); + // when(toscaOperationFacade.deleteToscaComponent(resourceFree)).thenReturn(eitherDelete); + // + // when(artifactManager.deleteAllComponentArtifactsIfNotOnGraph(artifacts)).thenReturn(StorageOperationStatus.OK); + // List<String> deletedComponents = new ArrayList<>(); + // deletedComponents.add(resourceFree); + // when(toscaOperationFacade.deleteMarkedElements(ComponentTypeEnum.RESOURCE)).thenReturn(Either.left(deletedComponents)); + // + // Either<List<String>, ResponseFormat> deleteMarkedResources = + // bl.deleteMarkedComponents(); + // assertTrue(deleteMarkedResources.isLeft()); + // List<String> resourceIdList = deleteMarkedResources.left().value(); + // assertFalse(resourceIdList.isEmpty()); + // assertTrue(resourceIdList.contains(resourceFree)); + // assertFalse(resourceIdList.contains(resourceInUse)); + // + // Mockito.verify(artifactManager, + // Mockito.times(1)).deleteAllComponentArtifactsIfNotOnGraph(artifacts); + // } + @SuppressWarnings("unchecked") @Test public void testFindVfCsarArtifactsToHandle() { - + Class<ResourceBusinessLogic> targetClass = ResourceBusinessLogic.class; String methodName = "findVfCsarArtifactsToHandle"; Resource resource = new Resource(); String deploymentArtifactToUpdateFileName = "deploymentArtifactToUpdate.yaml"; String deploymentArtifactToDeleteFileName = "deploymentArtifactToDelete.yaml"; String deploymentArtifactToCreateFileName = "deploymentArtifactToCreate.yaml"; - + String artifactInfoToUpdateFileName = "infoArtifactToUpdate.yaml"; String artifactInfoToDeleteFileName = "infoArtifactToDelete.yaml"; String artifactInfoToCreateFileName = "infoArtifactToCreate.yaml"; - + byte[] oldPayloadData = "oldPayloadData".getBytes(); byte[] newPayloadData = "newPayloadData".getBytes(); - Map<String, ArtifactDefinition> deploymentArtifacts =new HashMap<>(); - + Map<String, ArtifactDefinition> deploymentArtifacts = new HashMap<>(); + ArtifactDefinition deploymentArtifactToUpdate = new ArtifactDefinition(); deploymentArtifactToUpdate.setMandatory(false); deploymentArtifactToUpdate.setArtifactName(deploymentArtifactToUpdateFileName); deploymentArtifactToUpdate.setArtifactType("SNMP_POLL"); deploymentArtifactToUpdate.setPayload(oldPayloadData); - deploymentArtifactToUpdate.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); - + deploymentArtifactToUpdate + .setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); + ArtifactDefinition deploymentArtifactToDelete = new ArtifactDefinition(); deploymentArtifactToDelete.setMandatory(false); deploymentArtifactToDelete.setArtifactName(deploymentArtifactToDeleteFileName); deploymentArtifactToDelete.setArtifactType("SNMP_TRAP"); deploymentArtifactToDelete.setPayload(oldPayloadData); - deploymentArtifactToDelete.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); - + deploymentArtifactToDelete + .setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); + ArtifactDefinition deploymentArtifactToIgnore = new ArtifactDefinition(); - - deploymentArtifacts.put(ValidationUtils.normalizeArtifactLabel(deploymentArtifactToUpdate.getArtifactName()), deploymentArtifactToUpdate); - deploymentArtifacts.put(ValidationUtils.normalizeArtifactLabel(deploymentArtifactToDelete.getArtifactName()), deploymentArtifactToDelete); + + deploymentArtifacts.put(ValidationUtils.normalizeArtifactLabel(deploymentArtifactToUpdate.getArtifactName()), + deploymentArtifactToUpdate); + deploymentArtifacts.put(ValidationUtils.normalizeArtifactLabel(deploymentArtifactToDelete.getArtifactName()), + deploymentArtifactToDelete); deploymentArtifacts.put("ignore", deploymentArtifactToIgnore); - + Map<String, ArtifactDefinition> artifacts = new HashMap<>(); - + ArtifactDefinition artifactToUpdate = new ArtifactDefinition(); artifactToUpdate.setMandatory(false); artifactToUpdate.setArtifactName(artifactInfoToUpdateFileName); artifactToUpdate.setArtifactType("SNMP_POLL"); artifactToUpdate.setPayload(oldPayloadData); artifactToUpdate.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); - + ArtifactDefinition artifactToDelete = new ArtifactDefinition(); artifactToDelete.setMandatory(false); artifactToDelete.setArtifactName(artifactInfoToDeleteFileName); artifactToDelete.setArtifactType("SNMP_TRAP"); artifactToDelete.setPayload(oldPayloadData); artifactToDelete.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); - + ArtifactDefinition artifactToIgnore = new ArtifactDefinition(); - - artifacts.put(ValidationUtils.normalizeArtifactLabel(artifactToUpdate.getArtifactName()),artifactToUpdate); - artifacts.put(ValidationUtils.normalizeArtifactLabel(artifactToDelete.getArtifactName()),artifactToDelete); - artifacts.put("ignore",artifactToIgnore); - + + artifacts.put(ValidationUtils.normalizeArtifactLabel(artifactToUpdate.getArtifactName()), artifactToUpdate); + artifacts.put(ValidationUtils.normalizeArtifactLabel(artifactToDelete.getArtifactName()), artifactToDelete); + artifacts.put("ignore", artifactToIgnore); + resource.setDeploymentArtifacts(deploymentArtifacts); resource.setArtifacts(artifacts); - + List<NonMetaArtifactInfo> artifactPathAndNameList = new ArrayList<>(); - NonMetaArtifactInfo deploymentArtifactInfoToUpdate = new NonMetaArtifactInfo(deploymentArtifactToUpdate.getArtifactName(), null, - ArtifactTypeEnum.findType(deploymentArtifactToUpdate.getArtifactType()), ArtifactGroupTypeEnum.DEPLOYMENT, - newPayloadData, deploymentArtifactToUpdate.getArtifactName()); - - NonMetaArtifactInfo informationalArtifactInfoToUpdate = new NonMetaArtifactInfo(artifactToUpdate.getArtifactName(), null, - ArtifactTypeEnum.findType(artifactToUpdate.getArtifactType()), ArtifactGroupTypeEnum.DEPLOYMENT, - newPayloadData, artifactToUpdate.getArtifactName()); - - NonMetaArtifactInfo deploymentArtifactInfoToCreate = new NonMetaArtifactInfo(deploymentArtifactToCreateFileName, null, - ArtifactTypeEnum.OTHER, ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, deploymentArtifactToCreateFileName); - - NonMetaArtifactInfo informationalArtifactInfoToCreate = new NonMetaArtifactInfo(artifactInfoToCreateFileName, null, - ArtifactTypeEnum.OTHER, ArtifactGroupTypeEnum.DEPLOYMENT, - newPayloadData, artifactInfoToCreateFileName); - + NonMetaArtifactInfo deploymentArtifactInfoToUpdate = new NonMetaArtifactInfo( + deploymentArtifactToUpdate.getArtifactName(), null, + ArtifactTypeEnum.findType(deploymentArtifactToUpdate.getArtifactType()), + ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, deploymentArtifactToUpdate.getArtifactName()); + + NonMetaArtifactInfo informationalArtifactInfoToUpdate = new NonMetaArtifactInfo( + artifactToUpdate.getArtifactName(), null, ArtifactTypeEnum.findType(artifactToUpdate.getArtifactType()), + ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, artifactToUpdate.getArtifactName()); + + NonMetaArtifactInfo deploymentArtifactInfoToCreate = new NonMetaArtifactInfo(deploymentArtifactToCreateFileName, + null, ArtifactTypeEnum.OTHER, ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, + deploymentArtifactToCreateFileName); + + NonMetaArtifactInfo informationalArtifactInfoToCreate = new NonMetaArtifactInfo(artifactInfoToCreateFileName, + null, ArtifactTypeEnum.OTHER, ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, + artifactInfoToCreateFileName); + artifactPathAndNameList.add(deploymentArtifactInfoToUpdate); artifactPathAndNameList.add(informationalArtifactInfoToUpdate); artifactPathAndNameList.add(deploymentArtifactInfoToCreate); artifactPathAndNameList.add(informationalArtifactInfoToCreate); - - Object[] argObjects = {resource, artifactPathAndNameList, user}; - Class[] argClasses = {Resource.class, List.class, User.class}; - try { - Method method = targetClass.getDeclaredMethod(methodName, argClasses); - method.setAccessible(true); - Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat> findVfCsarArtifactsToHandleRes = - (Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat>) method.invoke(bl, argObjects); - assertTrue(findVfCsarArtifactsToHandleRes.isLeft()); - EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>> foundVfArtifacts = findVfCsarArtifactsToHandleRes.left().value(); - assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Create).size()==2); - assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Update).size()==2); - assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Create).size()==2); - - } - catch (Exception e) { - e.printStackTrace(); - } + + Object[] argObjects = { resource, artifactPathAndNameList, user }; + Class[] argClasses = { Resource.class, List.class, User.class }; + try { + Method method = targetClass.getDeclaredMethod(methodName, argClasses); + method.setAccessible(true); + Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat> findVfCsarArtifactsToHandleRes = (Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat>) method + .invoke(bl, argObjects); + assertTrue(findVfCsarArtifactsToHandleRes.isLeft()); + EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>> foundVfArtifacts = findVfCsarArtifactsToHandleRes + .left().value(); + assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Create).size() == 2); + assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Update).size() == 2); + assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Create).size() == 2); + + } catch (Exception e) { + e.printStackTrace(); + } } - + @SuppressWarnings("rawtypes") @Test public void testBuildNestedVfcToscaNamespace() { - + Class<ResourceBusinessLogic> targetClass = ResourceBusinessLogic.class; String methodName = "buildNestedVfcToscaNamespace"; String nodeTypeFullName = "org.openecomp.resource.abstract.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; String expectedNestedVfcToscaNamespace = "org.openecomp.resource.vfc.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; - Object[] argObjects = {nodeTypeFullName}; - Class[] argClasses = {String.class}; - try { - Method method = targetClass.getDeclaredMethod(methodName, argClasses); - method.setAccessible(true); - String actualNestedVfcToscaNamespace = (String) method.invoke(bl, argObjects); - assertTrue(!actualNestedVfcToscaNamespace.isEmpty()); - assertTrue(actualNestedVfcToscaNamespace.equals(expectedNestedVfcToscaNamespace)); - - } - catch (Exception e) { - e.printStackTrace(); - } + Object[] argObjects = { nodeTypeFullName }; + Class[] argClasses = { String.class }; + try { + Method method = targetClass.getDeclaredMethod(methodName, argClasses); + method.setAccessible(true); + String actualNestedVfcToscaNamespace = (String) method.invoke(bl, argObjects); + assertTrue(!actualNestedVfcToscaNamespace.isEmpty()); + assertTrue(actualNestedVfcToscaNamespace.equals(expectedNestedVfcToscaNamespace)); + + } catch (Exception e) { + e.printStackTrace(); + } } - + @SuppressWarnings("rawtypes") @Test public void testBuildNestedVfcToscaResourceName() { - + Class<ResourceBusinessLogic> targetClass = ResourceBusinessLogic.class; String methodName = "buildNestedVfcToscaResourceName"; String vfResourceName = "vfname"; String nodeTypeFullName = "org.openecomp.resource.abstract.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; String expectedNestedVfcToscaResourceName = "org.openecomp.resource.vfc.vfname.abstract.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; - Object[] argObjects = {vfResourceName, nodeTypeFullName}; - Class[] argClasses = {String.class, String.class}; - try { - Method method = targetClass.getDeclaredMethod(methodName, argClasses); - method.setAccessible(true); - String actualNestedVfcToscaResourceName = (String) method.invoke(bl, argObjects); - assertTrue(!actualNestedVfcToscaResourceName.isEmpty()); - assertTrue(actualNestedVfcToscaResourceName.equals(expectedNestedVfcToscaResourceName)); - - } - catch (Exception e) { - e.printStackTrace(); - } + Object[] argObjects = { vfResourceName, nodeTypeFullName }; + Class[] argClasses = { String.class, String.class }; + try { + Method method = targetClass.getDeclaredMethod(methodName, argClasses); + method.setAccessible(true); + String actualNestedVfcToscaResourceName = (String) method.invoke(bl, argObjects); + assertTrue(!actualNestedVfcToscaResourceName.isEmpty()); + assertTrue(actualNestedVfcToscaResourceName.equals(expectedNestedVfcToscaResourceName)); + + } catch (Exception e) { + e.printStackTrace(); + } } - + @SuppressWarnings("rawtypes") @Test public void testBuildNestedSubstituteYamlName() { - + Class<ResourceBusinessLogic> targetClass = ResourceBusinessLogic.class; String methodName = "buildNestedSubstituteYamlName"; String nodeTypeFullName = "org.openecomp.resource.abstract.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; String expectedNestedSubstituteYamlName = "Definitions/FEAdd_On_Module_vLBAgentTemplateServiceTemplate.yaml"; - Object[] argObjects = {nodeTypeFullName}; - Class[] argClasses = {String.class}; - try { - Method method = targetClass.getDeclaredMethod(methodName, argClasses); - method.setAccessible(true); - String actualNestedSubstituteYamlName = (String) method.invoke(bl, argObjects); - assertTrue(!actualNestedSubstituteYamlName.isEmpty()); - assertTrue(actualNestedSubstituteYamlName.equals(expectedNestedSubstituteYamlName)); - - } - catch (Exception e) { - e.printStackTrace(); - } + Object[] argObjects = { nodeTypeFullName }; + Class[] argClasses = { String.class }; + try { + Method method = targetClass.getDeclaredMethod(methodName, argClasses); + method.setAccessible(true); + String actualNestedSubstituteYamlName = (String) method.invoke(bl, argObjects); + assertTrue(!actualNestedSubstituteYamlName.isEmpty()); + assertTrue(actualNestedSubstituteYamlName.equals(expectedNestedSubstituteYamlName)); + + } catch (Exception e) { + e.printStackTrace(); + } } - - + @Test public void testVFGeneratedInputs() { - + Resource resource = createVF(); List<InputDefinition> inputs = resource.getInputs(); assertTrue(8 == inputs.size()); - for(InputDefinition input : inputs){ + for (InputDefinition input : inputs) { assertNotNull(input.getOwnerId()); } assertTrue(resource.getDerivedFromGenericType().equals(genericVF.getToscaResourceName())); assertTrue(resource.getDerivedFromGenericVersion().equals(genericVF.getVersion())); } - + @Test public void testVFUpdateGenericInputsToLatestOnCheckout() { - - //create a VF that is derived from generic version 1.0 - Resource resource = createVF(); + + // create a VF that is derived from generic version 1.0 + Resource resource = createVF(); // create a new generic version without properties genericVF.setVersion("2.0"); genericVF.setProperties(null); String currentDerivedFromVersion = resource.getDerivedFromGenericVersion(); List<InputDefinition> currentInputs = resource.getInputs(); - //verify previous inputs ownerId fields exist - user may not delete generated inputs + // verify previous inputs ownerId fields exist - user may not delete + // generated inputs assertTrue(8 == currentInputs.stream().filter(p -> null != p.getOwnerId()).collect(Collectors.toList()).size()); Either<Boolean, ResponseFormat> upgradeToLatestGeneric = bl.shouldUpgradeToLatestGeneric(resource); - //verify success + // verify success assertTrue(upgradeToLatestGeneric.isLeft()); - //verify update required and valid + // verify update required and valid assertTrue(upgradeToLatestGeneric.left().value()); - //verify version was upgraded + // verify version was upgraded assertFalse(resource.getDerivedFromGenericVersion().equals(currentDerivedFromVersion)); - //verify inputs were not deleted + // verify inputs were not deleted assertTrue(8 == resource.getInputs().size()); - //verify inputs ownerId fields were removed - user may delete/edit inputs - assertTrue(8 == resource.getInputs().stream().filter(p -> null == p.getOwnerId()).collect(Collectors.toList()).size()); + // verify inputs ownerId fields were removed - user may delete/edit + // inputs + assertTrue(8 == resource.getInputs().stream().filter(p -> null == p.getOwnerId()).collect(Collectors.toList()) + .size()); } - - + @Test public void testVFUpdateGenericInputsToLatestOnCheckoutNotPerformed() { - - //create a VF that is derived from generic version 1.0 + + // create a VF that is derived from generic version 1.0 Resource resource = createVF(); - - //add an input to the VF + + // add an input to the VF PropertyDefinition newProp = new PropertyDefinition(); newProp.setType("integer"); newProp.setName("newProp"); resource.getInputs().add(new InputDefinition(newProp)); - - //create a new generic version with a new property which has the same name as a user defined input on the VF with a different type + + // create a new generic version with a new property which has the same + // name as a user defined input on the VF with a different type genericVF.setVersion("2.0"); newProp.setType("string"); genericVF.setProperties(new ArrayList<PropertyDefinition>()); genericVF.getProperties().add(newProp); - + String currentDerivedFromVersion = resource.getDerivedFromGenericVersion(); - assertTrue(8 == resource.getInputs().stream().filter(p -> null != p.getOwnerId()).collect(Collectors.toList()).size()); + assertTrue(8 == resource.getInputs().stream().filter(p -> null != p.getOwnerId()).collect(Collectors.toList()) + .size()); Either<Boolean, ResponseFormat> upgradeToLatestGeneric = bl.shouldUpgradeToLatestGeneric(resource); - //verify success + // verify success assertTrue(upgradeToLatestGeneric.isLeft()); - //verify update is invalid an void + // verify update is invalid an void assertFalse(upgradeToLatestGeneric.left().value()); - //verify version was not upgraded + // verify version was not upgraded assertTrue(resource.getDerivedFromGenericVersion().equals(currentDerivedFromVersion)); - //verify inputs were not removed + // verify inputs were not removed assertTrue(9 == resource.getInputs().size()); - //verify user defined input exists - assertTrue(1 == resource.getInputs().stream().filter(p -> null == p.getOwnerId()).collect(Collectors.toList()).size()); - assertTrue(resource.getInputs().stream().filter(p -> null == p.getOwnerId()).findAny().get().getType().equals("integer")); + // verify user defined input exists + assertTrue(1 == resource.getInputs().stream().filter(p -> null == p.getOwnerId()).collect(Collectors.toList()) + .size()); + assertTrue(resource.getInputs().stream().filter(p -> null == p.getOwnerId()).findAny().get().getType() + .equals("integer")); } - + @Test public void testPNFGeneratedInputsNoGeneratedInformationalArtifacts() { - + Resource resource = createPNF(); List<InputDefinition> inputs = resource.getInputs(); assertTrue(8 == inputs.size()); - for(InputDefinition input : inputs){ + for (InputDefinition input : inputs) { assertNotNull(input.getOwnerId()); } assertTrue(resource.getDerivedFromGenericType().equals(genericPNF.getToscaResourceName())); assertTrue(resource.getDerivedFromGenericVersion().equals(genericPNF.getVersion())); assertTrue(0 == resource.getArtifacts().size()); } - - + private Resource createVF() { - + genericVF = setupGenericTypeMock(GENERIC_VF_NAME); - when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_VF_NAME)).thenReturn(Either.left(genericVF)); + when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_VF_NAME)) + .thenReturn(Either.left(genericVF)); Resource resource = createResourceObject(true); resource.setDerivedFrom(null); resource.setResourceType(ResourceTypeEnum.VF); when(toscaOperationFacade.createToscaComponent(resource)).thenReturn(Either.left(resource)); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isLeft()); return createResponse.left().value(); } - - private Resource createPNF() { - + + private Resource createPNF() { + genericPNF = setupGenericTypeMock(GENERIC_PNF_NAME); - when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_PNF_NAME)).thenReturn(Either.left(genericPNF)); + when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_PNF_NAME)) + .thenReturn(Either.left(genericPNF)); Resource resource = createResourceObject(true); resource.setDerivedFrom(null); resource.setResourceType(ResourceTypeEnum.PNF); when(toscaOperationFacade.createToscaComponent(resource)).thenReturn(Either.left(resource)); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, + AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isLeft()); return createResponse.left().value(); } - - - private Resource setupGenericTypeMock(String toscaName) { - + private Resource setupGenericTypeMock(String toscaName) { + Resource genericType = createResourceObject(true); genericType.setVersion("1.0"); genericType.setToscaResourceName(toscaName); - String[] propNames = {"nf_function", "nf_role", "nf_naming_code", "nf_type", "nf_naming", "availability_zone_max_count", "min_instances", "max_instances"}; - String[] propTypes = {"string", "string", "string", "string", "org.openecomp.datatypes.Naming", "integer", "integer", "integer"}; + String[] propNames = { "nf_function", "nf_role", "nf_naming_code", "nf_type", "nf_naming", + "availability_zone_max_count", "min_instances", "max_instances" }; + String[] propTypes = { "string", "string", "string", "string", "org.openecomp.datatypes.Naming", "integer", + "integer", "integer" }; List<PropertyDefinition> genericProps = new ArrayList<>(); - for(int i = 0; i < 8; ++i){ + for (int i = 0; i < 8; ++i) { PropertyDefinition prop = new PropertyDefinition(); prop.setName(propNames[i]); prop.setType(propTypes[i]); @@ -1783,6 +1941,289 @@ public class ResourceBusinessLogicTest { return genericType; } - - + private ResourceBusinessLogic createTestSubject() { + return new ResourceBusinessLogic(); + } + + @Test + public void testGetCsarOperation() throws Exception { + ResourceBusinessLogic testSubject; + CsarOperation result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCsarOperation(); + } + + @Test + public void testSetCsarOperation() throws Exception { + ResourceBusinessLogic testSubject; + CsarOperation csarOperation = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCsarOperation(csarOperation); + } + + + @Test + public void testGetLifecycleBusinessLogic() throws Exception { + ResourceBusinessLogic testSubject; + LifecycleBusinessLogic result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLifecycleBusinessLogic(); + } + + + @Test + public void testSetLifecycleManager() throws Exception { + ResourceBusinessLogic testSubject; + LifecycleBusinessLogic lifecycleBusinessLogic = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLifecycleManager(lifecycleBusinessLogic); + } + + + @Test + public void testGetElementDao() throws Exception { + ResourceBusinessLogic testSubject; + IElementOperation result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getElementDao(); + } + + + @Test + public void testSetElementDao() throws Exception { + ResourceBusinessLogic testSubject; + IElementOperation elementDao = null; + + // default test + testSubject = createTestSubject(); + testSubject.setElementDao(elementDao); + } + + + @Test + public void testGetUserAdmin() throws Exception { + ResourceBusinessLogic testSubject; + IUserBusinessLogic result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUserAdmin(); + } + + + @Test + public void testSetUserAdmin() throws Exception { + ResourceBusinessLogic testSubject; + UserBusinessLogic userAdmin = null; + + // default test + testSubject = createTestSubject(); + testSubject.setUserAdmin(userAdmin); + } + + + @Test + public void testGetComponentsUtils() throws Exception { + ResourceBusinessLogic testSubject; + ComponentsUtils result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getComponentsUtils(); + } + + + @Test + public void testSetComponentsUtils() throws Exception { + ResourceBusinessLogic testSubject; + ComponentsUtils componentsUtils = null; + + // default test + testSubject = createTestSubject(); + testSubject.setComponentsUtils(componentsUtils); + } + + + @Test + public void testGetArtifactsManager() throws Exception { + ResourceBusinessLogic testSubject; + ArtifactsBusinessLogic result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactsManager(); + } + + + @Test + public void testSetArtifactsManager() throws Exception { + ResourceBusinessLogic testSubject; + ArtifactsBusinessLogic artifactsManager = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactsManager(artifactsManager); + } + + + @Test + public void testSetPropertyOperation() throws Exception { + ResourceBusinessLogic testSubject; + IPropertyOperation propertyOperation = null; + + // default test + testSubject = createTestSubject(); + testSubject.setPropertyOperation(propertyOperation); + } + + + @Test + public void testGetApplicationDataTypeCache() throws Exception { + ResourceBusinessLogic testSubject; + ApplicationDataTypeCache result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getApplicationDataTypeCache(); + } + + + @Test + public void testSetApplicationDataTypeCache() throws Exception { + ResourceBusinessLogic testSubject; + ApplicationDataTypeCache applicationDataTypeCache = null; + + // default test + testSubject = createTestSubject(); + testSubject.setApplicationDataTypeCache(applicationDataTypeCache); + } + + @Test + public void testSetDeploymentArtifactsPlaceHolder() throws Exception { + ResourceBusinessLogic testSubject; + Component component = new Resource() { + }; + User user = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDeploymentArtifactsPlaceHolder(component, user); + } + + + + @Test + public void testValidateVendorReleaseName_1() throws Exception { + ResourceBusinessLogic testSubject; + String vendorRelease = ""; + Either<Boolean, ResponseFormat> result; + + // test 1 + testSubject = createTestSubject(); + vendorRelease = null; + result = testSubject.validateVendorReleaseName(vendorRelease); + Assert.assertEquals(false, result.left().value()); + + } + + + + + + + @Test + public void testGetCapabilityTypeOperation() throws Exception { + ResourceBusinessLogic testSubject; + ICapabilityTypeOperation result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilityTypeOperation(); + } + + + @Test + public void testSetCapabilityTypeOperation() throws Exception { + ResourceBusinessLogic testSubject; + ICapabilityTypeOperation capabilityTypeOperation = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilityTypeOperation(capabilityTypeOperation); + } + + + @Test + public void testValidatePropertiesDefaultValues() throws Exception { + ResourceBusinessLogic testSubject; + Resource resource = new Resource(); + Either<Boolean, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validatePropertiesDefaultValues(resource); + } + + + @Test + public void testGetComponentInstanceBL() throws Exception { + ResourceBusinessLogic testSubject; + ComponentInstanceBusinessLogic result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getComponentInstanceBL(); + } + + + + @Test + public void testGetComponentInstancesFilteredByPropertiesAndInputs() throws Exception { + ResourceBusinessLogic testSubject; + String componentId = ""; + ComponentTypeEnum componentTypeEnum = null; + String userId = ""; + String searchText = ""; + Either<List<ComponentInstance>, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getComponentInstancesFilteredByPropertiesAndInputs(componentId, componentTypeEnum, userId, + searchText); + } + + + + @Test + public void testGetCacheManagerOperation() throws Exception { + ResourceBusinessLogic testSubject; + ICacheMangerOperation result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCacheManagerOperation(); + } + + + @Test + public void testSetCacheManagerOperation() throws Exception { + ResourceBusinessLogic testSubject; + ICacheMangerOperation cacheManagerOperation = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCacheManagerOperation(cacheManagerOperation); + } + + } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadataTest.java new file mode 100644 index 0000000000..673964e264 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadataTest.java @@ -0,0 +1,255 @@ +package org.openecomp.sdc.be.externalapi.servlet.representation; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ArtifactMetadataTest { + + private ArtifactMetadata createTestSubject() { + return new ArtifactMetadata(); + } + + + @Test + public void testGetArtifactName() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactName(); + } + + + @Test + public void testSetArtifactName() throws Exception { + ArtifactMetadata testSubject; + String artifactName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactName(artifactName); + } + + + @Test + public void testGetArtifactType() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactType(); + } + + + @Test + public void testSetArtifactType() throws Exception { + ArtifactMetadata testSubject; + String artifactType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactType(artifactType); + } + + + @Test + public void testGetArtifactURL() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactURL(); + } + + + @Test + public void testSetArtifactURL() throws Exception { + ArtifactMetadata testSubject; + String artifactURL = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactURL(artifactURL); + } + + + @Test + public void testGetArtifactDescription() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactDescription(); + } + + + @Test + public void testSetArtifactDescription() throws Exception { + ArtifactMetadata testSubject; + String artifactDescription = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactDescription(artifactDescription); + } + + + @Test + public void testGetArtifactTimeout() throws Exception { + ArtifactMetadata testSubject; + Integer result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactTimeout(); + } + + + @Test + public void testSetArtifactTimeout() throws Exception { + ArtifactMetadata testSubject; + Integer artifactTimeout = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactTimeout(artifactTimeout); + } + + + @Test + public void testGetArtifactChecksum() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactChecksum(); + } + + + @Test + public void testSetArtifactChecksum() throws Exception { + ArtifactMetadata testSubject; + String artifactChecksum = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactChecksum(artifactChecksum); + } + + + @Test + public void testGetArtifactUUID() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactUUID(); + } + + + @Test + public void testSetArtifactUUID() throws Exception { + ArtifactMetadata testSubject; + String artifactUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactUUID(artifactUUID); + } + + + @Test + public void testGetArtifactVersion() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactVersion(); + } + + + @Test + public void testSetArtifactVersion() throws Exception { + ArtifactMetadata testSubject; + String artifactVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactVersion(artifactVersion); + } + + + @Test + public void testGetGeneratedFromUUID() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGeneratedFromUUID(); + } + + + @Test + public void testSetGeneratedFromUUID() throws Exception { + ArtifactMetadata testSubject; + String generatedFromUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGeneratedFromUUID(generatedFromUUID); + } + + + @Test + public void testGetArtifactLabel() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactLabel(); + } + + + @Test + public void testSetArtifactLabel() throws Exception { + ArtifactMetadata testSubject; + String artifactLabel = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactLabel(artifactLabel); + } + + + @Test + public void testGetArtifactGroupType() throws Exception { + ArtifactMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactGroupType(); + } + + + @Test + public void testSetArtifactGroupType() throws Exception { + ArtifactMetadata testSubject; + String artifactGroupType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactGroupType(artifactGroupType); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadataTest.java new file mode 100644 index 0000000000..1102dea900 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadataTest.java @@ -0,0 +1,125 @@ +package org.openecomp.sdc.be.externalapi.servlet.representation; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ProductAssetMetadataTest { + + private ProductAssetMetadata createTestSubject() { + return new ProductAssetMetadata(); + } + + + @Test + public void testGetLifecycleState() throws Exception { + ProductAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLifecycleState(); + } + + + @Test + public void testSetLifecycleState() throws Exception { + ProductAssetMetadata testSubject; + String lifecycleState = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLifecycleState(lifecycleState); + } + + + @Test + public void testGetLastUpdaterUserId() throws Exception { + ProductAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterUserId(); + } + + + @Test + public void testSetLastUpdaterUserId() throws Exception { + ProductAssetMetadata testSubject; + String lastUpdaterUserId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterUserId(lastUpdaterUserId); + } + + + @Test + public void testIsActive() throws Exception { + ProductAssetMetadata testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isActive(); + } + + + @Test + public void testSetActive() throws Exception { + ProductAssetMetadata testSubject; + boolean isActive = false; + + // default test + testSubject = createTestSubject(); + testSubject.setActive(isActive); + } + + + @Test + public void testGetContacts() throws Exception { + ProductAssetMetadata testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getContacts(); + } + + + @Test + public void testSetContacts() throws Exception { + ProductAssetMetadata testSubject; + List<String> contacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setContacts(contacts); + } + + + @Test + public void testGetProductGroupings() throws Exception { + ProductAssetMetadata testSubject; + List<ProductCategoryGroupMetadata> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProductGroupings(); + } + + + @Test + public void testSetProductGroupings() throws Exception { + ProductAssetMetadata testSubject; + List<ProductCategoryGroupMetadata> productGroupings = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProductGroupings(productGroupings); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadataTest.java new file mode 100644 index 0000000000..0d931e15df --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadataTest.java @@ -0,0 +1,79 @@ +package org.openecomp.sdc.be.externalapi.servlet.representation; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ProductCategoryGroupMetadataTest { + + private ProductCategoryGroupMetadata createTestSubject() { + return new ProductCategoryGroupMetadata("", "", ""); + } + + + @Test + public void testGetCategory() throws Exception { + ProductCategoryGroupMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + + @Test + public void testSetCategory() throws Exception { + ProductCategoryGroupMetadata testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + + @Test + public void testGetSubCategory() throws Exception { + ProductCategoryGroupMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubCategory(); + } + + + @Test + public void testSetSubCategory() throws Exception { + ProductCategoryGroupMetadata testSubject; + String subCategory = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSubCategory(subCategory); + } + + + @Test + public void testGetGroup() throws Exception { + ProductCategoryGroupMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroup(); + } + + + @Test + public void testSetGroup() throws Exception { + ProductCategoryGroupMetadata testSubject; + String group = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGroup(group); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadataTest.java new file mode 100644 index 0000000000..83d048ae6b --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadataTest.java @@ -0,0 +1,124 @@ +package org.openecomp.sdc.be.externalapi.servlet.representation; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; + +public class ResourceAssetDetailedMetadataTest { + + private ResourceAssetDetailedMetadata createTestSubject() { + return new ResourceAssetDetailedMetadata(); + } + + + @Test + public void testGetLastUpdaterFullName() throws Exception { + ResourceAssetDetailedMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterFullName(); + } + + + @Test + public void testSetLastUpdaterFullName() throws Exception { + ResourceAssetDetailedMetadata testSubject; + String lastUpdaterFullName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterFullName(lastUpdaterFullName); + } + + + @Test + public void testGetToscaResourceName() throws Exception { + ResourceAssetDetailedMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaResourceName(); + } + + + @Test + public void testSetToscaResourceName() throws Exception { + ResourceAssetDetailedMetadata testSubject; + String toscaResourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaResourceName(toscaResourceName); + } + + + @Test + public void testGetResources() throws Exception { + ResourceAssetDetailedMetadata testSubject; + List<ResourceInstanceMetadata> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResources(); + } + + + @Test + public void testSetResources() throws Exception { + ResourceAssetDetailedMetadata testSubject; + List<ResourceInstanceMetadata> resources = null; + + // default test + testSubject = createTestSubject(); + testSubject.setResources(resources); + } + + + @Test + public void testGetArtifacts() throws Exception { + ResourceAssetDetailedMetadata testSubject; + List<ArtifactMetadata> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testSetArtifacts() throws Exception { + ResourceAssetDetailedMetadata testSubject; + List<ArtifactMetadata> artifactMetaList = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifactMetaList); + } + + + @Test + public void testGetDescription() throws Exception { + ResourceAssetDetailedMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ResourceAssetDetailedMetadata testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadataTest.java new file mode 100644 index 0000000000..d0d784f5a8 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadataTest.java @@ -0,0 +1,123 @@ +package org.openecomp.sdc.be.externalapi.servlet.representation; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ResourceAssetMetadataTest { + + private ResourceAssetMetadata createTestSubject() { + return new ResourceAssetMetadata(); + } + + + @Test + public void testGetCategory() throws Exception { + ResourceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + + @Test + public void testSetCategory() throws Exception { + ResourceAssetMetadata testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + + @Test + public void testGetSubCategory() throws Exception { + ResourceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubCategory(); + } + + + @Test + public void testSetSubCategory() throws Exception { + ResourceAssetMetadata testSubject; + String subCategory = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSubCategory(subCategory); + } + + + @Test + public void testGetResourceType() throws Exception { + ResourceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceType(); + } + + + @Test + public void testSetResourceType() throws Exception { + ResourceAssetMetadata testSubject; + String resourceType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceType(resourceType); + } + + + @Test + public void testGetLifecycleState() throws Exception { + ResourceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLifecycleState(); + } + + + @Test + public void testSetLifecycleState() throws Exception { + ResourceAssetMetadata testSubject; + String lifecycleState = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLifecycleState(lifecycleState); + } + + + @Test + public void testGetLastUpdaterUserId() throws Exception { + ResourceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterUserId(); + } + + + @Test + public void testSetLastUpdaterUserId() throws Exception { + ResourceAssetMetadata testSubject; + String lastUpdaterUserId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterUserId(lastUpdaterUserId); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadataTest.java new file mode 100644 index 0000000000..ba9897c7dc --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadataTest.java @@ -0,0 +1,169 @@ +package org.openecomp.sdc.be.externalapi.servlet.representation; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ResourceInstanceMetadataTest { + + private ResourceInstanceMetadata createTestSubject() { + return new ResourceInstanceMetadata(); + } + + + @Test + public void testGetResourceInstanceName() throws Exception { + ResourceInstanceMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceInstanceName(); + } + + + @Test + public void testSetResourceInstanceName() throws Exception { + ResourceInstanceMetadata testSubject; + String resourceInstanceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceInstanceName(resourceInstanceName); + } + + + @Test + public void testGetResourceName() throws Exception { + ResourceInstanceMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceName(); + } + + + @Test + public void testSetResourceName() throws Exception { + ResourceInstanceMetadata testSubject; + String resourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceName(resourceName); + } + + + @Test + public void testGetResourceInvariantUUID() throws Exception { + ResourceInstanceMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceInvariantUUID(); + } + + + @Test + public void testSetResourceInvariantUUID() throws Exception { + ResourceInstanceMetadata testSubject; + String resourceInvariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceInvariantUUID(resourceInvariantUUID); + } + + + @Test + public void testGetResourceVersion() throws Exception { + ResourceInstanceMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVersion(); + } + + + @Test + public void testSetResourceVersion() throws Exception { + ResourceInstanceMetadata testSubject; + String resourceVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVersion(resourceVersion); + } + + + @Test + public void testGetResoucreType() throws Exception { + ResourceInstanceMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResoucreType(); + } + + + @Test + public void testSetResoucreType() throws Exception { + ResourceInstanceMetadata testSubject; + String resoucreType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResoucreType(resoucreType); + } + + + @Test + public void testGetResourceUUID() throws Exception { + ResourceInstanceMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceUUID(); + } + + + @Test + public void testSetResourceUUID() throws Exception { + ResourceInstanceMetadata testSubject; + String resourceUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceUUID(resourceUUID); + } + + + @Test + public void testGetArtifacts() throws Exception { + ResourceInstanceMetadata testSubject; + List<ArtifactMetadata> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testSetArtifacts() throws Exception { + ResourceInstanceMetadata testSubject; + List<ArtifactMetadata> artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadataTest.java new file mode 100644 index 0000000000..29825a6e60 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadataTest.java @@ -0,0 +1,81 @@ +package org.openecomp.sdc.be.externalapi.servlet.representation; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ServiceAssetDetailedMetadataTest { + + private ServiceAssetDetailedMetadata createTestSubject() { + return new ServiceAssetDetailedMetadata(); + } + + + @Test + public void testGetLastUpdaterFullName() throws Exception { + ServiceAssetDetailedMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterFullName(); + } + + + @Test + public void testSetLastUpdaterFullName() throws Exception { + ServiceAssetDetailedMetadata testSubject; + String lastUpdaterFullName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterFullName(lastUpdaterFullName); + } + + + @Test + public void testGetResources() throws Exception { + ServiceAssetDetailedMetadata testSubject; + List<ResourceInstanceMetadata> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResources(); + } + + + @Test + public void testSetResources() throws Exception { + ServiceAssetDetailedMetadata testSubject; + List<ResourceInstanceMetadata> resources = null; + + // default test + testSubject = createTestSubject(); + testSubject.setResources(resources); + } + + + @Test + public void testGetArtifacts() throws Exception { + ServiceAssetDetailedMetadata testSubject; + List<ArtifactMetadata> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testSetArtifacts() throws Exception { + ServiceAssetDetailedMetadata testSubject; + List<ArtifactMetadata> artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadataTest.java new file mode 100644 index 0000000000..6a4a38a02f --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadataTest.java @@ -0,0 +1,101 @@ +package org.openecomp.sdc.be.externalapi.servlet.representation; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ServiceAssetMetadataTest { + + private ServiceAssetMetadata createTestSubject() { + return new ServiceAssetMetadata(); + } + + + @Test + public void testGetCategory() throws Exception { + ServiceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + + @Test + public void testSetCategory() throws Exception { + ServiceAssetMetadata testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + + @Test + public void testGetLifecycleState() throws Exception { + ServiceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLifecycleState(); + } + + + @Test + public void testSetLifecycleState() throws Exception { + ServiceAssetMetadata testSubject; + String lifecycleState = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLifecycleState(lifecycleState); + } + + + @Test + public void testGetLastUpdaterUserId() throws Exception { + ServiceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterUserId(); + } + + + @Test + public void testSetLastUpdaterUserId() throws Exception { + ServiceAssetMetadata testSubject; + String lastUpdaterUserId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterUserId(lastUpdaterUserId); + } + + + @Test + public void testGetDistributionStatus() throws Exception { + ServiceAssetMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDistributionStatus(); + } + + + @Test + public void testSetDistributionStatus() throws Exception { + ServiceAssetMetadata testSubject; + String distributionStatus = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDistributionStatus(distributionStatus); + } +}
\ 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..b726bee926 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ComponentsUtilsTest.java @@ -0,0 +1,308 @@ +package org.openecomp.sdc.be.impl; + +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.tinkerpop.gremlin.structure.T; +import org.codehaus.jackson.map.module.SimpleModule; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.auditing.api.IAuditingManager; +import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.graph.datatype.AdditionalInformationEnum; +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.ArtifactDefinition; +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.tosca.ToscaError; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; +import org.openecomp.sdc.exception.ResponseFormat; + +import com.fasterxml.jackson.databind.JsonDeserializer; + +import fj.data.Either; + +public class ComponentsUtilsTest { + + private ComponentsUtils createTestSubject() { + return new ComponentsUtils(); + } + + + @Test + public void testInit() throws Exception { + ComponentsUtils testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.Init(); + } + + + @Test + public void testGetAuditingManager() throws Exception { + ComponentsUtils testSubject; + IAuditingManager result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAuditingManager(); + } + + + @Test + public void testSetAuditingManager() throws Exception { + ComponentsUtils testSubject; + IAuditingManager auditingManager = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAuditingManager(auditingManager); + } + + + @Test + public void testAuditResource() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Resource resource = null; + String prevState = ""; + String prevVersion = ""; + AuditingActionEnum actionEnum = null; + EnumMap<AuditingFieldsKeysEnum, Object> additionalParams = null; + + // test 1 + testSubject = createTestSubject(); + actionEnum = null; + testSubject.auditResource(responseFormat, modifier, resource, prevState, prevVersion, actionEnum, + additionalParams); + } + + + @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); + Assert.assertEquals(ActionStatus.GENERAL_ERROR, result); + } + + + @Test + public void testConvertFromToscaError() throws Exception { + ComponentsUtils testSubject; + ToscaError toscaError = null; + ActionStatus result; + + // test 1 + testSubject = createTestSubject(); + toscaError = null; + result = testSubject.convertFromToscaError(toscaError); + Assert.assertEquals(ActionStatus.GENERAL_ERROR, result); + } + + + @Test + public void testConvertFromStorageResponseForCapabilityType() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + 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 testConvertFromStorageResponseForResourceInstanceProperty() throws Exception { + ComponentsUtils testSubject; + StorageOperationStatus storageResponse = StorageOperationStatus.ARTIFACT_NOT_FOUND; + ActionStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertFromStorageResponseForResourceInstanceProperty(storageResponse); + } + + + @Test + public void testAuditComponentAdmin() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Component component = null; + String prevState = ""; + String prevVersion = ""; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum type = null; + + // default test + testSubject = createTestSubject(); + testSubject.auditComponentAdmin(responseFormat, modifier, component, prevState, prevVersion, actionEnum, type); + } + + + @Test + public void testAuditComponent() throws Exception { + ComponentsUtils testSubject; + ResponseFormat responseFormat = null; + User modifier = null; + Component component = null; + String prevState = ""; + String prevVersion = ""; + AuditingActionEnum actionEnum = null; + ComponentTypeEnum type = null; + EnumMap<AuditingFieldsKeysEnum, Object> additionalParams = null; + + // test 1 + testSubject = createTestSubject(); + actionEnum = null; + testSubject.auditComponent(responseFormat, modifier, component, prevState, prevVersion, actionEnum, type, + additionalParams); + } + + + @Test + public void testValidateStringNotEmpty_1() throws Exception { + ComponentsUtils testSubject; + String value = ""; + Boolean result; + + // test 1 + testSubject = createTestSubject(); + value = null; + result = testSubject.validateStringNotEmpty(value); + Assert.assertEquals(false, result); + + // test 2 + testSubject = createTestSubject(); + value = ""; + result = testSubject.validateStringNotEmpty(value); + Assert.assertEquals(false, result); + } + + + @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 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); + } + + + +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessInfoTest.java new file mode 100644 index 0000000000..096bb4dca2 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessInfoTest.java @@ -0,0 +1,233 @@ +package org.openecomp.sdc.be.info; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ArtifactAccessInfoTest { + + private ArtifactAccessInfo createTestSubject() { + return new ArtifactAccessInfo(); + } + + + @Test + public void testGetName() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testSetName() throws Exception { + ArtifactAccessInfo testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testGetUrl() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUrl(); + } + + + @Test + public void testSetUrl() throws Exception { + ArtifactAccessInfo testSubject; + String url = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUrl(url); + } + + + @Test + public void testGetId() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getId(); + } + + + @Test + public void testSetId() throws Exception { + ArtifactAccessInfo testSubject; + String id = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setId(id); + } + + + @Test + public void testGetType() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + ArtifactAccessInfo testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetDescription() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ArtifactAccessInfo testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testGetCreator() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCreator(); + } + + + @Test + public void testSetCreator() throws Exception { + ArtifactAccessInfo testSubject; + String creator = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCreator(creator); + } + + + @Test + public void testGetCreationTime() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCreationTime(); + } + + + @Test + public void testSetCreationTime() throws Exception { + ArtifactAccessInfo testSubject; + String creationTime = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCreationTime(creationTime); + } + + + @Test + public void testGetLastUpdater() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdater(); + } + + + @Test + public void testSetLastUpdater() throws Exception { + ArtifactAccessInfo testSubject; + String lastUpdater = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdater(lastUpdater); + } + + + @Test + public void testGetLastUpdateTime() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdateTime(); + } + + + @Test + public void testSetLastUpdateTime() throws Exception { + ArtifactAccessInfo testSubject; + String lastUpdateTime = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdateTime(lastUpdateTime); + } + + + @Test + public void testGetChecksum() throws Exception { + ArtifactAccessInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getChecksum(); + } + + + @Test + public void testSetChecksum() throws Exception { + ArtifactAccessInfo testSubject; + String checksum = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setChecksum(checksum); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessListTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessListTest.java new file mode 100644 index 0000000000..2164b91542 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessListTest.java @@ -0,0 +1,37 @@ +package org.openecomp.sdc.be.info; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ArtifactAccessListTest { + + private ArtifactAccessList createTestSubject() { + return new ArtifactAccessList(null); + } + + + @Test + public void testGetArtifacts() throws Exception { + ArtifactAccessList testSubject; + List<ArtifactAccessInfo> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testSetArtifacts() throws Exception { + ArtifactAccessList testSubject; + List<ArtifactAccessInfo> artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java new file mode 100644 index 0000000000..379959628c --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java @@ -0,0 +1,182 @@ +package org.openecomp.sdc.be.info; + +import static org.junit.Assert.*; +import java.util.*; +import org.junit.Assert; +import org.junit.Test; + + +public class ArtifactTemplateInfoTest { + + private ArtifactTemplateInfo createTestSubject() { + return new ArtifactTemplateInfo(); + } + + + @Test + public void testGetType() throws Exception { + ArtifactTemplateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + ArtifactTemplateInfo testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetFileName() throws Exception { + ArtifactTemplateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFileName(); + } + + + @Test + public void testSetFileName() throws Exception { + ArtifactTemplateInfo testSubject; + String fileName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setFileName(fileName); + } + + + @Test + public void testGetEnv() throws Exception { + ArtifactTemplateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEnv(); + } + + + @Test + public void testSetEnv() throws Exception { + ArtifactTemplateInfo testSubject; + String env = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEnv(env); + } + + + @Test + public void testGetRelatedArtifactsInfo() throws Exception { + ArtifactTemplateInfo testSubject; + List<ArtifactTemplateInfo> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelatedArtifactsInfo(); + } + + + @Test + public void testSetRelatedArtifactsInfo() throws Exception { + ArtifactTemplateInfo testSubject; + List<ArtifactTemplateInfo> relatedArtifactsInfo = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelatedArtifactsInfo(relatedArtifactsInfo); + } + + + @Test + public void testGetGroupName() throws Exception { + ArtifactTemplateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupName(); + } + + + @Test + public void testSetGroupName() throws Exception { + ArtifactTemplateInfo testSubject; + String groupName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGroupName(groupName); + } + + + @Test + public void testIsBase() throws Exception { + ArtifactTemplateInfo testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isBase(); + } + + + @Test + public void testSetBase() throws Exception { + ArtifactTemplateInfo testSubject; + boolean isBase = false; + + // default test + testSubject = createTestSubject(); + testSubject.setBase(isBase); + } + + + @Test + public void testGetDescription() throws Exception { + ArtifactTemplateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ArtifactTemplateInfo testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testToString() throws Exception { + ArtifactTemplateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + + +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfoTest.java new file mode 100644 index 0000000000..ad8e21bb84 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfoTest.java @@ -0,0 +1,59 @@ +package org.openecomp.sdc.be.info; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; + + +public class CreateAndAssotiateInfoTest { + + private CreateAndAssotiateInfo createTestSubject() { + return new CreateAndAssotiateInfo(new ComponentInstance(), new RequirementCapabilityRelDef()); + } + + + @Test + public void testGetNode() throws Exception { + CreateAndAssotiateInfo testSubject; + ComponentInstance result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNode(); + } + + + @Test + public void testSetNode() throws Exception { + CreateAndAssotiateInfo testSubject; + ComponentInstance node = null; + + // default test + testSubject = createTestSubject(); + testSubject.setNode(node); + } + + + @Test + public void testGetAssociate() throws Exception { + CreateAndAssotiateInfo testSubject; + RequirementCapabilityRelDef result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAssociate(); + } + + + @Test + public void testSetAssociate() throws Exception { + CreateAndAssotiateInfo testSubject; + RequirementCapabilityRelDef associate = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAssociate(associate); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusInfoTest.java new file mode 100644 index 0000000000..dd8a3e6eee --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusInfoTest.java @@ -0,0 +1,124 @@ +package org.openecomp.sdc.be.info; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.common.datastructure.ESTimeBasedEvent; + + +public class DistributionStatusInfoTest { + + private DistributionStatusInfo createTestSubject() { + return new DistributionStatusInfo(new ESTimeBasedEvent()); + } + + + @Test + public void testGetOmfComponentID() throws Exception { + DistributionStatusInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOmfComponentID(); + } + + + @Test + public void testSetOmfComponentID() throws Exception { + DistributionStatusInfo testSubject; + String omfComponentID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setOmfComponentID(omfComponentID); + } + + + @Test + public void testGetTimestamp() throws Exception { + DistributionStatusInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTimestamp(); + } + + + @Test + public void testSetTimestamp() throws Exception { + DistributionStatusInfo testSubject; + String timestamp = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setTimestamp(timestamp); + } + + + @Test + public void testGetUrl() throws Exception { + DistributionStatusInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUrl(); + } + + + @Test + public void testSetUrl() throws Exception { + DistributionStatusInfo testSubject; + String url = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUrl(url); + } + + + @Test + public void testGetStatus() throws Exception { + DistributionStatusInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatus(); + } + + + @Test + public void testSetStatus() throws Exception { + DistributionStatusInfo testSubject; + String status = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setStatus(status); + } + + + @Test + public void testGetErrorReason() throws Exception { + DistributionStatusInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getErrorReason(); + } + + + @Test + public void testSetErrorReason() throws Exception { + DistributionStatusInfo testSubject; + String errorReason = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setErrorReason(errorReason); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java new file mode 100644 index 0000000000..62b1bcbe0f --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java @@ -0,0 +1,101 @@ +package org.openecomp.sdc.be.info; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class DistributionStatusOfServiceInfoTest { + + private DistributionStatusOfServiceInfo createTestSubject() { + return new DistributionStatusOfServiceInfo(); + } + + + @Test + public void testGetDistributionID() throws Exception { + DistributionStatusOfServiceInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDistributionID(); + } + + + @Test + public void testSetDistributionID() throws Exception { + DistributionStatusOfServiceInfo testSubject; + String distributionID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDistributionID(distributionID); + } + + + @Test + public void testGetTimestamp() throws Exception { + DistributionStatusOfServiceInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTimestamp(); + } + + + @Test + public void testSetTimestamp() throws Exception { + DistributionStatusOfServiceInfo testSubject; + String timestamp = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setTimestamp(timestamp); + } + + + @Test + public void testGetUserId() throws Exception { + DistributionStatusOfServiceInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUserId(); + } + + + @Test + public void testSetUserId() throws Exception { + DistributionStatusOfServiceInfo testSubject; + String userId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUserId(userId); + } + + + @Test + public void testGetDeployementStatus() throws Exception { + DistributionStatusOfServiceInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDeployementStatus(); + } + + + @Test + public void testSetDeployementStatus() throws Exception { + DistributionStatusOfServiceInfo testSubject; + String deployementStatus = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDeployementStatus(deployementStatus); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java index 36644c5ff7..b2895d099c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java @@ -6,6 +6,8 @@ import javax.annotation.Generated; import org.junit.Test; import org.openecomp.sdc.be.model.GroupProperty; +import java.util.*; +import org.junit.Assert; public class GroupDefinitionInfoTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java new file mode 100644 index 0000000000..727a1f25d4 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java @@ -0,0 +1,79 @@ +package org.openecomp.sdc.be.info; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class GroupTemplateInfoTest { + + private GroupTemplateInfo createTestSubject() { + return new GroupTemplateInfo(); + } + + + @Test + public void testGetGroupName() throws Exception { + GroupTemplateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupName(); + } + + + @Test + public void testSetGroupName() throws Exception { + GroupTemplateInfo testSubject; + String groupName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGroupName(groupName); + } + + + @Test + public void testIsBase() throws Exception { + GroupTemplateInfo testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isBase(); + } + + + @Test + public void testSetBase() throws Exception { + GroupTemplateInfo testSubject; + boolean isBase = false; + + // default test + testSubject = createTestSubject(); + testSubject.setBase(isBase); + } + + + @Test + public void testGetArtifactTemplateInfo() throws Exception { + GroupTemplateInfo testSubject; + ArtifactTemplateInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactTemplateInfo(); + } + + + @Test + public void testSetArtifactTemplateInfo() throws Exception { + GroupTemplateInfo testSubject; + ArtifactTemplateInfo artifactTemplateInfo = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactTemplateInfo(artifactTemplateInfo); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceInfoTest.java new file mode 100644 index 0000000000..569b04d982 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceInfoTest.java @@ -0,0 +1,59 @@ +package org.openecomp.sdc.be.info; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ServiceInfoTest { + + private ServiceInfo createTestSubject() { + return new ServiceInfo("", null); + } + + + @Test + public void testGetName() throws Exception { + ServiceInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testSetName() throws Exception { + ServiceInfo testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testGetVersions() throws Exception { + ServiceInfo testSubject; + List<ServiceVersionInfo> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersions(); + } + + + @Test + public void testSetVersions() throws Exception { + ServiceInfo testSubject; + List<ServiceVersionInfo> versions = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVersions(versions); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceVersionInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceVersionInfoTest.java new file mode 100644 index 0000000000..2b5e97e86d --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceVersionInfoTest.java @@ -0,0 +1,56 @@ +package org.openecomp.sdc.be.info; + +import javax.annotation.Generated; + +import org.junit.Test; + +public class ServiceVersionInfoTest { + + private ServiceVersionInfo createTestSubject() { + return new ServiceVersionInfo("", "", ""); + } + + + @Test + public void testGetVersion() throws Exception { + ServiceVersionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testSetVersion() throws Exception { + ServiceVersionInfo testSubject; + String serviceVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(serviceVersion); + } + + + @Test + public void testGetUrl() throws Exception { + ServiceVersionInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUrl(); + } + + + @Test + public void testSetUrl() throws Exception { + ServiceVersionInfo testSubject; + String url = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUrl(url); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java new file mode 100644 index 0000000000..43144113ea --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java @@ -0,0 +1,57 @@ +package org.openecomp.sdc.be.info; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ServletJsonResponseTest { + + private ServletJsonResponse createTestSubject() { + return new ServletJsonResponse(); + } + + + @Test + public void testGetDescription() throws Exception { + ServletJsonResponse testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ServletJsonResponse testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testGetSource() throws Exception { + ServletJsonResponse testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSource(); + } + + + @Test + public void testSetSource() throws Exception { + ServletJsonResponse testSubject; + String source = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSource(source); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java new file mode 100644 index 0000000000..c96f71b8fd --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java @@ -0,0 +1,114 @@ +package org.openecomp.sdc.be.info; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaNodeTypeInfoTest { + + private ToscaNodeTypeInfo createTestSubject() { + return new ToscaNodeTypeInfo(); + } + + + @Test + public void testGetNodeName() throws Exception { + ToscaNodeTypeInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNodeName(); + } + + + @Test + public void testSetNodeName() throws Exception { + ToscaNodeTypeInfo testSubject; + String nodeName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setNodeName(nodeName); + } + + + @Test + public void testGetTemplateVersion() throws Exception { + ToscaNodeTypeInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTemplateVersion(); + } + + + @Test + public void testSetTemplateVersion() throws Exception { + ToscaNodeTypeInfo testSubject; + String templateVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setTemplateVersion(templateVersion); + } + + + @Test + public void testGetInterfaces() throws Exception { + ToscaNodeTypeInfo testSubject; + List<ToscaNodeTypeInterface> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInterfaces(); + } + + + @Test + public void testSetInterfaces() throws Exception { + ToscaNodeTypeInfo testSubject; + List<ToscaNodeTypeInterface> interfaces = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInterfaces(interfaces); + } + + + @Test + public void testGetIconPath() throws Exception { + ToscaNodeTypeInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIconPath(); + } + + + @Test + public void testSetIconPath() throws Exception { + ToscaNodeTypeInfo testSubject; + String iconPath = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setIconPath(iconPath); + } + + + @Test + public void testToString() throws Exception { + ToscaNodeTypeInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java new file mode 100644 index 0000000000..daacb79de5 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java @@ -0,0 +1,49 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.ESArtifactData; + +import ch.qos.logback.classic.Logger; + + +public class CsarBuildServletTest { + + private CsarBuildServlet createTestSubject() { + return new CsarBuildServlet(); + } + + + @Test + public void testGetDefaultTemplate() throws Exception { + CsarBuildServlet testSubject; + HttpServletRequest request = null; + String serviceName = ""; + String serviceVersion = ""; + Response result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDefaultTemplate(request, serviceName, serviceVersion); + } + + + @Test + public void testGetToscaCsarTemplate() throws Exception { + CsarBuildServlet testSubject; + HttpServletRequest request = null; + String serviceName = ""; + String serviceVersion = ""; + Response result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaCsarTemplate(request, serviceName, serviceVersion); + } + + + +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java new file mode 100644 index 0000000000..c56fd474b4 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java @@ -0,0 +1,48 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; + +import org.apache.tinkerpop.gremlin.structure.T; +import org.junit.Test; +import org.openecomp.sdc.be.model.ArtifactDefinition; + +public class RepresentationUtilsTest { + + private RepresentationUtils createTestSubject() { + return new RepresentationUtils(); + } + + + @Test + public void testConvertJsonToArtifactDefinitionForUpdate() throws Exception { + String content = ""; + Class<ArtifactDefinition> clazz = null; + ArtifactDefinition result; + + // default test + result = RepresentationUtils.convertJsonToArtifactDefinitionForUpdate(content, clazz); + } + + + @Test + public void testToRepresentation() throws Exception { + T elementToRepresent = null; + Object result; + + // default test + result = RepresentationUtils.toRepresentation(elementToRepresent); + } + + + + + @Test + public void testConvertJsonToArtifactDefinition() throws Exception { + String content = ""; + Class<ArtifactDefinition> clazz = null; + ArtifactDefinition result; + + // default test + result = RepresentationUtils.convertJsonToArtifactDefinition(content, clazz); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ArtifactTypesTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ArtifactTypesTest.java new file mode 100644 index 0000000000..dec4e78008 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ArtifactTypesTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.be.tosca; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.generator.data.ArtifactType; + + +public class ArtifactTypesTest { + + private ArtifactTypes createTestSubject() { + return new ArtifactTypes(); + } + + + @Test + public void testGetArtifactTypes() throws Exception { + ArtifactTypes testSubject; + List<ArtifactType> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactTypes(); + } + + + @Test + public void testSetArtifactTypes() throws Exception { + ArtifactTypes testSubject; + List<ArtifactType> artifactTypes = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactTypes(artifactTypes); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java index faf70f4047..8acfe6cfea 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java @@ -27,13 +27,18 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.tosca.CsarUtils.NonMetaArtifactInfo; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; +import org.openecomp.sdc.exception.ResponseFormat; import fj.data.Either; @@ -44,48 +49,90 @@ public class CsarUtilsTest { // Init Configuration String appConfigDir = "src/test/resources/config/catalog-be"; - ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); + ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), + appConfigDir); ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); } - + @Test - public void testValidateNonMetaArtifactHappyScenario(){ + public void testValidateNonMetaArtifactHappyScenario() { String artifactPath = "Artifacts/Deployment/YANG_XML/myYang.xml"; byte[] payloadData = "some payload data".getBytes(); Map<String, Set<List<String>>> collectedWarningMessages = new HashMap<>(); - Either<NonMetaArtifactInfo, Boolean> eitherNonMetaArtifact = CsarUtils.validateNonMetaArtifact(artifactPath, payloadData, collectedWarningMessages); - assertTrue(eitherNonMetaArtifact.isLeft() ); - assertTrue(collectedWarningMessages.isEmpty() ); + Either<NonMetaArtifactInfo, Boolean> eitherNonMetaArtifact = CsarUtils.validateNonMetaArtifact(artifactPath, + payloadData, collectedWarningMessages); + assertTrue(eitherNonMetaArtifact.isLeft()); + assertTrue(collectedWarningMessages.isEmpty()); artifactPath = "Artifacts/Informational/OTHER/someArtifact.xml"; eitherNonMetaArtifact = CsarUtils.validateNonMetaArtifact(artifactPath, payloadData, collectedWarningMessages); - assertTrue(eitherNonMetaArtifact.isLeft() ); - assertTrue(collectedWarningMessages.isEmpty() ); + assertTrue(eitherNonMetaArtifact.isLeft()); + assertTrue(collectedWarningMessages.isEmpty()); } - + @Test - public void testValidateNonMetaArtifactScenarioWithWarnnings(){ + public void testValidateNonMetaArtifactScenarioWithWarnnings() { String artifactPath = "Artifacts/Deployment/Buga/myYang.xml"; byte[] payloadData = "some payload data".getBytes(); Map<String, Set<List<String>>> collectedWarningMessages = new HashMap<>(); - Either<NonMetaArtifactInfo, Boolean> eitherNonMetaArtifact = CsarUtils.validateNonMetaArtifact(artifactPath, payloadData, collectedWarningMessages); - assertTrue(eitherNonMetaArtifact.isLeft() ); - + Either<NonMetaArtifactInfo, Boolean> eitherNonMetaArtifact = CsarUtils.validateNonMetaArtifact(artifactPath, + payloadData, collectedWarningMessages); + assertTrue(eitherNonMetaArtifact.isLeft()); + artifactPath = "Artifacts/Informational/Buga2/someArtifact.xml"; eitherNonMetaArtifact = CsarUtils.validateNonMetaArtifact(artifactPath, payloadData, collectedWarningMessages); - assertTrue(eitherNonMetaArtifact.isLeft() ); - - assertTrue(collectedWarningMessages.size() == 1 ); + assertTrue(eitherNonMetaArtifact.isLeft()); + + assertTrue(collectedWarningMessages.size() == 1); assertTrue(collectedWarningMessages.values().iterator().next().size() == 2); } - + @Test - public void testValidateNonMetaArtifactUnhappyScenario(){ + public void testValidateNonMetaArtifactUnhappyScenario() { String artifactPath = "Artifacts/Buga/YANG_XML/myYang.xml"; byte[] payloadData = "some payload data".getBytes(); Map<String, Set<List<String>>> collectedWarningMessages = new HashMap<>(); - Either<NonMetaArtifactInfo, Boolean> eitherNonMetaArtifact = CsarUtils.validateNonMetaArtifact(artifactPath, payloadData, collectedWarningMessages); - assertTrue(eitherNonMetaArtifact.isRight() ); - assertTrue( !collectedWarningMessages.isEmpty() ); + Either<NonMetaArtifactInfo, Boolean> eitherNonMetaArtifact = CsarUtils.validateNonMetaArtifact(artifactPath, + payloadData, collectedWarningMessages); + assertTrue(eitherNonMetaArtifact.isRight()); + assertTrue(!collectedWarningMessages.isEmpty()); + } + + private CsarUtils createTestSubject() { + return new CsarUtils(); } + + + @Test + public void testExtractVfcsArtifactsFromCsar() throws Exception { + Map<String, byte[]> csar = null; + Map<String, List<ArtifactDefinition>> result; + + // test 1 + csar = null; + result = CsarUtils.extractVfcsArtifactsFromCsar(csar); + Assert.assertEquals(new HashMap<String, List<ArtifactDefinition>>() , result); + } + + + @Test + public void testHandleWarningMessages() throws Exception { + Map<String, Set<List<String>>> collectedWarningMessages = new HashMap<>(); + + // default test + CsarUtils.handleWarningMessages(collectedWarningMessages); + } + + + @Test + public void testValidateNonMetaArtifact() throws Exception { + String artifactPath = ""; + byte[] payloadData = new byte[] { ' ' }; + Map<String, Set<List<String>>> collectedWarningMessages = null; + Either<NonMetaArtifactInfo, Boolean> result; + + // default test + result = CsarUtils.validateNonMetaArtifact(artifactPath, payloadData, collectedWarningMessages); + } + } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaRepresentationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaRepresentationTest.java new file mode 100644 index 0000000000..9af90bb9e4 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaRepresentationTest.java @@ -0,0 +1,61 @@ +package org.openecomp.sdc.be.tosca; + +import java.util.List; + +import javax.annotation.Generated; + +import org.apache.commons.lang3.tuple.Triple; +import org.junit.Test; +import org.openecomp.sdc.be.model.Component; + + +public class ToscaRepresentationTest { + + private ToscaRepresentation createTestSubject() { + return new ToscaRepresentation(); + } + + + @Test + public void testGetMainYaml() throws Exception { + ToscaRepresentation testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMainYaml(); + } + + + @Test + public void testSetMainYaml() throws Exception { + ToscaRepresentation testSubject; + String mainYaml = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setMainYaml(mainYaml); + } + + + @Test + public void testGetDependencies() throws Exception { + ToscaRepresentation testSubject; + List<Triple<String, String, Component>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDependencies(); + } + + + @Test + public void testSetDependencies() throws Exception { + ToscaRepresentation testSubject; + List<Triple<String, String, Component>> dependancies = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDependencies(dependancies); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/EntrySchemaTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/EntrySchemaTest.java new file mode 100644 index 0000000000..ca3cd411dc --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/EntrySchemaTest.java @@ -0,0 +1,57 @@ +package org.openecomp.sdc.be.tosca.model; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class EntrySchemaTest { + + private EntrySchema createTestSubject() { + return new EntrySchema(); + } + + + @Test + public void testGetType() throws Exception { + EntrySchema testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + EntrySchema testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetDescription() throws Exception { + EntrySchema testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + EntrySchema testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/SubstitutionMappingTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/SubstitutionMappingTest.java new file mode 100644 index 0000000000..f2e3e167df --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/SubstitutionMappingTest.java @@ -0,0 +1,81 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class SubstitutionMappingTest { + + private SubstitutionMapping createTestSubject() { + return new SubstitutionMapping(); + } + + + @Test + public void testGetNode_type() throws Exception { + SubstitutionMapping testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNode_type(); + } + + + @Test + public void testSetNode_type() throws Exception { + SubstitutionMapping testSubject; + String node_type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setNode_type(node_type); + } + + + @Test + public void testGetCapabilities() throws Exception { + SubstitutionMapping testSubject; + Map<String, String[]> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilities(); + } + + + @Test + public void testSetCapabilities() throws Exception { + SubstitutionMapping testSubject; + Map<String, String[]> capabilities = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilities(capabilities); + } + + + @Test + public void testGetRequirements() throws Exception { + SubstitutionMapping testSubject; + Map<String, String[]> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirements(); + } + + + @Test + public void testSetRequirements() throws Exception { + SubstitutionMapping testSubject; + Map<String, String[]> requirements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirements(requirements); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaCapabilityTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaCapabilityTest.java new file mode 100644 index 0000000000..01d65939d2 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaCapabilityTest.java @@ -0,0 +1,126 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaCapabilityTest { + + private ToscaCapability createTestSubject() { + return new ToscaCapability(); + } + + + @Test + public void testGetValid_source_types() throws Exception { + ToscaCapability testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValid_source_types(); + } + + + @Test + public void testSetValid_source_types() throws Exception { + ToscaCapability testSubject; + List<String> valid_source_types = null; + + // default test + testSubject = createTestSubject(); + testSubject.setValid_source_types(valid_source_types); + } + + + @Test + public void testGetType() throws Exception { + ToscaCapability testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + ToscaCapability testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetDescription() throws Exception { + ToscaCapability testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ToscaCapability testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testGetOccurrences() throws Exception { + ToscaCapability testSubject; + List<Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOccurrences(); + } + + + @Test + public void testSetOccurrences() throws Exception { + ToscaCapability testSubject; + List<Object> occurrences = null; + + // default test + testSubject = createTestSubject(); + testSubject.setOccurrences(occurrences); + } + + + @Test + public void testGetProperties() throws Exception { + ToscaCapability testSubject; + Map<String, ToscaProperty> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + ToscaCapability testSubject; + Map<String, ToscaProperty> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplateTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplateTest.java new file mode 100644 index 0000000000..06ff881988 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplateTest.java @@ -0,0 +1,104 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaGroupTemplateTest { + + private ToscaGroupTemplate createTestSubject() { + return new ToscaGroupTemplate(); + } + + + @Test + public void testGetType() throws Exception { + ToscaGroupTemplate testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + ToscaGroupTemplate testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetMembers() throws Exception { + ToscaGroupTemplate testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMembers(); + } + + + @Test + public void testSetMembers() throws Exception { + ToscaGroupTemplate testSubject; + List<String> members = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMembers(members); + } + + + @Test + public void testGetMetadata() throws Exception { + ToscaGroupTemplate testSubject; + IToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + + @Test + public void testSetMetadata() throws Exception { + ToscaGroupTemplate testSubject; + IToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } + + + @Test + public void testGetProperties() throws Exception { + ToscaGroupTemplate testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + ToscaGroupTemplate testSubject; + Map<String, Object> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaMetadataTest.java new file mode 100644 index 0000000000..6a4dc4583d --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaMetadataTest.java @@ -0,0 +1,387 @@ +package org.openecomp.sdc.be.tosca.model; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaMetadataTest { + + private ToscaMetadata createTestSubject() { + return new ToscaMetadata(); + } + + + @Test + public void testGetName() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testSetName() throws Exception { + ToscaMetadata testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testGetInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUUID(); + } + + + @Test + public void testSetInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String invariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUUID(invariantUUID); + } + + + @Test + public void testGetUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUUID(); + } + + + @Test + public void testSetUUID() throws Exception { + ToscaMetadata testSubject; + String uUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUUID(uUID); + } + + + @Test + public void testGetDescription() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ToscaMetadata testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testGetType() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + ToscaMetadata testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetCategory() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + + @Test + public void testSetCategory() throws Exception { + ToscaMetadata testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + + @Test + public void testGetSubcategory() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubcategory(); + } + + + @Test + public void testSetSubcategory() throws Exception { + ToscaMetadata testSubject; + String subcategory = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSubcategory(subcategory); + } + + + @Test + public void testGetResourceVendor() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVendor(); + } + + + @Test + public void testSetResourceVendor() throws Exception { + ToscaMetadata testSubject; + String resourceVendor = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVendor(resourceVendor); + } + + + @Test + public void testGetResourceVendorRelease() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVendorRelease(); + } + + + @Test + public void testSetResourceVendorRelease() throws Exception { + ToscaMetadata testSubject; + String resourceVendorRelease = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVendorRelease(resourceVendorRelease); + } + + + @Test + public void testGetResourceVendorModelNumber() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVendorModelNumber(); + } + + + @Test + public void testSetResourceVendorModelNumber() throws Exception { + ToscaMetadata testSubject; + String resourceVendorModelNumber = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVendorModelNumber(resourceVendorModelNumber); + } + + + @Test + public void testGetServiceType() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceType(); + } + + + @Test + public void testSetServiceType() throws Exception { + ToscaMetadata testSubject; + String serviceType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceType(serviceType); + } + + + @Test + public void testGetServiceRole() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceRole(); + } + + + @Test + public void testSetServiceRole() throws Exception { + ToscaMetadata testSubject; + String serviceRole = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceRole(serviceRole); + } + + + @Test + public void testIsEcompGeneratedNaming() throws Exception { + ToscaMetadata testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isEcompGeneratedNaming(); + } + + + @Test + public void testSetEcompGeneratedNaming() throws Exception { + ToscaMetadata testSubject; + Boolean ecompGeneratedNaming = null; + + // default test + testSubject = createTestSubject(); + testSubject.setEcompGeneratedNaming(ecompGeneratedNaming); + } + + + @Test + public void testIsNamingPolicy() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isNamingPolicy(); + } + + + @Test + public void testSetNamingPolicy() throws Exception { + ToscaMetadata testSubject; + String namingPolicy = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setNamingPolicy(namingPolicy); + } + + + @Test + public void testGetServiceEcompNaming() throws Exception { + ToscaMetadata testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceEcompNaming(); + } + + + @Test + public void testSetServiceEcompNaming() throws Exception { + ToscaMetadata testSubject; + Boolean serviceEcompNaming = null; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceEcompNaming(serviceEcompNaming); + } + + + @Test + public void testGetVersion() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testSetVersion() throws Exception { + ToscaMetadata testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + + @Test + public void testGetCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCustomizationUUID(); + } + + + @Test + public void testSetCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String customizationUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCustomizationUUID(customizationUUID); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplateTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplateTest.java new file mode 100644 index 0000000000..599f118b32 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplateTest.java @@ -0,0 +1,126 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaNodeTemplateTest { + + private ToscaNodeTemplate createTestSubject() { + return new ToscaNodeTemplate(); + } + + + @Test + public void testGetType() throws Exception { + ToscaNodeTemplate testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + ToscaNodeTemplate testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetProperties() throws Exception { + ToscaNodeTemplate testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + ToscaNodeTemplate testSubject; + Map<String, Object> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + + @Test + public void testGetRequirements() throws Exception { + ToscaNodeTemplate testSubject; + List<Map<String, ToscaTemplateRequirement>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirements(); + } + + + @Test + public void testSetRequirements() throws Exception { + ToscaNodeTemplate testSubject; + List<Map<String, ToscaTemplateRequirement>> requirements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirements(requirements); + } + + + @Test + public void testGetCapabilities() throws Exception { + ToscaNodeTemplate testSubject; + Map<String, ToscaTemplateCapability> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilities(); + } + + + @Test + public void testSetCapabilities() throws Exception { + ToscaNodeTemplate testSubject; + Map<String, ToscaTemplateCapability> capabilities = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilities(capabilities); + } + + + @Test + public void testGetMetadata() throws Exception { + ToscaNodeTemplate testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + + @Test + public void testSetMetadata() throws Exception { + ToscaNodeTemplate testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTypeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTypeTest.java new file mode 100644 index 0000000000..b4cccbdbf5 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTypeTest.java @@ -0,0 +1,148 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaNodeTypeTest { + + private ToscaNodeType createTestSubject() { + return new ToscaNodeType(); + } + + + @Test + public void testGetProperties() throws Exception { + ToscaNodeType testSubject; + Map<String, ToscaProperty> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + ToscaNodeType testSubject; + Map<String, ToscaProperty> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + + @Test + public void testGetCapabilities() throws Exception { + ToscaNodeType testSubject; + Map<String, ToscaCapability> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilities(); + } + + + @Test + public void testSetCapabilities() throws Exception { + ToscaNodeType testSubject; + Map<String, ToscaCapability> capabilities = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilities(capabilities); + } + + + @Test + public void testGetRequirements() throws Exception { + ToscaNodeType testSubject; + List<Map<String, ToscaRequirement>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirements(); + } + + + @Test + public void testSetRequirements() throws Exception { + ToscaNodeType testSubject; + List<Map<String, ToscaRequirement>> requirements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirements(requirements); + } + + + @Test + public void testGetDerived_from() throws Exception { + ToscaNodeType testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDerived_from(); + } + + + @Test + public void testSetDerived_from() throws Exception { + ToscaNodeType testSubject; + String derived_from = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDerived_from(derived_from); + } + + + @Test + public void testGetDescription() throws Exception { + ToscaNodeType testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ToscaNodeType testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testGetMetadata() throws Exception { + ToscaNodeType testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + + @Test + public void testSetMetadata() throws Exception { + ToscaNodeType testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaPropertyTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaPropertyTest.java new file mode 100644 index 0000000000..75bf7ddd75 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaPropertyTest.java @@ -0,0 +1,145 @@ +package org.openecomp.sdc.be.tosca.model; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaPropertyTest { + + private ToscaProperty createTestSubject() { + return new ToscaProperty(); + } + + + @Test + public void testGetEntry_schema() throws Exception { + ToscaProperty testSubject; + EntrySchema result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEntry_schema(); + } + + + @Test + public void testSetEntry_schema() throws Exception { + ToscaProperty testSubject; + EntrySchema entry_schema = null; + + // default test + testSubject = createTestSubject(); + testSubject.setEntry_schema(entry_schema); + } + + + @Test + public void testGetType() throws Exception { + ToscaProperty testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + ToscaProperty testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetDefaultp() throws Exception { + ToscaProperty testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDefaultp(); + } + + + @Test + public void testSetDefaultp() throws Exception { + ToscaProperty testSubject; + Object defaultp = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDefaultp(defaultp); + } + + + @Test + public void testGetDescription() throws Exception { + ToscaProperty testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ToscaProperty testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testGetRequired() throws Exception { + ToscaProperty testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequired(); + } + + + @Test + public void testSetRequired() throws Exception { + ToscaProperty testSubject; + Boolean required = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequired(required); + } + + + @Test + public void testGetStatus() throws Exception { + ToscaProperty testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatus(); + } + + + @Test + public void testSetStatus() throws Exception { + ToscaProperty testSubject; + String status = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setStatus(status); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaRequirementTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaRequirementTest.java new file mode 100644 index 0000000000..639f634d7f --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaRequirementTest.java @@ -0,0 +1,49 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaRequirementTest { + + private ToscaRequirement createTestSubject() { + return new ToscaRequirement(); + } + + + @Test + public void testGetOccurrences() throws Exception { + ToscaRequirement testSubject; + List<Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOccurrences(); + } + + + @Test + public void testSetOccurrences() throws Exception { + ToscaRequirement testSubject; + List<Object> occurrences = null; + + // default test + testSubject = createTestSubject(); + testSubject.setOccurrences(occurrences); + } + + + @Test + public void testToMap() throws Exception { + ToscaRequirement testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toMap(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateCapabilityTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateCapabilityTest.java new file mode 100644 index 0000000000..788361862b --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateCapabilityTest.java @@ -0,0 +1,60 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaTemplateCapabilityTest { + + private ToscaTemplateCapability createTestSubject() { + return new ToscaTemplateCapability(); + } + + + @Test + public void testGetValid_source_types() throws Exception { + ToscaTemplateCapability testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValid_source_types(); + } + + + @Test + public void testSetValid_source_types() throws Exception { + ToscaTemplateCapability testSubject; + List<String> valid_source_types = null; + + // default test + testSubject = createTestSubject(); + testSubject.setValid_source_types(valid_source_types); + } + + + @Test + public void testGetProperties() throws Exception { + ToscaTemplateCapability testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + ToscaTemplateCapability testSubject; + Map<String, Object> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateRequirementTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateRequirementTest.java new file mode 100644 index 0000000000..5ae2a37b37 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateRequirementTest.java @@ -0,0 +1,92 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaTemplateRequirementTest { + + private ToscaTemplateRequirement createTestSubject() { + return new ToscaTemplateRequirement(); + } + + + @Test + public void testGetCapability() throws Exception { + ToscaTemplateRequirement testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapability(); + } + + + @Test + public void testSetCapability() throws Exception { + ToscaTemplateRequirement testSubject; + String capability = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCapability(capability); + } + + + @Test + public void testGetNode() throws Exception { + ToscaTemplateRequirement testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNode(); + } + + + @Test + public void testSetNode() throws Exception { + ToscaTemplateRequirement testSubject; + String node = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setNode(node); + } + + + @Test + public void testGetRelationship() throws Exception { + ToscaTemplateRequirement testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelationship(); + } + + + @Test + public void testSetRelationship() throws Exception { + ToscaTemplateRequirement testSubject; + String relationship = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRelationship(relationship); + } + + + @Test + public void testToMap() throws Exception { + ToscaTemplateRequirement testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toMap(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateTest.java new file mode 100644 index 0000000000..3c60e96ffb --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateTest.java @@ -0,0 +1,132 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaTemplateTest { + + private ToscaTemplate createTestSubject() { + return new ToscaTemplate(""); + } + + + @Test + public void testGetNode_types() throws Exception { + ToscaTemplate testSubject; + Map<String, ToscaNodeType> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNode_types(); + } + + + @Test + public void testSetNode_types() throws Exception { + ToscaTemplate testSubject; + Map<String, ToscaNodeType> node_types = null; + + // default test + testSubject = createTestSubject(); + testSubject.setNode_types(node_types); + } + + + @Test + public void testGetImports() throws Exception { + ToscaTemplate testSubject; + List<Map<String, Map<String, String>>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getImports(); + } + + + @Test + public void testSetImports() throws Exception { + ToscaTemplate testSubject; + List<Map<String, Map<String, String>>> imports = null; + + // default test + testSubject = createTestSubject(); + testSubject.setImports(imports); + } + + + @Test + public void testGetTosca_definitions_version() throws Exception { + ToscaTemplate testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTosca_definitions_version(); + } + + + @Test + public void testSetTosca_definitions_version() throws Exception { + ToscaTemplate testSubject; + String tosca_definitions_version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setTosca_definitions_version(tosca_definitions_version); + } + + + @Test + public void testGetMetadata() throws Exception { + ToscaTemplate testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + + @Test + public void testSetMetadata() throws Exception { + ToscaTemplate testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } + + + @Test + public void testGetTopology_template() throws Exception { + ToscaTemplate testSubject; + ToscaTopolgyTemplate result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTopology_template(); + } + + + @Test + public void testSetTopology_template() throws Exception { + ToscaTemplate testSubject; + ToscaTopolgyTemplate topology_template = null; + + // default test + testSubject = createTestSubject(); + testSubject.setTopology_template(topology_template); + } + + + + + + +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTopolgyTemplateTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTopolgyTemplateTest.java new file mode 100644 index 0000000000..71fe9ce8e4 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/ToscaTopolgyTemplateTest.java @@ -0,0 +1,94 @@ +package org.openecomp.sdc.be.tosca.model; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class ToscaTopolgyTemplateTest { + + private ToscaTopolgyTemplate createTestSubject() { + return new ToscaTopolgyTemplate(); + } + + + @Test + public void testGetNode_templates() throws Exception { + ToscaTopolgyTemplate testSubject; + Map<String, ToscaNodeTemplate> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNode_templates(); + } + + + @Test + public void testSetNode_templates() throws Exception { + ToscaTopolgyTemplate testSubject; + Map<String, ToscaNodeTemplate> node_templates = null; + + // default test + testSubject = createTestSubject(); + testSubject.setNode_templates(node_templates); + } + + + @Test + public void testGetGroups() throws Exception { + ToscaTopolgyTemplate testSubject; + Map<String, ToscaGroupTemplate> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroups(); + } + + + + + @Test + public void testGetSubstitution_mappings() throws Exception { + ToscaTopolgyTemplate testSubject; + SubstitutionMapping result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubstitution_mappings(); + } + + + @Test + public void testSetSubstitution_mappings() throws Exception { + ToscaTopolgyTemplate testSubject; + SubstitutionMapping substitution_mapping = null; + + // default test + testSubject = createTestSubject(); + testSubject.setSubstitution_mappings(substitution_mapping); + } + + + @Test + public void testGetInputs() throws Exception { + ToscaTopolgyTemplate testSubject; + Map<String, ToscaProperty> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInputs(); + } + + + @Test + public void testSetInputs() throws Exception { + ToscaTopolgyTemplate testSubject; + Map<String, ToscaProperty> inputs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInputs(inputs); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/VfModuleToscaMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/VfModuleToscaMetadataTest.java new file mode 100644 index 0000000000..90be98bc9c --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/VfModuleToscaMetadataTest.java @@ -0,0 +1,123 @@ +package org.openecomp.sdc.be.tosca.model; + +import javax.annotation.Generated; + +import org.junit.Test; + + +public class VfModuleToscaMetadataTest { + + private VfModuleToscaMetadata createTestSubject() { + return new VfModuleToscaMetadata(); + } + + + @Test + public void testSetName() throws Exception { + VfModuleToscaMetadata testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testSetInvariantUUID() throws Exception { + VfModuleToscaMetadata testSubject; + String invariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUUID(invariantUUID); + } + + + @Test + public void testSetUUID() throws Exception { + VfModuleToscaMetadata testSubject; + String uUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUUID(uUID); + } + + + @Test + public void testSetVersion() throws Exception { + VfModuleToscaMetadata testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + + @Test + public void testGetVfModuleModelName() throws Exception { + VfModuleToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelName(); + } + + + @Test + public void testGetVfModuleModelInvariantUUID() throws Exception { + VfModuleToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelInvariantUUID(); + } + + + @Test + public void testGetVfModuleModelUUID() throws Exception { + VfModuleToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelUUID(); + } + + + @Test + public void testGetVfModuleModelVersion() throws Exception { + VfModuleToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelVersion(); + } + + + @Test + public void testGetVfModuleModelCustomizationUUID() throws Exception { + VfModuleToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelCustomizationUUID(); + } + + + @Test + public void testSetCustomizationUUID() throws Exception { + VfModuleToscaMetadata testSubject; + String customizationUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCustomizationUUID(customizationUUID); + } +}
\ No newline at end of file |