diff options
Diffstat (limited to 'catalog-be/src/test')
29 files changed, 3197 insertions, 37 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java index 2b33fbd704..27963fa8cb 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java @@ -20,31 +20,51 @@ package org.openecomp.sdc.be.servlets; -import fj.data.Either; -import org.apache.commons.codec.binary.Base64; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.sdc.be.model.UploadResourceInfo; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.common.datastructure.Wrapper; -import org.openecomp.sdc.exception.ResponseFormat; -import org.slf4j.Logger; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; -import javax.ws.rs.core.Response; +import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.List; import java.util.Map; import java.util.stream.Stream; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.tinkerpop.gremlin.structure.T; +import org.glassfish.grizzly.servlet.ServletUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.UploadResourceInfo; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.servlets.ResourceUploadServlet.ResourceAuthorityTypeEnum; +import org.openecomp.sdc.common.datastructure.Wrapper; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; + +import com.google.common.base.Supplier; +import com.google.gson.Gson; + +import aj.org.objectweb.asm.Type; +import fj.data.Either; public class AbstractValidationsServletTest { - private static AbstractValidationsServlet servlet = new AbstractValidationsServlet() {}; + private static AbstractValidationsServlet servlet = new AbstractValidationsServlet() { + }; private static final String BASIC_TOSCA_TEMPLATE = "tosca_definitions_version: tosca_simple_yaml_%s"; @@ -53,6 +73,7 @@ public class AbstractValidationsServletTest { servlet.initLog(mock(Logger.class)); } + @SuppressWarnings("unchecked") @Test public void testGetScarFromPayload() { @@ -71,10 +92,12 @@ public class AbstractValidationsServletTest { resourceInfo.setPayloadName(payloadName); resourceInfo.setPayloadData(payloadData); Method privateMethod = null; - privateMethod = AbstractValidationsServlet.class.getDeclaredMethod("getScarFromPayload", UploadResourceInfo.class); + privateMethod = AbstractValidationsServlet.class.getDeclaredMethod("getScarFromPayload", + UploadResourceInfo.class); privateMethod.setAccessible(true); returnValue = (Either<Map<String, byte[]>, ResponseFormat>) privateMethod.invoke(servlet, resourceInfo); - } catch (IOException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IOException | NoSuchMethodException | SecurityException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } assertTrue(returnValue.isLeft()); @@ -87,13 +110,12 @@ public class AbstractValidationsServletTest { Stream.of("1_0", "1_0_0", "1_1", "1_1_0").forEach(this::testValidToscaVersion); } - - private void testValidToscaVersion(String version) { + private void testValidToscaVersion(String version) { Wrapper<Response> responseWrapper = new Wrapper<>(); - servlet.validatePayloadIsTosca(responseWrapper, new UploadResourceInfo(), new User(), String.format(BASIC_TOSCA_TEMPLATE, version)); + servlet.validatePayloadIsTosca(responseWrapper, new UploadResourceInfo(), new User(), + String.format(BASIC_TOSCA_TEMPLATE, version)); assertTrue(responseWrapper.isEmpty()); } - - + } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AdditionalInformationServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AdditionalInformationServletTest.java new file mode 100644 index 0000000000..0cb9906dc4 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AdditionalInformationServletTest.java @@ -0,0 +1,171 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.AdditionalInformationBusinessLogic; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; + + +public class AdditionalInformationServletTest { + + private AdditionalInformationServlet createTestSubject() { + return new AdditionalInformationServlet(); + } + + + @Test + public void testCreateResourceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String resourceId = ""; + String data = ""; + HttpServletRequest request = null; + String userUserId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testCreateServiceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String serviceId = ""; + String data = ""; + HttpServletRequest request = null; + String userUserId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateResourceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String resourceId = ""; + String labelId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateServiceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String serviceId = ""; + String labelId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateResourceAdditionalInformationLabel_1() throws Exception { + AdditionalInformationServlet testSubject; + String resourceId = ""; + String labelId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteServiceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String serviceId = ""; + String labelId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetResourceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String resourceId = ""; + String labelId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetServiceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String serviceId = ""; + String labelId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetAllResourceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String resourceId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetAllServiceAdditionalInformationLabel() throws Exception { + AdditionalInformationServlet testSubject; + String serviceId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArtifactServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArtifactServletTest.java new file mode 100644 index 0000000000..b4d04f92a9 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArtifactServletTest.java @@ -0,0 +1,340 @@ +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.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; + + +public class ArtifactServletTest { + + private ArtifactServlet createTestSubject() { + return new ArtifactServlet(); + } + + + @Test + public void testLoadArtifact() throws Exception { + ArtifactServlet testSubject; + String resourceId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateArtifact() throws Exception { + ArtifactServlet testSubject; + String resourceId = ""; + String artifactId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteArtifact() throws Exception { + ArtifactServlet testSubject; + String resourceId = ""; + String artifactId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testLoadInformationArtifact() throws Exception { + ArtifactServlet testSubject; + String serviceId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateInformationArtifact() throws Exception { + ArtifactServlet testSubject; + String serviceId = ""; + String artifactId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateApiArtifact() throws Exception { + ArtifactServlet testSubject; + String serviceId = ""; + String artifactId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + String origMd5 = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteApiArtifact() throws Exception { + ArtifactServlet testSubject; + String serviceId = ""; + String artifactId = ""; + HttpServletRequest request = null; + String userId = ""; + String origMd5 = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteInformationalArtifact() throws Exception { + ArtifactServlet testSubject; + String serviceId = ""; + String artifactId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDownloadServiceArtifactBase64() throws Exception { + ArtifactServlet testSubject; + String serviceId = ""; + String artifactId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDownloadResourceArtifactBase64() throws Exception { + ArtifactServlet testSubject; + String resourceId = ""; + String artifactId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDownloadResourceInstanceArtifactBase64() throws Exception { + ArtifactServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String componentInstanceId = ""; + String artifactId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testLoadArtifactToInterface() throws Exception { + ArtifactServlet testSubject; + String resourceId = ""; + String interfaceType = ""; + String operation = ""; + String userId = ""; + String origMd5 = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteArtifactToInterface() throws Exception { + ArtifactServlet testSubject; + String resourceId = ""; + String interfaceType = ""; + String operation = ""; + String artifactId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateArtifactToInterface() throws Exception { + ArtifactServlet testSubject; + String resourceId = ""; + String interfaceType = ""; + String operation = ""; + String artifactId = ""; + String userId = ""; + String origMd5 = ""; + HttpServletRequest request = null; + String data = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateRIArtifact() throws Exception { + ArtifactServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String componentInstanceId = ""; + String artifactId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateComponentInstanceArtifact() throws Exception { + ArtifactServlet testSubject; + String userId = ""; + String origMd5 = ""; + String containerComponentType = ""; + String componentId = ""; + String componentInstanceId = ""; + String artifactId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testLoadComponentInstanceArtifact() throws Exception { + ArtifactServlet testSubject; + String userId = ""; + String origMd5 = ""; + String containerComponentType = ""; + String componentId = ""; + String componentInstanceId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteComponentInstanceArtifact() throws Exception { + ArtifactServlet testSubject; + String userId = ""; + String origMd5 = ""; + String containerComponentType = ""; + String componentId = ""; + String componentInstanceId = ""; + String artifactId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetComponentArtifacts() throws Exception { + ArtifactServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String artifactGroupType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetComponentInstanceArtifacts() throws Exception { + ArtifactServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String componentInstanceId = ""; + String artifactGroupType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AttributeServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AttributeServletTest.java new file mode 100644 index 0000000000..34a475882a --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AttributeServletTest.java @@ -0,0 +1,72 @@ +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.model.PropertyDefinition; +import org.openecomp.sdc.exception.ResponseFormat; + +import com.google.common.base.Equivalence.Wrapper; + +public class AttributeServletTest { + + private AttributeServlet createTestSubject() { + return new AttributeServlet(); + } + + + @Test + public void testCreateAttribute() throws Exception { + AttributeServlet testSubject; + String resourceId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUpdateAttribute() throws Exception { + AttributeServlet testSubject; + String resourceId = ""; + String attributeId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testDeleteAttribute() throws Exception { + AttributeServlet testSubject; + String resourceId = ""; + String attributeId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testBuildAttributeFromString() throws Exception { + AttributeServlet testSubject;String data = ""; + Wrapper<PropertyDefinition> attributesWrapper = null; + Wrapper<ResponseFormat> errorWrapper = null; + + + // default test + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java new file mode 100644 index 0000000000..52ee33fd74 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java @@ -0,0 +1,309 @@ +package org.openecomp.sdc.be.servlets; + +import java.util.List; + +import javax.annotation.Generated; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.apache.tinkerpop.gremlin.structure.T; +import org.junit.Test; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; + +public class ComponentInstanceServletTest { + + private ComponentInstanceServlet createTestSubject() { + return new ComponentInstanceServlet(); + } + + + @Test + public void testCreateComponentInstance() throws Exception { + ComponentInstanceServlet testSubject; + String data = ""; + String containerComponentId = ""; + String containerComponentType = ""; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateComponentInstanceMetadata() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String componentInstanceId = ""; + String containerComponentType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateMultipleComponentInstance() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String containerComponentType = ""; + HttpServletRequest request = null; + String componentInstanceJsonArray = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteResourceInstance() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String resourceInstanceId = ""; + String containerComponentType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testAssociateRIToRI() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String containerComponentType = ""; + String userId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDissociateRIFromRI() throws Exception { + ComponentInstanceServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String userId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testCreateAndAssociateRIToRI() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String containerComponentType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateResourceInstanceProperty() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String containerComponentType = ""; + String componentInstanceId = ""; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateResourceInstanceInput() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String containerComponentType = ""; + String componentInstanceId = ""; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateResourceInstanceAttribute() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String containerComponentType = ""; + String componentInstanceId = ""; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteResourceInstanceProperty() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String containerComponentType = ""; + String componentInstanceId = ""; + String propertyId = ""; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testChangeResourceInstanceVersion() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String componentInstanceId = ""; + String containerComponentType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateGroupInstanceProperty() throws Exception { + ComponentInstanceServlet testSubject; + String componentId = ""; + String containerComponentType = ""; + String componentInstanceId = ""; + String groupInstanceId = ""; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetGroupArtifactById() throws Exception { + ComponentInstanceServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String componentInstanceId = ""; + String groupInstId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetInstancePropertiesById() throws Exception { + ComponentInstanceServlet testSubject; + String containerComponentType = ""; + String containerComponentId = ""; + String componentInstanceUniqueId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testCreateServiceProxy() throws Exception { + ComponentInstanceServlet testSubject; + String data = ""; + String containerComponentId = ""; + String containerComponentType = ""; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteServiceProxy() throws Exception { + ComponentInstanceServlet testSubject; + String containerComponentId = ""; + String serviceProxyId = ""; + String containerComponentType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testChangeServiceProxyVersion() throws Exception { + ComponentInstanceServlet testSubject; + String containerComponentId = ""; + String serviceProxyId = ""; + String containerComponentType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentServletTest.java new file mode 100644 index 0000000000..3e97aa4cb0 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentServletTest.java @@ -0,0 +1,144 @@ +package org.openecomp.sdc.be.servlets; + +import java.util.List; + +import javax.annotation.Generated; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; + +public class ComponentServletTest { + + private ComponentServlet createTestSubject() { + return new ComponentServlet(); + } + + + @Test + public void testConformanceLevelValidation() throws Exception { + ComponentServlet testSubject; + String componentType = ""; + String componentUuid = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetRequirementAndCapabilities() throws Exception { + ComponentServlet testSubject; + String componentType = ""; + String componentId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetLatestVersionNotAbstractCheckoutComponents() throws Exception { + ComponentServlet testSubject; + String componentType = ""; + HttpServletRequest request = null; + String internalComponentType = ""; + List<String> componentUids = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetLatestVersionNotAbstractCheckoutComponentsByBody() throws Exception { + ComponentServlet testSubject; + String componentType = ""; + HttpServletRequest request = null; + String internalComponentType = ""; + String userId = ""; + List<String> data = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetLatestVersionNotAbstractCheckoutComponentsIdesOnly() throws Exception { + ComponentServlet testSubject; + String componentType = ""; + HttpServletRequest request = null; + String internalComponentType = ""; + String userId = ""; + String data = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetComponentInstancesFilteredByPropertiesAndInputs() throws Exception { + ComponentServlet testSubject; + String componentType = ""; + String componentId = ""; + HttpServletRequest request = null; + String searchText = ""; + String userId = ""; + String data = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetComponentDataFilteredByParams() throws Exception { + ComponentServlet testSubject; + String componentType = ""; + String componentId = ""; + List<String> dataParamsToReturn = null; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetFilteredComponentInstanceProperties() throws Exception { + ComponentServlet testSubject; + String componentType = ""; + String componentId = ""; + String propertyNameFragment = ""; + List<String> resourceTypes = null; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConfigMgrServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConfigMgrServletTest.java new file mode 100644 index 0000000000..4f2ca19986 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConfigMgrServletTest.java @@ -0,0 +1,84 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.http.HttpServletRequest; + +import org.junit.Assert; +import org.junit.Test; + +import com.datastax.driver.core.Configuration; + +public class ConfigMgrServletTest { + + private ConfigMgrServlet createTestSubject() { + return new ConfigMgrServlet(); + } + + + @Test + public void testGetConfig() throws Exception { + ConfigMgrServlet testSubject; + HttpServletRequest request = null; + String type = ""; + String result; + + // test 1 + testSubject = createTestSubject(); + type = null; + + + // test 2 + testSubject = createTestSubject(); + type = ""; + + // test 3 + testSubject = createTestSubject(); + type = "configuration"; + } + + + @Test + public void testSetConfig1() throws Exception { + ConfigMgrServlet testSubject; + HttpServletRequest request = null; + Configuration configuration = null; + String result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testSetConfig2() throws Exception { + ConfigMgrServlet testSubject; + HttpServletRequest request = null; + Configuration configuration = null; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testSetConfig3() throws Exception { + ConfigMgrServlet testSubject; + HttpServletRequest request = null; + Configuration configuration = null; + String result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testSetConfig4() throws Exception { + ConfigMgrServlet testSubject; + HttpServletRequest request = null; + Configuration configuration = null; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConfigServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConfigServletTest.java new file mode 100644 index 0000000000..adc996eb4c --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConfigServletTest.java @@ -0,0 +1,24 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.http.HttpServletRequest; + +import org.junit.Test; + +public class ConfigServletTest { + + private ConfigServlet createTestSubject() { + return new ConfigServlet(); + } + + + @Test + public void testGetConfig() throws Exception { + ConfigServlet testSubject; + HttpServletRequest request = null; + String result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConsumerServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConsumerServletTest.java new file mode 100644 index 0000000000..6360c5a76e --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConsumerServletTest.java @@ -0,0 +1,85 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.ConsumerBusinessLogic; +import org.openecomp.sdc.be.model.ConsumerDefinition; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; + +public class ConsumerServletTest { + + private ConsumerServlet createTestSubject() { + return new ConsumerServlet(); + } + + + @Test + public void testCreateConsumer() throws Exception { + ConsumerServlet testSubject; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetConsumer() throws Exception { + ConsumerServlet testSubject; + String consumerId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testDeleteConsumer() throws Exception { + ConsumerServlet testSubject; + String consumerId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetConsumerBL() throws Exception { + ConsumerServlet testSubject; + ServletContext context = null; + ConsumerBusinessLogic result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testConvertJsonToObject() throws Exception { + ConsumerServlet testSubject; + String data = ""; + User user = null; + AuditingActionEnum actionEnum = null; + Either<ConsumerDefinition, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + } +}
\ 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 index daacb79de5..e80016a678 100644 --- 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 @@ -8,6 +8,8 @@ import org.junit.Test; import org.openecomp.sdc.be.resources.data.ESArtifactData; import ch.qos.logback.classic.Logger; +import java.util.*; +import org.junit.Assert; public class CsarBuildServletTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/DistributionServiceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/DistributionServiceServletTest.java new file mode 100644 index 0000000000..2233b4ebac --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/DistributionServiceServletTest.java @@ -0,0 +1,63 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.DistributionMonitoringBusinessLogic; + +public class DistributionServiceServletTest { + + private DistributionServiceServlet createTestSubject() { + return new DistributionServiceServlet(); + } + + + @Test + public void testGetServiceById() throws Exception { + DistributionServiceServlet testSubject; + String serviceUUID = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetListOfDistributionStatuses() throws Exception { + DistributionServiceServlet testSubject; + String did = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testInit() throws Exception { + DistributionServiceServlet testSubject; + HttpServletRequest request = null; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetDistributionBL() throws Exception { + DistributionServiceServlet testSubject; + ServletContext context = null; + DistributionMonitoringBusinessLogic result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java new file mode 100644 index 0000000000..2fe68d3a90 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java @@ -0,0 +1,244 @@ +package org.openecomp.sdc.be.servlets; + +import java.util.List; + +import javax.annotation.Generated; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; + +public class ElementServletTest { + + private ElementServlet createTestSubject() { + return new ElementServlet(); + } + + + @Test + public void testGetComponentCategories() throws Exception { + ElementServlet testSubject; + String componentType = ""; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetAllCategories() throws Exception { + ElementServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testCreateComponentCategory() throws Exception { + ElementServlet testSubject; + String componentType = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteComponentCategory() throws Exception { + ElementServlet testSubject; + String categoryUniqueId = ""; + String componentType = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testCreateComponentSubCategory() throws Exception { + ElementServlet testSubject; + String componentType = ""; + String categoryId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteComponentSubCategory() throws Exception { + ElementServlet testSubject; + String categoryUniqueId = ""; + String subCategoryUniqueId = ""; + String componentType = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testCreateComponentGrouping() throws Exception { + ElementServlet testSubject; + String componentType = ""; + String grandParentCategoryId = ""; + String parentSubCategoryId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteComponentGrouping() throws Exception { + ElementServlet testSubject; + String grandParentCategoryUniqueId = ""; + String parentSubCategoryUniqueId = ""; + String groupingUniqueId = ""; + String componentType = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetTags() throws Exception { + ElementServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetPropertyScopes() throws Exception { + ElementServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetArtifactTypes() throws Exception { + ElementServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetConfiguration() throws Exception { + ElementServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetFollowedResourcesServices() throws Exception { + ElementServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetCatalogComponents() throws Exception { + ElementServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + List<OriginTypeEnum> excludeTypes = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteMarkedResources() throws Exception { + ElementServlet testSubject; + String componentType = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetListOfCsars() throws Exception { + ElementServlet testSubject; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupServletTest.java new file mode 100644 index 0000000000..85b835076b --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupServletTest.java @@ -0,0 +1,44 @@ +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; + +public class GroupServletTest { + + private GroupServlet createTestSubject() { + return new GroupServlet(); + } + + + @Test + public void testGetGroupArtifactById() throws Exception { + GroupServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String groupId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + } + + + @Test + public void testUpdateGroupMetadata() throws Exception { + GroupServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String groupUniqueId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/InputsServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/InputsServletTest.java new file mode 100644 index 0000000000..9cc13d32de --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/InputsServletTest.java @@ -0,0 +1,167 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.InputsBusinessLogic; +import org.openecomp.sdc.be.model.ComponentInstInputsMap; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; + +public class InputsServletTest { + + private InputsServlet createTestSubject() { + return new InputsServlet(); + } + + + @Test + public void testGetComponentInputs() throws Exception { + InputsServlet testSubject; + String componentType = ""; + String componentId = ""; + HttpServletRequest request = null; + String fromName = ""; + int amount = 0; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUpdateComponentInputs() throws Exception { + InputsServlet testSubject; + String containerComponentType = ""; + String componentId = ""; + String data = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetComponentInstanceInputs() throws Exception { + InputsServlet testSubject; + String componentType = ""; + String componentId = ""; + String instanceId = ""; + String originComonentUid = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetInputPropertiesForComponentInstance() throws Exception { + InputsServlet testSubject; + String componentType = ""; + String componentId = ""; + String instanceId = ""; + String inputId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetInputsForComponentInput() throws Exception { + InputsServlet testSubject; + String componentType = ""; + String componentId = ""; + String inputId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetInputsAndPropertiesForComponentInput() throws Exception { + InputsServlet testSubject; + String componentType = ""; + String componentId = ""; + String inputId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testParseToComponentInstanceMap() throws Exception { + InputsServlet testSubject; + String serviceJson = ""; + User user = null; + Either<ComponentInstInputsMap, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testCreateMultipleInputs() throws Exception { + InputsServlet testSubject; + String componentType = ""; + String componentId = ""; + HttpServletRequest request = null; + String userId = ""; + String componentInstInputsMapObj = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testDeleteInput() throws Exception { + InputsServlet testSubject; + String componentType = ""; + String componentId = ""; + String inputId = ""; + HttpServletRequest request = null; + String userId = ""; + String componentInstInputsMapObj = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetInputBL() throws Exception { + InputsServlet testSubject; + ServletContext context = null; + InputsBusinessLogic result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/LifecycleServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/LifecycleServletTest.java new file mode 100644 index 0000000000..f92e439c9a --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/LifecycleServletTest.java @@ -0,0 +1,46 @@ +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.model.LifeCycleTransitionEnum; +import org.openecomp.sdc.be.model.User; + +import fj.data.Either; + +public class LifecycleServletTest { + + private LifecycleServlet createTestSubject() { + return new LifecycleServlet(); + } + + + @Test + public void testChangeResourceState() throws Exception { + LifecycleServlet testSubject; + String jsonChangeInfo = ""; + String componentCollection = ""; + String lifecycleTransition = ""; + String componentId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testValidateTransitionEnum() throws Exception { + LifecycleServlet testSubject; + String lifecycleTransition = ""; + User user = null; + Either<LifeCycleTransitionEnum, Response> result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ProductServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ProductServletTest.java new file mode 100644 index 0000000000..2376ceea32 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ProductServletTest.java @@ -0,0 +1,93 @@ +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; + +public class ProductServletTest { + + private ProductServlet createTestSubject() { + return new ProductServlet(); + } + + + @Test + public void testCreateProduct() throws Exception { + ProductServlet testSubject; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetProductById() throws Exception { + ProductServlet testSubject; + String productId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetServiceByNameAndVersion() throws Exception { + ProductServlet testSubject; + String productName = ""; + String productVersion = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testDeleteProduct() throws Exception { + ProductServlet testSubject; + String productId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUpdateProductMetadata() throws Exception { + ProductServlet testSubject; + String productId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testValidateServiceName() throws Exception { + ProductServlet testSubject; + String productName = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PropertyServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PropertyServletTest.java new file mode 100644 index 0000000000..dd31364868 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PropertyServletTest.java @@ -0,0 +1,119 @@ +package org.openecomp.sdc.be.servlets; + +import java.util.Map; + +import javax.annotation.Generated; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.codehaus.jettison.json.JSONObject; +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.PropertyDefinition; + +import com.google.common.collect.Multiset.Entry; + +import fj.data.Either; + +public class PropertyServletTest { + + private PropertyServlet createTestSubject() { + return new PropertyServlet(); + } + + + @Test + public void testCreateProperty() throws Exception { + PropertyServlet testSubject; + String resourceId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetProperty() throws Exception { + PropertyServlet testSubject; + String resourceId = ""; + String propertyId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testDeleteProperty() throws Exception { + PropertyServlet testSubject; + String resourceId = ""; + String propertyId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUpdateProperty() throws Exception { + PropertyServlet testSubject; + String resourceId = ""; + String propertyId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetPropertyModel() throws Exception { + PropertyServlet testSubject; + String resourceId = ""; + String data = ""; + Either<Map<String, PropertyDefinition>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + } + + + + + + @Test + public void testGetPropertyDefinitionJSONObject() throws Exception { + PropertyServlet testSubject; + PropertyDefinition propertyDefinition = null; + JSONObject result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetPropertyBL() throws Exception { + PropertyServlet testSubject; + ServletContext context = null; + PropertyBusinessLogic result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RequirementsServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RequirementsServletTest.java new file mode 100644 index 0000000000..4407ec6577 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RequirementsServletTest.java @@ -0,0 +1,29 @@ +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; + +public class RequirementsServletTest { + + private RequirementsServlet createTestSubject() { + return new RequirementsServlet(); + } + + + @Test + public void testUpdateRequirement() throws Exception { + RequirementsServlet testSubject; + String resourceId = ""; + String requirementId = ""; + String requirementData = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServletTest.java new file mode 100644 index 0000000000..b88a097412 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServletTest.java @@ -0,0 +1,54 @@ +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 ch.qos.logback.classic.Logger; + +public class ResourceArtifactDownloadServletTest { + + private ResourceArtifactDownloadServlet createTestSubject() { + return new ResourceArtifactDownloadServlet(); + } + + + @Test + public void testGetResourceArtifactByName() throws Exception { + ResourceArtifactDownloadServlet testSubject; + String resourceName = ""; + String resourceVersion = ""; + String artifactName = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetResourceArtifactMetadata() throws Exception { + ResourceArtifactDownloadServlet testSubject; + String resourceName = ""; + String resourceVersion = ""; + String artifactName = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetLogger() throws Exception { + ResourceArtifactDownloadServlet testSubject; + Logger result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourcesServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourcesServletTest.java new file mode 100644 index 0000000000..1844cfe188 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourcesServletTest.java @@ -0,0 +1,242 @@ +package org.openecomp.sdc.be.servlets; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.exception.ResponseFormat; + +import com.google.common.base.Equivalence.Wrapper; + +import fj.data.Either; + +public class ResourcesServletTest { + + private ResourcesServlet createTestSubject() { + return new ResourcesServlet(); + } + + + @Test + public void testCreateResource() throws Exception { + ResourcesServlet testSubject; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testIsUIImport() throws Exception { + ResourcesServlet testSubject; + String data = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testPerformUIImport() throws Exception { + ResourcesServlet testSubject;Wrapper<Response> responseWrapper = null; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + String resourceUniqueId = ""; + + + // default test + } + + + @Test + public void testParseToResource() throws Exception { + ResourcesServlet testSubject; + String resourceJson = ""; + User user = null; + Either<Resource, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testParseToLightResource() throws Exception { + ResourcesServlet testSubject; + String resourceJson = ""; + User user = null; + Either<Resource, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteResource() throws Exception { + ResourcesServlet testSubject; + String resourceId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteResourceByNameAndVersion() throws Exception { + ResourcesServlet testSubject; + String resourceName = ""; + String version = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetResourceById() throws Exception { + ResourcesServlet testSubject; + String resourceId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetResourceByNameAndVersion() throws Exception { + ResourcesServlet testSubject; + String resourceName = ""; + String resourceVersion = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testValidateResourceName() throws Exception { + ResourcesServlet testSubject; + String resourceName = ""; + String resourceType = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetCertifiedAbstractResources() throws Exception { + ResourcesServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetCertifiedNotAbstractResources() throws Exception { + ResourcesServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateResourceMetadata() throws Exception { + ResourcesServlet testSubject; + String resourceId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateResource() throws Exception { + ResourcesServlet testSubject; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + String resourceId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testConvertMapToList() throws Exception { + Map<String, PropertyDefinition> properties = null; + List<PropertyDefinition> result; + + // test 1 + properties = null; + + } + + + @Test + public void testGetResourceFromCsar() throws Exception { + ResourcesServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + String csarUUID = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ServiceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ServiceServletTest.java new file mode 100644 index 0000000000..7a21a231d8 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ServiceServletTest.java @@ -0,0 +1,266 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; +import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.exception.ResponseFormat; + +import com.google.common.base.Equivalence.Wrapper; +import com.google.common.util.concurrent.Service; + +import fj.data.Either; + +public class ServiceServletTest { + + private ServiceServlet createTestSubject() { + return new ServiceServlet(); + } + + + @Test + public void testCreateService() throws Exception { + ServiceServlet testSubject; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testParseToService() throws Exception { + ServiceServlet testSubject; + String serviceJson = ""; + User user = null; + Either<Service, ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testValidateServiceName() throws Exception { + ServiceServlet testSubject; + String serviceName = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetComponentAuditRecords() throws Exception { + ServiceServlet testSubject; + String componentType = ""; + String componentUniqueId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testFillUUIDAndVersion() throws Exception { + ServiceServlet testSubject;Wrapper<Response> responseWrapper = null; + Wrapper<String> uuidWrapper = null; + Wrapper<String> versionWrapper = null; + User user = null; + ComponentTypeEnum componentTypeEnum = null; + String componentUniqueId = ""; + ServletContext context = null; + + + // default test + } + + + @Test + public void testDeleteService() throws Exception { + ServiceServlet testSubject; + String serviceId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDeleteServiceByNameAndVersion() throws Exception { + ServiceServlet testSubject; + String serviceName = ""; + String version = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateServiceMetadata() throws Exception { + ServiceServlet testSubject; + String serviceId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateGroupInstancePropertyValues() throws Exception { + ServiceServlet testSubject; + String serviceId = ""; + String componentInstanceId = ""; + String groupInstanceId = ""; + String data = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetServiceById() throws Exception { + ServiceServlet testSubject; + String serviceId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testGetServiceByNameAndVersion() throws Exception { + ServiceServlet testSubject; + String serviceName = ""; + String serviceVersion = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testUpdateServiceDistributionState() throws Exception { + ServiceServlet testSubject; + LifecycleChangeInfoWithAction jsonChangeInfo = null; + String serviceId = ""; + String state = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testActivateDistribution() throws Exception { + ServiceServlet testSubject; + String serviceId = ""; + String env = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testMarkDistributionAsDeployed() throws Exception { + ServiceServlet testSubject; + String serviceId = ""; + String did = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testTempUrlToBeDeleted() throws Exception { + ServiceServlet testSubject; + String serviceId = ""; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testDownloadServiceArtifact() throws Exception { + ServiceServlet testSubject; + String artifactName = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + + } + + + @Test + public void testExecuteCommand() throws Exception { + ServiceServlet testSubject; + String artifactName = ""; + Either<byte[], ResponseFormat> result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java new file mode 100644 index 0000000000..94aaee2afc --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java @@ -0,0 +1,39 @@ +package org.openecomp.sdc.be.servlets; + +import javax.annotation.Generated; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; + +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic; + +public class TypesFetchServletTest { + + private TypesFetchServlet createTestSubject() { + return new TypesFetchServlet(); + } + + + @Test + public void testGetAllDataTypesServlet() throws Exception { + TypesFetchServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetPropertyBL() throws Exception { + TypesFetchServlet testSubject; + ServletContext context = null; + PropertyBusinessLogic result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java index 420cbcca6b..8f4f57e836 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java @@ -35,6 +35,8 @@ import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.tinkerpop.gremlin.structure.T; import org.glassfish.grizzly.http.util.HttpStatus; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.client.ClientConfig; @@ -55,16 +57,19 @@ import org.openecomp.sdc.be.impl.ServletUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.servlets.TypesUploadServlet; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerTwoParam; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.web.context.WebApplicationContext; +import com.google.common.base.Equivalence.Wrapper; +import com.google.common.base.Supplier; + import fj.data.Either; public class TypesUploadServletTest extends JerseyTest { @@ -83,7 +88,8 @@ public class TypesUploadServletTest extends JerseyTest { @BeforeClass public static void setup() { ExternalConfiguration.setAppName("catalog-be"); - 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(webApplicationContext); when(webApplicationContext.getBean(CapabilityTypeImportManager.class)).thenReturn(importManager); when(webApplicationContext.getBean(ServletUtils.class)).thenReturn(servletUtils); @@ -106,11 +112,13 @@ public class TypesUploadServletTest extends JerseyTest { List<CapabilityTypeDefinition> emptyList = new ArrayList<CapabilityTypeDefinition>(); Either<List<CapabilityTypeDefinition>, ResponseFormat> either = Either.left(emptyList); when(importManager.createCapabilityTypes(Mockito.anyString())).thenReturn(either); - FileDataBodyPart filePart = new FileDataBodyPart("capabilityTypeZip", new File("src/test/resources/types/capabilityTypes.zip")); + FileDataBodyPart filePart = new FileDataBodyPart("capabilityTypeZip", + new File("src/test/resources/types/capabilityTypes.zip")); MultiPart multipartEntity = new FormDataMultiPart(); multipartEntity.bodyPart(filePart); - Response response = target().path("/v1/catalog/uploadType/capability").request(MediaType.APPLICATION_JSON).post(Entity.entity(multipartEntity, MediaType.MULTIPART_FORM_DATA), Response.class); + Response response = target().path("/v1/catalog/uploadType/capability").request(MediaType.APPLICATION_JSON) + .post(Entity.entity(multipartEntity, MediaType.MULTIPART_FORM_DATA), Response.class); assertTrue(response.getStatus() == HttpStatus.CREATED_201.getStatusCode()); @@ -137,7 +145,8 @@ public class TypesUploadServletTest extends JerseyTest { when(request.getSession()).thenReturn(session); when(session.getServletContext()).thenReturn(servletContext); 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); for (String mandatoryHeader : configurationManager.getConfiguration().getIdentificationHeaderFields()) { @@ -145,10 +154,96 @@ public class TypesUploadServletTest extends JerseyTest { } - when(servletContext.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).thenReturn(configurationManager); + when(servletContext.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)) + .thenReturn(configurationManager); } }); return resourceConfig; } + + private TypesUploadServlet createTestSubject() { + return new TypesUploadServlet(); + } + + + @Test + public void testUploadCapabilityType() throws Exception { + TypesUploadServlet testSubject; + File file = null; + HttpServletRequest request = null; + String creator = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUploadInterfaceLifecycleType() throws Exception { + TypesUploadServlet testSubject; + File file = null; + HttpServletRequest request = null; + String creator = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUploadCategories() throws Exception { + TypesUploadServlet testSubject; + File file = null; + HttpServletRequest request = null; + String creator = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUploadDataTypes() throws Exception { + TypesUploadServlet testSubject; + File file = null; + HttpServletRequest request = null; + String creator = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUploadGroupTypes() throws Exception { + TypesUploadServlet testSubject; + File file = null; + HttpServletRequest request = null; + String creator = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUploadPolicyTypes() throws Exception { + TypesUploadServlet testSubject; + File file = null; + HttpServletRequest request = null; + String creator = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/UserAdminServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/UserAdminServletTest.java index ed69f104d2..6fd930c684 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/UserAdminServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/UserAdminServletTest.java @@ -30,19 +30,21 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.ws.rs.core.Application; +import javax.ws.rs.core.Response; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; +import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Test; import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.utils.UserStatusEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.servlets.UserAdminServlet; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.UserRoleEnum; @@ -75,7 +77,8 @@ public class UserAdminServletTest extends JerseyTest { ExternalConfiguration.setAppName("catalog-be"); when(session.getServletContext()).thenReturn(servletContext); - 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(webApplicationContext); when(webApplicationContext.getBean(UserBusinessLogic.class)).thenReturn(userAdminManager); @@ -97,26 +100,52 @@ public class UserAdminServletTest extends JerseyTest { } /* - * @Test public void deactivateUserSuccessfullyTest(){ String userToDeleteUserId = "admin1"; User adminUser = new User(); adminUser.setUserId(ADMIN_ATT_UID); Either<User, ActionStatus> eitherActiveUser = buildEitherUser(userToDeleteUserId, true); - * User userToDelete = eitherActiveUser.left().value(); doReturn(eitherActiveUser).when(userAdminManager).getUser( userToDeleteUserId); + * @Test public void deactivateUserSuccessfullyTest(){ String + * userToDeleteUserId = "admin1"; User adminUser = new User(); + * adminUser.setUserId(ADMIN_ATT_UID); Either<User, ActionStatus> + * eitherActiveUser = buildEitherUser(userToDeleteUserId, true); User + * userToDelete = eitherActiveUser.left().value(); + * doReturn(eitherActiveUser).when(userAdminManager).getUser( + * userToDeleteUserId); * - * Either<User, ActionStatus> eitherInactiveUser = buildEitherUser(userToDeleteUserId, false); doReturn(eitherInactiveUser).when(userAdminManager).deActivateUser( adminUser, userToDelete.getUserId()); + * Either<User, ActionStatus> eitherInactiveUser = + * buildEitherUser(userToDeleteUserId, false); + * doReturn(eitherInactiveUser).when(userAdminManager).deActivateUser( + * adminUser, userToDelete.getUserId()); * * - * Response response = target().path("/v1/user/"+userToDeleteUserId).request().delete(); assertTrue(response.getStatus() == HttpStatus.OK.value()); verify(userAdminManager, times(1)).deActivateUser(adminUser, userToDelete.getUserId()); } + * Response response = + * target().path("/v1/user/"+userToDeleteUserId).request().delete(); + * assertTrue(response.getStatus() == HttpStatus.OK.value()); + * verify(userAdminManager, times(1)).deActivateUser(adminUser, + * userToDelete.getUserId()); } * * - * @Test public void forceDeleteUserSuccessfullyTest(){ String userToDeleteUserId = "admin1"; when(request.getHeader(User.FORCE_DELETE_HEADER_FLAG)).thenReturn(User. FORCE_DELETE_HEADER_FLAG); + * @Test public void forceDeleteUserSuccessfullyTest(){ String + * userToDeleteUserId = "admin1"; + * when(request.getHeader(User.FORCE_DELETE_HEADER_FLAG)).thenReturn(User. + * FORCE_DELETE_HEADER_FLAG); * * User adminUser = new User(); adminUser.setUserId(ADMIN_ATT_UID); * - * Either<User, ActionStatus> eitherActiveUser = buildEitherUser(userToDeleteUserId, true); User userToDelete = eitherActiveUser.left().value(); doReturn(eitherActiveUser).when(userAdminManager).getUser( userToDeleteUserId); + * Either<User, ActionStatus> eitherActiveUser = + * buildEitherUser(userToDeleteUserId, true); User userToDelete = + * eitherActiveUser.left().value(); + * doReturn(eitherActiveUser).when(userAdminManager).getUser( + * userToDeleteUserId); * - * Either<User, ActionStatus> eitherUser = buildEitherUser(userToDeleteUserId, true); doReturn(eitherUser).when(userAdminManager).deleteUser(userToDelete. getUserId()); + * Either<User, ActionStatus> eitherUser = + * buildEitherUser(userToDeleteUserId, true); + * doReturn(eitherUser).when(userAdminManager).deleteUser(userToDelete. + * getUserId()); * * - * Response response = target().path("/v1/user/"+userToDeleteUserId).request().delete(); assertTrue(response.getStatus() == HttpStatus.OK.value()); verify(userAdminManager, times(0)).deActivateUser(adminUser, userToDelete.getUserId()); - * verify(userAdminManager, times(1)).deleteUser(userToDelete.getUserId()); } + * Response response = + * target().path("/v1/user/"+userToDeleteUserId).request().delete(); + * assertTrue(response.getStatus() == HttpStatus.OK.value()); + * verify(userAdminManager, times(0)).deActivateUser(adminUser, + * userToDelete.getUserId()); verify(userAdminManager, + * times(1)).deleteUser(userToDelete.getUserId()); } */ @Override @@ -145,4 +174,117 @@ public class UserAdminServletTest extends JerseyTest { return Either.left(user); } + private UserAdminServlet createTestSubject() { + return new UserAdminServlet(); + } + + + @Test + public void testGet() throws Exception { + UserAdminServlet testSubject; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetRole() throws Exception { + UserAdminServlet testSubject; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testUpdateUserRole() throws Exception { + UserAdminServlet testSubject; + String userIdUpdateUser = ""; + HttpServletRequest request = null; + String data = ""; + String modifierUserId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testCreateUser() throws Exception { + UserAdminServlet testSubject; + HttpServletRequest request = null; + String newUserData = ""; + String modifierAttId = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testAuthorize() throws Exception { + UserAdminServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + String firstName = ""; + String lastName = ""; + String email = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetAdminsUser() throws Exception { + UserAdminServlet testSubject; + String userId = ""; + HttpServletRequest request = null; + Response result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetUsersList() throws Exception { + UserAdminServlet testSubject; + HttpServletRequest request = null; + String userId = ""; + String roles = ""; + Response result; + + // test 1 + testSubject = createTestSubject(); + roles = null; + + // test 2 + testSubject = createTestSubject(); + roles = ""; + } + + + @Test + public void testDeActivateUser() throws Exception { + UserAdminServlet testSubject; + String userId = ""; + HttpServletRequest request = null; + String userIdHeader = ""; + Response result; + + // default test + testSubject = createTestSubject(); + } + } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java new file mode 100644 index 0000000000..e6f1ac82fb --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java @@ -0,0 +1,71 @@ +package org.openecomp.sdc.be.tosca; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.tosca.model.ToscaNodeType; +import org.openecomp.sdc.be.tosca.model.ToscaProperty; + +import fj.data.Either; + +public class PropertyConvertorTest { + + private PropertyConvertor createTestSubject() { + return new PropertyConvertor(); + } + + + @Test + public void testGetInstance() throws Exception { + PropertyConvertor result; + + // default test + result = PropertyConvertor.getInstance(); + } + + + @Test + public void testConvertProperties() throws Exception { + PropertyConvertor testSubject; + Component component = null; + ToscaNodeType toscaNodeType = null; + Map<String, DataTypeDefinition> dataTypes = null; + Either<ToscaNodeType, ToscaError> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertProperties(component, toscaNodeType, dataTypes); + } + + + @Test + public void testConvertProperty() throws Exception { + PropertyConvertor testSubject; + Map<String, DataTypeDefinition> dataTypes = null; + PropertyDefinition property = null; + boolean isCapabiltyProperty = false; + ToscaProperty result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testConvertToToscaObject() throws Exception { + PropertyConvertor testSubject; + String propertyType = ""; + String value = ""; + String innerType = ""; + Map<String, DataTypeDefinition> dataTypes = null; + Object result; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java new file mode 100644 index 0000000000..7cb2ef7cf8 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java @@ -0,0 +1,36 @@ +package org.openecomp.sdc.be.tosca; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.tosca.model.ToscaTemplate; + +import fj.data.Either; + +public class ToscaExportHandlerTest { + + private ToscaExportHandler createTestSubject() { + return new ToscaExportHandler(); + } + + + @Test + public void testGetDependencies() throws Exception { + ToscaExportHandler testSubject; + Component component = null; + Either<ToscaTemplate, ToscaError> result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGetInterfaceFilename() throws Exception { + String artifactName = ""; + String result; + + // default test + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaUtilsTest.java new file mode 100644 index 0000000000..c3a993596c --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaUtilsTest.java @@ -0,0 +1,56 @@ +package org.openecomp.sdc.be.tosca; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.model.Component; + +import com.datastax.driver.core.UserType.Field; + +public class ToscaUtilsTest { + + private ToscaUtils createTestSubject() { + return new ToscaUtils(); + } + + + @Test + public void testIsAtomicType() throws Exception { + Component component = null; + boolean result; + + // default test + } + + + @Test + public void testIsComplexVfc() throws Exception { + Component component = null; + boolean result; + + // default test + } + + + @Test + public void testObjectToMap() throws Exception { + Object objectToConvert = null; + Class clazz = null; + Map<String, Object> result; + + // default test + } + + + @Test + public void testGetAllFields() throws Exception { + List<Field> fields = null; + Class<?> type = null; + List<Field> result; + + // default test + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/RollbackManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/RollbackManagerTest.java new file mode 100644 index 0000000000..6558b140c7 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/RollbackManagerTest.java @@ -0,0 +1,47 @@ +package org.openecomp.sdc.common.transaction.mngr; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.common.transaction.api.RollbackHandler; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; +import org.openecomp.sdc.common.util.MethodActivationStatusEnum; + +import fj.data.Either; + +public class RollbackManagerTest { + + private RollbackManager createTestSubject() { + return new RollbackManager(null, "", "", null); + } + + + @Test + public void testTransactionRollback() throws Exception { + RollbackManager testSubject; + DBActionCodeEnum result; + + // default test + } + + + @Test + public void testAddRollbackHandler() throws Exception { + RollbackManager testSubject; + RollbackHandler rollbackHandler = null; + Either<RollbackHandler, MethodActivationStatusEnum> result; + + // default test + } + + + @Test + public void testGetRollbackHandler() throws Exception { + RollbackManager testSubject; + DBTypeEnum dbType = null; + Either<RollbackHandler, MethodActivationStatusEnum> result; + + // default test + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/TransactionManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/TransactionManagerTest.java new file mode 100644 index 0000000000..aca9db39c0 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/TransactionManagerTest.java @@ -0,0 +1,54 @@ +package org.openecomp.sdc.common.transaction.mngr; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.common.transaction.api.ITransactionSdnc; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.ActionTypeEnum; + +public class TransactionManagerTest { + + private TransactionManager createTestSubject() { + return new TransactionManager(); + } + + + @Test + public void testGetTransaction() throws Exception { + TransactionManager testSubject; + String userId = ""; + ActionTypeEnum actionType = null; + ITransactionSdnc result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testGenerateTransactionID() throws Exception { + TransactionManager testSubject; + Integer result; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testResetTransactionId() throws Exception { + TransactionManager testSubject; + + // default test + testSubject = createTestSubject(); + } + + + @Test + public void testInit() throws Exception { + TransactionManager testSubject; + + // default test + testSubject = createTestSubject(); + } +}
\ No newline at end of file |