From 1cfb08779ea0e00be69e072a940b3063e049fe6b Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Wed, 31 Jan 2018 17:19:00 +0200 Subject: org.onap migration Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d Issue-ID: VID-86 Signed-off-by: Ofir Sonsino --- ...tyObfuscationConversionCommandLineUtilTest.java | 22 + .../src/test/java/org/onap/aai/util/TestSuite.java | 11 + .../org/onap/ecomp/vid/selenium/FirstClass.java | 606 +++++++++++++++++++++ .../onap/ecomp/vid/selenium/LogOutLeftPane.java | 242 ++++++++ .../core/MockApplicationContextTestSuite.java | 177 ++++++ .../org/onap/fusionapp/controller/NetMapTest.java | 49 ++ .../onap/fusionapp/service/ProfileServiceTest.java | 75 +++ .../main/java/org/vid/dao/FnAppDoaImplTest.java | 45 ++ .../src/test/java/org/onap/vid/RelatedToTest.java | 37 ++ .../src/test/java/org/onap/vid/TestSuite.java | 11 + .../org/onap/vid/aai/AaiGetVnfResponseTest.java | 33 ++ .../org/onap/vid/aai/ServicePropertiesTest.java | 34 ++ .../onap/vid/aai/SubscriberAaiResponseTest.java | 22 + .../org/onap/vid/aai/SubscriberWithFilterTest.java | 30 + .../src/test/java/org/onap/vid/aai/TestSuite.java | 12 + .../test/java/org/onap/vid/aai/VnfResultTest.java | 34 ++ .../onap/vid/aai/model/RelatedToPropertyTest.java | 55 ++ .../onap/vid/aai/model/RelationshipDataTest.java | 55 ++ .../org/onap/vid/aai/model/RelationshipTest.java | 103 ++++ .../vid/aai/model/ServiceRelationshipsTest.java | 165 ++++++ .../java/org/onap/vid/aai/model/TestSuite.java | 11 + .../java/org/onap/vid/asdc/beans/ArtifactTest.java | 277 ++++++++++ .../java/org/onap/vid/asdc/beans/ResourceTest.java | 391 +++++++++++++ .../org/onap/vid/asdc/beans/SubResourceTest.java | 167 ++++++ .../java/org/onap/vid/asdc/beans/TestSuite.java | 11 + .../onap/vid/asdc/beans/tosca/CapabilityTest.java | 124 +++++ .../onap/vid/asdc/beans/tosca/ConstraintTest.java | 221 ++++++++ .../org/onap/vid/asdc/beans/tosca/GroupTest.java | 124 +++++ .../vid/asdc/beans/tosca/NodeTemplateTest.java | 92 ++++ .../org/onap/vid/asdc/beans/tosca/TestSuite.java | 12 + .../vid/asdc/beans/tosca/TopologyTemplateTest.java | 101 ++++ .../vid/asdc/beans/tosca/ToscaMetadataTest.java | 443 +++++++++++++++ .../onap/vid/asdc/beans/tosca/ToscaModelTest.java | 146 +++++ .../onap/vid/asdc/parser/ToscaParserImpl2Test.java | 154 ++++++ .../test/java/org/onap/vid/bl/AaiServiceTest.java | 143 +++++ .../org/onap/vid/client/FakeHttpSessionTest.java | 206 +++++++ .../test/java/org/onap/vid/client/TestSuite.java | 11 + .../org/onap/vid/controller/AaiControllerTest.java | 51 ++ .../vid/controller/HealthCheckControllerTest.java | 47 ++ .../org/onap/vid/controller/LocalWebConfig.java | 70 +++ .../org/onap/vid/controller/MsoControllerTest.java | 109 ++++ .../PromiseEcompRequestIdFilterTest.java | 168 ++++++ .../vid/controller/PropertyControllerTest.java | 39 ++ .../onap/vid/controller/ToscaParserMockHelper.java | 42 ++ .../org/onap/vid/controller/VidControllerTest.java | 187 +++++++ .../vid/controller/ViewEditSubControllerTest.java | 45 ++ .../vid/integrationTest/AaiIntegrationTest.java | 43 ++ .../java/org/onap/vid/model/ModelUtilTest.java | 48 ++ .../test/java/org/onap/vid/model/NewNodeTest.java | 212 +++++++ .../java/org/onap/vid/model/NewServiceTest.java | 235 ++++++++ .../test/java/org/onap/vid/model/NewVNFTest.java | 88 +++ .../java/org/onap/vid/model/ServiceModelTest.java | 123 +++++ .../test/java/org/onap/vid/model/TestSuite.java | 12 + .../java/org/onap/vid/model/VolumeGroupTest.java | 169 ++++++ .../test/java/org/onap/vid/model/WorkflowTest.java | 72 +++ .../src/test/java/org/onap/vid/model/oeModel.java | 10 + .../org/onap/vid/mso/MsoBusinessLogicTest.java | 71 +++ .../vid/mso/MsoOperationalEnvironmentTest.java | 215 ++++++++ .../test/java/org/onap/vid/mso/MsoUtilTest.java | 53 ++ .../onap/vid/mso/RestMsoImplementationTest.java | 20 + .../onap/vid/mso/rest/AsyncRequestStatusTest.java | 91 ++++ .../org/onap/vid/mso/rest/MsoRestClientTest.java | 78 +++ .../org/onap/vid/mso/rest/OutgoingRequestId.java | 280 ++++++++++ .../org/onap/vid/mso/rest/RelatedInstanceTest.java | 93 ++++ .../org/onap/vid/mso/rest/RelatedModelTest.java | 93 ++++ .../org/onap/vid/mso/rest/RequestDetailsTest.java | 182 +++++++ .../test/java/org/onap/vid/mso/rest/TestSuite.java | 12 + .../onap/vid/policy/PolicyResponseWrapperTest.java | 70 +++ .../org/onap/vid/policy/PolicyRestIntTest.java | 22 + .../onap/vid/policy/PolicyRestInterfaceTest.java | 24 + .../java/org/onap/vid/policy/PolicyUtilTest.java | 54 ++ .../java/org/onap/vid/policy/RestObjectTest.java | 50 ++ .../test/java/org/onap/vid/policy/TestSuite.java | 12 + .../onap/vid/policy/rest/RequestDetailsTest.java | 33 ++ .../java/org/onap/vid/policy/rest/TestSuite.java | 11 + .../java/org/onap/vid/properties/TestSuite.java | 11 + .../org/onap/vid/properties/VidPropertiesTest.java | 31 ++ .../java/org/onap/vid/roles/RoleProviderTest.java | 50 ++ .../java/org/onap/vid/roles/RoleValidatorTest.java | 58 ++ .../test/java/org/onap/vid/roles/TestSuite.java | 11 + .../RestObjects/GetTimeSlotsRestObjectTest.java | 33 ++ .../PostCreateNewVnfRestObjectTest.java | 33 ++ .../PostSubmitVnfChangeRestObjectTest.java | 33 ++ .../vid/scheduler/RestObjects/RestObjectTest.java | 55 ++ .../PostCreateNewVnfWrapperTest.java | 55 ++ .../PostSubmitVnfChangeTimeSlotsWrapperTest.java | 55 ++ .../SchedulerResponseWrapperTest.java | 77 +++ .../vid/scheduler/SchedulerRestInterfaceTest.java | 26 + .../vid/scheduler/rest/RequestDetailsTest.java | 34 ++ .../org/onap/vid/scheduler/rest/TestSuite.java | 11 + .../java/org/onap/vid/selenium/FirstClass.java | 605 ++++++++++++++++++++ .../java/org/onap/vid/selenium/LogOutLeftPane.java | 242 ++++++++ .../services/ChangeManagementServiceImplTest.java | 69 +++ .../vid/services/ChangeManagementServiceTest.java | 29 + .../services/ChangeManagementServiceUnitTest.java | 107 ++++ .../java/org/onap/vid/services/CsvServiceTest.java | 80 +++ .../test/java/org/onap/vid/services/TestSuite.java | 11 + .../org/onap/vid/testUtils/IntersectionTest.java | 101 ++++ .../java/org/onap/vid/testUtils/RegExMatcher.java | 29 + .../java/org/onap/vid/testUtils/TestUtils.java | 68 +++ .../opencomp/vid/controller/MsoControllerTest.java | 112 ---- .../vid/controller/ToscaParserMockHelper.java | 42 -- .../opencomp/vid/controller/VidControllerTest.java | 201 ------- .../java/org/opencomp/vid/testUtils/TestUtils.java | 65 --- ...tyObfuscationConversionCommandLineUtilTest.java | 21 - .../java/org/openecomp/aai/util/TestSuite.java | 11 - .../openecomp/ecomp/vid/selenium/FirstClass.java | 606 --------------------- .../ecomp/vid/selenium/LogOutLeftPane.java | 242 -------- .../core/MockApplicationContextTestSuite.java | 177 ------ .../openecomp/fusionapp/controller/NetMapTest.java | 49 -- .../fusionapp/service/ProfileServiceTest.java | 75 --- .../main/java/org/vid/dao/FnAppDoaImplTest.java | 45 -- .../test/java/org/openecomp/vid/RelatedToTest.java | 36 -- .../src/test/java/org/openecomp/vid/TestSuite.java | 11 - .../openecomp/vid/aai/AaiGetVnfResponseTest.java | 33 -- .../openecomp/vid/aai/ServicePropertiesTest.java | 33 -- .../vid/aai/SubscriberAaiResponseTest.java | 22 - .../vid/aai/SubscriberWithFilterTest.java | 30 - .../test/java/org/openecomp/vid/aai/TestSuite.java | 12 - .../java/org/openecomp/vid/aai/VnfResultTest.java | 33 -- .../vid/aai/model/RelatedToPropertyTest.java | 55 -- .../vid/aai/model/RelationshipDataTest.java | 55 -- .../openecomp/vid/aai/model/RelationshipTest.java | 101 ---- .../vid/aai/model/ServiceRelationshipsTest.java | 165 ------ .../org/openecomp/vid/aai/model/TestSuite.java | 11 - .../org/openecomp/vid/asdc/beans/ArtifactTest.java | 277 ---------- .../org/openecomp/vid/asdc/beans/ResourceTest.java | 391 ------------- .../openecomp/vid/asdc/beans/SubResourceTest.java | 167 ------ .../org/openecomp/vid/asdc/beans/TestSuite.java | 11 - .../vid/asdc/beans/tosca/CapabilityTest.java | 124 ----- .../vid/asdc/beans/tosca/ConstraintTest.java | 221 -------- .../openecomp/vid/asdc/beans/tosca/GroupTest.java | 124 ----- .../vid/asdc/beans/tosca/NodeTemplateTest.java | 92 ---- .../openecomp/vid/asdc/beans/tosca/TestSuite.java | 12 - .../vid/asdc/beans/tosca/TopologyTemplateTest.java | 101 ---- .../vid/asdc/beans/tosca/ToscaMetadataTest.java | 443 --------------- .../vid/asdc/beans/tosca/ToscaModelTest.java | 146 ----- .../openecomp/vid/client/FakeHttpSessionTest.java | 206 ------- .../java/org/openecomp/vid/client/TestSuite.java | 11 - .../vid/controller/AaiControllerTest.java | 88 --- .../vid/controller/HealthCheckControllerTest.java | 47 -- .../vid/controller/PropertyControllerTest.java | 58 -- .../org/openecomp/vid/controller/TestSuite.java | 12 - .../vid/controller/ViewEditSubControllerTest.java | 45 -- .../org/openecomp/vid/model/ModelUtilTest.java | 48 -- .../java/org/openecomp/vid/model/NewNodeTest.java | 212 ------- .../org/openecomp/vid/model/NewServiceTest.java | 235 -------- .../java/org/openecomp/vid/model/NewVNFTest.java | 88 --- .../org/openecomp/vid/model/ServiceModelTest.java | 123 ----- .../java/org/openecomp/vid/model/TestSuite.java | 12 - .../org/openecomp/vid/model/VolumeGroupTest.java | 169 ------ .../java/org/openecomp/vid/model/WorkflowTest.java | 72 --- .../openecomp/vid/mso/MsoLocalClientNewTest.java | 169 ------ .../java/org/openecomp/vid/mso/MsoRestIntTest.java | 22 - .../openecomp/vid/mso/MsoRestInterfaceTest.java | 21 - .../java/org/openecomp/vid/mso/MsoUtilTest.java | 53 -- .../vid/mso/RestMsoImplementationTest.java | 44 -- .../test/java/org/openecomp/vid/mso/TestSuite.java | 12 - .../vid/mso/rest/AsyncRequestStatusTest.java | 91 ---- .../vid/mso/rest/RelatedInstanceTest.java | 93 ---- .../openecomp/vid/mso/rest/RelatedModelTest.java | 93 ---- .../openecomp/vid/mso/rest/RequestDetailsTest.java | 182 ------- .../java/org/openecomp/vid/mso/rest/TestSuite.java | 12 - .../vid/policy/PolicyResponseWrapperTest.java | 70 --- .../openecomp/vid/policy/PolicyRestIntTest.java | 22 - .../vid/policy/PolicyRestInterfaceTest.java | 24 - .../org/openecomp/vid/policy/PolicyUtilTest.java | 54 -- .../org/openecomp/vid/policy/RestObjectTest.java | 50 -- .../java/org/openecomp/vid/policy/TestSuite.java | 12 - .../vid/policy/rest/RequestDetailsTest.java | 33 -- .../org/openecomp/vid/policy/rest/TestSuite.java | 11 - .../org/openecomp/vid/properties/TestSuite.java | 11 - .../vid/properties/VidPropertiesTest.java | 31 -- .../org/openecomp/vid/roles/RoleProviderTest.java | 50 -- .../org/openecomp/vid/roles/RoleValidatorTest.java | 58 -- .../java/org/openecomp/vid/roles/TestSuite.java | 11 - .../RestObjects/GetTimeSlotsRestObjectTest.java | 33 -- .../PostCreateNewVnfRestObjectTest.java | 33 -- .../PostSubmitVnfChangeRestObjectTest.java | 33 -- .../vid/scheduler/RestObjects/RestObjectTest.java | 55 -- .../vid/scheduler/RestObjects/TestSuite.java | 12 - .../PostCreateNewVnfWrapperTest.java | 55 -- .../PostSubmitVnfChangeTimeSlotsWrapperTest.java | 55 -- .../SchedulerResponseWrapperTest.java | 77 --- .../SchedulerResponseWrappers/TestSuite.java | 12 - .../vid/scheduler/SchedulerRestInterfaceTest.java | 26 - .../org/openecomp/vid/scheduler/TestSuite.java | 11 - .../vid/scheduler/rest/RequestDetailsTest.java | 33 -- .../openecomp/vid/scheduler/rest/TestSuite.java | 11 - .../services/ChangeManagementServiceImplTest.java | 69 --- .../vid/services/ChangeManagementServiceTest.java | 29 - .../java/org/openecomp/vid/services/TestSuite.java | 11 - 192 files changed, 9600 insertions(+), 7562 deletions(-) create mode 100644 vid-app-common/src/test/java/org/onap/aai/util/JettyObfuscationConversionCommandLineUtilTest.java create mode 100644 vid-app-common/src/test/java/org/onap/aai/util/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/ecomp/vid/selenium/FirstClass.java create mode 100644 vid-app-common/src/test/java/org/onap/ecomp/vid/selenium/LogOutLeftPane.java create mode 100644 vid-app-common/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/fusionapp/controller/NetMapTest.java create mode 100644 vid-app-common/src/test/java/org/onap/fusionapp/service/ProfileServiceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/src/main/java/org/vid/dao/FnAppDoaImplTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/RelatedToTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/ServicePropertiesTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/VnfResultTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/model/RelatedToPropertyTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipDataTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/model/ServiceRelationshipsTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/aai/model/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/ArtifactTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/ResourceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/SubResourceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/CapabilityTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ConstraintTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/GroupTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/NodeTemplateTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TopologyTemplateTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaMetadataTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaModelTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/client/FakeHttpSessionTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/client/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/PromiseEcompRequestIdFilterTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/PropertyControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/ToscaParserMockHelper.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controller/ViewEditSubControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/integrationTest/AaiIntegrationTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/ModelUtilTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/NewNodeTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/NewServiceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/NewVNFTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/ServiceModelTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/VolumeGroupTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/WorkflowTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/oeModel.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/rest/AsyncRequestStatusTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestId.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/rest/RelatedInstanceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/rest/RelatedModelTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/rest/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/policy/PolicyResponseWrapperTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/policy/PolicyRestIntTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/policy/PolicyRestInterfaceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/policy/PolicyUtilTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/policy/RestObjectTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/policy/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/policy/rest/RequestDetailsTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/policy/rest/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/properties/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/properties/VidPropertiesTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/roles/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/GetTimeSlotsRestObjectTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/PostCreateNewVnfRestObjectTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObjectTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/RestObjectTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapperTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapperTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapperTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerRestInterfaceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/rest/RequestDetailsTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/scheduler/rest/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/selenium/FirstClass.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/selenium/LogOutLeftPane.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/services/CsvServiceTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/services/TestSuite.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/testUtils/RegExMatcher.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java delete mode 100644 vid-app-common/src/test/java/org/opencomp/vid/controller/MsoControllerTest.java delete mode 100644 vid-app-common/src/test/java/org/opencomp/vid/controller/ToscaParserMockHelper.java delete mode 100644 vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java delete mode 100644 vid-app-common/src/test/java/org/opencomp/vid/testUtils/TestUtils.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtilTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/aai/util/TestSuite.java delete mode 100755 vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java delete mode 100755 vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java delete mode 100755 vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java delete mode 100755 vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java delete mode 100755 vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java delete mode 100755 vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/RelatedToTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/AaiGetVnfResponseTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/ServicePropertiesTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/SubscriberAaiResponseTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/SubscriberWithFilterTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/VnfResultTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelatedToPropertyTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelationshipDataTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelationshipTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/model/ServiceRelationshipsTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/aai/model/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/ArtifactTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/ResourceTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/SubResourceTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/CapabilityTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ConstraintTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/GroupTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplateTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplateTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadataTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ToscaModelTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/client/FakeHttpSessionTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/client/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/controller/AaiControllerTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/controller/HealthCheckControllerTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/controller/PropertyControllerTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/controller/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/controller/ViewEditSubControllerTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/model/ModelUtilTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/model/NewNodeTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/model/NewServiceTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/model/NewVNFTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/model/ServiceModelTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/model/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/model/VolumeGroupTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/model/WorkflowTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/MsoLocalClientNewTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/MsoRestIntTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/MsoRestInterfaceTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/MsoUtilTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/RestMsoImplementationTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/rest/AsyncRequestStatusTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RelatedInstanceTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RelatedModelTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RequestDetailsTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/mso/rest/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyResponseWrapperTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyRestIntTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyRestInterfaceTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyUtilTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/policy/RestObjectTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/policy/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/policy/rest/RequestDetailsTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/policy/rest/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/properties/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/properties/VidPropertiesTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/roles/RoleProviderTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/roles/RoleValidatorTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/roles/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/GetTimeSlotsRestObjectTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/PostCreateNewVnfRestObjectTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObjectTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/RestObjectTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapperTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapperTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapperTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/rest/RequestDetailsTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/scheduler/rest/TestSuite.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceImplTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceTest.java delete mode 100644 vid-app-common/src/test/java/org/openecomp/vid/services/TestSuite.java (limited to 'vid-app-common/src/test/java/org') diff --git a/vid-app-common/src/test/java/org/onap/aai/util/JettyObfuscationConversionCommandLineUtilTest.java b/vid-app-common/src/test/java/org/onap/aai/util/JettyObfuscationConversionCommandLineUtilTest.java new file mode 100644 index 000000000..8e2e223af --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/aai/util/JettyObfuscationConversionCommandLineUtilTest.java @@ -0,0 +1,22 @@ +package org.onap.aai.util; + +import org.junit.Test; +import org.onap.vid.aai.util.JettyObfuscationConversionCommandLineUtil; + +public class JettyObfuscationConversionCommandLineUtilTest { + + private JettyObfuscationConversionCommandLineUtil createTestSubject() { + return new JettyObfuscationConversionCommandLineUtil(); + } + + + @Test + public void testMain() throws Exception { + String[] args = new String[] { "" }; + + // default test + JettyObfuscationConversionCommandLineUtil.main(args); + } + + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/aai/util/TestSuite.java b/vid-app-common/src/test/java/org/onap/aai/util/TestSuite.java new file mode 100644 index 000000000..b4faaa279 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/aai/util/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.aai.util; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ JettyObfuscationConversionCommandLineUtilTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/ecomp/vid/selenium/FirstClass.java b/vid-app-common/src/test/java/org/onap/ecomp/vid/selenium/FirstClass.java new file mode 100644 index 000000000..d0da08c58 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/ecomp/vid/selenium/FirstClass.java @@ -0,0 +1,606 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ecomp.vid.selenium; + +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.AfterSuite; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.ie.InternetExplorerDriver; +import org.openqa.selenium.support.ui.Select; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.TimeUnit; +import org.apache.log4j.Logger; +import org.testng.Assert; +import org.testng.asserts.*; + +/** + * The Class FirstClass. + */ +public class FirstClass { + + /** The login button. */ + WebElement loginButton; + + /** The eg. */ + String eg; + + /** The login. */ + WebElement login; + + /** The pwd. */ + WebElement pwd; + + /** The log. */ + Logger log; + + /** The errormessage. */ + WebElement errormessage; + + + /** The driver. */ + WebDriver driver=new FirefoxDriver(); + + + + /** The config prop. */ + private final Properties configProp = new Properties(); + + + /** + * Instantiates a new first class. + */ + private FirstClass() { + // TODO Auto-generated constructor stub + // + try{ + // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties"); + //FileInputStream input1 = new FileInputStream("objectmap.properties"); + + InputStream input =new FileInputStream("objectconfig.properties"); + System.out.println("Read all properties from file"); + configProp.load(input); + System.out.println("Read all properties from file completed"); + } + catch(IOException e) { + + e.printStackTrace(); + } + } + + + /* + + + @BeforeClass + public void setUp() { + System.out.println("*******************"); + System.out.println("launching IE browser"); + System.setProperty("webdriver.ie.driver", driverPath+"IEDriverServer.exe"); + driver = new InternetExplorerDriver(); + driver.findElement(By.className()); + driver.manage().window().maximize(); + + + login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']")); + pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']")); + loginButton = driver.findElement(By.id("loginBtn")); + } + + + */ + /** + * Sets the up. + */ + // TODO Auto-generated method stub + @BeforeClass + public void setUp() + { + + + //WebDriver driver=new FirefoxDriver(); + + log = Logger.getLogger(FirstClass.class.getName()); + + + + // Get url + driver.get(configProp.getProperty("baseURL")); + driver.manage().window().maximize(); + + + login = driver.findElement(By.xpath(configProp.getProperty("login"))); + + pwd = driver.findElement(By.xpath(configProp.getProperty("pwd"))); + loginButton = driver.findElement(By.id(configProp.getProperty("loginButton"))); + } + + + /** + * Empty username password. + */ + @Test(priority=1) + public void emptyUsernamePassword() + { + + + //User Name and Password field is empty + log.info("-----VID-11 TC-8----Username and password empty"); + loginButton.click(); + errormessage=driver.findElement(By.xpath("//*[@id='errorInfo']/span")); + String errmsg= errormessage.getText(); + //System.out.println("Error message is"+errmsg); + //String expected = "Invaild username or password, Please try again"; + + //Assert.assertEquals(errmsg,expected); + + Boolean str = driver.getPageSource().contains("Invalid username or password, Please try again"); + System.out.println(driver.getPageSource().contains("Invalid username or password, Please try again")); + + if(str==true) + { + log.info("Error message validated"); + log.info("VID-11 TC-8 PASSED"); + + }else + log.error("Failed validation"); + + } + + + + /** + * Invalid user name. + */ + @Test(priority=2) + public void invalidUserName() + { + + log.info("-----VID-11 TC-6----Invalid Username and Valid Password"); + + + login.sendKeys("xxx"); + pwd.sendKeys("abc123"); + loginButton.click(); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + String errmsg= errormessage.getText(); + String expected = "Invalid username or password, Please try again"; + Assert.assertEquals(errmsg,expected); + //Boolean str1 = driver.getPageSource().contains("Invalid username or password, Please try again"); + //System.out.print(str1); + + log.info("VID-11 TC-6 PASSED"); + + } + + + /** + * Invalid password. + */ + @Test(priority=3) + public void invalidPassword() + { + log.info("-----VID-11 TC-7----Valid Username and Invalid Password"); + // Valid user name and Invalid password. + login.clear(); + pwd.clear(); + login.sendKeys("testuser"); + pwd.sendKeys("xxx"); + loginButton.click(); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + + String errmsg= errormessage.getText(); + String expected = "Invalid username or password, Please try again"; + Assert.assertEquals(errmsg,expected); + + //Boolean str2 = driver.getPageSource().contains("Invaild username or password, Please try again"); + //System.out.print(str2); + + log.info("VID-11 TC-7 PASSED"); + } + + + /** + * Login successful. + */ + @Test(priority=4) + public void loginSuccessful() + { + log.info("-----VID-11 TC-1----Valid Username and Valid Password"); + //Login with valid user name and password. + login.clear(); + login.sendKeys("su"); + pwd.clear(); + pwd.sendKeys("fusion"); + + + loginButton.click(); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + try { + Thread.sleep(6000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); + log.info("VID-11 TC-1 PASSED"); + + } + + + /** + * Verify home page elements left pane. + */ + @Test(priority=5) + public void verifyHomePageElementsLeftPane() + + { + + + log.info("VID-10 TC 1 "); + //VID Home + log.info("VID 11 TC-2"); + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[1]/a/span")).isDisplayed(); + //Create New Service Instance + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[2]/a/span")).isDisplayed(); + + //Browse Service Type + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[3]/a/span")).isDisplayed(); + //View Log + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[4]/a/span")).isDisplayed(); + + //Profile + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[5]/a/span")).isDisplayed(); + //Admin + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).isDisplayed(); + //Logout + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a/span")).isDisplayed(); + + //Infrastructure Subscriber Name + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[1]/div/label")).isDisplayed(); + //Infrastructure Subscriber Name Select Drop down + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")).isDisplayed(); + //Infrastructure Service Type + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[1]/div/label")).isDisplayed(); + //Infrastructure Service Type Select Drop down + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")).isDisplayed(); + //Submit button + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).isDisplayed(); + + //Login Snippet Icon + driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).isDisplayed(); + + + //String bodyText = driver.findElement(By.tagName("body")).getText(); + //Assert.assertTrue("Text not found!", bodyText.contains("Search Existing Service Instances")); + //Assert.IsTrue(driver.getPageSource.Contains("Search Existing Service Instances")); + + log.info("VID-12 TC-1"); + Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); + Assert.assertTrue(driver.getPageSource().contains("Please search by the Subscriber name or Service Type from below:")); + log.info("VID-12 TC-1 PASSED"); + log.info("VID-10 TC 1 PASSED"); + log.info("VID-11 TC-2 PASSED"); + } + + + /** + * Disabled submit button. + */ + @Test(priority=6) + public void disabledSubmitButton() + { + log.info("VID-12 TC-13"); + //Assert submit button disabled. + Assert.assertFalse(driver.findElement(By.xpath(configProp.getProperty("submitButton"))).isEnabled()); + log.info("VID-12 TC-13 PASSED"); + + } + + /** + * Default list box value. + */ + @Test(priority=7) + public void defaultListBoxValue() + { + log.info("VID-12 TC-2"); + + + //WebElement subscribername =driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")); + + Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))); + Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown")))); + + + WebElement ielement=iSelect.getFirstSelectedOption(); + WebElement oelement=oSelect.getFirstSelectedOption(); + String defaultsubscribername=oelement.getText(); + String defaultservicetype=ielement.getText(); + + Assert.assertEquals(defaultsubscribername,"Select Subscriber Name"); + Assert.assertEquals(defaultservicetype,"Select Service Type"); + + + + + //Verify Select Subscriber Name isDisplayed. + //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select/option[1]")).isSelected(); + + //Verify Select Service Type isDisplayed. + //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select/option[1]")).isSelected(); + + + log.info("VID-12 TC-2 PASSED"); + + } + + + + /** + * Select subscriber name drop down. + * + * @throws InterruptedException the interrupted exception + */ + @Test(priority=8) + public void selectSubscriberNameDropDown() throws InterruptedException + { + log.info("------------------VID-10 TC-2,VID-12 TC-11, VID-12 TC-9, VID 12 TC-10,VID-12 TC-6, VID 12 TC-5--------------------"); + + + driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown"))); + + driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown"))); + Thread.sleep(5000); + + //Infrastructure Subscriber Name + Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))); + + List elementCount = oSelect.getOptions(); + log.info("Select Element Count of Service Name"); + System.out.println(elementCount.size()); + + + //Verifying getInfrastructureSubscribersList + log.info("VID-29 TC-1"); + Assert.assertTrue(elementCount.size()>0); + log.info("VID-29 TC-1 PASSED"); + + oSelect.selectByIndex(2); + String selectedOption = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))).getFirstSelectedOption().getText(); + + System.out.println("Service Name selected is " +selectedOption); + log.info("VID-10 TC-2 PASSED"); + + //Submit button is clicked + driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click(); + + + //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); + //Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:")) + + + //Verify whether the page header is displayed "Global Customer ID" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed(); + Assert.assertTrue(driver.getPageSource().contains("Global Customer ID")); + Assert.assertTrue(driver.getPageSource().contains("Subscriber Name")); + Assert.assertTrue(driver.getPageSource().contains("Service Type")); + Assert.assertTrue(driver.getPageSource().contains("Service Instance ID")); + + log.info("VID-12 TC-5 PASSED"); + log.info("VID-12 TC-11 PASSED"); + + WebElement serviceinstancetable =driver.findElement(By.xpath("//table[@class='tablesorter tablesorter-default ng-isolate-scope']")); + + List rows_table = serviceinstancetable.findElements(By.tagName("tr")); + //To calculate no of rows In table. + int rows_count = rows_table.size(); + + //Loop will execute till the last row of table. + for (int row=0; row Columns_row = rows_table.get(row).findElements(By.tagName("td")); + //To calculate no of columns(cells) In that specific row. + int columns_count = Columns_row.size(); + //System.out.println("Number of cells In Row "+row+" are "+columns_count); + + //Loop will execute till the last cell of that specific row. + for (int column=0; column exx= rows_table.get(1).findElements(By.tagName("td")); + eg=Columns_row.get(2).getText(); + // System.out.println("Cell value of row 1 and column 2 is" +eg); + } + } + + + + + //Verify View/Edit isDisplayed and Click + + driver.findElement(By.xpath("//a[@alt='View/Edit']")).isDisplayed(); + + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/tbody/tr[1]/td[1]/div/a")).click(); + + log.info("User clicked View/Edit"); + + //Verify the Subscriber Name displayed. + String header= driver.findElement(By.xpath("//h1[@class='heading1 ng-binding']")).getText(); + //System.out.println(header); + + + if(header.contains(eg)) + { + System.out.println("Header contains the subscriber name"); + }else + System.out.println("Header does not contain the subscriber name"); + + + + Assert.assertTrue(driver.getPageSource().contains("PerfTest Subscriber00020021")); + log.info("VID-12 TC-6 PASSED"); + + + + driver.navigate().back(); + //Cancel button isDisplayed + driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).isDisplayed(); + log.info("VID-12 TC-9 PASSED"); + + //Cancel button is clicked + driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).click(); + log.info("Cancel button is clicked"); + + //Verifying VID Home page is displayed + Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); + log.info("VID-12 TC-10 PASSED"); + + } + + + /** + * Refresh subscriber name. + */ + @Test(priority=9) + public void refreshSubscriberName() + { + log.info("VID-10 TC-4"); + + + driver.findElement(By.xpath(configProp.getProperty("refreshButtonSubscriberName"))).isDisplayed(); + + log.info("VID-10 TC-4 PASSED"); + + + } + + + /** + * Select subscriber type drop down. + * + * @throws InterruptedException the interrupted exception + */ + @Test(priority=9) + public void selectSubscriberTypeDropDown() throws InterruptedException + { + Thread.sleep(5000); + log.info("------------------VID-10 TC-3, VID-12 TC-12,--------------------"); + //Infrastructure Subscriber Type + Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown")))); + + List ielementCount = iSelect.getOptions(); + log.info("Select Element Count of Service type"); + System.out.println(ielementCount.size()); + iSelect.selectByIndex(1); + + log.info("VID-10 TC-3 PASSED"); + + + //Submit button is clicked + driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click(); + + //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); + //Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:")) + log.info("Page Header: Selected Subscriber's Service Instance Details"); + + + //Verify whether the page header is displayed "Global Customer ID" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed(); + + //Assert.assertTrue(driver.getPageSource().contains("Global Customer ID")); + log.info("Table is displayed"); + + log.info("VID-12 TC-12 PASSED"); + + } + + + + /** + * Logout under profile. + */ + @Test(priority=10) + public void logoutUnderProfile() + { + + log.info("-----------VID-11 TC-5---------------------"); + //driver.findElement(By.partialLinkText("Click here to login")).click(); + //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + + driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).click(); + driver.findElement(By.xpath(".//*[@id='reg-logout-div']/a")).click(); + //Validate that the user has logged out of VID. Displays "Portal" + Assert.assertTrue(driver.getPageSource().contains("Portal")); + + log.info("VID-11 TC-5 PASSED"); + + } + + + + /** + * Tear down. + */ + @AfterClass + public void tearDown() + { + driver.close(); + + } + + + + } + + + + diff --git a/vid-app-common/src/test/java/org/onap/ecomp/vid/selenium/LogOutLeftPane.java b/vid-app-common/src/test/java/org/onap/ecomp/vid/selenium/LogOutLeftPane.java new file mode 100644 index 000000000..fdd5ea38d --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/ecomp/vid/selenium/LogOutLeftPane.java @@ -0,0 +1,242 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ecomp.vid.selenium; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import org.apache.log4j.Logger; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +/** + * The Class LogOutLeftPane. + */ +@Test(enabled=false) +public class LogOutLeftPane { + + /** The login button. */ + WebElement loginButton; + + /** The login. */ + WebElement login; + + /** The pwd. */ + WebElement pwd; + + /** The log. */ + Logger log; + + /** The errormessage. */ + WebElement errormessage; + + /** The driver. */ + WebDriver driver=new FirefoxDriver(); + + + /** The config prop. */ + private final Properties configProp = new Properties(); + + + /** + * Instantiates a new log out left pane. + */ + private LogOutLeftPane() { + // TODO Auto-generated constructor stub + // + try{ + // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties"); + //FileInputStream input1 = new FileInputStream("objectmap.properties"); + + InputStream input =new FileInputStream("objectconfig.properties"); + System.out.println("Read all properties from file"); + configProp.load(input); + System.out.println("Read all properties from file completed"); + } + catch(IOException e) { + + e.printStackTrace(); + } + } + + + + + /** + * Do before test. + */ + // TODO Auto-generated method stub + @BeforeTest + public void doBeforeTest() + { + //WebDriver driver=new FirefoxDriver(); + + log = Logger.getLogger(LogOutLeftPane.class.getName()); + + + + // Get url + driver.get("http://vid.onap.org:9080/vid/login_external.htm"); + driver.manage().window().maximize(); + + + login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']")); + pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']")); + loginButton = driver.findElement(By.id("loginBtn")); + } + + + /** + * Expand collapse panel. + * + * @throws InterruptedException the interrupted exception + */ + @Test(priority=1) + public void expandCollapsePanel() throws InterruptedException + { + + + + login.clear(); + login.sendKeys("su"); + pwd.clear(); + pwd.sendKeys("fusion"); + //driver.findElement(By.partialLinkText("Click here to login")).click(); + //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + loginButton.click(); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + + log.info("Clicking Profile link from left pane"); + Thread.sleep(3000); + System.out.println("properties file details --->"+configProp.getProperty("profilelink")); + driver.findElement(By.xpath(configProp.getProperty("profilelink"))).click(); + Thread.sleep(3000); + + //Verify whether the sub panel is displayed + //To verify the following :Search import from webphone and Self + driver.findElement(By.xpath(".//*[@id='panel4']")).isDisplayed(); + log.info("Expand and collapse passed for Profile link"); + + //For Admin + //Verify expand and collapse working for ADMIN + log.info("Clicking Admin link from left pane"); + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).click(); + //To verify the following: Roles, Roles Functions, Usages + driver.findElement(By.xpath(".//*[@id='panel5']")).isDisplayed(); + + + log.info("Expand and collapse passed for ADMIN link"); + + log.info("VID-11 TC-3 PASSED"); + + } + + + /** + * Drop down list. + * + * @throws InterruptedException the interrupted exception + */ + @Test(priority=2) + public void dropDownList() throws InterruptedException + { + //VID-12 TC-3 + log.info("VID-12 TC-3"); + //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")); + + //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")); + Thread.sleep(5000); + + //Infrastructure Subscriber Name + Select oSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))); + Select iSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select"))); + + List elementCount = oSelect.getOptions(); + log.info("Subscriber Name Drop Down"); + System.out.println(elementCount.size()); + oSelect.selectByIndex(1); + log.info("Subscriber name selected"); + //String selectedOption = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))).getFirstSelectedOption().getText(); + + + List count = iSelect.getOptions(); + log.info("Subscriber type drop down"); + System.out.println(count.size()); + oSelect.selectByIndex(1); + log.info("Subscriber type selected"); + + + + //Submit button is clicked + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).click(); + + + //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); + log.info("VID-12 TC-3 PASSED"); + } + + + + + /** + * Logout left pane. + */ + @Test(priority=3) + public void logoutLeftPane() + { + //To Verify if the logout link redirects to Login page when clicked. + + + /*log.info("----------------VID-11 TC-4----------------"); + login.clear(); + login.sendKeys("testuser"); + pwd.clear(); + pwd.sendKeys("abc123"); + //driver.findElement(By.partialLinkText("Click here to login")).click(); + //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + loginButton.click(); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);*/ + log.info("----------------VID-11 TC-4----------------"); + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a")).click(); + //Validate that the user has logged out of VID. Displays "Portal" + Assert.assertTrue(driver.getPageSource().contains("Portal")); + + log.info("VID 11 TC-4 PASSED"); + + driver.close(); + + } + +} diff --git a/vid-app-common/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java b/vid-app-common/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java new file mode 100644 index 000000000..bd6854911 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java @@ -0,0 +1,177 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.fusion.core; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.AnnotationConfigWebContextLoader; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.testng.annotations.Test; +import org.openecomp.portalsdk.core.conf.AppConfig; +import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.util.CacheManager; + +/** + * + * + * + * In order to write a unit test, + * 1. inherit this class - See SanityTest.java + * 2. place the "war" folder on your test class's classpath + * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path + * but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath + * -Dcontainer.classpath="classpath:" + * + */ + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class}) +@ActiveProfiles(value="test") +@Test(enabled=false) +public class MockApplicationContextTestSuite { + + /** The wac. */ + @Autowired + public WebApplicationContext wac; + + /** The mock mvc. */ + private MockMvc mockMvc; + + /** + * Setup. + */ + @Before + public void setup() { + if(mockMvc == null) { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + + } + } + + /** + * Gets the bean. + * + * @param name the name + * @return the bean + */ + public Object getBean(String name) { + return this.wac.getBean(name); + } + + + /** + * Gets the mock mvc. + * + * @return the mock mvc + */ + public MockMvc getMockMvc() { + return mockMvc; + } + + /** + * Sets the mock mvc. + * + * @param mockMvc the new mock mvc + */ + public void setMockMvc(MockMvc mockMvc) { + this.mockMvc = mockMvc; + } + + /** + * Gets the web application context. + * + * @return the web application context + */ + public WebApplicationContext getWebApplicationContext() { + return wac; + } + + + + +} + + + @Configuration + @ComponentScan(basePackages = "org.onap", + excludeFilters = { + // the following source configurations should not be scanned; instead of using Exclusion filter, we can use the @Profile annotation to exclude them + // see AppConfig class + //@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.onap.portalsdk.core.*AppConfig*")//, + //@ComponentScan.Filter(type = FilterType.REGEX, pattern = org.onap.*.*AppConfig*") + } + ) + @Profile("test") + class MockAppConfig extends AppConfig { + + @Bean + public SystemProperties systemProperties(){ + return new MockSystemProperties(); + } + + @Bean + public AbstractCacheManager cacheManager() { + return new CacheManager() { + + public void configure() throws IOException { + + } + }; + } + + protected String[] tileDefinitions() { + return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"}; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout()); + //registry.addInterceptor(resourceInterceptor()); + } + + public static class MockSystemProperties extends SystemProperties { + + public MockSystemProperties() { + } + + } + + } + + + + diff --git a/vid-app-common/src/test/java/org/onap/fusionapp/controller/NetMapTest.java b/vid-app-common/src/test/java/org/onap/fusionapp/controller/NetMapTest.java new file mode 100644 index 000000000..7a4c56019 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/fusionapp/controller/NetMapTest.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.fusionapp.controller; + +import org.junit.Assert; +import org.junit.Test; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +import org.onap.fusion.core.MockApplicationContextTestSuite; + +/** + * The Class NetMapTest. + */ + +public class NetMapTest extends MockApplicationContextTestSuite { + + /** + * Test get net map. + * + * @throws Exception the exception + */ +// @Test + public void testGetNetMap() throws Exception { + ResultActions ra =getMockMvc().perform(MockMvcRequestBuilders.get("/net_map")); + //Assert.assertEquals(UrlAccessRestrictedException.class,ra.andReturn().getResolvedException().getClass()); + Assert.assertEquals("net_map_int",ra.andReturn().getModelAndView().getModel().get("frame_int")); + } + + +} diff --git a/vid-app-common/src/test/java/org/onap/fusionapp/service/ProfileServiceTest.java b/vid-app-common/src/test/java/org/onap/fusionapp/service/ProfileServiceTest.java new file mode 100644 index 000000000..212074fcd --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/fusionapp/service/ProfileServiceTest.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.fusionapp.service; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import org.onap.fusion.core.MockApplicationContextTestSuite; +import org.openecomp.portalsdk.core.domain.Profile; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.service.ProfileService; +import org.openecomp.portalsdk.core.service.UserProfileService; + + +/** + * The Class ProfileServiceTest. + */ + +public class ProfileServiceTest extends MockApplicationContextTestSuite { + + /** The service. */ + @Autowired + ProfileService service; + + /** The user profile service. */ + @Autowired + UserProfileService userProfileService; + + /** + * Test find all. + */ + //@Test + public void testFindAll() { + try { + List profiles = service.findAll(); + Assert.assertTrue(profiles.size() > 0); + + } + catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Test find all active. + */ +// @Test + public void testFindAllActive() { + + List users = userProfileService.findAllActive(); + List activeUsers = userProfileService.findAllActive(); + Assert.assertTrue(users.size() - activeUsers.size() >= 0); + } +} diff --git a/vid-app-common/src/test/java/org/onap/src/main/java/org/vid/dao/FnAppDoaImplTest.java b/vid-app-common/src/test/java/org/onap/src/main/java/org/vid/dao/FnAppDoaImplTest.java new file mode 100644 index 000000000..e98e7b205 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/src/main/java/org/vid/dao/FnAppDoaImplTest.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.src.main.java.org.vid.dao; + +import java.io.IOException; +import java.sql.SQLException; + +import org.junit.Test; + +import org.onap.vid.dao.FnAppDoaImpl; + +public class FnAppDoaImplTest { + + //@Test + public void testGetconnection() throws ClassNotFoundException, IOException, SQLException{ + FnAppDoaImpl impl=new FnAppDoaImpl(); + impl.getConnection(null,null,null, null); + + } + + //@Test + public void testProfileCount() throws ClassNotFoundException, IOException, SQLException{ + FnAppDoaImpl impl=new FnAppDoaImpl(); + impl.getProfileCount(null,null,null, null); + } + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/RelatedToTest.java b/vid-app-common/src/test/java/org/onap/vid/RelatedToTest.java new file mode 100644 index 000000000..ca4ac1b81 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/RelatedToTest.java @@ -0,0 +1,37 @@ +package org.onap.vid; + +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.RelatedTo; + + +public class RelatedToTest { + + private RelatedTo createTestSubject() { + return new RelatedTo(); + } + + + @Test + public void testGetAdditionalProperties() throws Exception { + RelatedTo testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAdditionalProperties(); + } + + + @Test + public void testSetAdditionalProperty() throws Exception { + RelatedTo testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAdditionalProperty(name, value); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/TestSuite.java new file mode 100644 index 000000000..e70d7fe25 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ RelatedToTest.class, org.onap.vid.aai.TestSuite.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java new file mode 100644 index 000000000..7889d5148 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java @@ -0,0 +1,33 @@ +package org.onap.vid.aai; + +import java.util.Map; + +import org.junit.Test; + +public class AaiGetVnfResponseTest { + + private AaiGetVnfResponse createTestSubject() { + return new AaiGetVnfResponse(); + } + + @Test + public void testGetAdditionalProperties() throws Exception { + AaiGetVnfResponse testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAdditionalProperties(); + } + + @Test + public void testSetAdditionalProperty() throws Exception { + AaiGetVnfResponse testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAdditionalProperty(name, value); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/ServicePropertiesTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/ServicePropertiesTest.java new file mode 100644 index 000000000..577f52820 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/ServicePropertiesTest.java @@ -0,0 +1,34 @@ +package org.onap.vid.aai; + +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.aai.model.ServiceProperties; + +public class ServicePropertiesTest { + + private ServiceProperties createTestSubject() { + return new ServiceProperties(); + } + + @Test + public void testGetAdditionalProperties() throws Exception { + ServiceProperties testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAdditionalProperties(); + } + + @Test + public void testSetAdditionalProperty() throws Exception { + ServiceProperties testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAdditionalProperty(name, value); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java new file mode 100644 index 000000000..c01fe27e6 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java @@ -0,0 +1,22 @@ +package org.onap.vid.aai; + +import org.junit.Test; +import org.onap.vid.model.SubscriberList; + +public class SubscriberAaiResponseTest { + + private SubscriberAaiResponse createTestSubject() { + return new SubscriberAaiResponse(new SubscriberList(), "", 0); + } + + + @Test + public void testGetSubscriberList() throws Exception { + SubscriberAaiResponse testSubject; + SubscriberList result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubscriberList(); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java new file mode 100644 index 000000000..c76e5cdc2 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java @@ -0,0 +1,30 @@ +package org.onap.vid.aai; + +import org.junit.Test; + +public class SubscriberWithFilterTest { + + private SubscriberWithFilter createTestSubject() { + return new SubscriberWithFilter(); + } + + @Test + public void testGetIsPermitted() throws Exception { + SubscriberWithFilter testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIsPermitted(); + } + + @Test + public void testSetIsPermitted() throws Exception { + SubscriberWithFilter testSubject; + boolean isPermitted = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIsPermitted(isPermitted); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/aai/TestSuite.java new file mode 100644 index 000000000..eac3bdf26 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/TestSuite.java @@ -0,0 +1,12 @@ +package org.onap.vid.aai; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ SubscriberAaiResponseTest.class, AaiGetVnfResponseTest.class, ServicePropertiesTest.class, + SubscriberWithFilterTest.class, VnfResultTest.class, org.onap.vid.aai.model.TestSuite.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/VnfResultTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/VnfResultTest.java new file mode 100644 index 000000000..2b7a60429 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/VnfResultTest.java @@ -0,0 +1,34 @@ +package org.onap.vid.aai; + +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.aai.model.VnfResult; + +public class VnfResultTest { + + private VnfResult createTestSubject() { + return new VnfResult(); + } + + @Test + public void testGetAdditionalProperties() throws Exception { + VnfResult testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAdditionalProperties(); + } + + @Test + public void testSetAdditionalProperty() throws Exception { + VnfResult testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAdditionalProperty(name, value); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelatedToPropertyTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelatedToPropertyTest.java new file mode 100644 index 000000000..0d26f5607 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelatedToPropertyTest.java @@ -0,0 +1,55 @@ +package org.onap.vid.aai.model; + +import org.junit.Test; + + +public class RelatedToPropertyTest { + + private RelatedToProperty createTestSubject() { + return new RelatedToProperty(); + } + + + @Test + public void testGetPropertyKey() throws Exception { + RelatedToProperty testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getPropertyKey(); + } + + + @Test + public void testSetPropertyKey() throws Exception { + RelatedToProperty testSubject; + String propertyKey = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setPropertyKey(propertyKey); + } + + + @Test + public void testGetPropertyValue() throws Exception { + RelatedToProperty testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getPropertyValue(); + } + + + @Test + public void testSetPropertyValue() throws Exception { + RelatedToProperty testSubject; + String propertyValue = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setPropertyValue(propertyValue); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipDataTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipDataTest.java new file mode 100644 index 000000000..ae5f7c39a --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipDataTest.java @@ -0,0 +1,55 @@ +package org.onap.vid.aai.model; + +import org.junit.Test; + + +public class RelationshipDataTest { + + private RelationshipData createTestSubject() { + return new RelationshipData(); + } + + + @Test + public void testGetRelationshipKey() throws Exception { + RelationshipData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelationshipKey(); + } + + + @Test + public void testSetRelationshipKey() throws Exception { + RelationshipData testSubject; + String relationshipKey = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRelationshipKey(relationshipKey); + } + + + @Test + public void testGetRelationshipValue() throws Exception { + RelationshipData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelationshipValue(); + } + + + @Test + public void testSetRelationshipValue() throws Exception { + RelationshipData testSubject; + String relationshipValue = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRelationshipValue(relationshipValue); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipTest.java new file mode 100644 index 000000000..893fc51fc --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipTest.java @@ -0,0 +1,103 @@ +package org.onap.vid.aai.model; + +import java.util.List; + +import org.junit.Test; +import org.onap.vid.aai.model.Relationship; +import org.onap.vid.aai.model.RelationshipData; + + +public class RelationshipTest { + + private Relationship createTestSubject() { + return new Relationship(); + } + + + @Test + public void testGetRelatedTo() throws Exception { + Relationship testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelatedTo(); + } + + + @Test + public void testSetRelatedTo() throws Exception { + Relationship testSubject; + String relatedTo = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRelatedTo(relatedTo); + } + + + @Test + public void testGetRelatedLink() throws Exception { + Relationship testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelatedLink(); + } + + + @Test + public void testSetRelatedLink() throws Exception { + Relationship testSubject; + String relatedLink = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRelatedLink(relatedLink); + } + + + @Test + public void testGetRelationDataList() throws Exception { + Relationship testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelationDataList(); + } + + + @Test + public void testSetRelationDataList() throws Exception { + Relationship testSubject; + List relationDataList = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelationDataList(relationDataList); + } + + + @Test + public void testGetRelatedToPropertyList() throws Exception { + Relationship testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelatedToPropertyList(); + } + + + @Test + public void testSetRelatedToPropertyList() throws Exception { + Relationship testSubject; + List relatedToPropertyList = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelatedToPropertyList(relatedToPropertyList); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ServiceRelationshipsTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ServiceRelationshipsTest.java new file mode 100644 index 000000000..e8bcf5f57 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ServiceRelationshipsTest.java @@ -0,0 +1,165 @@ +package org.onap.vid.aai.model; + +import org.junit.Test; + + +public class ServiceRelationshipsTest { + + private ServiceRelationships createTestSubject() { + return new ServiceRelationships(); + } + + + @Test + public void testGetServiceInstanceId() throws Exception { + ServiceRelationships testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceInstanceId(); + } + + + @Test + public void testSetServiceInstanceId() throws Exception { + ServiceRelationships testSubject; + String serviceInstanceId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceInstanceId(serviceInstanceId); + } + + + @Test + public void testGetServiceInstanceName() throws Exception { + ServiceRelationships testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceInstanceName(); + } + + + @Test + public void testSetServiceInstanceName() throws Exception { + ServiceRelationships testSubject; + String serviceInstanceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceInstanceName(serviceInstanceName); + } + + + @Test + public void testGetModelInvariantId() throws Exception { + ServiceRelationships testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModelInvariantId(); + } + + + @Test + public void testSetModelInvariantId() throws Exception { + ServiceRelationships testSubject; + String modelInvariantId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setModelInvariantId(modelInvariantId); + } + + + @Test + public void testGetModelVersionId() throws Exception { + ServiceRelationships testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModelVersionId(); + } + + + @Test + public void testSetModelVersionId() throws Exception { + ServiceRelationships testSubject; + String modelVersionId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setModelVersionId(modelVersionId); + } + + + @Test + public void testGetResourceVersion() throws Exception { + ServiceRelationships testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVersion(); + } + + + @Test + public void testSetResourceVersion() throws Exception { + ServiceRelationships testSubject; + String resourceVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVersion(resourceVersion); + } + + + @Test + public void testGetOrchestrationStatus() throws Exception { + ServiceRelationships testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOrchestrationStatus(); + } + + + @Test + public void testSetOrchestrationStatus() throws Exception { + ServiceRelationships testSubject; + String orchestrationStatus = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setOrchestrationStatus(orchestrationStatus); + } + + + @Test + public void testGetRelationshipList() throws Exception { + ServiceRelationships testSubject; + RelationshipList result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelationshipList(); + } + + + @Test + public void testSetRelationshipList() throws Exception { + ServiceRelationships testSubject; + RelationshipList relationshipList = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelationshipList(relationshipList); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/TestSuite.java new file mode 100644 index 000000000..8d5f62e54 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.aai.model; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ ServiceRelationshipsTest.class, RelationshipTest.class, RelatedToPropertyTest.class, RelationshipDataTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ArtifactTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ArtifactTest.java new file mode 100644 index 000000000..04944120a --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ArtifactTest.java @@ -0,0 +1,277 @@ +package org.onap.vid.asdc.beans; + +import org.junit.Test; + + +public class ArtifactTest { + + private Artifact createTestSubject() { + return new Artifact(); + } + + + @Test + public void testGetArtifactName() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactName(); + } + + + @Test + public void testGetArtifactType() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactType(); + } + + + @Test + public void testGetArtifactGroupType() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactGroupType(); + } + + + @Test + public void testGetArtifactLabel() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactLabel(); + } + + + @Test + public void testGetArtifactURL() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactURL(); + } + + + @Test + public void testGetArtifactDescription() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactDescription(); + } + + + @Test + public void testGetArtifactTimeout() throws Exception { + Artifact testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactTimeout(); + } + + + @Test + public void testGetArtifactChecksum() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactChecksum(); + } + + + @Test + public void testGetArtifactUUID() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactUUID(); + } + + + @Test + public void testGetArtifactVersion() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactVersion(); + } + + + @Test + public void testGetGeneratedFromUUID() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGeneratedFromUUID(); + } + + + @Test + public void testSetArtifactName() throws Exception { + Artifact testSubject; + String artifactName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactName(artifactName); + } + + + @Test + public void testSetArtifactType() throws Exception { + Artifact testSubject; + String artifactType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactType(artifactType); + } + + + @Test + public void testSetArtifactGroupType() throws Exception { + Artifact testSubject; + String artifactGroupType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactGroupType(artifactGroupType); + } + + + @Test + public void testSetArtifactLabel() throws Exception { + Artifact testSubject; + String artifactLabel = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactLabel(artifactLabel); + } + + + @Test + public void testSetArtifactURL() throws Exception { + Artifact testSubject; + String artifactURL = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactURL(artifactURL); + } + + + @Test + public void testSetArtifactDescription() throws Exception { + Artifact testSubject; + String artifactDescription = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactDescription(artifactDescription); + } + + + @Test + public void testSetArtifactTimeout() throws Exception { + Artifact testSubject; + int artifactTimeout = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactTimeout(artifactTimeout); + } + + + @Test + public void testSetArtifactChecksum() throws Exception { + Artifact testSubject; + String artifactChecksum = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactChecksum(artifactChecksum); + } + + + @Test + public void testSetArtifactUUID() throws Exception { + Artifact testSubject; + String artifactUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactUUID(artifactUUID); + } + + + @Test + public void testSetArtifactVersion() throws Exception { + Artifact testSubject; + String artifactVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactVersion(artifactVersion); + } + + + @Test + public void testSetGeneratedFromUUID() throws Exception { + Artifact testSubject; + String generatedFromUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGeneratedFromUUID(generatedFromUUID); + } + + + @Test + public void testHashCode() throws Exception { + Artifact testSubject; + int result; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactUUID("48a52540-8772-4368-9cdb-1f124ea5c931"); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + Artifact testSubject; + Object o = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(o); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ResourceTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ResourceTest.java new file mode 100644 index 000000000..af42409cd --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ResourceTest.java @@ -0,0 +1,391 @@ +package org.onap.vid.asdc.beans; + +import java.util.Collection; + +import org.junit.Test; +import org.onap.vid.asdc.beans.Resource.LifecycleState; +import org.onap.vid.asdc.beans.Resource.Type; + + +public class ResourceTest { + + private Resource createTestSubject() { + return new Resource(); + } + + + @Test + public void testGetUuid() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUuid(); + } + + + @Test + public void testGetInvariantUUID() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUUID(); + } + + + @Test + public void testGetName() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testGetDescription() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testGetVersion() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testGetToscaModelURL() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaModelURL(); + } + + + @Test + public void testGetCategory() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + + @Test + public void testGetSubCategory() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubCategory(); + } + + + @Test + public void testGetResourceType() throws Exception { + Resource testSubject; + Type result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceType(); + } + + + @Test + public void testGetLifecycleState() throws Exception { + Resource testSubject; + LifecycleState result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLifecycleState(); + } + + + @Test + public void testGetLastUpdaterUserId() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterUserId(); + } + + + @Test + public void testGetLastUpdaterFullName() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterFullName(); + } + + + @Test + public void testGetToscaModel() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaModel(); + } + + + @Test + public void testGetToscaResourceName() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaResourceName(); + } + + + @Test + public void testGetArtifacts() throws Exception { + Resource testSubject; + Collection result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testGetResources() throws Exception { + Resource testSubject; + Collection result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResources(); + } + + + @Test + public void testSetUuid() throws Exception { + Resource testSubject; + String uuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUuid(uuid); + } + + + @Test + public void testSetInvariantUUID() throws Exception { + Resource testSubject; + String invariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUUID(invariantUUID); + } + + + @Test + public void testSetName() throws Exception { + Resource testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testSetDescription() throws Exception { + Resource testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testSetVersion() throws Exception { + Resource testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + + @Test + public void testSetToscaModelURL() throws Exception { + Resource testSubject; + String toscaModelURL = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaModelURL(toscaModelURL); + } + + + @Test + public void testSetCategory() throws Exception { + Resource testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + + @Test + public void testSetSubCategory() throws Exception { + Resource testSubject; + String subCategory = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSubCategory(subCategory); + } + + + @Test + public void testSetResourceType() throws Exception { + Resource testSubject; + Type resourceType = null; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceType(resourceType); + } + + + @Test + public void testSetLifecycleState() throws Exception { + Resource testSubject; + LifecycleState lifecycleState = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLifecycleState(lifecycleState); + } + + + @Test + public void testSetLastUpdaterUserId() throws Exception { + Resource testSubject; + String lastUpdaterUserId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterUserId(lastUpdaterUserId); + } + + + @Test + public void testSetLastUpdaterFullName() throws Exception { + Resource testSubject; + String lastUpdaterFullName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterFullName(lastUpdaterFullName); + } + + + @Test + public void testSetToscaModel() throws Exception { + Resource testSubject; + String toscaModel = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaModel(toscaModel); + } + + + @Test + public void testSetToscaResourceName() throws Exception { + Resource testSubject; + String toscaResourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaResourceName(toscaResourceName); + } + + + @Test + public void testSetArtifacts() throws Exception { + Resource testSubject; + Collection artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } + + + @Test + public void testSetResources() throws Exception { + Resource testSubject; + Collection resources = null; + + // default test + testSubject = createTestSubject(); + testSubject.setResources(resources); + } + + + @Test + public void testHashCode() throws Exception { + Resource testSubject; + int result; + + // default test + testSubject = createTestSubject(); + testSubject.setUuid("cb49608f-5a24-4789-b0f7-2595473cb997"); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + Resource testSubject; + Object o = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(o); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/SubResourceTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/SubResourceTest.java new file mode 100644 index 000000000..e1672b71e --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/SubResourceTest.java @@ -0,0 +1,167 @@ +package org.onap.vid.asdc.beans; + +import java.util.Collection; + +import org.junit.Test; + + +public class SubResourceTest { + + private SubResource createTestSubject() { + return new SubResource(); + } + + + @Test + public void testGetResourceInstanceName() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceInstanceName(); + } + + + @Test + public void testGetResourceName() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceName(); + } + + + @Test + public void testGetResourceInvariantUUID() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceInvariantUUID(); + } + + + @Test + public void testGetResourceVersion() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVersion(); + } + + + @Test + public void testGetResoucreType() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResoucreType(); + } + + + @Test + public void testGetResourceUUID() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceUUID(); + } + + + @Test + public void testGetArtifacts() throws Exception { + SubResource testSubject; + Collection result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testSetResourceInstanceName() throws Exception { + SubResource testSubject; + String resourceInstanceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceInstanceName(resourceInstanceName); + } + + + @Test + public void testSetResourceName() throws Exception { + SubResource testSubject; + String resourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceName(resourceName); + } + + + @Test + public void testSetResourceInvariantUUID() throws Exception { + SubResource testSubject; + String resourceInvariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceInvariantUUID(resourceInvariantUUID); + } + + + @Test + public void testSetResourceVersion() throws Exception { + SubResource testSubject; + String resourceVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVersion(resourceVersion); + } + + + @Test + public void testSetResoucreType() throws Exception { + SubResource testSubject; + String resourceType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResoucreType(resourceType); + } + + + @Test + public void testSetResourceUUID() throws Exception { + SubResource testSubject; + String resourceUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceUUID(resourceUUID); + } + + + @Test + public void testSetArtifacts() throws Exception { + SubResource testSubject; + Collection artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/TestSuite.java new file mode 100644 index 000000000..6f0d47a2e --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.asdc.beans; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ ArtifactTest.class, ResourceTest.class, SubResourceTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/CapabilityTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/CapabilityTest.java new file mode 100644 index 000000000..7609e36d1 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/CapabilityTest.java @@ -0,0 +1,124 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Collection; +import java.util.Map; + +import org.junit.Test; + + +public class CapabilityTest { + + private Capability createTestSubject() { + return new Capability(); + } + + + @Test + public void testGetType() throws Exception { + Capability testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testGetDescription() throws Exception { + Capability testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testGetOccurrences() throws Exception { + Capability testSubject; + Collection result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOccurrences(); + } + + + @Test + public void testGetProperties() throws Exception { + Capability testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testGetValid_source_types() throws Exception { + Capability testSubject; + Collection result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValid_source_types(); + } + + + @Test + public void testSetType() throws Exception { + Capability testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testSetDescription() throws Exception { + Capability testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testSetOccurrences() throws Exception { + Capability testSubject; + Collection occurrences = null; + + // default test + testSubject = createTestSubject(); + testSubject.setOccurrences(occurrences); + } + + + @Test + public void testSetProperties() throws Exception { + Capability testSubject; + Map properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + + @Test + public void testSetValid_source_types() throws Exception { + Capability testSubject; + Collection valid_source_types = null; + + // default test + testSubject = createTestSubject(); + testSubject.setValid_source_types(valid_source_types); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ConstraintTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ConstraintTest.java new file mode 100644 index 000000000..ebba7d172 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ConstraintTest.java @@ -0,0 +1,221 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.List; + +import org.junit.Test; + +public class ConstraintTest { + + private Constraint createTestSubject() { + return new Constraint(); + } + + + @Test + public void testGetvalid_values() throws Exception { + Constraint testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getvalid_values(); + } + + + @Test + public void testGetEqual() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEqual(); + } + + + @Test + public void testGetGreater_than() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGreater_than(); + } + + + @Test + public void testGetGreater_or_equal() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGreater_or_equal(); + } + + + @Test + public void testGetLess_than() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLess_than(); + } + + + @Test + public void testGetLess_or_equal() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLess_or_equal(); + } + + + @Test + public void testGetIn_range() throws Exception { + Constraint testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIn_range(); + } + + + @Test + public void testGetLength() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLength(); + } + + + @Test + public void testGetMin_length() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMin_length(); + } + + + @Test + public void testGetMax_length() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMax_length(); + } + + + @Test + public void testSetvalid_values() throws Exception { + Constraint testSubject; + List vlist = null; + + // default test + testSubject = createTestSubject(); + testSubject.setvalid_values(vlist); + } + + + @Test + public void testSetEqual() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setEqual(e); + } + + + @Test + public void testSetGreater_than() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setGreater_than(e); + } + + + @Test + public void testSetLess_than() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLess_than(e); + } + + + @Test + public void testSetIn_range() throws Exception { + Constraint testSubject; + List e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setIn_range(e); + } + + + @Test + public void testSetLength() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLength(e); + } + + + @Test + public void testSetMin_length() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMin_length(e); + } + + + @Test + public void testSetMax_length() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMax_length(e); + } + + + @Test + public void testToString() throws Exception { + Constraint testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/GroupTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/GroupTest.java new file mode 100644 index 000000000..3692a15b9 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/GroupTest.java @@ -0,0 +1,124 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Collection; +import java.util.Map; + +import org.junit.Test; + + +public class GroupTest { + + private Group createTestSubject() { + return new Group(); + } + + + @Test + public void testGetMetadata() throws Exception { + Group testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + + @Test + public void testSetMetadata() throws Exception { + Group testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } + + + @Test + public void testGetMembers() throws Exception { + Group testSubject; + Collection result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMembers(); + } + + + @Test + public void testSetMembers() throws Exception { + Group testSubject; + Collection members = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMembers(members); + } + + + @Test + public void testGetType() throws Exception { + Group testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + Group testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetvf_module_type() throws Exception { + Group testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getvf_module_type(); + } + + + @Test + public void testSetvf_module_type() throws Exception { + Group testSubject; + String vf_module_type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setvf_module_type(vf_module_type); + } + + + @Test + public void testGetProperties() throws Exception { + Group testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + Group testSubject; + Map properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/NodeTemplateTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/NodeTemplateTest.java new file mode 100644 index 000000000..678a5102d --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/NodeTemplateTest.java @@ -0,0 +1,92 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Map; + +import org.junit.Test; + +public class NodeTemplateTest { + + private NodeTemplate createTestSubject() { + return new NodeTemplate(); + } + + @Test + public void testGetType() throws Exception { + NodeTemplate testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + @Test + public void testSetType() throws Exception { + NodeTemplate testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + @Test + public void testGetMetadata() throws Exception { + NodeTemplate testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + @Test + public void testSetMetadata() throws Exception { + NodeTemplate testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } + + @Test + public void testGetProperties() throws Exception { + NodeTemplate testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + @Test + public void testSetProperties() throws Exception { + NodeTemplate testSubject; + Map properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + @Test + public void testGetRequirements() throws Exception { + NodeTemplate testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirements(); + } + + @Test + public void testSetRequirements() throws Exception { + NodeTemplate testSubject; + Object requirements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirements(requirements); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TestSuite.java new file mode 100644 index 000000000..d94d33920 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TestSuite.java @@ -0,0 +1,12 @@ +package org.onap.vid.asdc.beans.tosca; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ GroupTest.class, TopologyTemplateTest.class, ToscaModelTest.class, CapabilityTest.class, ToscaMetadataTest.class, + ConstraintTest.class, NodeTemplateTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TopologyTemplateTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TopologyTemplateTest.java new file mode 100644 index 000000000..8392d926c --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TopologyTemplateTest.java @@ -0,0 +1,101 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Map; + +import org.junit.Test; + + +public class TopologyTemplateTest { + + private TopologyTemplate createTestSubject() { + return new TopologyTemplate(); + } + + + @Test + public void testGetsubstitution_mappings() throws Exception { + TopologyTemplate testSubject; + SubstitutionMappings result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getsubstitution_mappings(); + } + + + @Test + public void testSetsubstitution_mappings() throws Exception { + TopologyTemplate testSubject; + SubstitutionMappings substitution_mappings = null; + + // default test + testSubject = createTestSubject(); + testSubject.setsubstitution_mappings(substitution_mappings); + } + + + @Test + public void testGetInputs() throws Exception { + TopologyTemplate testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInputs(); + } + + + @Test + public void testSetInputs() throws Exception { + TopologyTemplate testSubject; + Map inputs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInputs(inputs); + } + + + @Test + public void testGetnode_templates() throws Exception { + TopologyTemplate testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getnode_templates(); + } + + + @Test + public void testSetnode_templates() throws Exception { + TopologyTemplate testSubject; + Map node_templates = null; + + // default test + testSubject = createTestSubject(); + testSubject.setnode_templates(node_templates); + } + + + @Test + public void testGetGroups() throws Exception { + TopologyTemplate testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroups(); + } + + + @Test + public void testSetGroups() throws Exception { + TopologyTemplate testSubject; + Map groups = null; + + // default test + testSubject = createTestSubject(); + testSubject.setGroups(groups); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaMetadataTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaMetadataTest.java new file mode 100644 index 000000000..2c91d9621 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaMetadataTest.java @@ -0,0 +1,443 @@ +package org.onap.vid.asdc.beans.tosca; + +import org.junit.Test; + +public class ToscaMetadataTest { + + private ToscaMetadata createTestSubject() { + return new ToscaMetadata(); + } + + @Test + public void testGetType() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + @Test + public void testGetInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUUID(); + } + + @Test + public void testGetCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCustomizationUUID(); + } + + @Test + public void testGetUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUUID(); + } + + @Test + public void testGetVersion() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + @Test + public void testGetName() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testGetDescription() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + @Test + public void testGetCategory() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + @Test + public void testGetSubcategory() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubcategory(); + } + + @Test + public void testGetResourceVendor() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVendor(); + } + + @Test + public void testGetResourceVendorRelease() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVendorRelease(); + } + + @Test + public void testGetServiceEcompNaming() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceEcompNaming(); + } + + @Test + public void testGetNamingPolicy() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNamingPolicy(); + } + + @Test + public void testIsServiceHoming() throws Exception { + ToscaMetadata testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isServiceHoming(); + } + + @Test + public void testIsEcompGeneratedNaming() throws Exception { + ToscaMetadata testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isEcompGeneratedNaming(); + } + + @Test + public void testSetType() throws Exception { + ToscaMetadata testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + @Test + public void testSetInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String invariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUUID(invariantUUID); + } + + @Test + public void testSetNamingPolicy() throws Exception { + ToscaMetadata testSubject; + String namingPolicy = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setNamingPolicy(namingPolicy); + } + + @Test + public void testSetUUID() throws Exception { + ToscaMetadata testSubject; + String uuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUUID(uuid); + } + + @Test + public void testSetCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String u = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCustomizationUUID(u); + } + + @Test + public void testSetVersion() throws Exception { + ToscaMetadata testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + @Test + public void testSetName() throws Exception { + ToscaMetadata testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testSetDescription() throws Exception { + ToscaMetadata testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + @Test + public void testSetCategory() throws Exception { + ToscaMetadata testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + @Test + public void testSetServiceEcompNaming() throws Exception { + ToscaMetadata testSubject; + String serviceEcompNaming = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceEcompNaming(serviceEcompNaming); + } + + @Test + public void testSetServiceHoming() throws Exception { + ToscaMetadata testSubject; + boolean serviceHoming = false; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceHoming(serviceHoming); + } + + @Test + public void testSetEcompGeneratedNaming() throws Exception { + ToscaMetadata testSubject; + boolean ecompGeneratedNaming = false; + + // default test + testSubject = createTestSubject(); + testSubject.setEcompGeneratedNaming(ecompGeneratedNaming); + } + + @Test + public void testGettemplate_name() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.gettemplate_name(); + } + + @Test + public void testSettemplate_name() throws Exception { + ToscaMetadata testSubject; + String template_name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.settemplate_name(template_name); + } + + + @Test + public void testSetSubcategory() throws Exception { + ToscaMetadata testSubject; + String subcategory = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSubcategory(subcategory); + } + + + @Test + public void testSetResourceVendor() throws Exception { + ToscaMetadata testSubject; + String resourceVendor = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVendor(resourceVendor); + } + + + @Test + public void testSetResourceVendorRelease() throws Exception { + ToscaMetadata testSubject; + String resourceVendorRelease = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVendorRelease(resourceVendorRelease); + } + + + @Test + public void testGetVfModuleModelName() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelName(); + } + + + @Test + public void testSetVfModuleModelName() throws Exception { + ToscaMetadata testSubject; + String vfModuleModelName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelName(vfModuleModelName); + } + + + @Test + public void testGetVfModuleModelInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelInvariantUUID(); + } + + + @Test + public void testSetVfModuleModelInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String vfModuleModelInvariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelInvariantUUID(vfModuleModelInvariantUUID); + } + + + @Test + public void testGetVfModuleModelUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelUUID(); + } + + + @Test + public void testSetVfModuleModelUUID() throws Exception { + ToscaMetadata testSubject; + String vfModuleModelUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelUUID(vfModuleModelUUID); + } + + + @Test + public void testGetVfModuleModelVersion() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelVersion(); + } + + + @Test + public void testSetVfModuleModelVersion() throws Exception { + ToscaMetadata testSubject; + String vfModuleModelVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelVersion(vfModuleModelVersion); + } + + + @Test + public void testSetVfModuleModelCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String u = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelCustomizationUUID(u); + } + + + @Test + public void testGetVfModuleModelCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelCustomizationUUID(); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaModelTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaModelTest.java new file mode 100644 index 000000000..ee5463744 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaModelTest.java @@ -0,0 +1,146 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Collection; +import java.util.Map; + +import org.junit.Test; + + +public class ToscaModelTest { + + private ToscaModel createTestSubject() { + return new ToscaModel(); + } + + + @Test + public void testGetMetadata() throws Exception { + ToscaModel testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + + @Test + public void testSetMetadata() throws Exception { + ToscaModel testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } + + + @Test + public void testGettosca_definitions_version() throws Exception { + ToscaModel testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.gettosca_definitions_version(); + } + + + @Test + public void testSettosca_definitions_version() throws Exception { + ToscaModel testSubject; + String tosca_definitions_version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.settosca_definitions_version(tosca_definitions_version); + } + + + @Test + public void testGettopology_template() throws Exception { + ToscaModel testSubject; + TopologyTemplate result; + + // default test + testSubject = createTestSubject(); + result = testSubject.gettopology_template(); + } + + + @Test + public void testSettopology_template() throws Exception { + ToscaModel testSubject; + TopologyTemplate topology_template = null; + + // default test + testSubject = createTestSubject(); + testSubject.settopology_template(topology_template); + } + + + @Test + public void testGetDescription() throws Exception { + ToscaModel testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ToscaModel testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testGetImports() throws Exception { + ToscaModel testSubject; + Collection>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getImports(); + } + + + @Test + public void testSetImports() throws Exception { + ToscaModel testSubject; + Collection>> imports = null; + + // default test + testSubject = createTestSubject(); + testSubject.setImports(imports); + } + + + @Test + public void testGetnode_types() throws Exception { + ToscaModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getnode_types(); + } + + + @Test + public void testSetnode_types() throws Exception { + ToscaModel testSubject; + Map node_types = null; + + // default test + testSubject = createTestSubject(); + testSubject.setnode_types(node_types); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java new file mode 100644 index 000000000..99f8ef38a --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java @@ -0,0 +1,154 @@ +package org.onap.vid.asdc.parser; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.google.common.collect.ImmutableList; +import org.apache.log4j.Logger; +import org.junit.Assert; +import org.onap.vid.controller.WebConfig; +import org.onap.vid.model.VfModule; +import org.onap.vid.model.VolumeGroup; +import org.onap.vid.properties.AsdcClientConfiguration; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.toscaparser.api.Group; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.web.context.WebApplicationContext; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map; + +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.*; + +@Test +@ContextConfiguration(classes = { WebConfig.class, AsdcClientConfiguration.class, SystemProperties.class }) +@WebAppConfiguration +public class ToscaParserImpl2Test extends AbstractTestNGSpringContextTests { + + private final String myUUID = "myUUID"; + private static final Logger log = Logger.getLogger(ToscaParserImpl2Test.class); + + @Autowired + private ToscaParserImpl2 toscaParserImpl2; + + @Autowired + private WebApplicationContext wac; + + @BeforeMethod + private void verifyWiring() { + Assert.assertNotNull(wac); + Assert.assertNotNull(toscaParserImpl2); + } + + @Test + public void testGetNFModuleFromVf() throws Exception { + ISdcCsarHelper csarHelper = getMockedSdcCsarHelper(); + + Map vfModulesFromVF = toscaParserImpl2.getVfModulesFromVF(csarHelper, myUUID); + + assertThat(vfModulesFromVF, allOf( + aMapWithSize(2), + hasKey("withoutVol"), + hasKey("withVol") + )); + + verify(csarHelper, only()).getVfModulesByVf(anyString()); + } + + @Test + public void testGetVolumeGroupsFromVF() throws Exception { + ISdcCsarHelper csarHelper = getMockedSdcCsarHelper(); + + Map volumeGroupsFromVF = toscaParserImpl2.getVolumeGroupsFromVF(csarHelper, myUUID); + + assertThat(volumeGroupsFromVF, allOf( + aMapWithSize(1), + hasKey("withVol") + )); + + verify(csarHelper, only()).getVfModulesByVf(anyString()); + } + + private ISdcCsarHelper getMockedSdcCsarHelper() { + ISdcCsarHelper csarHelper = mock(ISdcCsarHelper.class); + +// ThreadLocalsHolder.setCollector(new ExceptionCollector("c:\\temp\\foo")); + + Group withVol = createMinimalGroup("withVol", true); + Group withoutVol = createMinimalGroup("withoutVol", false); + + when(csarHelper.getVfModulesByVf(myUUID)) + .thenReturn(ImmutableList.of(withVol, withoutVol)); + + return csarHelper; + } + + private static Group createMinimalGroup(String name, boolean isVolumeGroup) { + LinkedHashMap + templates, + properties, + metadata, + customDef, + vfModule, + vfModuleProperties, + volumeGroup; + + templates = new LinkedHashMap<>(); + templates.put("type", "org.onap.groups.VfModule"); + + properties = addNewNamedMap(templates, "properties"); + properties.put("volume_group", isVolumeGroup); + + metadata = addNewNamedMap(templates, "metadata"); + + ArrayList memberNodes = new ArrayList<>(); + + customDef = new LinkedHashMap<>(); + vfModule = addNewNamedMap(customDef, "org.onap.groups.VfModule"); + vfModuleProperties = addNewNamedMap(vfModule, "properties"); +// vfModule.put("derived_from", "tosca.groups.Root"); +// vfModule.put("description", "Grouped all heat resources which are in the same VF Module"); + + volumeGroup = addNewNamedMap(vfModuleProperties, "volume_group"); +// volumeGroup.put("description", "volume_group"); + volumeGroup.put("type", "boolean"); + volumeGroup.put("default", false); + volumeGroup.put("required", true); + + + Group group = new Group( + name, + templates, + memberNodes, + customDef + ); + + try { + log.info(String.format("Built a group: %s", + (new com.fasterxml.jackson.databind.ObjectMapper()) + .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) + .writeValueAsString(group) + )); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + + return group; + } + + private static LinkedHashMap addNewNamedMap(LinkedHashMap root, String key) { + LinkedHashMap properties = new LinkedHashMap<>(); + root.put(key, properties); + return properties; + } + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java new file mode 100644 index 000000000..b64f5e50e --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java @@ -0,0 +1,143 @@ +package org.onap.vid.bl; + +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.vid.aai.AaiClientInterface; +import org.onap.vid.aai.AaiResponse; +import org.onap.vid.aai.model.*; +import org.onap.vid.aai.model.AaiGetPnfs.Pnf; +import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse; +import org.onap.vid.roles.Role; +import org.onap.vid.roles.RoleValidator; +import org.onap.vid.services.AaiServiceImpl; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.hamcrest.Matchers.arrayWithSize; +import static org.hamcrest.Matchers.equalTo; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.hamcrest.MatcherAssert.assertThat; + +public class AaiServiceTest { + + @InjectMocks + private AaiServiceImpl aaiService; + + @Mock + private AaiClientInterface aaiClientInterface; + + + + @BeforeMethod + public void initMocks(){ + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGetSpecificPnf(){ + Pnf pnf = new Pnf(); + pnf.setPnfId("11111"); + AaiResponse aaiResponse = new AaiResponse<>(pnf, "aaaa", 200); + Mockito.doReturn(aaiResponse).when(aaiClientInterface).getSpecificPnf(Mockito.anyString()); + AaiResponse specificPnf = aaiService.getSpecificPnf("1345667"); + assertNotNull(specificPnf); + pnf = specificPnf.getT(); + assertNotNull(pnf); + assertEquals("11111",pnf.getPnfId()); + assertEquals("aaaa",specificPnf.getErrorMessage()); + assertEquals(200,specificPnf.getHttpCode()); + } + + @Test + public void testGetAssociatedPnfs(){ + ServiceRelationships serviceRelationships = createServiceRelationships(); + AaiResponse aaiResponse = new AaiResponse<>(serviceRelationships, null, 200); + Mockito.doReturn(aaiResponse).when(aaiClientInterface).getServiceInstance(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); + + LogicalLinkResponse logicalLinkResponse = createLogicalLinkResponse(); + AaiResponse aaiResponse1 = new AaiResponse<>(logicalLinkResponse, null, 200); + Mockito.doReturn(aaiResponse1).when(aaiClientInterface).getLogicalLink("SANITY6758cce9%3ALAG1992%7CSANITY6785cce9%3ALAG1961"); + + List pnfList = aaiService.getServiceInstanceAssociatedPnfs("123", "456", "789"); + assertNotNull(pnfList); + assertEquals(1, pnfList.size()); + assertEquals("SANITY6785cce9", pnfList.get(0)); + } + + private ServiceRelationships createServiceRelationships() { + ServiceRelationships serviceRelationships = new ServiceRelationships(); + serviceRelationships.setServiceInstanceName("test service"); + + RelationshipData logicalLinksRelationshipData = new RelationshipData(); + logicalLinksRelationshipData.setRelationshipKey("logical-link.link-name"); + logicalLinksRelationshipData.setRelationshipValue("SANITY6758cce9:LAG1992|SANITY6785cce9:LAG1961"); + + Relationship logicalLinksRelationship = new Relationship(); + logicalLinksRelationship.setRelatedTo("logical-link"); + logicalLinksRelationship.setRelationDataList(Arrays.asList(logicalLinksRelationshipData)); + + RelationshipList logicalLinksRelationshipsList = new RelationshipList(); + logicalLinksRelationshipsList.setRelationship(Arrays.asList(logicalLinksRelationship)); + + serviceRelationships.setRelationshipList(logicalLinksRelationshipsList); + return serviceRelationships; + } + + private LogicalLinkResponse createLogicalLinkResponse() { + LogicalLinkResponse logicalLinkResponse = new LogicalLinkResponse(); + logicalLinkResponse.setLinkName("SANITY6758cce9:LAG1992|SANITY6785cce9:LAG1961"); + + RelationshipData lagInterfaceRelationshipData = new RelationshipData(); + lagInterfaceRelationshipData.setRelationshipKey("pnf.pnf-name"); + lagInterfaceRelationshipData.setRelationshipValue("SANITY6785cce9"); + + Relationship lagInterfaceRelationship = new Relationship(); + lagInterfaceRelationship.setRelatedTo("lag-interface"); + lagInterfaceRelationship.setRelationDataList(Arrays.asList(lagInterfaceRelationshipData)); + + RelationshipList lagInterfaceRelationshipsList = new RelationshipList(); + lagInterfaceRelationshipsList.setRelationship(Arrays.asList(lagInterfaceRelationship)); + + logicalLinkResponse.setRelationshipList(lagInterfaceRelationshipsList); + + return logicalLinkResponse; + } + + @DataProvider + public static Object[][] getTenantsData() { + return new Object[][] { + {"customer1", "serviceType1", "tenant1", "customer1", "serviceType1", "tenant1", "id-1", true}, + {"customer1", "serviceType1", "TeNant1", "customer1", "serviceType1", "tenant1", "id-1", true}, + {"customer1", "serviceType1", "TENANT1", "customer1", "serviceType1", "tenant1", "id-1", true}, + {"customer1", "serviceType1", "tenant2", "customer1", "serviceType1", "tenant1", "tenant2", false}, + {"customer1", "serviceType1", null, "customer1", "serviceType1", "tenant1", "tenant2", true}, + {"customer2", "serviceType1", "tenant1", "customer1", "serviceType1", "tenant1", "id-1", false}, + {"customer1", "serviceType2", "tenant1", "customer1", "serviceType1", "tenant1", "id-1", false}, + {"customer2", "serviceType1", null, "customer1", "serviceType1", "tenant1", "id-1", false}, + {"customer1", "serviceType2", null, "customer1", "serviceType1", "tenant1", "id-1", false}, + }; + } + + @Test(dataProvider = "getTenantsData") + public void testGetTenants(String userGlobalCustomerId, String userServiceType, String userTenantName, String serviceGlobalCustomerId, + String serviceServiceType, String serviceTenantName, String serviceTenantId, boolean expectedIsPermitted) { + GetTenantsResponse[] getTenantsResponses = new GetTenantsResponse[] {new GetTenantsResponse(null, serviceTenantName, serviceTenantId, false)}; + AaiResponse aaiResponse = new AaiResponse<>(getTenantsResponses, null, 200); + Mockito.doReturn(aaiResponse).when(aaiClientInterface).getTenants(serviceGlobalCustomerId, serviceServiceType); + Role role = new Role(null, userGlobalCustomerId, userServiceType, userTenantName); + RoleValidator roleValidator = new RoleValidator(Collections.singletonList(role)); + AaiResponse actualTenants = aaiService.getTenants(serviceGlobalCustomerId, serviceServiceType, roleValidator); + + assertThat(actualTenants.getT(), arrayWithSize(1)); + assertThat(actualTenants.getT()[0].tenantName, equalTo(serviceTenantName)); + assertThat(actualTenants.getT()[0].isPermitted, equalTo(expectedIsPermitted)); + } +} diff --git a/vid-app-common/src/test/java/org/onap/vid/client/FakeHttpSessionTest.java b/vid-app-common/src/test/java/org/onap/vid/client/FakeHttpSessionTest.java new file mode 100644 index 000000000..74cfbcfc7 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/client/FakeHttpSessionTest.java @@ -0,0 +1,206 @@ +package org.onap.vid.client; + +import java.util.Enumeration; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpSessionContext; + +import org.junit.Test; + + +public class FakeHttpSessionTest { + + private FakeHttpSession createTestSubject() { + return new FakeHttpSession(); + } + + + @Test + public void testGetCreationTime() throws Exception { + FakeHttpSession testSubject; + long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCreationTime(); + } + + + @Test + public void testGetId() throws Exception { + FakeHttpSession testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getId(); + } + + + @Test + public void testGetLastAccessedTime() throws Exception { + FakeHttpSession testSubject; + long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastAccessedTime(); + } + + + @Test + public void testGetServletContext() throws Exception { + FakeHttpSession testSubject; + ServletContext result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServletContext(); + } + + + @Test + public void testSetMaxInactiveInterval() throws Exception { + FakeHttpSession testSubject; + int maxInactiveInterval = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setMaxInactiveInterval(maxInactiveInterval); + } + + + @Test + public void testGetMaxInactiveInterval() throws Exception { + FakeHttpSession testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMaxInactiveInterval(); + } + + + @Test + public void testGetSessionContext() throws Exception { + FakeHttpSession testSubject; + HttpSessionContext result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSessionContext(); + } + + + @Test + public void testGetAttribute() throws Exception { + FakeHttpSession testSubject; + String name = ""; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAttribute(name); + } + + + @Test + public void testGetValue() throws Exception { + FakeHttpSession testSubject; + String name = ""; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(name); + } + + + @Test + public void testGetAttributeNames() throws Exception { + FakeHttpSession testSubject; + Enumeration result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAttributeNames(); + } + + + @Test + public void testGetValueNames() throws Exception { + FakeHttpSession testSubject; + String[] result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValueNames(); + } + + + @Test + public void testSetAttribute() throws Exception { + FakeHttpSession testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAttribute(name, value); + } + + + @Test + public void testPutValue() throws Exception { + FakeHttpSession testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.putValue(name, value); + } + + + @Test + public void testRemoveAttribute() throws Exception { + FakeHttpSession testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.removeAttribute(name); + } + + + @Test + public void testRemoveValue() throws Exception { + FakeHttpSession testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.removeValue(name); + } + + + @Test + public void testInvalidate() throws Exception { + FakeHttpSession testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.invalidate(); + } + + + @Test + public void testIsNew() throws Exception { + FakeHttpSession testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isNew(); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/client/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/client/TestSuite.java new file mode 100644 index 000000000..434dd5cc0 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/client/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.client; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ FakeHttpSessionTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java new file mode 100644 index 000000000..548c48043 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java @@ -0,0 +1,51 @@ +package org.onap.vid.controller; + +import javax.servlet.http.HttpServletRequest; + +import org.json.simple.JSONObject; +import org.junit.Test; +import org.springframework.http.ResponseEntity; +import org.springframework.web.servlet.ModelAndView; + +public class AaiControllerTest { + + private AaiController createTestSubject() { + return new AaiController(); + } + + @Test + public void testWelcome() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + ModelAndView result; + + // default test + testSubject = createTestSubject(); + result = testSubject.welcome(request); + } + + + @Test + public void testGetTargetProvStatus() throws Exception { + AaiController testSubject; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTargetProvStatus(); + } + + @Test + public void testViewEditGetTenantsFromServiceType() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + String globalCustomerId = ""; + String serviceType = ""; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.viewEditGetTenantsFromServiceType(request, globalCustomerId, serviceType); + } + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java new file mode 100644 index 000000000..ddbe4e888 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java @@ -0,0 +1,47 @@ +package org.onap.vid.controller; + +import org.junit.Test; +import org.onap.vid.controller.HealthCheckController.HealthStatus; + +public class HealthCheckControllerTest { + + private HealthCheckController createTestSubject() { + return new HealthCheckController(); + } + + @Test + public void testGetProfileCount() throws Exception { + HealthCheckController testSubject; + String driver = ""; + String URL = ""; + String username = ""; + String password = ""; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProfileCount(driver, URL, username, password); + } + + @Test + public void testGethealthCheckStatusforIDNS() throws Exception { + HealthCheckController testSubject; + HealthStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.gethealthCheckStatusforIDNS(); + } + + @Test + public void testGetHealthCheck() throws Exception { + HealthCheckController testSubject; + String UserAgent = ""; + String ECOMPRequestID = ""; + HealthStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getHealthCheck(UserAgent, ECOMPRequestID); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java b/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java new file mode 100644 index 000000000..9b6a3e7b4 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java @@ -0,0 +1,70 @@ +package org.onap.vid.controller; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.io.IOUtils; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.onap.vid.aai.AaiClient; +import org.onap.vid.aai.AaiClientInterface; +import org.onap.vid.asdc.AsdcClient; +import org.onap.vid.asdc.local.LocalAsdcClient; +import org.onap.vid.asdc.parser.ToscaParserImpl2; +import org.onap.vid.controller.VidController; +import org.onap.vid.services.AaiService; +import org.onap.vid.services.AaiServiceImpl; +import org.onap.vid.services.VidService; +import org.onap.vid.services.VidServiceImpl; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.io.IOException; +import java.io.InputStream; + +@Configuration +public class LocalWebConfig { + + /** + * Gets the object mapper. + * + * @return the object mapper + */ + @Bean + public ObjectMapper getObjectMapper() { + return new ObjectMapper(); + } + + + @Bean + public VidService vidService(AsdcClient asdcClient) { + return new VidServiceImpl(asdcClient); + } + + @Bean + public AaiService getAaiService() { + return new AaiServiceImpl(); + } + + @Bean + public AaiClientInterface getAaiClientInterface() { + return new AaiClient(); + } + + @Bean + public AsdcClient asdcClient() throws IOException { + + + final InputStream asdcServicesFile = VidController.class.getClassLoader().getResourceAsStream("sdcservices.json"); + + final JSONTokener jsonTokener = new JSONTokener(IOUtils.toString(asdcServicesFile)); + final JSONObject sdcServicesCatalog = new JSONObject(jsonTokener); + + return new LocalAsdcClient.Builder().catalog(sdcServicesCatalog).build(); + + } + + @Bean + public ToscaParserImpl2 getToscaParser() { + return new ToscaParserImpl2(); + } + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java new file mode 100644 index 000000000..6ca6a9f01 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java @@ -0,0 +1,109 @@ +package org.onap.vid.controller; + +import org.apache.commons.lang.StringEscapeUtils; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.vid.controller.MsoConfig; +import org.onap.vid.controller.MsoController; +import org.onap.vid.domain.mso.RequestInfo; +import org.onap.vid.factories.MsoRequestFactory; +import org.onap.vid.mso.rest.Request; +import org.onap.vid.mso.rest.RequestDetails; +import org.onap.vid.mso.rest.Task; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.testng.Assert; +import org.testng.Assert.*; +import org.testng.annotations.Test; + +import java.util.List; + + +@WebAppConfiguration +@ContextConfiguration(classes = {SystemProperties.class, MsoConfig.class}) +public class MsoControllerTest extends AbstractTestNGSpringContextTests { + + @Autowired + MsoRequestFactory msoRequestFactory; + + @Test(enabled = false) + public void testInstanceCreationNew() throws Exception { + + RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json"); + MsoController msoController = new MsoController(null); + //TODO: make ths test to really test something + //ResponseEntity responseEntityNew = msoController.createSvcInstanceNew(null, requestDetails); + ResponseEntity responseEntity = msoController.createSvcInstance(null, requestDetails); + //Assert.assertEquals(responseEntityNew, responseEntity); + + } + + @Test(enabled = false) + public void testInstanceCreationLocalWithRest() throws Exception { + + RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json"); + MsoController msoController = new MsoController(null); + ResponseEntity responseEntityNew = msoController.createSvcInstance(null, requestDetails); + //TODO: make ths test to really test something +// ResponseEntity responseEntityRest = msoController.createSvcInstanceNewRest(null, requestDetails); +// +// Assert.assertEquals(responseEntityNew.getBody(), responseEntityRest.getBody()); + + } + + @Test(enabled = false) + public void testInstanceCreation() throws Exception { + + RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json"); + MsoController msoController = new MsoController(null); + ResponseEntity responseEntity = msoController.createSvcInstance(null, requestDetails); + + + Assert.assertEquals(responseEntity.getBody(), "{ \"status\": 200, \"entity\": {\n" + + " \"requestReferences\": {\n" + + " \"instanceId\": \"ba00de9b-3c3e-4b0a-a1ad-0c5489e711fb\",\n" + + " \"requestId\": \"311cc766-b673-4a50-b9c5-471f68914586\"\n" + + " }\n" + + "}}"); + + } + + @Test(enabled = false) + public void testGetOrchestrationRequestsForDashboard() throws Exception { + MsoController msoController = new MsoController(null); + List orchestrationRequestsForDashboard = msoController.getOrchestrationRequestsForDashboard(); + + Assert.assertEquals(orchestrationRequestsForDashboard.size(), 2); + } + + @Test(enabled = false) + public void testGetManualTasksByRequestId() throws Exception { + MsoController msoController = new MsoController(null); + List orchestrationRequestsForDashboard = msoController.getManualTasksByRequestId("za1234d1-5a33-55df-13ab-12abad84e335"); + + Assert. assertEquals(orchestrationRequestsForDashboard.get(0).getTaskId(), "daf4dd84-b77a-42da-a051-3239b7a9392c"); + } + + + public void testCompleteManualTask() throws Exception { // TODO not done yet + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setResponseValue("rollback"); + requestInfo.setRequestorId("abc"); + requestInfo.setSource("VID"); + RequestDetails requestDetails = new RequestDetails(); + requestDetails.setRequestInfo(requestInfo); + MsoController msoController = new MsoController(null); + ResponseEntity responseEntity = msoController.manualTaskComplete("daf4dd84-b77a-42da-a051-3239b7a9392c", requestDetails); + String assertString = "{ \\\"status\\\": 200, \\\"entity\\\": {\\n\" +\n" + + " \" \\\"taskRequestReference\\\": {\\n\" +\n" + + " \" \\\"taskId\\\": \\\"daf4dd84-b77a-42da-a051-3239b7a9392c\\\"\\n\" +\n" + + " \" }\\n\" +\n" + + " \"}\\n\" +\n" + + " \"}"; + Assert.assertEquals(responseEntity.getBody(), StringEscapeUtils.unescapeJava(assertString)); + } + + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/PromiseEcompRequestIdFilterTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/PromiseEcompRequestIdFilterTest.java new file mode 100644 index 000000000..245d8bbd5 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/PromiseEcompRequestIdFilterTest.java @@ -0,0 +1,168 @@ +package org.onap.vid.controller; + +import com.google.common.collect.ImmutableMap; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.mockito.stubbing.Answer; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.onap.vid.controller.filter.PromiseEcompRequestIdFilter; +import org.springframework.mock.web.MockHttpServletResponse; +import org.testng.annotations.Test; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; +import java.util.function.Function; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.argThat; +import static org.openecomp.portalsdk.core.util.SystemProperties.ECOMP_REQUEST_ID; + +@Test +public class PromiseEcompRequestIdFilterTest { + + private final String anotherHeader = "ANDREI_RUBLEV"; + private final String anotherValue = "foo value"; + private final String mixedCaseHeader = "x-ecomp-REQUESTID"; + + @Test + public void givenRequestIdHeader_headerValueNotChanged() throws IOException, ServletException { + + final String someTxId = "863850e2-8545-4efd-94b8-afba5f52b3d5"; + + final ImmutableMap incomingRequestHeaders = ImmutableMap.of( + anotherHeader, anotherValue, + ECOMP_REQUEST_ID, someTxId + ); + + buildRequestThenRunThroughFilterAndAssertResultRequestHeaders(incomingRequestHeaders, specificTxId(someTxId)); + } + + @Test + public void givenMixedCaseRequestIdHeader_headerValueNotChanged() throws IOException, ServletException { + + final String someTxId = "729bbd8d-b0c2-4809-a794-dcccd9cda2c0"; + + final ImmutableMap incomingRequestHeaders = ImmutableMap.of( + mixedCaseHeader, someTxId, + anotherHeader, anotherValue + ); + + buildRequestThenRunThroughFilterAndAssertResultRequestHeaders(incomingRequestHeaders, specificTxId(someTxId)); + } + + @Test + public void givenNoRequestIdHeader_headerValueWasGenerated() throws IOException, ServletException { + + final ImmutableMap incomingRequestHeaders = ImmutableMap.of( + anotherHeader, anotherValue + ); + + buildRequestThenRunThroughFilterAndAssertResultRequestHeaders(incomingRequestHeaders, UserUtils::getRequestId); + } + + + private void buildRequestThenRunThroughFilterAndAssertResultRequestHeaders( + ImmutableMap originalRequestHeaders, + Function txIdExtractor + ) throws IOException, ServletException { + HttpServletRequest servletRequest = createMockedHttpServletRequest(originalRequestHeaders); + HttpServletResponse servletResponse = createMockedHttpServletResponse(); + + final FilterChain capturingFilterChain = Mockito.mock(FilterChain.class); + + ////////////////// + // + // doFilter() is the function under test + // + new PromiseEcompRequestIdFilter().doFilter(servletRequest, servletResponse, capturingFilterChain); + // + ////////////////// + + final ServletRequest capturedServletRequest = extractCapturedServletRequest(capturingFilterChain); + final ServletResponse capturedServletResponse = extractCapturedServletResponse(capturingFilterChain); + final String expectedTxId = txIdExtractor.apply((HttpServletRequest) capturedServletRequest); + + assertRequestObjectHeaders(capturedServletRequest, expectedTxId); + assertResponseObjectHeaders(capturedServletResponse, expectedTxId); + } + + + private void assertRequestObjectHeaders(ServletRequest request, String expectedTxId) { + /* + Assert that: + - Two headers are in place + - Direct value extraction is as expected + - UserUtils.getRequestId() returns correct and valid value + */ + final HttpServletRequest httpServletRequest = (HttpServletRequest) request; + + assertThat(Collections.list(httpServletRequest.getHeaderNames()), + containsInAnyOrder(equalToIgnoringCase(ECOMP_REQUEST_ID), equalToIgnoringCase(anotherHeader))); + + assertThat(httpServletRequest.getHeader(anotherHeader), is(anotherValue)); + + assertThat(httpServletRequest.getHeader(ECOMP_REQUEST_ID), is(expectedTxId)); + assertThat(httpServletRequest.getHeader(mixedCaseHeader), is(expectedTxId)); + + assertThat(UserUtils.getRequestId(httpServletRequest), is(expectedTxId)); + assertThat(UserUtils.getRequestId(httpServletRequest), is(not(emptyOrNullString()))); + } + + private void assertResponseObjectHeaders(ServletResponse response, String txId) { + final String REQUEST_ID_HEADER_NAME_IN_RESPONSE = mixedCaseHeader + "-echo"; + final HttpServletResponse httpServletResponse = (HttpServletResponse) response; + + assertThat("header " + REQUEST_ID_HEADER_NAME_IN_RESPONSE.toLowerCase() + " in response must be provided", + httpServletResponse.getHeader(REQUEST_ID_HEADER_NAME_IN_RESPONSE), is(txId)); + } + + + + private HttpServletRequest createMockedHttpServletRequest(Map requestHeaders) { + HttpServletRequest servletRequest = Mockito.mock(HttpServletRequest.class); + requestHeaders.forEach((k, v) -> { + Mockito.when(servletRequest.getHeader(argThat(equalToIgnoringCase(k)))).thenReturn(v); + Mockito.when(servletRequest.getHeaders(argThat(equalToIgnoringCase(k)))).then(returnEnumerationAnswer(v)); + }); + Mockito.when(servletRequest.getHeaderNames()).then(returnEnumerationAnswer(requestHeaders.keySet())); + return servletRequest; + } + + private HttpServletResponse createMockedHttpServletResponse() { + return new MockHttpServletResponse(); + } + + private static Answer> returnEnumerationAnswer(String ... items) { + return returnEnumerationAnswer(Arrays.asList(items)); + } + + private static Answer> returnEnumerationAnswer(Collection items) { + return invocation -> Collections.enumeration(items); + } + + private Function specificTxId(String someTxId) { + return r -> someTxId; + } + + private ServletRequest extractCapturedServletRequest(FilterChain capturingFilterChain) throws IOException, ServletException { + ArgumentCaptor captor = ArgumentCaptor.forClass(ServletRequest.class); + Mockito.verify(capturingFilterChain).doFilter(captor.capture(), any()); + return captor.getValue(); + } + + private ServletResponse extractCapturedServletResponse(FilterChain capturingFilterChain) throws IOException, ServletException { + ArgumentCaptor captor = ArgumentCaptor.forClass(ServletResponse.class); + Mockito.verify(capturingFilterChain).doFilter(any(), captor.capture()); + return captor.getValue(); + } + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/PropertyControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/PropertyControllerTest.java new file mode 100644 index 000000000..e9c2e61be --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/PropertyControllerTest.java @@ -0,0 +1,39 @@ +package org.onap.vid.controller; + +import javax.servlet.http.HttpServletRequest; + +import org.junit.Test; +import org.springframework.http.ResponseEntity; +import org.springframework.web.servlet.ModelAndView; + +public class PropertyControllerTest { + + private PropertyController createTestSubject() { + return new PropertyController(); + } + + @Test + public void testWelcome() throws Exception { + PropertyController testSubject; + HttpServletRequest request = null; + ModelAndView result; + + // default test + testSubject = createTestSubject(); + result = testSubject.welcome(request); + } + + + @Test + public void testGetProperty() throws Exception { + PropertyController testSubject; + String name = ""; + String defaultvalue = ""; + HttpServletRequest request = null; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperty(name, defaultvalue, request); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/ToscaParserMockHelper.java b/vid-app-common/src/test/java/org/onap/vid/controller/ToscaParserMockHelper.java new file mode 100644 index 000000000..36a179109 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/ToscaParserMockHelper.java @@ -0,0 +1,42 @@ +package org.onap.vid.controller; + +import org.onap.vid.model.NewServiceModel; + +/** + * Created by moriya1 on 04/07/2017. + */ +public class ToscaParserMockHelper { + + private String uuid; + private String filePath; + private NewServiceModel newServiceModel; + + public ToscaParserMockHelper(String uuid, String filePath) { + this.uuid = uuid; + this.filePath = filePath; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public NewServiceModel getNewServiceModel() { + return newServiceModel; + } + + public void setNewServiceModel(NewServiceModel newServiceModel) { + this.newServiceModel = newServiceModel; + } +} diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java new file mode 100644 index 000000000..b443e1f05 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java @@ -0,0 +1,187 @@ +package org.onap.vid.controller; + +import com.fasterxml.jackson.databind.ObjectMapper; +import net.javacrumbs.jsonunit.JsonAssert; +import org.apache.commons.io.IOUtils; +import org.onap.vid.asdc.AsdcCatalogException; +import org.onap.vid.asdc.AsdcClient; +import org.onap.vid.asdc.parser.ToscaParserImpl2; +import org.onap.vid.model.*; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mock.web.MockServletContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.testng.Assert; +import org.testng.annotations.Test; + +import static org.onap.vid.testUtils.TestUtils.assertJsonStringEqualsIgnoreNulls; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Path; +import java.util.Map; +import java.util.UUID; + +//import org.junit.Assert; +//import org.junit.Ignore; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@ContextConfiguration(classes = {LocalWebConfig.class, SystemProperties.class}) +//@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration + +public class VidControllerTest extends AbstractTestNGSpringContextTests { + + @Autowired + MockServletContext context; + @Autowired + private AsdcClient asdcClient; + private ToscaParserImpl2 p2 = new ToscaParserImpl2(); + private ObjectMapper om = new ObjectMapper(); + + + @Test + public void assertEqualsBetweenServices() throws Exception { + for (ToscaParserMockHelper mockHelper : getExpectedServiceModel()) { + Service expectedService = mockHelper.getNewServiceModel().getService(); + Service actualService = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getService(); + assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(expectedService), om.writeValueAsString(actualService)); + } + } + +// @Test +// public void assertEqualBetweenObjects() throws Exception { +// for (ToscaParserMockHelper mockHelper : getExpectedServiceModel()) { +// final Path csarPath = getCsarPath(mockHelper.getUuid()); +// System.out.println("Comparing for csar " + csarPath); +// ServiceModel actualServiceModel = p2.makeServiceModel(csarPath, getServiceByUuid(mockHelper.getUuid())); +// assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(mockHelper.getNewServiceModel()), om.writeValueAsString(actualServiceModel)); +// } +// } + +// @Test +// public void assertEqualsBetweenNetworkNodes() throws Exception { +// for (ToscaParserMockHelper mockHelper : getExpectedServiceModel()) { +// Map expectedNetworksMap = mockHelper.getNewServiceModel().getNetworks(); +// Map actualNetworksMap = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getNetworks(); +// for (Map.Entry entry : expectedNetworksMap.entrySet()) { +// Network expectedNetwork = entry.getValue(); +// Network actualNetwork = actualNetworksMap.get(entry.getKey()); +// Assert.assertEquals(expectedNetwork.getModelCustomizationName(), actualNetwork.getModelCustomizationName()); +// verifyBaseNodeProperties(expectedNetwork, actualNetwork); +// compareProperties(expectedNetwork.getProperties(), actualNetwork.getProperties()); +// } +// } +// } + + //Because we are not supporting the old flow, the JSON are different by definition. + @Test + public void assertEqualsBetweenVnfsOfTosca() throws Exception { + for (ToscaParserMockHelper mockHelper : getExpectedServiceModel()) { + Map expectedVnfsMap = mockHelper.getNewServiceModel().getVnfs(); + Map actualVnfsMap = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVnfs(); + for (Map.Entry entry : expectedVnfsMap.entrySet()) { + VNF expectedVnf = entry.getValue(); + VNF actualVnf = actualVnfsMap.get(entry.getKey()); + verifyBaseNodeProperties(expectedVnf, actualVnf); + Assert.assertEquals(expectedVnf.getModelCustomizationName(), actualVnf.getModelCustomizationName()); + compareProperties(expectedVnf.getProperties(), actualVnf.getProperties()); + assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(expectedVnf), om.writeValueAsString(actualVnf)); + } + } + } + + @Test + public void assertEqualsBetweenVolumeGroups() throws Exception { + for (ToscaParserMockHelper mockHelper : getExpectedServiceModel()) { + Map actualVolumeGroups = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVolumeGroups(); + Map expectedVolumeGroups = mockHelper.getNewServiceModel().getVolumeGroups(); + JsonAssert.assertJsonEquals(actualVolumeGroups, expectedVolumeGroups); + } + } + + @Test + public void assertEqualsBetweenVfModules() throws Exception { + for (ToscaParserMockHelper mockHelper : getExpectedServiceModel()) { + Map actualVfModules = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVfModules(); + Map expectedVfModules = mockHelper.getNewServiceModel().getVfModules(); + JsonAssert.assertJsonEquals(actualVfModules, expectedVfModules); + } + } + + @Test + public void assertEqualsBetweenPolicyConfigurationNodes() throws Exception { + for (ToscaParserMockHelper mockHelper : getExpectedServiceModel()) { + Map actualConfigurations = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getConfigurations(); + Map expectedConfigurations = mockHelper.getNewServiceModel().getConfigurations(); + JsonAssert.assertJsonEquals(actualConfigurations, expectedConfigurations); + } + } + + @Test + public void assertEqualsBetweenServiceProxyNodes() throws Exception { + for (ToscaParserMockHelper mockHelper : getExpectedServiceModel()) { + Map actualServiceProxies = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getServiceProxies(); + Map expectedServiceProxies = mockHelper.getNewServiceModel().getServiceProxies(); + JsonAssert.assertJsonEquals(actualServiceProxies, expectedServiceProxies); + } + } + + private void verifyBaseNodeProperties(Node expectedNode, Node actualNode) { + Assert.assertEquals(expectedNode.getName(), actualNode.getName()); + Assert.assertEquals(expectedNode.getCustomizationUuid(), actualNode.getCustomizationUuid()); + Assert.assertEquals(expectedNode.getDescription(), actualNode.getDescription()); + Assert.assertEquals(expectedNode.getInvariantUuid(), actualNode.getInvariantUuid()); + Assert.assertEquals(expectedNode.getUuid(), actualNode.getUuid()); + Assert.assertEquals(expectedNode.getVersion(), actualNode.getVersion()); + } + + private void compareProperties(Map expectedProperties, Map actualProperties) { + for (Map.Entry property : expectedProperties.entrySet()) { + String expectedValue = property.getValue(); + String key = property.getKey(); + String actualValue = actualProperties.get(key); + Assert.assertEquals(expectedValue, actualValue); + } + } + + private ToscaParserMockHelper[] getExpectedServiceModel() throws IOException { + ToscaParserMockHelper[] mockHelpers = { + new ToscaParserMockHelper(Constants.vlUuid, Constants.vlFilePath), + new ToscaParserMockHelper(Constants.vfUuid, Constants.vfFilePath), + new ToscaParserMockHelper(Constants.configurationUuid, Constants.configurationFilePath), + }; + for (ToscaParserMockHelper mockHelper : mockHelpers) { + InputStream jsonFile = VidControllerTest.class.getClassLoader().getResourceAsStream(mockHelper.getFilePath()); + String expectedJsonAsString = IOUtils.toString(jsonFile); + NewServiceModel newServiceModel1 = om.readValue(expectedJsonAsString, NewServiceModel.class); + mockHelper.setNewServiceModel(newServiceModel1); + } + return mockHelpers; + } + + private Path getCsarPath(String uuid) throws AsdcCatalogException { + return asdcClient.getServiceToscaModel(UUID.fromString(uuid)); + } + + private org.onap.vid.asdc.beans.Service getServiceByUuid(String uuid) throws AsdcCatalogException { + return asdcClient.getService(UUID.fromString(uuid)); + } + + public class Constants { + public static final String configurationUuid = "ee6d61be-4841-4f98-8f23-5de9da846ca7"; + public static final String configurationFilePath = "policy-configuration-csar.JSON"; + static final String vfUuid = "48a52540-8772-4368-9cdb-1f124ea5c931"; + static final String vlUuid = "cb49608f-5a24-4789-b0f7-2595473cb997"; + // public static final String PNFUuid = "68101369-6f08-4e99-9a28-fa6327d344f3"; + static final String vfFilePath = "vf-csar.JSON"; + static final String vlFilePath = "vl-csar.JSON"; +// public static final String PNFFilePath = "/Users/Oren/Git/Att/vid_internal/vid-app-common/src/main/resources/pnf.csar"; + + } + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/ViewEditSubControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/ViewEditSubControllerTest.java new file mode 100644 index 000000000..061b359c7 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controller/ViewEditSubControllerTest.java @@ -0,0 +1,45 @@ +//package org.onap.vid.controller; +// +//import javax.servlet.http.HttpServletRequest; +// +//import org.junit.Test; +//import org.springframework.web.servlet.ModelAndView; +// +//public class ViewEditSubControllerTest { +// +// private ViewEditSubController createTestSubject() { +// return new ViewEditSubController(); +// } +// +// @Test +// public void testWelcome() throws Exception { +// ViewEditSubController testSubject; +// HttpServletRequest request = null; +// ModelAndView result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.welcome(request); +// } +// +// +// @Test +// public void testGetViewName() throws Exception { +// ViewEditSubController testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getViewName(); +// } +// +// @Test +// public void testSetViewName() throws Exception { +// ViewEditSubController testSubject; +// String viewName = ""; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.setViewName(viewName); +// } +//} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/integrationTest/AaiIntegrationTest.java b/vid-app-common/src/test/java/org/onap/vid/integrationTest/AaiIntegrationTest.java new file mode 100644 index 000000000..eaad6ccc6 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/integrationTest/AaiIntegrationTest.java @@ -0,0 +1,43 @@ +package org.onap.vid.integrationTest; + +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.vid.aai.AaiClient; +import org.onap.vid.aai.AaiClientInterface; +import org.onap.vid.aai.AaiResponse; +import org.onap.vid.aai.model.GetServiceModelsByDistributionStatusResponse; +import org.onap.vid.aai.model.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mock.web.MockServletContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.testng.Assert; +import org.testng.annotations.Test; + + +@ContextConfiguration(classes = {SystemProperties.class}) + + +@WebAppConfiguration +public class AaiIntegrationTest extends AbstractTestNGSpringContextTests { + + + @Autowired + MockServletContext servletContext; + + + @Test + public void testGetServiceModelsFromAai() throws Exception { + AaiClientInterface aaiClient = new AaiClient(servletContext); + AaiResponse serviceModelsByDistributionStatusResponse = aaiClient.getServiceModelsByDistributionStatus(); + GetServiceModelsByDistributionStatusResponse response = serviceModelsByDistributionStatusResponse.getT(); + for(Result result: response.getResults()){ + Assert.assertNotNull(result.getModel().getModelInvariantId()); + Assert.assertNotNull(result.getModel().getModelVers().getModelVer().get(0).getModelVersionId()); + Assert.assertNotNull(result.getModel().getModelVers().getModelVer().get(0).getModelName()); + Assert.assertNotNull(result.getModel().getModelVers().getModelVer().get(0).getModelVersion()); + } + } + + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/model/ModelUtilTest.java b/vid-app-common/src/test/java/org/onap/vid/model/ModelUtilTest.java new file mode 100644 index 000000000..af69b5342 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/ModelUtilTest.java @@ -0,0 +1,48 @@ +package org.onap.vid.model; + +import org.junit.Assert; +import org.junit.Test; + + +public class ModelUtilTest { + + private ModelUtil createTestSubject() { + return new ModelUtil(); + } + + + @Test + public void testGetTags() throws Exception { + String[] namespaces; + String constantValue = "test"; + String[] result; + + // test 1 + namespaces = null; + result = ModelUtil.getTags(namespaces, constantValue); + Assert.assertNull(result); + + // test 2 + namespaces = new String[] { "" }; + result = ModelUtil.getTags(namespaces, constantValue); + Assert.assertArrayEquals(new String[] { constantValue }, result); + } + + + @Test + public void testIsType() throws Exception { + String type = "a"; + String[] tags; + boolean result; + + // test 1 + tags = null; + result = ModelUtil.isType(type, tags); + Assert.assertEquals(false, result); + + // test 2 + tags = new String[] { "a" }; + result = ModelUtil.isType(type, tags); + Assert.assertEquals(true, result); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/NewNodeTest.java b/vid-app-common/src/test/java/org/onap/vid/model/NewNodeTest.java new file mode 100644 index 000000000..853ad738d --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/NewNodeTest.java @@ -0,0 +1,212 @@ +package org.onap.vid.model; + +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.asdc.beans.tosca.Input; + + +public class NewNodeTest { + + private NewNode createTestSubject() { + return new NewNode(); + } + + + @Test + public void testGetUuid() throws Exception { + NewNode testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUuid(); + } + + + @Test + public void testGetInvariantUuid() throws Exception { + NewNode testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUuid(); + } + + + @Test + public void testGetDescription() throws Exception { + NewNode testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testGetName() throws Exception { + NewNode testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testGetVersion() throws Exception { + NewNode testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testGetCustomizationUuid() throws Exception { + NewNode testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCustomizationUuid(); + } + + + @Test + public void testGetInputs() throws Exception { + NewNode testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInputs(); + } + + + @Test + public void testGetCommands() throws Exception { + NewNode testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCommands(); + } + + + @Test + public void testGetProperties() throws Exception { + NewNode testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetUuid() throws Exception { + NewNode testSubject; + String uuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUuid(uuid); + } + + + @Test + public void testSetInvariantUuid() throws Exception { + NewNode testSubject; + String invariantUuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUuid(invariantUuid); + } + + + @Test + public void testSetDescription() throws Exception { + NewNode testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testSetName() throws Exception { + NewNode testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testSetVersion() throws Exception { + NewNode testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + + @Test + public void testSetCustomizationUuid() throws Exception { + NewNode testSubject; + String u = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCustomizationUuid(u); + } + + + @Test + public void testSetInputs() throws Exception { + NewNode testSubject; + Map inputs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInputs(inputs); + } + + + @Test + public void testSetCommands() throws Exception { + NewNode testSubject; + Map m = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCommands(m); + } + + + @Test + public void testSetProperties() throws Exception { + NewNode testSubject; + Map p = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(p); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/NewServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/model/NewServiceTest.java new file mode 100644 index 000000000..ec688bdf3 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/NewServiceTest.java @@ -0,0 +1,235 @@ +package org.onap.vid.model; + +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.asdc.beans.tosca.Input; + +public class NewServiceTest { + + private NewService createTestSubject() { + return new NewService(); + } + + + @Test + public void testGetUuid() throws Exception { + NewService testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUuid(); + } + + + @Test + public void testGetInvariantUuid() throws Exception { + NewService testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUuid(); + } + + + @Test + public void testGetName() throws Exception { + NewService testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testGetVersion() throws Exception { + NewService testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testGetToscaModelURL() throws Exception { + NewService testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaModelURL(); + } + + + @Test + public void testGetCategory() throws Exception { + NewService testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + + @Test + public void testGetDescription() throws Exception { + NewService testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testGetInputs() throws Exception { + NewService testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInputs(); + } + + + @Test + public void testGetServiceEcompNaming() throws Exception { + NewService testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceEcompNaming(); + } + + + @Test + public void testSetUuid() throws Exception { + NewService testSubject; + String uuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUuid(uuid); + } + + + @Test + public void testSetInvariantUuid() throws Exception { + NewService testSubject; + String invariantUuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUuid(invariantUuid); + } + + + @Test + public void testSetName() throws Exception { + NewService testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testSetVersion() throws Exception { + NewService testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + + @Test + public void testSetToscaModelURL() throws Exception { + NewService testSubject; + String toscaModelURL = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaModelURL(toscaModelURL); + } + + + @Test + public void testSetCategory() throws Exception { + NewService testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + + @Test + public void testSetDescription() throws Exception { + NewService testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testSetInputs() throws Exception { + NewService testSubject; + Map inputs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInputs(inputs); + } + + + @Test + public void testSetServiceEcompNaming() throws Exception { + NewService testSubject; + String serviceEcompNaming = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceEcompNaming(serviceEcompNaming); + } + + + @Test + public void testHashCode() throws Exception { + NewService testSubject; + int result; + + // default test + testSubject = createTestSubject(); + testSubject.setUuid("cb49608f-5a24-4789-b0f7-2595473cb997"); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + NewService testSubject; + Object o = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(o); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/NewVNFTest.java b/vid-app-common/src/test/java/org/onap/vid/model/NewVNFTest.java new file mode 100644 index 000000000..6546e0888 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/NewVNFTest.java @@ -0,0 +1,88 @@ +package org.onap.vid.model; + +import java.util.Map; + +import org.junit.Test; + +public class NewVNFTest { + + private NewVNF createTestSubject() { + return new NewVNF(); + } + + + @Test + public void testGetModelCustomizationName() throws Exception { + NewVNF testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModelCustomizationName(); + } + + + @Test + public void testGetVfModules() throws Exception { + NewVNF testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModules(); + } + + + @Test + public void testSetVfModules() throws Exception { + NewVNF testSubject; + Map vfModules = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModules(vfModules); + } + + + @Test + public void testGetVolumeGroups() throws Exception { + NewVNF testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVolumeGroups(); + } + + + @Test + public void testSetVolumeGroups() throws Exception { + NewVNF testSubject; + Map volumeGroups = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVolumeGroups(volumeGroups); + } + + + @Test + public void testSetModelCustomizationName() throws Exception { + NewVNF testSubject; + String modelCustomizationName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setModelCustomizationName(modelCustomizationName); + } + + + @Test + public void testNormalizeName() throws Exception { + String originalName = ""; + String result; + + // default test + result = NewVNF.normalizeName(originalName); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/ServiceModelTest.java b/vid-app-common/src/test/java/org/onap/vid/model/ServiceModelTest.java new file mode 100644 index 000000000..27aa468c1 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/ServiceModelTest.java @@ -0,0 +1,123 @@ +package org.onap.vid.model; + +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.asdc.beans.tosca.ToscaModel; +import org.onap.vid.model.Service; + +public class ServiceModelTest { + + private ServiceModel createTestSubject() { + return new ServiceModel(); + } + + @Test + public void testGetService() throws Exception { + ServiceModel testSubject; + Service result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getService(); + } + + @Test + public void testGetVnfs() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVnfs(); + } + + @Test + public void testGetNetworks() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNetworks(); + } + + @Test + public void testSetService() throws Exception { + ServiceModel testSubject; + Service service = null; + + // default test + testSubject = createTestSubject(); + testSubject.setService(service); + } + + @Test + public void testSetVnfs() throws Exception { + ServiceModel testSubject; + Map vnfs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVnfs(vnfs); + } + + @Test + public void testSetNetworks() throws Exception { + ServiceModel testSubject; + Map networks = null; + + // default test + testSubject = createTestSubject(); + testSubject.setNetworks(networks); + } + + @Test + public void testGetVfModules() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModules(); + } + + @Test + public void testGetVolumeGroups() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVolumeGroups(); + } + + @Test + public void testSetVfModules() throws Exception { + ServiceModel testSubject; + Map vfModules = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModules(vfModules); + } + + @Test + public void testSetVolumeGroups() throws Exception { + ServiceModel testSubject; + Map volumeGroups = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVolumeGroups(volumeGroups); + } + + @Test + public void testAssociateGroups() throws Exception { + ServiceModel testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.associateGroups(); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/model/TestSuite.java new file mode 100644 index 000000000..f634fbc95 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/TestSuite.java @@ -0,0 +1,12 @@ +package org.onap.vid.model; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ ModelUtilTest.class, NewServiceTest.class, VolumeGroupTest.class, NewNodeTest.class, ServiceModelTest.class, + WorkflowTest.class, NewVNFTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/model/VolumeGroupTest.java b/vid-app-common/src/test/java/org/onap/vid/model/VolumeGroupTest.java new file mode 100644 index 000000000..05e517ec3 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/VolumeGroupTest.java @@ -0,0 +1,169 @@ +package org.onap.vid.model; + +import org.junit.Test; +import org.onap.vid.asdc.beans.tosca.Group; + + +public class VolumeGroupTest { + + private VolumeGroup createTestSubject() { + return new VolumeGroup(); + } + + + @Test + public void testGetUuid() throws Exception { + VolumeGroup testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUuid(); + } + + + @Test + public void testGetCustomizationUuid() throws Exception { + VolumeGroup testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCustomizationUuid(); + } + + + @Test + public void testGetModelCustomizationName() throws Exception { + VolumeGroup testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModelCustomizationName(); + } + + + @Test + public void testGetInvariantUuid() throws Exception { + VolumeGroup testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUuid(); + } + + + @Test + public void testGetDescription() throws Exception { + VolumeGroup testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testGetName() throws Exception { + VolumeGroup testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testGetVersion() throws Exception { + VolumeGroup testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testSetUuid() throws Exception { + VolumeGroup testSubject; + String uuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUuid(uuid); + } + + + @Test + public void testSetInvariantUuid() throws Exception { + VolumeGroup testSubject; + String invariantUuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUuid(invariantUuid); + } + + + @Test + public void testSetDescription() throws Exception { + VolumeGroup testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testSetName() throws Exception { + VolumeGroup testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testSetVersion() throws Exception { + VolumeGroup testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + + @Test + public void testSetCustomizationUuid() throws Exception { + VolumeGroup testSubject; + String u = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCustomizationUuid(u); + } + + + @Test + public void testSetModelCustomizationName() throws Exception { + VolumeGroup testSubject; + String u = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setModelCustomizationName(u); + } + + + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/WorkflowTest.java b/vid-app-common/src/test/java/org/onap/vid/model/WorkflowTest.java new file mode 100644 index 000000000..8cfc65a73 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/WorkflowTest.java @@ -0,0 +1,72 @@ +package org.onap.vid.model; + +import java.util.Collection; + +import org.junit.Test; + +public class WorkflowTest { + + private Workflow createTestSubject() { + return new Workflow(); + } + + @Test + public void testGetId() throws Exception { + Workflow testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getId(); + } + + @Test + public void testGetWorkflowName() throws Exception { + Workflow testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getWorkflowName(); + } + + @Test + public void testGetVnfNames() throws Exception { + Workflow testSubject; + Collection result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVnfNames(); + } + + @Test + public void testSetId() throws Exception { + Workflow testSubject; + int id = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setId(id); + } + + @Test + public void testSetWorkflowName() throws Exception { + Workflow testSubject; + String workflowName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setWorkflowName(workflowName); + } + + @Test + public void testSetVnfName() throws Exception { + Workflow testSubject; + Collection vnfNames = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVnfName(vnfNames); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/oeModel.java b/vid-app-common/src/test/java/org/onap/vid/model/oeModel.java new file mode 100644 index 000000000..9d350cb72 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/oeModel.java @@ -0,0 +1,10 @@ +package org.onap.vid.model; + +import java.util.List; +import java.util.Map; + +public class oeModel { + public Map>> categoryParameters; +} + + diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicTest.java new file mode 100644 index 000000000..4a0685786 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicTest.java @@ -0,0 +1,71 @@ +package org.onap.vid.mso; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.vid.controller.MsoConfig; +import org.onap.vid.mso.MsoBusinessLogicImpl; +import org.onap.vid.mso.MsoInterface; +import org.onap.vid.mso.MsoResponseWrapper; +import org.onap.vid.mso.rest.RequestDetails; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.net.URL; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + +@Test +@ContextConfiguration(classes = { SystemProperties.class, MsoConfig.class }) +@WebAppConfiguration +public class MsoBusinessLogicTest extends AbstractTestNGSpringContextTests { + + @InjectMocks + private MsoBusinessLogicImpl msoBusinessLogic; + + @Mock + private MsoInterface msoClient; + + @BeforeMethod + public void initMocks(){ + MockitoAnnotations.initMocks(this); + } + + @Test + public void testCreateInstance() throws Exception { + String instanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d"; + final RequestDetails requestDetails = setRequestDetails("mso_request_create_configuration.json"); + Mockito.doReturn(getOkResponse(instanceId)).when(msoClient).createConfigurationInstance(requestDetails, "/serviceInstances/v6/3f93c7cb-2fd0-4557-9514-e189b7b04f9d/configurations"); + final MsoResponseWrapper msoResponseWrapper = msoBusinessLogic.createConfigurationInstance(requestDetails, instanceId); + + assertNotNull(msoResponseWrapper); + assertEquals(202, msoResponseWrapper.getStatus()); + } + + private MsoResponseWrapper getOkResponse(String instanceId){ + MsoResponseWrapper responseWrapper = new MsoResponseWrapper(); + String entity = " \"body\": {\n" + + " \"requestReferences\": {\n" + + " \"instanceId\": \""+instanceId+"\",\n" + + " \"requestId\": \"b6dc9806-b094-42f7-9386-a48de8218ce8\"\n" + + " }"; + responseWrapper.setEntity(entity); + responseWrapper.setStatus(202); + return responseWrapper; + } + + private RequestDetails setRequestDetails(String bodyFileName)throws Exception { + final URL resource = this.getClass().getResource("/payload_jsons/" + bodyFileName); + ObjectMapper mapper = new ObjectMapper(); + RequestDetails requestDetails = mapper.readValue(resource, RequestDetails.class); + return requestDetails; + + } +} diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java new file mode 100644 index 000000000..fcf246c99 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java @@ -0,0 +1,215 @@ +package org.onap.vid.mso; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableListMultimap; +import org.apache.commons.io.IOUtils; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.vid.changeManagement.RequestDetailsWrapper; +import org.onap.vid.controller.MsoConfig; +import org.onap.vid.controller.OperationalEnvironmentController; +import org.onap.vid.controller.OperationalEnvironmentController.*; +import org.onap.vid.controller.WebConfig; +import org.onap.vid.mso.MsoBusinessLogic; +import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo; +import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo; +import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails; +import org.onap.vid.mso.rest.RequestDetails; +import org.onap.vid.properties.AsdcClientConfiguration; +import org.skyscreamer.jsonassert.JSONAssert; +import org.skyscreamer.jsonassert.JSONCompareMode; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import javax.inject.Inject; +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Test +@ContextConfiguration(classes = { WebConfig.class, AsdcClientConfiguration.class, SystemProperties.class, MsoConfig.class }) +@WebAppConfiguration +public class MsoOperationalEnvironmentTest extends AbstractTestNGSpringContextTests { + + @Inject + private MsoBusinessLogic msoBusinessLogic; + + @Test(dataProvider = "getOperationalEnvironmentActivationPermutations") + public void testJsonResultOfOperationalEnvironmentActivationRequestDetails(HashMap permutation) throws IOException { + + // Convert 'manifest' to model + final OperationalEnvironmentManifest manifest = new ObjectMapper().readerFor(OperationalEnvironmentManifest.class).readValue(permutation.get("")); + + // build OperationalEnvironmentActivateInfo + OperationalEnvironmentActivateInfo inputUnderTest = createOperationalEnvironmentActivateInfo("", permutation.get(""), manifest, permutation.get(""), permutation.get(""), permutation.get("")); + + // transform to RequestDetails, and serialize to json + // -> actually, the function "msoBusinessLogic.createOperationalEnvironmentActivationRequestDetails" + // is the code under test here + final RequestDetailsWrapper operationalEnvironmentActivationRequestDetails = msoBusinessLogic.createOperationalEnvironmentActivationRequestDetails(inputUnderTest); + + String expected = buildExpectation("payload_jsons/activateOperationalEnvironmentsPayloadToMso.json", permutation); + + assertThatExpectationIsLikeObject(expected, operationalEnvironmentActivationRequestDetails); + } + + @DataProvider + private Object[][] getOperationalEnvironmentActivationPermutations() throws IOException { + final String manifest = "" + + "{" + + " \"serviceModelList\": [" + + " {" + + " \"serviceModelVersionId\": \"uuid2\"," + + " \"recoveryAction\": \"retry\"" + + " }" + + " ]" + + "}"; + + + final ImmutableListMultimap options = ImmutableListMultimap.builder() + .putAll("", "instanceId") + .putAll("", "1", "0198adb8-87fd-46ef-94ae-258816629c8b") + .putAll("", "relatedInstanceId", "2744cf56-4f00-4e48-917b-c3bd3b1f8984") + .putAll("", "relatedInstanceName", "Brooklynn Puanani") + .putAll("", "workloadContext", "VNF_E2E-extreme") + .putAll("", manifest) + .build(); + + List> permutations = permuteOptions(options); + + return permutations.stream().map(m -> new Object[] { m }).collect(Collectors.toList()).toArray(new Object[0][0]); + } + + @Test(dataProvider = "getOperationalEnvironmentCreationPermutations") + public void testJsonResultOfOperationalEnvironmentCreationRequestDetails(HashMap permutation) throws IOException { + + // build OperationalEnvironmentCreateBody + OperationalEnvironmentController.OperationalEnvironmentCreateBody inputUnderTest = createOperationalEnvironmentCreateBody(permutation.get(""), permutation.get(""), permutation.get(""), permutation.get(""), permutation.get(""), permutation.get("")); + + // transform to RequestDetails, and serialize to json + // -> actually, the function "msoBusinessLogic.createOperationalEnvironmentActivationRequestDetails" + // is the code under test here + final RequestDetailsWrapper operationalEnvironmentCreationRequestDetails = msoBusinessLogic.convertParametersToRequestDetails(inputUnderTest, permutation.get("")); + + String expected = buildExpectation("payload_jsons/createOperationalEnvironmentsPayloadToMso.json", permutation); + + assertThatExpectationIsLikeObject(expected, operationalEnvironmentCreationRequestDetails); + } + + @DataProvider + private Object[][] getOperationalEnvironmentCreationPermutations() throws IOException { + + final ImmutableListMultimap options = ImmutableListMultimap.builder() + // instanceName, ecompInstanceId, ecompInstanceName, operationalEnvType, tenantContext, workloadContext + .putAll("", "1", "ceb60bba-7c18-49cd-a8f6-83ff2e1430b0", "Storm Landebert") + .putAll("", "instanceName", "Slavica Hadrien") + .putAll("", "ecompInstanceId", "58ec6753-957f-4124-8f92-c1c0bd2464a4") + .putAll("", "ecompInstanceName", "Bente Keelin") + .putAll("", "operationalEnvType", "VNF") + .putAll("", "tenantContext", "Production") + .putAll("", "workloadContext", "E2E-extreme") + .build(); + + List> permutations = permuteOptions(options); + + return permutations.stream().map(m -> new Object[] { m }).collect(Collectors.toList()).toArray(new Object[0][0]); + } + + @Test(dataProvider = "getOperationalEnvironmentDeactivationPermutations") + public void testJsonResultOfOperationalEnvironmentDeactivationRequestDetails(HashMap permutation) throws IOException { + + OperationalEnvironmentDeactivateInfo inputUnderTest = createOperationalEnvironmentDeactivateInfo("operationalEnvId>", permutation.get("")); + + final RequestDetailsWrapper operationalEnvironmentDeactivationRequestDetails = msoBusinessLogic.createOperationalEnvironmentDeactivationRequestDetails(inputUnderTest); + + String expected = buildExpectation("payload_jsons/deactivateOperationalEnvironmentsPayloadToMso.json", permutation); + + assertThatExpectationIsLikeObject(expected, operationalEnvironmentDeactivationRequestDetails); + } + + @DataProvider + private Object[][] getOperationalEnvironmentDeactivationPermutations() throws IOException { + + final ImmutableListMultimap options = ImmutableListMultimap.builder() + .putAll("", "instanceName", "Slavica Hadrien") + .build(); + + List> permutations = permuteOptions(options); + + return permutations.stream().map(m -> new Object[] { m }).collect(Collectors.toList()).toArray(new Object[0][0]); + } + + private List> permuteOptions(ImmutableListMultimap options) { + // try any value, where the other keys are on the default one (index zero) + // result it's not the whole world of permutations, but rather a skim set, which its + // size is as the number of unique values in "options" + + HashMap baseMutation = new HashMap<>(); + for (String key : options.keySet()) { + baseMutation.put(key, options.get(key).get(0)); + } + + List> res = new LinkedList<>(); + res.add(baseMutation); + + for (String key : options.keySet()) { + final ImmutableList entry = options.get(key); + for (String value : entry.subList(1, entry.size())) { // skip the first option at index zero + HashMap mutation = new HashMap<>(); + mutation.putAll(baseMutation); + mutation.put(key, value); + res.add(mutation); + } + } + return res; + } + + private void assertThatExpectationIsLikeObject(String expected, Object requestDetails) throws JsonProcessingException { + final String requestDetailsAsString = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(requestDetails); + + // assert for exact match + try { + JSONAssert.assertEquals("built mso request is not ok", expected, requestDetailsAsString, JSONCompareMode.STRICT); + } catch (AssertionError | Exception e) { + System.out.println("requestDetailsAsString: \n" + requestDetailsAsString); + System.out.println("expected: \n" + expected); + throw e; + } + } + + private String buildExpectation(String modelFileName, HashMap permutation) throws IOException { + // load expected result, and populate it with current input 'permutation' values + final URL resource = this.getClass().getResource("/" + modelFileName); + String expected = IOUtils.toString(resource, "UTF-8"); + + for (Map.Entry stringStringEntry : permutation.entrySet()) { + expected = expected.replaceAll(stringStringEntry.getKey(), stringStringEntry.getValue()); + } + return expected; + } + + + + private OperationalEnvironmentActivateInfo createOperationalEnvironmentActivateInfo(String operationalEnvId, String userId, OperationalEnvironmentManifest manifest, String relatedInstanceId, String relatedInstanceName, String workloadContext) { + OperationalEnvironmentController.OperationalEnvironmentActivateBody body = new OperationalEnvironmentController.OperationalEnvironmentActivateBody(relatedInstanceId, relatedInstanceName, workloadContext, manifest); + return new OperationalEnvironmentActivateInfo(body, userId, operationalEnvId); + } + + private OperationalEnvironmentDeactivateInfo createOperationalEnvironmentDeactivateInfo(String operationalEnvId, String userId) { + return new OperationalEnvironmentDeactivateInfo(userId, operationalEnvId); + } + + private OperationalEnvironmentController.OperationalEnvironmentCreateBody createOperationalEnvironmentCreateBody(String instanceName, String ecompInstanceId, String ecompInstanceName, String operationalEnvType, String tenantContext, String workloadContext) { + return new OperationalEnvironmentController.OperationalEnvironmentCreateBody(instanceName, ecompInstanceId, ecompInstanceName, operationalEnvType, tenantContext, workloadContext); + } + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java new file mode 100644 index 000000000..3356fddfc --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java @@ -0,0 +1,53 @@ +package org.onap.vid.mso; + +import org.apache.poi.hssf.record.formula.functions.T; +import org.glassfish.jersey.client.ClientResponse; +import org.junit.Assert; +import org.junit.Test; + +public class MsoUtilTest { + + private MsoUtil createTestSubject() { + return new MsoUtil(); + } + + @Test + public void testWrapResponse() throws Exception { + String body = ""; + int statusCode = 0; + MsoResponseWrapper result; + + // default test + result = MsoUtil.wrapResponse(body, statusCode); + } + + + @Test + public void testWrapResponse_2() throws Exception { + RestObject rs = null; + MsoResponseWrapper result; + + // test 1 + result = MsoUtil.wrapResponse(rs); + Assert.assertNotNull(result); + } + + @Test + public void testConvertPojoToString() throws Exception { + T t = null; + String result; + + // test 1 + t = null; + result = MsoUtil.convertPojoToString(t); + Assert.assertEquals("", result); + } + + @Test + public void testMain() throws Exception { + String[] args = new String[] { "" }; + + // default test + MsoUtil.main(args); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java new file mode 100644 index 000000000..a3fa7bca3 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java @@ -0,0 +1,20 @@ +package org.onap.vid.mso; + +import org.junit.Test; + +public class RestMsoImplementationTest { + + private RestMsoImplementation createTestSubject() { + return new RestMsoImplementation(); + } + +// @Test +// public void testInitMsoClient() throws Exception { +// RestMsoImplementation testSubject; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.initMsoClient(); +// } + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/AsyncRequestStatusTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/AsyncRequestStatusTest.java new file mode 100644 index 000000000..ba939580a --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/AsyncRequestStatusTest.java @@ -0,0 +1,91 @@ +package org.onap.vid.mso.rest; + +import org.junit.Test; +import org.onap.vid.domain.mso.InstanceIds; +import org.onap.vid.domain.mso.RequestStatus; + + +public class AsyncRequestStatusTest { + + private AsyncRequestStatus createTestSubject() { + return new AsyncRequestStatus(); + } + + + @Test + public void testGetInstanceIds() throws Exception { + AsyncRequestStatus testSubject; + InstanceIds result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInstanceIds(); + } + + + @Test + public void testSetInstanceIds() throws Exception { + AsyncRequestStatus testSubject; + InstanceIds instanceIds = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInstanceIds(instanceIds); + } + + + @Test + public void testGetRequestStatus() throws Exception { + AsyncRequestStatus testSubject; + RequestStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequestStatus(); + } + + + @Test + public void testSetRequestStatus() throws Exception { + AsyncRequestStatus testSubject; + RequestStatus requestStatus = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequestStatus(requestStatus); + } + + + @Test + public void testToString() throws Exception { + AsyncRequestStatus testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + + @Test + public void testHashCode() throws Exception { + AsyncRequestStatus testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + AsyncRequestStatus testSubject; + Object other = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(other); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java new file mode 100644 index 000000000..ef261055a --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java @@ -0,0 +1,78 @@ +//package org.onap.vid.mso.rest; +// +//import com.fasterxml.jackson.databind.ObjectMapper; +//import org.json.JSONObject; +//import org.junit.Assert; +//import org.openecomp.portalsdk.core.util.SystemProperties; +//import org.onap.vid.changeManagement.RequestDetails; +//import org.onap.vid.controller.LocalWebConfig; +//import org.onap.vid.domain.mso.CloudConfiguration; +//import org.onap.vid.domain.mso.ModelInfo; +//import org.onap.vid.domain.mso.RequestInfo; +//import org.onap.vid.domain.mso.RequestParameters; +//import org.onap.vid.mso.MsoBusinessLogic; +//import org.onap.vid.mso.MsoBusinessLogicImpl; +//import org.onap.vid.mso.rest.MsoRestClientNew; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.web.WebAppConfiguration; +//import org.testng.annotations.Test; +// +// +//@ContextConfiguration(classes = {LocalWebConfig.class, SystemProperties.class}) +//@WebAppConfiguration +//public class MsoRestClientTest { +// +// +// private MsoBusinessLogic msoBusinessLogic = new MsoBusinessLogicImpl(new MsoRestClientNew()); +// private ObjectMapper om = new ObjectMapper(); +// +// @Test +// public void createInPlaceMsoRequest() { +// String result = null; +// try { +// RequestDetails requestDetails = generateMockMsoRequest(); +// result = om.writeValueAsString(msoBusinessLogic.generateInPlaceMsoRequest(requestDetails)); +// +// } catch (Exception e) { +// e.printStackTrace(); +// +// } +// if (result == null) { +// Assert.fail("Failed to create mso request"); +// } +// JSONObject jsonObj = new JSONObject(result); +// Assert.assertNotNull(jsonObj.getJSONObject("requestDetails")); +// +// +// } +// +// private RequestDetails generateMockMsoRequest() { +// RequestDetails requestDetails = new RequestDetails(); +// requestDetails.setVnfInstanceId("vnf-instance-id"); +// requestDetails.setVnfName("vnf-name"); +// CloudConfiguration cloudConfiguration = new CloudConfiguration(); +// cloudConfiguration.setTenantId("tenant-id"); +// cloudConfiguration.setLcpCloudRegionId("lcp-region"); +// requestDetails.setCloudConfiguration(cloudConfiguration); +// ModelInfo modelInfo = new ModelInfo(); +// modelInfo.setModelInvariantId("model-invarient-id"); +// modelInfo.setModelCustomizationName("modelCustomizationName"); +// requestDetails.setModelInfo(modelInfo); +// RequestInfo requestInfo = new RequestInfo(); +// requestInfo.setRequestorId("ok883e"); +// requestInfo.setSource("VID"); +// requestDetails.setRequestInfo(requestInfo); +// RequestParameters requestParameters = new RequestParameters(); +// requestParameters.setSubscriptionServiceType("subscriber-service-type"); +// requestParameters.setAdditionalProperty("a", 1); +// requestParameters.setAdditionalProperty("b", 2); +// requestParameters.setAdditionalProperty("c", 3); +// requestParameters.setAdditionalProperty("d", 4); +// String payload = "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}"; +// requestParameters.setAdditionalProperty("payload", payload); +// +// requestDetails.setRequestParameters(requestParameters); +// return requestDetails; +// } +// +//} diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestId.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestId.java new file mode 100644 index 000000000..51071a859 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestId.java @@ -0,0 +1,280 @@ +package org.onap.vid.mso.rest; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.reflect.FieldUtils; +import org.mockito.*; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.onap.vid.aai.util.AAIRestInterface; +import org.onap.vid.asdc.rest.RestfulAsdcClient; +import org.onap.vid.changeManagement.RequestDetailsWrapper; +import org.onap.vid.controller.filter.PromiseEcompRequestIdFilter; +import org.onap.vid.mso.RestMsoImplementation; +import org.onap.vid.mso.RestObject; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.Serializable; +import java.util.List; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static java.util.UUID.randomUUID; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.*; + + +public class OutgoingRequestId { + + + @InjectMocks + private RestMsoImplementation restMsoImplementation; + + @InjectMocks + private AAIRestInterface aaiRestInterface; + + private RestfulAsdcClient restfulAsdcClient = new RestfulAsdcClient.Builder(mock(Client.class), null).build(); + + @Captor + private ArgumentCaptor> multivaluedMapArgumentCaptor; + + @BeforeClass + public void initMocks() { + MockitoAnnotations.initMocks(this); + } + + @BeforeMethod + private void putRequestInSpringContext() { + RequestContextHolder.setRequestAttributes(new ServletRequestAttributes((HttpServletRequest) PromiseEcompRequestIdFilter.wrapIfNeeded(new MockHttpServletRequest()))); + } + + @DataProvider + public Object[][] sdcMethods() { + return Stream.>of( + + client -> client.getResource(randomUUID()), + client -> client.getResourceArtifact(randomUUID(), randomUUID()), + RestfulAsdcClient::getResources, + client -> client.getResources(ImmutableMap.of()), + client -> client.getResourceToscaModel(randomUUID()), + client -> client.getService(randomUUID()), + client -> client.getServiceArtifact(randomUUID(), randomUUID()), + RestfulAsdcClient::getServices, + client -> client.getServices(ImmutableMap.of()), + client -> client.getServiceToscaModel(randomUUID()) + + ).map(l -> ImmutableList.of(l).toArray()).collect(Collectors.toList()).toArray(new Object[][]{}); + } + + @Test(dataProvider = "sdcMethods") + public void sdc(Consumer f) throws Exception { + final Mocks mocks = setAndGetMocksInsideRestImpl(restfulAsdcClient); + + f.accept(restfulAsdcClient); + + verifyRequestIdHeaderWasAdded(mocks.getFakeBuilder()); + } + + @DataProvider + public Object[][] msoMethods() { + return Stream.>of( + + client -> client.Get(new Object(), "whatever source id", "/any path", new RestObject<>()), + client -> client.GetForObject("whatever source id", "/any path", Object.class), + client -> client.Post(new Object(), "some payload", "whatever source id", "/any path", new RestObject<>()), + client -> client.PostForObject("some payload", "whatever source id", "/any path", Object.class), + client -> client.Put(Object.class, new RequestDetailsWrapper(), "whatever source id", "/any path", new RestObject<>()) + + ).map(l -> ImmutableList.of(l).toArray()).collect(Collectors.toList()).toArray(new Object[][]{}); + } + + @Test(dataProvider = "msoMethods") + public void mso(Consumer f) throws Exception { + final Mocks mocks = setAndGetMocksInsideRestImpl(restMsoImplementation.getClass()); + + f.accept(restMsoImplementation); + + verifyRequestIdHeaderWasAdded(mocks.getFakeBuilder()); + } + + @DataProvider + public Object[][] aaiMethods() { + return Stream.>of( + + client -> client.RestGet("from app id", "some transId", "/any path", false), + client -> client.Delete("whatever source id", "some transId", "/any path"), + client -> client.RestPost("from app id", "some transId", "/any path", "some payload", false), + client -> client.RestPut("from app id", "some transId", "/any path", "some payload", false) + + ).map(l -> ImmutableList.of(l).toArray()).collect(Collectors.toList()).toArray(new Object[][]{}); + } + + @Test(dataProvider = "aaiMethods") + public void aai(Consumer f) throws Exception { + final Mocks mocks = setAndGetMocksInsideRestImpl(aaiRestInterface.getClass()); + + f.accept(aaiRestInterface); + + verifyRequestIdHeaderWasAdded(mocks.getFakeBuilder()); + } + +// @Test(dataProvider = "schedulerMethods") +// public void scheduler(Consumer f) throws Exception { +// +// This test os not feasible in the wat acheduler is implemented today, +// as Scheduler's client is rewritten in every call. +// +// :-( +// +// } + + private void verifyRequestIdHeaderWasAdded(Invocation.Builder fakeBuilder) { + final String requestIdHeader = "x-ecomp-requestid"; + final String uuidRegex = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; + + // Checks that the builder was called with either one of header("x-ecomp-requestid", uuid) + // or the plural brother: headers(Map.of("x-ecomp-requestid", Set.of(uuid)) + + Object requestId; + // The 'verify()' will capture the request id. If no match -- AssertionError will + // catch for a second chance -- another 'verify()'. + try { + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Object.class); + Mockito.verify(fakeBuilder) + .header( + Matchers.argThat(equalToIgnoringCase(requestIdHeader)), + argumentCaptor.capture() + ); + requestId = argumentCaptor.getValue(); + + } catch (AssertionError e) { + Mockito.verify(fakeBuilder).headers(multivaluedMapArgumentCaptor.capture()); + + final MultivaluedMap headersMap = multivaluedMapArgumentCaptor.getValue(); + final String thisRequestIdHeader = getFromSetCaseInsensitive(headersMap.keySet(), requestIdHeader); + + assertThat(headersMap.keySet(), hasItem(thisRequestIdHeader)); + requestId = headersMap.getFirst(thisRequestIdHeader); + } + + assertThat("header '" + requestIdHeader + "' should be a uuid", requestId, + allOf(instanceOf(String.class), hasToString(matchesPattern(uuidRegex)))); + } + + private String getFromSetCaseInsensitive(Set set, String key) { + return set.stream() + .filter(anotherString -> anotherString.equalsIgnoreCase(key)) + .findFirst() + .orElse(key); + } + + private Mocks setAndGetMocksInsideRestImpl(Class clazz) throws IllegalAccessException { + Mocks mocks = new Mocks(); + Client fakeClient = mocks.getFakeClient(); + + FieldUtils.writeStaticField(clazz, "client", fakeClient, true); + + return mocks; + } + + private Mocks setAndGetMocksInsideRestImpl(Object instance) throws IllegalAccessException { + Mocks mocks = new Mocks(); + Client fakeClient = mocks.getFakeClient(); + + FieldUtils.writeField(instance, "client", fakeClient, true); + + return mocks; + } + + private static class Mocks { + private final Client fakeClient; + private final Invocation.Builder fakeBuilder; + + Client getFakeClient() { + return fakeClient; + } + + Invocation.Builder getFakeBuilder() { + return fakeBuilder; + } + + Mocks() { + final MockSettings mockSettings = withSettings().defaultAnswer(new TriesToReturnMockByType()); + + fakeClient = mock(Client.class, mockSettings); + fakeBuilder = mock(Invocation.Builder.class, mockSettings); + final WebTarget fakeWebTarget = mock(WebTarget.class, mockSettings); + final Response fakeResponse = mock(Response.class, mockSettings); + + TriesToReturnMockByType.setAvailableMocks( + fakeClient, + fakeWebTarget, + fakeBuilder, + fakeResponse + ); + + Mockito.when(fakeBuilder.get(any(Class.class))).thenReturn(null); + Mockito.when(fakeBuilder.get(eq(InputStream.class))).thenReturn(new ByteArrayInputStream(new byte[]{})); + Mockito.when(fakeBuilder.get(any(GenericType.class))).thenReturn(null); + + Mockito.when(fakeResponse.getStatus()).thenReturn(200); + } + } + + @FunctionalInterface + public interface ThrowingConsumer extends Consumer { + @Override + default void accept(T t) { + try { + acceptThrows(t); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + void acceptThrows(T t) throws Exception; + } + + /* + inspired out from newer Mockito version + returns a mock from given list if it's a matching return-type + */ + public static class TriesToReturnMockByType implements Answer, Serializable { + private final Answer defaultReturn = RETURNS_DEFAULTS; + private static List availableMocks = ImmutableList.of(); + + static void setAvailableMocks(Object... mocks) { + availableMocks = ImmutableList.copyOf(mocks); + } + + public Object answer(InvocationOnMock invocation) throws Throwable { + Class methodReturnType = invocation.getMethod().getReturnType(); + + return availableMocks.stream() + .filter(mock -> methodReturnType.isAssignableFrom(mock.getClass())) + //.peek(m -> System.out.println("found a mock: " + m.getClass().getName())) + .findFirst() + .orElse(defaultReturn.answer(invocation)); + } + } + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/RelatedInstanceTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RelatedInstanceTest.java new file mode 100644 index 000000000..4b35430e0 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RelatedInstanceTest.java @@ -0,0 +1,93 @@ +package org.onap.vid.mso.rest; + +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.domain.mso.ModelInfo; + + +public class RelatedInstanceTest { + + private RelatedInstance createTestSubject() { + return new RelatedInstance(); + } + + + @Test + public void testGetModelInfo() throws Exception { + RelatedInstance testSubject; + ModelInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModelInfo(); + } + + + @Test + public void testSetModelInfo() throws Exception { + RelatedInstance testSubject; + ModelInfo modelInfo = null; + + // default test + testSubject = createTestSubject(); + testSubject.setModelInfo(modelInfo); + } + + + @Test + public void testToString() throws Exception { + RelatedInstance testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + + @Test + public void testGetAdditionalProperties() throws Exception { + RelatedInstance testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAdditionalProperties(); + } + + + @Test + public void testSetAdditionalProperty() throws Exception { + RelatedInstance testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAdditionalProperty(name, value); + } + + + @Test + public void testHashCode() throws Exception { + RelatedInstance testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + RelatedInstance testSubject; + Object other = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(other); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/RelatedModelTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RelatedModelTest.java new file mode 100644 index 000000000..91d61bd9f --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RelatedModelTest.java @@ -0,0 +1,93 @@ +package org.onap.vid.mso.rest; + +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.domain.mso.ModelInfo; + + +public class RelatedModelTest { + + private RelatedModel createTestSubject() { + return new RelatedModel(); + } + + + @Test + public void testGetModelInfo() throws Exception { + RelatedModel testSubject; + ModelInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModelInfo(); + } + + + @Test + public void testSetModelInfo() throws Exception { + RelatedModel testSubject; + ModelInfo modelInfo = null; + + // default test + testSubject = createTestSubject(); + testSubject.setModelInfo(modelInfo); + } + + + @Test + public void testToString() throws Exception { + RelatedModel testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + + @Test + public void testGetAdditionalProperties() throws Exception { + RelatedModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAdditionalProperties(); + } + + + @Test + public void testSetAdditionalProperty() throws Exception { + RelatedModel testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAdditionalProperty(name, value); + } + + + @Test + public void testHashCode() throws Exception { + RelatedModel testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + RelatedModel testSubject; + Object other = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(other); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java new file mode 100644 index 000000000..153e16561 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java @@ -0,0 +1,182 @@ +package org.onap.vid.mso.rest; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.onap.vid.domain.mso.*; + + +public class RequestDetailsTest { + + private RequestDetails createTestSubject() { + return new RequestDetails(); + } + + + @Test + public void testGetCloudConfiguration() throws Exception { + RequestDetails testSubject; + CloudConfiguration result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCloudConfiguration(); + } + + + @Test + public void testSetCloudConfiguration() throws Exception { + RequestDetails testSubject; + CloudConfiguration cloudConfiguration = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCloudConfiguration(cloudConfiguration); + } + + + @Test + public void testGetModelInfo() throws Exception { + RequestDetails testSubject; + ModelInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModelInfo(); + } + + + @Test + public void testSetModelInfo() throws Exception { + RequestDetails testSubject; + ModelInfo modelInfo = null; + + // default test + testSubject = createTestSubject(); + testSubject.setModelInfo(modelInfo); + } + + + @Test + public void testGetRelatedInstanceList() throws Exception { + RequestDetails testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelatedInstanceList(); + } + + + @Test + public void testSetRelatedInstanceList() throws Exception { + RequestDetails testSubject; + List relatedInstanceList = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelatedInstanceList(relatedInstanceList); + } + + + @Test + public void testGetRequestInfo() throws Exception { + RequestDetails testSubject; + RequestInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequestInfo(); + } + + + @Test + public void testSetRequestInfo() throws Exception { + RequestDetails testSubject; + RequestInfo requestInfo = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequestInfo(requestInfo); + } + + + @Test + public void testGetSubscriberInfo() throws Exception { + RequestDetails testSubject; + SubscriberInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubscriberInfo(); + } + + + @Test + public void testSetSubscriberInfo() throws Exception { + RequestDetails testSubject; + SubscriberInfo subscriberInfo = null; + + // default test + testSubject = createTestSubject(); + testSubject.setSubscriberInfo(subscriberInfo); + } + + + @Test + public void testToString() throws Exception { + RequestDetails testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + + @Test + public void testGetAdditionalProperties() throws Exception { + RequestDetails testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAdditionalProperties(); + } + + + @Test + public void testSetAdditionalProperty() throws Exception { + RequestDetails testSubject; + String name = ""; + Object value = null; + + // default test + testSubject = createTestSubject(); + testSubject.setAdditionalProperty(name, value); + } + + + @Test + public void testHashCode() throws Exception { + RequestDetails testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + RequestDetails testSubject; + Object other = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(other); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/TestSuite.java new file mode 100644 index 000000000..72633daef --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/TestSuite.java @@ -0,0 +1,12 @@ +package org.onap.vid.mso.rest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ RelatedModelTest.class, AsyncRequestStatusTest.class, RequestDetailsTest.class, + RelatedInstanceTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/policy/PolicyResponseWrapperTest.java b/vid-app-common/src/test/java/org/onap/vid/policy/PolicyResponseWrapperTest.java new file mode 100644 index 000000000..4e2676c6a --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/policy/PolicyResponseWrapperTest.java @@ -0,0 +1,70 @@ +package org.onap.vid.policy; + +import org.junit.Test; + +public class PolicyResponseWrapperTest { + + private PolicyResponseWrapper createTestSubject() { + return new PolicyResponseWrapper(); + } + + @Test + public void testGetEntity() throws Exception { + PolicyResponseWrapper testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEntity(); + } + + @Test + public void testGetStatus() throws Exception { + PolicyResponseWrapper testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatus(); + } + + @Test + public void testSetStatus() throws Exception { + PolicyResponseWrapper testSubject; + int v = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setStatus(v); + } + + @Test + public void testSetEntity() throws Exception { + PolicyResponseWrapper testSubject; + String v = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEntity(v); + } + + @Test + public void testToString() throws Exception { + PolicyResponseWrapper testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + @Test + public void testGetResponse() throws Exception { + PolicyResponseWrapper testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResponse(); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/policy/PolicyRestIntTest.java b/vid-app-common/src/test/java/org/onap/vid/policy/PolicyRestIntTest.java new file mode 100644 index 000000000..b94d21b91 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/policy/PolicyRestIntTest.java @@ -0,0 +1,22 @@ +package org.onap.vid.policy; + +import org.junit.Test; +import org.onap.vid.policy.rest.RequestDetails; + +public class PolicyRestIntTest { + + private PolicyRestInt createTestSubject() { + return new PolicyRestInt(); + } + + @Test + public void testLogRequest() throws Exception { + PolicyRestInt testSubject; + RequestDetails r = null; + + // test 1 + testSubject = createTestSubject(); + r = null; + testSubject.logRequest(r); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/policy/PolicyRestInterfaceTest.java b/vid-app-common/src/test/java/org/onap/vid/policy/PolicyRestInterfaceTest.java new file mode 100644 index 000000000..04f6890e2 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/policy/PolicyRestInterfaceTest.java @@ -0,0 +1,24 @@ +package org.onap.vid.policy; + +import org.apache.poi.hssf.record.formula.functions.T; +import org.json.simple.JSONObject; +import org.junit.Test; +import org.onap.vid.policy.rest.RequestDetails; + +public class PolicyRestInterfaceTest { + + private PolicyRestInterface createTestSubject() { + return new PolicyRestInterface(); + } + + + @Test + public void testLogRequest() throws Exception { + PolicyRestInterface testSubject; + RequestDetails r = null; + + // default test + testSubject = createTestSubject(); + testSubject.logRequest(r); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/policy/PolicyUtilTest.java b/vid-app-common/src/test/java/org/onap/vid/policy/PolicyUtilTest.java new file mode 100644 index 000000000..566d17c11 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/policy/PolicyUtilTest.java @@ -0,0 +1,54 @@ +package org.onap.vid.policy; + +import org.apache.poi.hssf.record.formula.functions.T; +import org.glassfish.jersey.client.ClientResponse; +import org.junit.Assert; +import org.junit.Test; + +public class PolicyUtilTest { + + private PolicyUtil createTestSubject() { + return new PolicyUtil(); + } + + @Test + public void testWrapResponse() throws Exception { + String body = ""; + int statusCode = 0; + PolicyResponseWrapper result; + + // default test + result = PolicyUtil.wrapResponse(body, statusCode); + } + + + @Test + public void testWrapResponse_2() throws Exception { + RestObject rs = null; + PolicyResponseWrapper result; + + // test 1 + rs = null; + result = PolicyUtil.wrapResponse(rs); + Assert.assertNotNull(result); + } + + @Test + public void testConvertPojoToString() throws Exception { + T t = null; + String result; + + // test 1 + t = null; + result = PolicyUtil.convertPojoToString(t); + Assert.assertEquals("", result); + } + + @Test + public void testMain() throws Exception { + String[] args = new String[] { "" }; + + // default test + PolicyUtil.main(args); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/policy/RestObjectTest.java b/vid-app-common/src/test/java/org/onap/vid/policy/RestObjectTest.java new file mode 100644 index 000000000..7665d99a2 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/policy/RestObjectTest.java @@ -0,0 +1,50 @@ +package org.onap.vid.policy; + +import org.apache.poi.hssf.record.formula.functions.T; +import org.junit.Test; + +public class RestObjectTest { + + private RestObject createTestSubject() { + return new RestObject(); + } + + @Test + public void testSet() throws Exception { + RestObject testSubject; + T t = null; + + // default test + testSubject = createTestSubject(); + testSubject.set(t); + } + + @Test + public void testGet() throws Exception { + RestObject testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.get(); + } + + @Test + public void testSetStatusCode() throws Exception { + RestObject testSubject; + int v = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setStatusCode(v); + } + + @Test + public void testGetStatusCode() throws Exception { + RestObject testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatusCode(); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/policy/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/policy/TestSuite.java new file mode 100644 index 000000000..6d2a790be --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/policy/TestSuite.java @@ -0,0 +1,12 @@ +package org.onap.vid.policy; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ RestObjectTest.class, PolicyResponseWrapperTest.class, PolicyRestIntTest.class, PolicyUtilTest.class, + PolicyRestInterfaceTest.class, org.onap.vid.policy.rest.TestSuite.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/policy/rest/RequestDetailsTest.java b/vid-app-common/src/test/java/org/onap/vid/policy/rest/RequestDetailsTest.java new file mode 100644 index 000000000..3c17a66a0 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/policy/rest/RequestDetailsTest.java @@ -0,0 +1,33 @@ +package org.onap.vid.policy.rest; + +import org.junit.Test; + + +public class RequestDetailsTest { + + private RequestDetails createTestSubject() { + return new RequestDetails(); + } + + + @Test + public void testGetPolicyName() throws Exception { + RequestDetails testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getPolicyName(); + } + + + @Test + public void testSetPolicyName() throws Exception { + RequestDetails testSubject; + String policyName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setPolicyName(policyName); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/policy/rest/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/policy/rest/TestSuite.java new file mode 100644 index 000000000..0a8dfff91 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/policy/rest/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.policy.rest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ RequestDetailsTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/properties/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/properties/TestSuite.java new file mode 100644 index 000000000..747c1edbd --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/properties/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.properties; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ VidPropertiesTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/properties/VidPropertiesTest.java b/vid-app-common/src/test/java/org/onap/vid/properties/VidPropertiesTest.java new file mode 100644 index 000000000..f256ba027 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/properties/VidPropertiesTest.java @@ -0,0 +1,31 @@ +package org.onap.vid.properties; + +import org.junit.Test; + + +public class VidPropertiesTest { + + private VidProperties createTestSubject() { + return new VidProperties(); + } + + + @Test + public void testGetAsdcModelNamespace() throws Exception { + String result; + + // default test + result = VidProperties.getAsdcModelNamespace(); + } + + + @Test + public void testGetPropertyWithDefault() throws Exception { + String propName = ""; + String defaultValue = ""; + String result; + + // default test + result = VidProperties.getPropertyWithDefault(propName, defaultValue); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java new file mode 100644 index 000000000..b023bc265 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java @@ -0,0 +1,50 @@ +package org.onap.vid.roles; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.junit.Test; + + +public class RoleProviderTest { + + private RoleProvider createTestSubject() { + return new RoleProvider(); + } + + + @Test + public void testExtractRoleFromSession() throws Exception { + HttpServletRequest request = null; + List result; + + // default test + result = RoleProvider.extractRoleFromSession(request); + } + + +// @Test +// public void testGetUserRoles() throws Exception { +// RoleProvider testSubject; +// HttpServletRequest request = null; +// List result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getUserRoles(request); +// } + + + @Test + public void testSplitRole() throws Exception { + RoleProvider testSubject; + String roleAsString = ""; + String[] result; + + // default test + testSubject = createTestSubject(); + //TODO:fix result = testSubject.splitRole(roleAsString); + } + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorTest.java new file mode 100644 index 000000000..7a1b09ac5 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorTest.java @@ -0,0 +1,58 @@ +package org.onap.vid.roles; + +import org.junit.Test; +import org.onap.vid.mso.rest.RequestDetails; + +public class RoleValidatorTest { + + private RoleValidator createTestSubject() { + return new RoleValidator(null); + } + +// @Test +// public void testIsSubscriberPermitted() throws Exception { +// RoleValidator testSubject; +// String subscriberName = ""; +// boolean result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.isSubscriberPermitted(subscriberName); +// } +// +// @Test +// public void testIsServicePermitted() throws Exception { +// RoleValidator testSubject; +// String subscriberName = ""; +// String serviceType = ""; +// boolean result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.isServicePermitted(subscriberName, serviceType); +// } + + @Test + public void testIsMsoRequestValid() throws Exception { + RoleValidator testSubject; + RequestDetails mso_request = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isMsoRequestValid(mso_request); + } + +// @Test +// public void testIsTenantPermitted() throws Exception { +// RoleValidator testSubject; +// String globalCustomerId = ""; +// String serviceType = ""; +// String tenant = ""; +// boolean result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.isTenantPermitted(globalCustomerId, serviceType, tenant); +// } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/roles/TestSuite.java new file mode 100644 index 000000000..7966eaa1f --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/roles/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.roles; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ RoleValidatorTest.class, RoleProviderTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/GetTimeSlotsRestObjectTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/GetTimeSlotsRestObjectTest.java new file mode 100644 index 000000000..5bb525ebf --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/GetTimeSlotsRestObjectTest.java @@ -0,0 +1,33 @@ +//package org.onap.vid.scheduler.RestObjects; +// +//import org.junit.Test; +// +// +//public class GetTimeSlotsRestObjectTest { +// +// private GetTimeSlotsRestObject createTestSubject() { +// return new GetTimeSlotsRestObject(); +// } +// +// +// @Test +// public void testSetUUID() throws Exception { +// GetTimeSlotsRestObject testSubject; +// String uuid = ""; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.setUUID(uuid); +// } +// +// +// @Test +// public void testGetUUID() throws Exception { +// GetTimeSlotsRestObject testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getUUID(); +// } +//} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/PostCreateNewVnfRestObjectTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/PostCreateNewVnfRestObjectTest.java new file mode 100644 index 000000000..8750d5847 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/PostCreateNewVnfRestObjectTest.java @@ -0,0 +1,33 @@ +//package org.onap.vid.scheduler.RestObjects; +// +//import org.junit.Test; +// +// +//public class PostCreateNewVnfRestObjectTest { +// +// private PostCreateNewVnfRestObject createTestSubject() { +// return new PostCreateNewVnfRestObject(); +// } +// +// +// @Test +// public void testSetUUID() throws Exception { +// PostCreateNewVnfRestObject testSubject; +// String uuid = ""; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.setUUID(uuid); +// } +// +// +// @Test +// public void testGetUUID() throws Exception { +// PostCreateNewVnfRestObject testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getUUID(); +// } +//} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObjectTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObjectTest.java new file mode 100644 index 000000000..9c78d2365 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObjectTest.java @@ -0,0 +1,33 @@ +//package org.onap.vid.scheduler.RestObjects; +// +//import org.junit.Test; +// +// +//public class PostSubmitVnfChangeRestObjectTest { +// +// private PostSubmitVnfChangeRestObject createTestSubject() { +// return new PostSubmitVnfChangeRestObject(); +// } +// +// +// @Test +// public void testSetUUID() throws Exception { +// PostSubmitVnfChangeRestObject testSubject; +// String uuid = ""; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.setUUID(uuid); +// } +// +// +// @Test +// public void testGetUUID() throws Exception { +// PostSubmitVnfChangeRestObject testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getUUID(); +// } +//} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/RestObjectTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/RestObjectTest.java new file mode 100644 index 000000000..b8924d84b --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/RestObjects/RestObjectTest.java @@ -0,0 +1,55 @@ +package org.onap.vid.scheduler.RestObjects; + +import org.apache.poi.hssf.record.formula.functions.T; +import org.junit.Test; + + +public class RestObjectTest { + + private RestObject createTestSubject() { + return new RestObject(); + } + + + @Test + public void testSet() throws Exception { + RestObject testSubject; + T t = null; + + // default test + testSubject = createTestSubject(); + testSubject.set(t); + } + + + @Test + public void testGet() throws Exception { + RestObject testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.get(); + } + + + @Test + public void testSetStatusCode() throws Exception { + RestObject testSubject; + int v = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setStatusCode(v); + } + + + @Test + public void testGetStatusCode() throws Exception { + RestObject testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatusCode(); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapperTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapperTest.java new file mode 100644 index 000000000..b0b051aff --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapperTest.java @@ -0,0 +1,55 @@ +//package org.onap.vid.scheduler.SchedulerResponseWrappers; +// +//import org.junit.Test; +// +// +//public class PostCreateNewVnfWrapperTest { +// +// private PostCreateNewVnfWrapper createTestSubject() { +// return new PostCreateNewVnfWrapper(); +// } +// +// +// @Test +// public void testGetUuid() throws Exception { +// PostCreateNewVnfWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getUuid(); +// } +// +// +// @Test +// public void testSetUuid() throws Exception { +// PostCreateNewVnfWrapper testSubject; +// String v = ""; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.setUuid(v); +// } +// +// +// @Test +// public void testToString() throws Exception { +// PostCreateNewVnfWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.toString(); +// } +// +// +// @Test +// public void testGetResponse() throws Exception { +// PostCreateNewVnfWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getResponse(); +// } +//} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapperTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapperTest.java new file mode 100644 index 000000000..871d8997e --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapperTest.java @@ -0,0 +1,55 @@ +//package org.onap.vid.scheduler.SchedulerResponseWrappers; +// +//import org.junit.Test; +// +// +//public class PostSubmitVnfChangeTimeSlotsWrapperTest { +// +// private PostSubmitVnfChangeTimeSlotsWrapper createTestSubject() { +// return new PostSubmitVnfChangeTimeSlotsWrapper(); +// } +// +// +// @Test +// public void testGetUuid() throws Exception { +// PostSubmitVnfChangeTimeSlotsWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getUuid(); +// } +// +// +// @Test +// public void testSetUuid() throws Exception { +// PostSubmitVnfChangeTimeSlotsWrapper testSubject; +// String v = ""; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.setUuid(v); +// } +// +// +// @Test +// public void testToString() throws Exception { +// PostSubmitVnfChangeTimeSlotsWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.toString(); +// } +// +// +// @Test +// public void testGetResponse() throws Exception { +// PostSubmitVnfChangeTimeSlotsWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getResponse(); +// } +//} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapperTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapperTest.java new file mode 100644 index 000000000..495fb8abe --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapperTest.java @@ -0,0 +1,77 @@ +//package org.onap.vid.scheduler.SchedulerResponseWrappers; +// +//import org.junit.Test; +// +// +//public class SchedulerResponseWrapperTest { +// +// private SchedulerResponseWrapper createTestSubject() { +// return new SchedulerResponseWrapper(); +// } +// +// +// @Test +// public void testGetEntity() throws Exception { +// SchedulerResponseWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getEntity(); +// } +// +// +// @Test +// public void testGetStatus() throws Exception { +// SchedulerResponseWrapper testSubject; +// int result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getStatus(); +// } +// +// +// @Test +// public void testSetStatus() throws Exception { +// SchedulerResponseWrapper testSubject; +// int v = 0; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.setStatus(v); +// } +// +// +// @Test +// public void testSetEntity() throws Exception { +// SchedulerResponseWrapper testSubject; +// String v = ""; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.setEntity(v); +// } +// +// +// @Test +// public void testToString() throws Exception { +// SchedulerResponseWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.toString(); +// } +// +// +// @Test +// public void testGetResponse() throws Exception { +// SchedulerResponseWrapper testSubject; +// String result; +// +// // default test +// testSubject = createTestSubject(); +// result = testSubject.getResponse(); +// } +//} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerRestInterfaceTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerRestInterfaceTest.java new file mode 100644 index 000000000..5f861dfe4 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerRestInterfaceTest.java @@ -0,0 +1,26 @@ +package org.onap.vid.scheduler; + +import org.apache.poi.hssf.record.formula.functions.T; +import org.json.simple.JSONObject; +import org.junit.Test; + +public class SchedulerRestInterfaceTest { + + private SchedulerRestInterface createTestSubject() { + return new SchedulerRestInterface(); + } + + + + @Test + public void testLogRequest() throws Exception { + SchedulerRestInterface testSubject; + JSONObject requestDetails = null; + + // default test + testSubject = createTestSubject(); + testSubject.logRequest(requestDetails); + } + + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/rest/RequestDetailsTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/rest/RequestDetailsTest.java new file mode 100644 index 000000000..aa634f93c --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/rest/RequestDetailsTest.java @@ -0,0 +1,34 @@ +package org.onap.vid.scheduler.rest; + +import org.junit.Test; +import org.onap.vid.mso.rest.RequestDetails; + + +public class RequestDetailsTest { + + private RequestDetails createTestSubject() { + return new RequestDetails(); + } + + + /*@Test + public void testGetDomain() throws Exception { + RequestDetails testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDomain(); + } + + + @Test + public void testSetDomain() throws Exception { + RequestDetails testSubject; + String domain = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDomain(domain); + }*/ +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/rest/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/rest/TestSuite.java new file mode 100644 index 000000000..2bdeeb307 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/rest/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.scheduler.rest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ RequestDetailsTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/selenium/FirstClass.java b/vid-app-common/src/test/java/org/onap/vid/selenium/FirstClass.java new file mode 100644 index 000000000..e3ccdd965 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/selenium/FirstClass.java @@ -0,0 +1,605 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.selenium; + +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.AfterSuite; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.TimeUnit; +import org.apache.log4j.Logger; +import org.testng.Assert; +import org.testng.asserts.*; + +/** + * The Class FirstClass. + */ +public class FirstClass { + + /** The login button. */ + WebElement loginButton; + + /** The eg. */ + String eg; + + /** The login. */ + WebElement login; + + /** The pwd. */ + WebElement pwd; + + /** The log. */ + Logger log; + + /** The errormessage. */ + WebElement errormessage; + + + /** The driver. */ + WebDriver driver=new FirefoxDriver(); + + + + /** The config prop. */ + private final Properties configProp = new Properties(); + + + /** + * Instantiates a new first class. + */ + private FirstClass() { + // TODO Auto-generated constructor stub + // + try{ + // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties"); + //FileInputStream input1 = new FileInputStream("objectmap.properties"); + + InputStream input =new FileInputStream("objectconfig.properties"); + System.out.println("Read all properties from file"); + configProp.load(input); + System.out.println("Read all properties from file completed"); + } + catch(IOException e) { + + e.printStackTrace(); + } + } + + + /* + + + @BeforeClass + public void setUp() { + System.out.println("*******************"); + System.out.println("launching IE browser"); + System.setProperty("webdriver.ie.driver", driverPath+"IEDriverServer.exe"); + driver = new InternetExplorerDriver(); + driver.findElement(By.className()); + driver.manage().window().maximize(); + + + login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']")); + pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']")); + loginButton = driver.findElement(By.id("loginBtn")); + } + + + */ + /** + * Sets the up. + */ + // TODO Auto-generated method stub + @BeforeClass + public void setUp() + { + + + //WebDriver driver=new FirefoxDriver(); + + log = Logger.getLogger(FirstClass.class.getName()); + + + + // Get url + driver.get(configProp.getProperty("baseURL")); + driver.manage().window().maximize(); + + + login = driver.findElement(By.xpath(configProp.getProperty("login"))); + + pwd = driver.findElement(By.xpath(configProp.getProperty("pwd"))); + loginButton = driver.findElement(By.id(configProp.getProperty("loginButton"))); + } + + + /** + * Empty username password. + */ + @Test(priority=1) + public void emptyUsernamePassword() + { + + + //User Name and Password field is empty + log.info("-----VID-11 TC-8----Username and password empty"); + loginButton.click(); + errormessage=driver.findElement(By.xpath("//*[@id='errorInfo']/span")); + String errmsg= errormessage.getText(); + //System.out.println("Error message is"+errmsg); + //String expected = "Invaild username or password, Please try again"; + + //Assert.assertEquals(errmsg,expected); + + Boolean str = driver.getPageSource().contains("Invalid username or password, Please try again"); + System.out.println(driver.getPageSource().contains("Invalid username or password, Please try again")); + + if(str==true) + { + log.info("Error message validated"); + log.info("VID-11 TC-8 PASSED"); + + }else + log.error("Failed validation"); + + } + + + + /** + * Invalid user name. + */ + @Test(priority=2) + public void invalidUserName() + { + + log.info("-----VID-11 TC-6----Invalid Username and Valid Password"); + + + login.sendKeys("xxx"); + pwd.sendKeys("abc123"); + loginButton.click(); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + String errmsg= errormessage.getText(); + String expected = "Invalid username or password, Please try again"; + Assert.assertEquals(errmsg,expected); + //Boolean str1 = driver.getPageSource().contains("Invalid username or password, Please try again"); + //System.out.print(str1); + + log.info("VID-11 TC-6 PASSED"); + + } + + + /** + * Invalid password. + */ + @Test(priority=3) + public void invalidPassword() + { + log.info("-----VID-11 TC-7----Valid Username and Invalid Password"); + // Valid user name and Invalid password. + login.clear(); + pwd.clear(); + login.sendKeys("testuser"); + pwd.sendKeys("xxx"); + loginButton.click(); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + + String errmsg= errormessage.getText(); + String expected = "Invalid username or password, Please try again"; + Assert.assertEquals(errmsg,expected); + + //Boolean str2 = driver.getPageSource().contains("Invaild username or password, Please try again"); + //System.out.print(str2); + + log.info("VID-11 TC-7 PASSED"); + } + + + /** + * Login successful. + */ + @Test(priority=4) + public void loginSuccessful() + { + log.info("-----VID-11 TC-1----Valid Username and Valid Password"); + //Login with valid user name and password. + login.clear(); + login.sendKeys("su"); + pwd.clear(); + pwd.sendKeys("fusion"); + + + loginButton.click(); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + try { + Thread.sleep(6000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); + log.info("VID-11 TC-1 PASSED"); + + } + + + /** + * Verify home page elements left pane. + */ + @Test(priority=5) + public void verifyHomePageElementsLeftPane() + + { + + + log.info("VID-10 TC 1 "); + //VID Home + log.info("VID 11 TC-2"); + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[1]/a/span")).isDisplayed(); + //Create New Service Instance + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[2]/a/span")).isDisplayed(); + + //Browse Service Type + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[3]/a/span")).isDisplayed(); + //View Log + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[4]/a/span")).isDisplayed(); + + //Profile + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[5]/a/span")).isDisplayed(); + //Admin + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).isDisplayed(); + //Logout + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a/span")).isDisplayed(); + + //Infrastructure Subscriber Name + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[1]/div/label")).isDisplayed(); + //Infrastructure Subscriber Name Select Drop down + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")).isDisplayed(); + //Infrastructure Service Type + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[1]/div/label")).isDisplayed(); + //Infrastructure Service Type Select Drop down + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")).isDisplayed(); + //Submit button + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).isDisplayed(); + + //Login Snippet Icon + driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).isDisplayed(); + + + //String bodyText = driver.findElement(By.tagName("body")).getText(); + //Assert.assertTrue("Text not found!", bodyText.contains("Search Existing Service Instances")); + //Assert.IsTrue(driver.getPageSource.Contains("Search Existing Service Instances")); + + log.info("VID-12 TC-1"); + Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); + Assert.assertTrue(driver.getPageSource().contains("Please search by the Subscriber name or Service Type from below:")); + log.info("VID-12 TC-1 PASSED"); + log.info("VID-10 TC 1 PASSED"); + log.info("VID-11 TC-2 PASSED"); + } + + + /** + * Disabled submit button. + */ + @Test(priority=6) + public void disabledSubmitButton() + { + log.info("VID-12 TC-13"); + //Assert submit button disabled. + Assert.assertFalse(driver.findElement(By.xpath(configProp.getProperty("submitButton"))).isEnabled()); + log.info("VID-12 TC-13 PASSED"); + + } + + /** + * Default list box value. + */ + @Test(priority=7) + public void defaultListBoxValue() + { + log.info("VID-12 TC-2"); + + + //WebElement subscribername =driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")); + + Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))); + Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown")))); + + + WebElement ielement=iSelect.getFirstSelectedOption(); + WebElement oelement=oSelect.getFirstSelectedOption(); + String defaultsubscribername=oelement.getText(); + String defaultservicetype=ielement.getText(); + + Assert.assertEquals(defaultsubscribername,"Select Subscriber Name"); + Assert.assertEquals(defaultservicetype,"Select Service Type"); + + + + + //Verify Select Subscriber Name isDisplayed. + //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select/option[1]")).isSelected(); + + //Verify Select Service Type isDisplayed. + //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select/option[1]")).isSelected(); + + + log.info("VID-12 TC-2 PASSED"); + + } + + + + /** + * Select subscriber name drop down. + * + * @throws InterruptedException the interrupted exception + */ + @Test(priority=8) + public void selectSubscriberNameDropDown() throws InterruptedException + { + log.info("------------------VID-10 TC-2,VID-12 TC-11, VID-12 TC-9, VID 12 TC-10,VID-12 TC-6, VID 12 TC-5--------------------"); + + + driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown"))); + + driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown"))); + Thread.sleep(5000); + + //Infrastructure Subscriber Name + Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))); + + List elementCount = oSelect.getOptions(); + log.info("Select Element Count of Service Name"); + System.out.println(elementCount.size()); + + + //Verifying getInfrastructureSubscribersList + log.info("VID-29 TC-1"); + Assert.assertTrue(elementCount.size()>0); + log.info("VID-29 TC-1 PASSED"); + + oSelect.selectByIndex(2); + String selectedOption = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))).getFirstSelectedOption().getText(); + + System.out.println("Service Name selected is " +selectedOption); + log.info("VID-10 TC-2 PASSED"); + + //Submit button is clicked + driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click(); + + + //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); + //Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:")) + + + //Verify whether the page header is displayed "Global Customer ID" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed(); + Assert.assertTrue(driver.getPageSource().contains("Global Customer ID")); + Assert.assertTrue(driver.getPageSource().contains("Subscriber Name")); + Assert.assertTrue(driver.getPageSource().contains("Service Type")); + Assert.assertTrue(driver.getPageSource().contains("Service Instance ID")); + + log.info("VID-12 TC-5 PASSED"); + log.info("VID-12 TC-11 PASSED"); + + WebElement serviceinstancetable =driver.findElement(By.xpath("//table[@class='tablesorter tablesorter-default ng-isolate-scope']")); + + List rows_table = serviceinstancetable.findElements(By.tagName("tr")); + //To calculate no of rows In table. + int rows_count = rows_table.size(); + + //Loop will execute till the last row of table. + for (int row=0; row Columns_row = rows_table.get(row).findElements(By.tagName("td")); + //To calculate no of columns(cells) In that specific row. + int columns_count = Columns_row.size(); + //System.out.println("Number of cells In Row "+row+" are "+columns_count); + + //Loop will execute till the last cell of that specific row. + for (int column=0; column exx= rows_table.get(1).findElements(By.tagName("td")); + eg=Columns_row.get(2).getText(); + // System.out.println("Cell value of row 1 and column 2 is" +eg); + } + } + + + + + //Verify View/Edit isDisplayed and Click + + driver.findElement(By.xpath("//a[@alt='View/Edit']")).isDisplayed(); + + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/tbody/tr[1]/td[1]/div/a")).click(); + + log.info("User clicked View/Edit"); + + //Verify the Subscriber Name displayed. + String header= driver.findElement(By.xpath("//h1[@class='heading1 ng-binding']")).getText(); + //System.out.println(header); + + + if(header.contains(eg)) + { + System.out.println("Header contains the subscriber name"); + }else + System.out.println("Header does not contain the subscriber name"); + + + + Assert.assertTrue(driver.getPageSource().contains("PerfTest Subscriber00020021")); + log.info("VID-12 TC-6 PASSED"); + + + + driver.navigate().back(); + //Cancel button isDisplayed + driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).isDisplayed(); + log.info("VID-12 TC-9 PASSED"); + + //Cancel button is clicked + driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).click(); + log.info("Cancel button is clicked"); + + //Verifying VID Home page is displayed + Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); + log.info("VID-12 TC-10 PASSED"); + + } + + + /** + * Refresh subscriber name. + */ + @Test(priority=9) + public void refreshSubscriberName() + { + log.info("VID-10 TC-4"); + + + driver.findElement(By.xpath(configProp.getProperty("refreshButtonSubscriberName"))).isDisplayed(); + + log.info("VID-10 TC-4 PASSED"); + + + } + + + /** + * Select subscriber type drop down. + * + * @throws InterruptedException the interrupted exception + */ + @Test(priority=9) + public void selectSubscriberTypeDropDown() throws InterruptedException + { + Thread.sleep(5000); + log.info("------------------VID-10 TC-3, VID-12 TC-12,--------------------"); + //Infrastructure Subscriber Type + Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown")))); + + List ielementCount = iSelect.getOptions(); + log.info("Select Element Count of Service type"); + System.out.println(ielementCount.size()); + iSelect.selectByIndex(1); + + log.info("VID-10 TC-3 PASSED"); + + + //Submit button is clicked + driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click(); + + //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); + //Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:")) + log.info("Page Header: Selected Subscriber's Service Instance Details"); + + + //Verify whether the page header is displayed "Global Customer ID" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed(); + + //Assert.assertTrue(driver.getPageSource().contains("Global Customer ID")); + log.info("Table is displayed"); + + log.info("VID-12 TC-12 PASSED"); + + } + + + + /** + * Logout under profile. + */ + @Test(priority=10) + public void logoutUnderProfile() + { + + log.info("-----------VID-11 TC-5---------------------"); + //driver.findElement(By.partialLinkText("Click here to login")).click(); + //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + + driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).click(); + driver.findElement(By.xpath(".//*[@id='reg-logout-div']/a")).click(); + //Validate that the user has logged out of VID. Displays "Portal" + Assert.assertTrue(driver.getPageSource().contains("Portal")); + + log.info("VID-11 TC-5 PASSED"); + + } + + + + /** + * Tear down. + */ + @AfterClass + public void tearDown() + { + driver.close(); + + } + + + + } + + + + diff --git a/vid-app-common/src/test/java/org/onap/vid/selenium/LogOutLeftPane.java b/vid-app-common/src/test/java/org/onap/vid/selenium/LogOutLeftPane.java new file mode 100644 index 000000000..19c6b1996 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/selenium/LogOutLeftPane.java @@ -0,0 +1,242 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.selenium; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import org.apache.log4j.Logger; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +/** + * The Class LogOutLeftPane. + */ +@Test(enabled=false) +public class LogOutLeftPane { + + /** The login button. */ + WebElement loginButton; + + /** The login. */ + WebElement login; + + /** The pwd. */ + WebElement pwd; + + /** The log. */ + Logger log; + + /** The errormessage. */ + WebElement errormessage; + + /** The driver. */ + WebDriver driver=new FirefoxDriver(); + + + /** The config prop. */ + private final Properties configProp = new Properties(); + + + /** + * Instantiates a new log out left pane. + */ + private LogOutLeftPane() { + // TODO Auto-generated constructor stub + // + try{ + // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties"); + //FileInputStream input1 = new FileInputStream("objectmap.properties"); + + InputStream input =new FileInputStream("objectconfig.properties"); + System.out.println("Read all properties from file"); + configProp.load(input); + System.out.println("Read all properties from file completed"); + } + catch(IOException e) { + + e.printStackTrace(); + } + } + + + + + /** + * Do before test. + */ + // TODO Auto-generated method stub + @BeforeTest + public void doBeforeTest() + { + //WebDriver driver=new FirefoxDriver(); + + log = Logger.getLogger(LogOutLeftPane.class.getName()); + + + + // Get url + driver.get("http://vid.onap.org:9080/vid/login_external.htm"); + driver.manage().window().maximize(); + + + login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']")); + pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']")); + loginButton = driver.findElement(By.id("loginBtn")); + } + + + /** + * Expand collapse panel. + * + * @throws InterruptedException the interrupted exception + */ + @Test(priority=1) + public void expandCollapsePanel() throws InterruptedException + { + + + + login.clear(); + login.sendKeys("su"); + pwd.clear(); + pwd.sendKeys("fusion"); + //driver.findElement(By.partialLinkText("Click here to login")).click(); + //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + loginButton.click(); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + + log.info("Clicking Profile link from left pane"); + Thread.sleep(3000); + System.out.println("properties file details --->"+configProp.getProperty("profilelink")); + driver.findElement(By.xpath(configProp.getProperty("profilelink"))).click(); + Thread.sleep(3000); + + //Verify whether the sub panel is displayed + //To verify the following :Search import from webphone and Self + driver.findElement(By.xpath(".//*[@id='panel4']")).isDisplayed(); + log.info("Expand and collapse passed for Profile link"); + + //For Admin + //Verify expand and collapse working for ADMIN + log.info("Clicking Admin link from left pane"); + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).click(); + //To verify the following: Roles, Roles Functions, Usages + driver.findElement(By.xpath(".//*[@id='panel5']")).isDisplayed(); + + + log.info("Expand and collapse passed for ADMIN link"); + + log.info("VID-11 TC-3 PASSED"); + + } + + + /** + * Drop down list. + * + * @throws InterruptedException the interrupted exception + */ + @Test(priority=2) + public void dropDownList() throws InterruptedException + { + //VID-12 TC-3 + log.info("VID-12 TC-3"); + //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")); + + //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")); + Thread.sleep(5000); + + //Infrastructure Subscriber Name + Select oSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))); + Select iSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select"))); + + List elementCount = oSelect.getOptions(); + log.info("Subscriber Name Drop Down"); + System.out.println(elementCount.size()); + oSelect.selectByIndex(1); + log.info("Subscriber name selected"); + //String selectedOption = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))).getFirstSelectedOption().getText(); + + + List count = iSelect.getOptions(); + log.info("Subscriber type drop down"); + System.out.println(count.size()); + oSelect.selectByIndex(1); + log.info("Subscriber type selected"); + + + + //Submit button is clicked + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).click(); + + + //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" + driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); + log.info("VID-12 TC-3 PASSED"); + } + + + + + /** + * Logout left pane. + */ + @Test(priority=3) + public void logoutLeftPane() + { + //To Verify if the logout link redirects to Login page when clicked. + + + /*log.info("----------------VID-11 TC-4----------------"); + login.clear(); + login.sendKeys("testuser"); + pwd.clear(); + pwd.sendKeys("abc123"); + //driver.findElement(By.partialLinkText("Click here to login")).click(); + //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + loginButton.click(); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);*/ + log.info("----------------VID-11 TC-4----------------"); + driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a")).click(); + //Validate that the user has logged out of VID. Displays "Portal" + Assert.assertTrue(driver.getPageSource().contains("Portal")); + + log.info("VID 11 TC-4 PASSED"); + + driver.close(); + + } + +} diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java new file mode 100644 index 000000000..e73838c92 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java @@ -0,0 +1,69 @@ +package org.onap.vid.services; + +import static org.junit.Assert.*; +import java.util.*; + +import org.json.simple.JSONArray; +import org.junit.Assert; +import org.junit.Test; +import org.onap.vid.changeManagement.ChangeManagementRequest; +import org.onap.vid.changeManagement.RequestDetails; +import org.onap.vid.mso.rest.Request; +import org.springframework.http.ResponseEntity; + +public class ChangeManagementServiceImplTest { + + /*TODO: fix private ChangeManagementServiceImpl createTestSubject() { + return new ChangeManagementServiceImpl(); + }*/ + + + /*@Test + public void testGetMSOChangeManagements() throws Exception { + ChangeManagementServiceImpl testSubject; + Collection result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMSOChangeManagements(); + } + + + @Test + public void testFindRequestByVnfName() throws Exception { + ChangeManagementServiceImpl testSubject;List requests = null; + String vnfName = ""; + RequestDetails result; + + // test 1 + testSubject=createTestSubject();requests = null; + result=Deencapsulation.invoke(testSubject, "findRequestByVnfName", new Object[]{List.class, vnfName}); + Assert.assertEquals(null, result); + }*/ +/* + + @Test + public void testDoChangeManagement() throws Exception { + ChangeManagementServiceImpl testSubject; + ChangeManagementRequest request = null; + String vnfName = ""; + ResponseEntity result; + + // test 1 + testSubject = createTestSubject(); + request = null; + result = testSubject.doChangeManagement(request, vnfName); + Assert.assertEquals(null, result); + } + + + @Test + public void testGetSchedulerChangeManagements() throws Exception { + ChangeManagementServiceImpl testSubject; + JSONArray result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSchedulerChangeManagements(); + }*/ +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceTest.java new file mode 100644 index 000000000..f3df4c6a9 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceTest.java @@ -0,0 +1,29 @@ +package org.onap.vid.services; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.vid.changeManagement.ChangeManagementRequest; +import org.onap.vid.changeManagement.ChangeManagementResponse; +import org.springframework.http.ResponseEntity; + +import junit.framework.Assert; + +import static org.junit.Assert.*; + + +public class ChangeManagementServiceTest { + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void doChangeManagement_requestTypeIsUpdateVnfNotFound_doUpdateAndReturnNull() throws Exception { + + } + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java new file mode 100644 index 000000000..f692bdc6d --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java @@ -0,0 +1,107 @@ +package org.onap.vid.services; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.io.IOUtils; +import org.mockito.ArgumentCaptor; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.vid.changeManagement.ChangeManagementRequest; +import org.onap.vid.controller.MsoConfig; +import org.onap.vid.controller.WebConfig; +import org.onap.vid.model.RequestReferencesContainer; +import org.onap.vid.mso.RestObject; +import org.onap.vid.mso.rest.MsoRestClientNew; +import org.onap.vid.mso.rest.RequestDetails; +import org.onap.vid.properties.AsdcClientConfiguration; +import org.onap.vid.services.ChangeManagementService; +import org.onap.vid.services.ChangeManagementServiceImpl; +import org.onap.vid.testUtils.RegExMatcher; +import org.skyscreamer.jsonassert.JSONAssert; +import org.skyscreamer.jsonassert.JSONCompareMode; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.testng.annotations.Test; + +import javax.inject.Inject; +import java.net.URL; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsInstanceOf.instanceOf; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.*; + + +@Test +@ContextConfiguration(classes = {WebConfig.class, AsdcClientConfiguration.class, SystemProperties.class, ChangeManagementServiceUnitTest.TestMsoConfig.class}) +@WebAppConfiguration +public class ChangeManagementServiceUnitTest extends AbstractTestNGSpringContextTests { + + private ObjectMapper objectMapper = new ObjectMapper(); + @Inject + private ChangeManagementService changeManagementService; + @Inject + private MsoRestClientNew restClientUnderTest; + + // @Test + void testInPlaceSoftwareUpdateRequest() throws Exception { + + + doReturn(new RestObject()).when(restClientUnderTest).PostForObject(anyObject(), anyString(), anyString(), anyObject()); + + URL requestJsonUrl = this.getClass().getResource("/services/change_management_software_update_request.json"); + ChangeManagementRequest changeManagementRequest = objectMapper.readValue(requestJsonUrl, ChangeManagementRequest.class); + changeManagementService.doChangeManagement(changeManagementRequest, "vidVnf"); + + ArgumentCaptor endpointCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor sourceIdCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Object.class); + ArgumentCaptor responseTypeCaptor = ArgumentCaptor.forClass(Class.class); + verify(restClientUnderTest).PostForObject(requestCaptor.capture(), sourceIdCaptor.capture(), endpointCaptor.capture(), responseTypeCaptor.capture()); + + org.onap.vid.changeManagement.RequestDetails expectedRequest = changeManagementRequest.getRequestDetails().get(0); + + String serviceInstanceId = expectedRequest.getRelatedInstList().get(0).getRelatedInstance().instanceId; + ; + String vnfInstanceId = expectedRequest.getVnfInstanceId(); + String regEx = String.format("/serviceInstances/v[0-9]+/%s/vnfs/%s/inPlaceSoftwareUpdate", serviceInstanceId, vnfInstanceId); + assertThat(endpointCaptor.getValue(), RegExMatcher.matchesRegEx(regEx)); + assertThat(requestCaptor.getValue(), instanceOf(RequestDetails.class)); + RequestDetails actualRequest = ((RequestDetails) requestCaptor.getValue()); + + assertThat(actualRequest.getCloudConfiguration().getTenantId(), equalTo(expectedRequest.getCloudConfiguration().getTenantId())); + assertThat(actualRequest.getCloudConfiguration().getLcpCloudRegionId(), equalTo(expectedRequest.getCloudConfiguration().getLcpCloudRegionId())); + assertThat(actualRequest.getRequestInfo(), equalTo(expectedRequest.getRequestInfo())); + assertThat(actualRequest.getRequestParameters(), equalTo(expectedRequest.getRequestParameters())); + + URL expectedMsoRequestUrl = this.getClass().getResource("/services/change_management_software_update_expected_mso_request.json"); + String expectedMsoRequestString = IOUtils.toString(expectedMsoRequestUrl, "UTF-8"); + String actualRequestString = objectMapper.writeValueAsString(actualRequest); + try { + JSONAssert.assertEquals("built mso request is not ok", expectedMsoRequestString, actualRequestString, JSONCompareMode.NON_EXTENSIBLE); + } catch (AssertionError | Exception e) { + System.out.println("requestDetailsAsString: \n" + actualRequestString); + System.out.println("expected: \n" + expectedMsoRequestString); + throw e; + } + + } + + @Configuration + public static class TestMsoConfig extends MsoConfig { + + @Override + public MsoRestClientNew getMsoClient() { + MsoRestClientNew spyClient = spy(new MsoRestClientNew()); + return spyClient; + } + + @Bean + public ChangeManagementService getChangeManagementService() { + return new ChangeManagementServiceImpl(null, getMsoBusinessLogic()); + } + } +} diff --git a/vid-app-common/src/test/java/org/onap/vid/services/CsvServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/services/CsvServiceTest.java new file mode 100644 index 000000000..051a1cf45 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/services/CsvServiceTest.java @@ -0,0 +1,80 @@ +//package org.onap.vid.services; +//import org.apache.commons.io.IOUtils; +//import org.onap.vid.services.CsvServiceImpl; +//import org.skyscreamer.jsonassert.JSONAssert; +//import org.skyscreamer.jsonassert.JSONCompareMode; +//import org.testng.Assert; +//import org.testng.annotations.DataProvider; +//import org.testng.annotations.Test; +//import org.json.JSONObject; +// +//import javax.ws.rs.BadRequestException; +//import java.io.IOException; +//import java.lang.reflect.Method; +//import java.net.URL; +//import java.util.List; +// +//@Test +//public class CsvServiceTest { +// +// private CsvServiceImpl csvService = new CsvServiceImpl(); +// private final static String CSV_FOLDER = "csv_files/{CSV_FILE}"; +// private final static String VALID_CSV = "csv_to_json.csv"; +// private final static String ONE_LINE_CSV = "one_line.csv"; +// private final static String EMPTY_CSV = "empty_file.csv"; +// private final static String MISSING_CONTENT_CSV = "missing_content.csv"; +// private final static String MISSING_VALUES_CSV = "missing_values.csv"; +// +// +///* +// @Test +// public void parseValidCsv() throws IllegalAccessException, IOException, InstantiationException { +// String expectedJson = getExpectation("vnfConfigUpdatePayload.json"); +// readAndParse(VALID_CSV,16,expectedJson); +// +// }*/ +// +// private String getExpectation(String modelFileName) throws IOException { +// // load expected result +// final URL resource = this.getClass().getResource("/" + modelFileName); +// String expected = IOUtils.toString(resource, "UTF-8"); +// return expected; +// } +///* +// @Test +// public void parseOneLineCsv() throws IllegalAccessException, IOException, InstantiationException { +// String expectedJson ="{\"payload\":{\"request-parameters\":{\"vnf-name\":\"ibcx0099v\"}}}"; +// readAndParse(ONE_LINE_CSV,1,expectedJson); +// }*/ +// +// @DataProvider +// public static Object[][] invalidFiles(Method test) { +// return new Object[][]{ +// {MISSING_CONTENT_CSV}, {MISSING_VALUES_CSV} +// }; +// } +///* +// @Test(dataProvider = "invalidFiles", expectedExceptions = {BadRequestException.class}, expectedExceptionsMessageRegExp = "Invalid csv file") +// public void parseMissingContentCsv(String invalidFile) throws IllegalAccessException, IOException, InstantiationException { +// readAndParse(invalidFile, 2, null); +// } +// +// +// @Test +// public void parseEmptyCsv() throws IllegalAccessException, IOException, InstantiationException { +// String expectedJson ="{}"; +// readAndParse(EMPTY_CSV,0,expectedJson); +// } +// +// private void readAndParse(String fileName, int expectedNumRows, String expectedJson) throws IllegalAccessException, IOException, InstantiationException { +// final URL resource = CsvServiceTest.class.getClassLoader().getResource(CSV_FOLDER.replaceFirst("\\{CSV_FILE\\}", fileName)); +// Assert.assertNotNull(resource, "The csv file was not found"); +// List content = csvService.readCsv(resource.getPath()); +// Assert.assertEquals(content.size(), expectedNumRows, "The number of non-empty lines in file is wrong"); +// JSONObject json = csvService.convertCsvToJson (content); +// JSONAssert.assertEquals(expectedJson, json, JSONCompareMode.STRICT); +// +// }*/ +// +// +//} diff --git a/vid-app-common/src/test/java/org/onap/vid/services/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/services/TestSuite.java new file mode 100644 index 000000000..e43432467 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/services/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.services; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ ChangeManagementServiceImplTest.class, ChangeManagementServiceTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java b/vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java new file mode 100644 index 000000000..c766d26f3 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java @@ -0,0 +1,101 @@ +package org.onap.vid.testUtils; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.vid.utils.Intersection; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by moriya1 on 10/10/2017. + */ +public class IntersectionTest { + + @Test + public void testFourArrays(){ + List l1 = new ArrayList(); + l1.add("1"); + l1.add("2"); + + List l2 = new ArrayList(); + l2.add("2"); + l2.add("3"); + + List l3 = new ArrayList(); + l3.add("2"); + l3.add("4"); + + List l4 = new ArrayList(); + l4.add("2"); + l4.add("5"); + + List> all = new ArrayList<>(); + all.add(l1); + all.add(l2); + all.add(l3); + all.add(l4); + Intersection m = new Intersection<>(); + List ans = m.intersectMultipileArray(all); + Assert.assertEquals(1,ans.size()); + Assert.assertEquals(ans.get(0),"2"); + + } + + + + @Test + public void testTwoArrays(){ + List l1 = new ArrayList(); + l1.add("1"); + l1.add("2"); + + List l2 = new ArrayList(); + l2.add("2"); + l2.add("3"); + + List> all = new ArrayList<>(); + all.add(l1); + all.add(l2); + Intersection m = new Intersection<>(); + List l3 = m.intersectMultipileArray(all); + Assert.assertEquals(l3.size(),1); + Assert.assertEquals(l3.get(0),"2"); + + } + + + @Test + public void testNoIntersection(){ + List l1 = new ArrayList(); + l1.add("1"); + l1.add("2"); + + List l2 = new ArrayList(); + l2.add("3"); + l2.add("4"); + + List> all = new ArrayList<>(); + all.add(l1); + all.add(l2); + Intersection m = new Intersection<>(); + List l3 = m.intersectMultipileArray(all); + Assert.assertEquals(l3.size(),0); + + } + + @Test + public void testOneArrays(){ + List l1 = new ArrayList(); + l1.add("1"); + l1.add("2"); + List> all = new ArrayList<>(); + all.add(l1); + Intersection m = new Intersection<>(); + List l3 = m.intersectMultipileArray(all); + Assert.assertEquals(l3.size(),2); + Assert.assertEquals(l3.get(0),"1"); + Assert.assertEquals(l3.get(1),"2"); + + } +} diff --git a/vid-app-common/src/test/java/org/onap/vid/testUtils/RegExMatcher.java b/vid-app-common/src/test/java/org/onap/vid/testUtils/RegExMatcher.java new file mode 100644 index 000000000..c88c8a835 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/testUtils/RegExMatcher.java @@ -0,0 +1,29 @@ +package org.onap.vid.testUtils; + +import org.hamcrest.Description; +import org.hamcrest.TypeSafeMatcher; + +public class RegExMatcher extends TypeSafeMatcher { + + private final String regEx; + + public RegExMatcher(String regEx) { + this.regEx = regEx; + } + + + @Override + public void describeTo(Description description) { + description.appendText("matches regEx="+regEx); + } + + + @Override + protected boolean matchesSafely(String item) { + return item.matches(regEx); + } + + public static RegExMatcher matchesRegEx(final String regEx) { + return new RegExMatcher(regEx); + } +} diff --git a/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java b/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java new file mode 100644 index 000000000..73a79cd21 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java @@ -0,0 +1,68 @@ +package org.onap.vid.testUtils; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Assert; + +import java.util.Iterator; + +import static fj.parser.Parser.fail; + +/** + * Created by Oren on 6/7/17. + */ +public class TestUtils { + + /** + * The method compares between two jsons. the function assert that the actual object does not reduce or change the functionallity/parsing of the expected json. + * This means that if the expected JSON has a key which is null or the JSON doesn't have a key which contained in the expected JSON the assert will succeed and the will pass. + * For example : For JSON expected = {a:null} and actual {a:3} the test will pass + * Other example : For JSON expected = {a:3} and actual {a:null} the test will fail + * + * @param expected JSON + * @param actual JSON + */ + public static void assertJsonStringEqualsIgnoreNulls(String expected, String actual) { + if (expected == null || expected == JSONObject.NULL) {return;} + + JSONObject expectedJSON = new JSONObject(expected); + JSONObject actualJSON = new JSONObject(actual); + Iterator keys = expectedJSON.keys(); + + while( keys.hasNext() ) { + String key = (String)keys.next(); + Object expectedValue = expectedJSON.get(key); + if (expectedValue == JSONObject.NULL){ + continue; + } + + Object actualValue = actualJSON.get(key); + + if (expectedValue instanceof JSONObject) { + String expectedVal = expectedValue.toString(); + String actualVal = actualValue.toString(); + assertJsonStringEqualsIgnoreNulls(expectedVal, actualVal); + } + else if (expectedValue instanceof JSONArray) { + if (actualValue instanceof JSONArray) { + JSONArray expectedJSONArray = (JSONArray)expectedValue; + JSONArray actualJSONArray = (JSONArray)actualValue; + for (int i = 0; i < expectedJSONArray.length(); i++) { + String expectedItem = expectedJSONArray.get(i).toString(); + String actualItem = actualJSONArray.get(i).toString(); + if (expectedValue instanceof JSONObject) + assertJsonStringEqualsIgnoreNulls(expectedItem, actualItem); + } + } + else { + fail("expected: " + expectedValue + " got:" + actualValue); + } + } + else { + Assert.assertEquals(expectedValue, actualValue); + } + } + } + + +} diff --git a/vid-app-common/src/test/java/org/opencomp/vid/controller/MsoControllerTest.java b/vid-app-common/src/test/java/org/opencomp/vid/controller/MsoControllerTest.java deleted file mode 100644 index 731668dc2..000000000 --- a/vid-app-common/src/test/java/org/opencomp/vid/controller/MsoControllerTest.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.opencomp.vid.controller; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import org.apache.commons.lang.StringEscapeUtils; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.vid.controller.MsoConfig; -import org.openecomp.vid.controller.MsoController; -import org.openecomp.vid.domain.mso.RequestInfo; -import org.openecomp.vid.factories.MsoRequestFactory; -import org.openecomp.vid.mso.rest.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -@RunWith(SpringJUnit4ClassRunner.class) -@WebAppConfiguration -@ContextConfiguration(classes = {SystemProperties.class , MsoConfig.class}) -public class MsoControllerTest { - - @Autowired - MsoRequestFactory msoRequestFactory; - - //@Test - public void testInstanceCreationNew() throws Exception { - - RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json"); - MsoController msoController = new MsoController(); - ResponseEntity responseEntityNew = msoController.createSvcInstanceNew(null, requestDetails); - ResponseEntity responseEntity = msoController.createSvcInstance(null, requestDetails); - assertEquals(responseEntityNew, responseEntity); - - } - - //@Test - public void testInstanceCreationLocalWithRest() throws Exception { - - RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json"); - MsoController msoController = new MsoController(); - ResponseEntity responseEntityNew = msoController.createSvcInstance(null, requestDetails); - ResponseEntity responseEntityRest = msoController.createSvcInstanceNewRest(null, requestDetails); - - assertEquals(responseEntityNew.getBody(), responseEntityRest.getBody()); - - } - - //@Test - public void testInstanceCreation() throws Exception { - - RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json"); - MsoController msoController = new MsoController(); - ResponseEntity responseEntity = msoController.createSvcInstance(null, requestDetails); - - - assertEquals(responseEntity.getBody(), "{ \"status\": 200, \"entity\": {\n" + - " \"requestReferences\": {\n" + - " \"instanceId\": \"ba00de9b-3c3e-4b0a-a1ad-0c5489e711fb\",\n" + - " \"requestId\": \"311cc766-b673-4a50-b9c5-471f68914586\"\n" + - " }\n" + - "}}"); - - } - - @Test - public void testGetOrchestrationRequestsForDashboard() throws Exception{ - MsoController msoController = new MsoController(); - List orchestrationRequestsForDashboard = msoController.getOrchestrationRequestsForDashboard(); - - assertEquals(orchestrationRequestsForDashboard.size() , 2); - } - - @Test - public void testGetManualTasksByRequestId() throws Exception{ - MsoController msoController = new MsoController(); - List orchestrationRequestsForDashboard = msoController.getManualTasksByRequestId("za1234d1-5a33-55df-13ab-12abad84e335"); - - assertEquals(orchestrationRequestsForDashboard.get(0).getTaskId() , "daf4dd84-b77a-42da-a051-3239b7a9392c"); - } - - - public void testCompleteManualTask() throws Exception{ // TODO not done yet - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setResponseValue("rollback"); - requestInfo.setRequestorId("abc"); - requestInfo.setSource("VID"); - RequestDetails requestDetails = new RequestDetails(); - requestDetails.setRequestInfo(requestInfo); - MsoController msoController = new MsoController(); - ResponseEntity responseEntity = msoController.manualTaskComplete("daf4dd84-b77a-42da-a051-3239b7a9392c" , requestDetails); - String assertString = "{ \\\"status\\\": 200, \\\"entity\\\": {\\n\" +\n" + - " \" \\\"taskRequestReference\\\": {\\n\" +\n" + - " \" \\\"taskId\\\": \\\"daf4dd84-b77a-42da-a051-3239b7a9392c\\\"\\n\" +\n" + - " \" }\\n\" +\n" + - " \"}\\n\" +\n" + - " \"}"; - assertEquals(responseEntity.getBody() , StringEscapeUtils.unescapeJava(assertString)); - } - - - - - -} diff --git a/vid-app-common/src/test/java/org/opencomp/vid/controller/ToscaParserMockHelper.java b/vid-app-common/src/test/java/org/opencomp/vid/controller/ToscaParserMockHelper.java deleted file mode 100644 index a9a902b6a..000000000 --- a/vid-app-common/src/test/java/org/opencomp/vid/controller/ToscaParserMockHelper.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.opencomp.vid.controller; - -import org.openecomp.vid.model.NewServiceModel; - -/** - * Created by moriya1 on 04/07/2017. - */ -public class ToscaParserMockHelper { - - private String uuid; - private String filePath; - private NewServiceModel newServiceModel; - - public ToscaParserMockHelper(String uuid, String filePath) { - this.uuid = uuid; - this.filePath = filePath; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getFilePath() { - return filePath; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - public NewServiceModel getNewServiceModel() { - return newServiceModel; - } - - public void setNewServiceModel(NewServiceModel newServiceModel) { - this.newServiceModel = newServiceModel; - } -} diff --git a/vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java b/vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java deleted file mode 100644 index 8596cf3d4..000000000 --- a/vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package org.opencomp.vid.controller; - -import net.javacrumbs.jsonunit.JsonAssert; -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.map.ObjectMapper; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; -import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; -import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; -import org.openecomp.sdc.tosca.parser.impl.SdcTypes; -import org.openecomp.vid.aai.AaiClient; -import org.openecomp.vid.aai.AaiResponse; -import org.openecomp.vid.asdc.AsdcCatalogException; -import org.openecomp.vid.asdc.AsdcClient; -import org.openecomp.vid.asdc.parser.ToscaParserImpl2; -import org.openecomp.vid.controller.WebConfig; -import org.openecomp.vid.model.*; -import org.openecomp.vid.properties.AsdcClientConfiguration; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.servlet.ServletContext; - -import static org.opencomp.vid.testUtils.TestUtils.assertJsonStringEqualsIgnoreNulls; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = {WebConfig.class, AsdcClientConfiguration.class,SystemProperties.class }) -@WebAppConfiguration - -public class VidControllerTest { - - @Autowired - private AsdcClient asdcClient; - - @Autowired - ServletContext context; - public class Constants{ - public static final String vfUuid = "48a52540-8772-4368-9cdb-1f124ea5c931"; - public static final String vlUuid = "68101369-6f08-4e99-9a28-fa6327d344f3"; - public static final String PNFUuid = "73e1322a-8a9a-49dc-9558-b0c5c5770e4a"; - public static final String vfFilePath = "vf-csar.JSON"; - public static final String vlFilePath = "vl-csar.JSON"; - public static final String PNFFilePath = "/vid_internal/vid-app-common/src/main/resources/pnf.csar"; - } - - private ToscaParserImpl2 p2 = new ToscaParserImpl2(); - private ObjectMapper om = new ObjectMapper(); - - - @Test - public void test() { - AaiClient client = new AaiClient(context); - AaiResponse response = client.getVNFData(); - try { - System.out.println(new ObjectMapper().writeValueAsString(response)); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Test - public void checkPNFFieldsExist() throws SdcToscaParserException, AsdcCatalogException { - String serviceRoleString = "serviceRole"; - String serviceTypeString = "serviceType"; - - SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); - ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(getCsarPath(Constants.PNFUuid).toString()); - List pnfs = sdcCsarHelper.getServiceNodeTemplateBySdcType(SdcTypes.PNF); - Assert.assertEquals(sdcCsarHelper.getServiceMetadata().getValue(serviceTypeString).toLowerCase(),"transport"); - Assert.assertEquals(sdcCsarHelper.getServiceMetadata().getValue(serviceRoleString).toLowerCase(),"pnf"); - Assert.assertTrue(pnfs.size()>0); - - } - - - @Test - public void assertEqualsBetweenServices() throws Exception { - for (ToscaParserMockHelper mockHelper: getExpectedServiceModel()) { - Service expectedService = mockHelper.getNewServiceModel().getService(); - Service actualService = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getService(); - JsonAssert.assertJsonEquals(expectedService, actualService); - } - } - - //@Test - // bug in SDC tosca filterNodeTemplatePropertiesByValue - public void assertEqualBetweenObjects() throws Exception { - for (ToscaParserMockHelper mockHelper: getExpectedServiceModel()) { - ServiceModel actualServiceModel = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())); - JsonAssert.assertJsonEquals(mockHelper.getNewServiceModel(), actualServiceModel); - /*java.lang.AssertionError: JSON documents are different: - Different keys found in node "networks.ExtVL 0.commands". Expected [exVL_naming#naming_policy, network_role, network_scope], got [network_role, network_scope]. Missing: "networks.ExtVL 0.commands.exVL_naming#naming_policy" - Different keys found in node "networks.ExtVL 0.inputs". Expected [exVL_naming#naming_policy, network_role, network_scope], got [network_role, network_scope]. Missing: "networks.ExtVL 0.inputs.exVL_naming#naming_policy"*/ - } - } - - @Test - public void assertEqualsBetweenNetworkNodes() throws Exception { - for (ToscaParserMockHelper mockHelper: getExpectedServiceModel()) { - Map expectedNetworksMap = mockHelper.getNewServiceModel().getNetworks(); - Map actualNetworksMap = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getNetworks(); - for (Map.Entry entry : expectedNetworksMap.entrySet()) { - Network expectedNetwork = entry.getValue(); - Network actualNetwork = actualNetworksMap.get(entry.getKey()); - Assert.assertEquals(expectedNetwork.getModelCustomizationName(), actualNetwork.getModelCustomizationName()); - verifyBaseNodeProperties(expectedNetwork, actualNetwork); - compareProperties(expectedNetwork.getProperties(), actualNetwork.getProperties()); - } - } - } - - //Because we are not supporting the old flow, the JSON are different by definition. - @Test - public void assertEqualsBetweenVnfsOfTosca() throws Exception { - for (ToscaParserMockHelper mockHelper: getExpectedServiceModel()) { - Map expectedVnfsMap = mockHelper.getNewServiceModel().getVnfs(); - Map actualVnfsMap = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVnfs(); - for (Map.Entry entry : expectedVnfsMap.entrySet()) { - VNF expectedVnf = entry.getValue(); - VNF actualVnf = actualVnfsMap.get(entry.getKey()); - verifyBaseNodeProperties(expectedVnf, actualVnf); - Assert.assertEquals(expectedVnf.getModelCustomizationName(), actualVnf.getModelCustomizationName()); - compareProperties(expectedVnf.getProperties(), actualVnf.getProperties()); - assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(expectedVnf), om.writeValueAsString(actualVnf)); - } - } - } - - @Test - public void assertEqualsBetweenVolumeGroups() throws Exception { - for (ToscaParserMockHelper mockHelper: getExpectedServiceModel()) { - Path cSarPath = getCsarPath(mockHelper.getUuid()); - Map actualVolumeGroups = new HashMap<>(); - if(cSarPath != null) { - actualVolumeGroups = p2.makeServiceModel(cSarPath, getServiceByUuid(mockHelper.getUuid())).getVolumeGroups(); - } - Map expectedVolumeGroups = mockHelper.getNewServiceModel().getVolumeGroups(); - JsonAssert.assertJsonEquals(actualVolumeGroups, expectedVolumeGroups); - } - } - - @Test - public void assertEqualsBetweenVfModules() throws Exception { - for (ToscaParserMockHelper mockHelper: getExpectedServiceModel()) { - Map actualVfModules = p2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVfModules(); - Map expectedVfModules = mockHelper.getNewServiceModel().getVfModules(); - JsonAssert.assertJsonEquals(actualVfModules, expectedVfModules); - } - } - - private void verifyBaseNodeProperties(Node expectedNode, Node actualNode) { - Assert.assertEquals(expectedNode.getName(), actualNode.getName()); - Assert.assertEquals(expectedNode.getCustomizationUuid(), actualNode.getCustomizationUuid()); - Assert.assertEquals(expectedNode.getDescription(), actualNode.getDescription()); - Assert.assertEquals(expectedNode.getInvariantUuid(), actualNode.getInvariantUuid()); - Assert.assertEquals(expectedNode.getUuid(), actualNode.getUuid()); - Assert.assertEquals(expectedNode.getVersion(), actualNode.getVersion()); - } - - private void compareProperties(Map expectedProperties, Map actualProperties) { - for (Map.Entry property : expectedProperties.entrySet()) { - String expectedValue = property.getValue(); - String key = property.getKey(); - String actualValue = actualProperties.get(key); - Assert.assertEquals(expectedValue, actualValue); - } - } - - private ToscaParserMockHelper[] getExpectedServiceModel() throws IOException { - ToscaParserMockHelper[] mockHelpers = {new ToscaParserMockHelper(Constants.vlUuid, Constants.vlFilePath), new ToscaParserMockHelper(Constants.vfUuid, Constants.vfFilePath)}; - for(ToscaParserMockHelper mockHelper: mockHelpers) { - InputStream jsonFile = VidControllerTest.class.getClassLoader().getResourceAsStream(mockHelper.getFilePath()); - String expectedJsonAsString = IOUtils.toString(jsonFile).toString(); - NewServiceModel newServiceModel1 = om.readValue(expectedJsonAsString, NewServiceModel.class); - mockHelper.setNewServiceModel(newServiceModel1); - } - return mockHelpers; - } - - private Path getCsarPath(String uuid) throws AsdcCatalogException { - return asdcClient.getServiceToscaModel(UUID.fromString(uuid)); - } - - private org.openecomp.vid.asdc.beans.Service getServiceByUuid(String uuid) throws AsdcCatalogException { - return asdcClient.getService(UUID.fromString(uuid)); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/opencomp/vid/testUtils/TestUtils.java b/vid-app-common/src/test/java/org/opencomp/vid/testUtils/TestUtils.java deleted file mode 100644 index 29115e0aa..000000000 --- a/vid-app-common/src/test/java/org/opencomp/vid/testUtils/TestUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opencomp.vid.testUtils; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Assert; - -import java.util.Iterator; - -import static fj.parser.Parser.fail; - -/** - * Created by Oren on 6/7/17. - */ -public class TestUtils { - - /** - * The method compares between two jsons. the function assert that the actual object does not reduce or change the functionallity/parsing of the expected json. - * This means that if the expected JSON has a key which is null or the JSON doesn't have a key which contained in the expected JSON the assert will succeed and the will pass. - * For example : For JSON expected = {a:null} and actual {a:3} the test will pass - * Other example : For JSON expected = {a:3} and actual {a:null} the test will fail - * - * @param expected JSON - * @param actual JSON - */ - public static void assertJsonStringEqualsIgnoreNulls(String expected, String actual) { - if (expected == null || expected == JSONObject.NULL) {return;} - - JSONObject expectedJSON = new JSONObject(expected); - JSONObject actualJSON = new JSONObject(actual); - Iterator keys = expectedJSON.keys(); - - while( keys.hasNext() ) { - String key = (String)keys.next(); - Object expectedValue = expectedJSON.get(key); - if (expectedValue == JSONObject.NULL){ - continue; - } - - Object actualValue = actualJSON.get(key); - - if (expectedValue instanceof JSONObject) { - String expectedVal = expectedValue.toString(); - String actualVal = actualValue.toString(); - assertJsonStringEqualsIgnoreNulls(expectedVal, actualVal); - } - else if (expectedValue instanceof JSONArray) { - if (actualValue instanceof JSONArray) { - JSONArray expectedJSONArray = (JSONArray)expectedValue; - JSONArray actualJSONArray = (JSONArray)expectedValue; - for (int i = 0; i < expectedJSONArray.length(); i++) { - String expectedItem = expectedJSONArray.getJSONObject(i).toString(); - String actualItem = actualJSONArray.getJSONObject(i).toString(); - assertJsonStringEqualsIgnoreNulls(expectedItem, actualItem); - } - } - else { - fail("expected: " + expectedValue + " got:" + actualValue); - } - } - else { - Assert.assertEquals(expectedValue, actualValue); - } - } - } -} diff --git a/vid-app-common/src/test/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtilTest.java b/vid-app-common/src/test/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtilTest.java deleted file mode 100644 index f72a2825b..000000000 --- a/vid-app-common/src/test/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtilTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openecomp.aai.util; - -import org.junit.Test; - -public class JettyObfuscationConversionCommandLineUtilTest { - - private JettyObfuscationConversionCommandLineUtil createTestSubject() { - return new JettyObfuscationConversionCommandLineUtil(); - } - - - @Test - public void testMain() throws Exception { - String[] args = new String[] { "" }; - - // default test - JettyObfuscationConversionCommandLineUtil.main(args); - } - - -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/aai/util/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/aai/util/TestSuite.java deleted file mode 100644 index f7d57ad7c..000000000 --- a/vid-app-common/src/test/java/org/openecomp/aai/util/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.aai.util; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ JettyObfuscationConversionCommandLineUtilTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java deleted file mode 100755 index ed06994aa..000000000 --- a/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java +++ /dev/null @@ -1,606 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.ecomp.vid.selenium; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterSuite; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - - -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.ie.InternetExplorerDriver; -import org.openqa.selenium.support.ui.Select; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.TimeUnit; -import org.apache.log4j.Logger; -import org.testng.Assert; -import org.testng.asserts.*; - -/** - * The Class FirstClass. - */ -public class FirstClass { - - /** The login button. */ - WebElement loginButton; - - /** The eg. */ - String eg; - - /** The login. */ - WebElement login; - - /** The pwd. */ - WebElement pwd; - - /** The log. */ - Logger log; - - /** The errormessage. */ - WebElement errormessage; - - - /** The driver. */ - WebDriver driver=new FirefoxDriver(); - - - - /** The config prop. */ - private final Properties configProp = new Properties(); - - - /** - * Instantiates a new first class. - */ - private FirstClass() { - // TODO Auto-generated constructor stub - // - try{ - // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties"); - //FileInputStream input1 = new FileInputStream("objectmap.properties"); - - InputStream input =new FileInputStream("objectconfig.properties"); - System.out.println("Read all properties from file"); - configProp.load(input); - System.out.println("Read all properties from file completed"); - } - catch(IOException e) { - - e.printStackTrace(); - } - } - - - /* - - - @BeforeClass - public void setUp() { - System.out.println("*******************"); - System.out.println("launching IE browser"); - System.setProperty("webdriver.ie.driver", driverPath+"IEDriverServer.exe"); - driver = new InternetExplorerDriver(); - driver.findElement(By.className()); - driver.manage().window().maximize(); - - - login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']")); - pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']")); - loginButton = driver.findElement(By.id("loginBtn")); - } - - - */ - /** - * Sets the up. - */ - // TODO Auto-generated method stub - @BeforeClass - public void setUp() - { - - - //WebDriver driver=new FirefoxDriver(); - - log = Logger.getLogger(FirstClass.class.getName()); - - - - // Get url - driver.get(configProp.getProperty("baseURL")); - driver.manage().window().maximize(); - - - login = driver.findElement(By.xpath(configProp.getProperty("login"))); - - pwd = driver.findElement(By.xpath(configProp.getProperty("pwd"))); - loginButton = driver.findElement(By.id(configProp.getProperty("loginButton"))); - } - - - /** - * Empty username password. - */ - @Test(priority=1) - public void emptyUsernamePassword() - { - - - //User Name and Password field is empty - log.info("-----VID-11 TC-8----Username and password empty"); - loginButton.click(); - errormessage=driver.findElement(By.xpath("//*[@id='errorInfo']/span")); - String errmsg= errormessage.getText(); - //System.out.println("Error message is"+errmsg); - //String expected = "Invaild username or password, Please try again"; - - //Assert.assertEquals(errmsg,expected); - - Boolean str = driver.getPageSource().contains("Invalid username or password, Please try again"); - System.out.println(driver.getPageSource().contains("Invalid username or password, Please try again")); - - if(str==true) - { - log.info("Error message validated"); - log.info("VID-11 TC-8 PASSED"); - - }else - log.error("Failed validation"); - - } - - - - /** - * Invalid user name. - */ - @Test(priority=2) - public void invalidUserName() - { - - log.info("-----VID-11 TC-6----Invalid Username and Valid Password"); - - - login.sendKeys("xxx"); - pwd.sendKeys("abc123"); - loginButton.click(); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - String errmsg= errormessage.getText(); - String expected = "Invalid username or password, Please try again"; - Assert.assertEquals(errmsg,expected); - //Boolean str1 = driver.getPageSource().contains("Invalid username or password, Please try again"); - //System.out.print(str1); - - log.info("VID-11 TC-6 PASSED"); - - } - - - /** - * Invalid password. - */ - @Test(priority=3) - public void invalidPassword() - { - log.info("-----VID-11 TC-7----Valid Username and Invalid Password"); - // Valid user name and Invalid password. - login.clear(); - pwd.clear(); - login.sendKeys("testuser"); - pwd.sendKeys("xxx"); - loginButton.click(); - driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); - - - String errmsg= errormessage.getText(); - String expected = "Invalid username or password, Please try again"; - Assert.assertEquals(errmsg,expected); - - //Boolean str2 = driver.getPageSource().contains("Invaild username or password, Please try again"); - //System.out.print(str2); - - log.info("VID-11 TC-7 PASSED"); - } - - - /** - * Login successful. - */ - @Test(priority=4) - public void loginSuccessful() - { - log.info("-----VID-11 TC-1----Valid Username and Valid Password"); - //Login with valid user name and password. - login.clear(); - login.sendKeys("su"); - pwd.clear(); - pwd.sendKeys("fusion"); - - - loginButton.click(); - driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); - - try { - Thread.sleep(6000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); - log.info("VID-11 TC-1 PASSED"); - - } - - - /** - * Verify home page elements left pane. - */ - @Test(priority=5) - public void verifyHomePageElementsLeftPane() - - { - - - log.info("VID-10 TC 1 "); - //VID Home - log.info("VID 11 TC-2"); - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[1]/a/span")).isDisplayed(); - //Create New Service Instance - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[2]/a/span")).isDisplayed(); - - //Browse Service Type - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[3]/a/span")).isDisplayed(); - //View Log - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[4]/a/span")).isDisplayed(); - - //Profile - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[5]/a/span")).isDisplayed(); - //Admin - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).isDisplayed(); - //Logout - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a/span")).isDisplayed(); - - //Infrastructure Subscriber Name - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[1]/div/label")).isDisplayed(); - //Infrastructure Subscriber Name Select Drop down - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")).isDisplayed(); - //Infrastructure Service Type - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[1]/div/label")).isDisplayed(); - //Infrastructure Service Type Select Drop down - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")).isDisplayed(); - //Submit button - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).isDisplayed(); - - //Login Snippet Icon - driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).isDisplayed(); - - - //String bodyText = driver.findElement(By.tagName("body")).getText(); - //Assert.assertTrue("Text not found!", bodyText.contains("Search Existing Service Instances")); - //Assert.IsTrue(driver.getPageSource.Contains("Search Existing Service Instances")); - - log.info("VID-12 TC-1"); - Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); - Assert.assertTrue(driver.getPageSource().contains("Please search by the Subscriber name or Service Type from below:")); - log.info("VID-12 TC-1 PASSED"); - log.info("VID-10 TC 1 PASSED"); - log.info("VID-11 TC-2 PASSED"); - } - - - /** - * Disabled submit button. - */ - @Test(priority=6) - public void disabledSubmitButton() - { - log.info("VID-12 TC-13"); - //Assert submit button disabled. - Assert.assertFalse(driver.findElement(By.xpath(configProp.getProperty("submitButton"))).isEnabled()); - log.info("VID-12 TC-13 PASSED"); - - } - - /** - * Default list box value. - */ - @Test(priority=7) - public void defaultListBoxValue() - { - log.info("VID-12 TC-2"); - - - //WebElement subscribername =driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")); - - Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))); - Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown")))); - - - WebElement ielement=iSelect.getFirstSelectedOption(); - WebElement oelement=oSelect.getFirstSelectedOption(); - String defaultsubscribername=oelement.getText(); - String defaultservicetype=ielement.getText(); - - Assert.assertEquals(defaultsubscribername,"Select Subscriber Name"); - Assert.assertEquals(defaultservicetype,"Select Service Type"); - - - - - //Verify Select Subscriber Name isDisplayed. - //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select/option[1]")).isSelected(); - - //Verify Select Service Type isDisplayed. - //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select/option[1]")).isSelected(); - - - log.info("VID-12 TC-2 PASSED"); - - } - - - - /** - * Select subscriber name drop down. - * - * @throws InterruptedException the interrupted exception - */ - @Test(priority=8) - public void selectSubscriberNameDropDown() throws InterruptedException - { - log.info("------------------VID-10 TC-2,VID-12 TC-11, VID-12 TC-9, VID 12 TC-10,VID-12 TC-6, VID 12 TC-5--------------------"); - - - driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown"))); - - driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown"))); - Thread.sleep(5000); - - //Infrastructure Subscriber Name - Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))); - - List elementCount = oSelect.getOptions(); - log.info("Select Element Count of Service Name"); - System.out.println(elementCount.size()); - - - //Verifying getInfrastructureSubscribersList - log.info("VID-29 TC-1"); - Assert.assertTrue(elementCount.size()>0); - log.info("VID-29 TC-1 PASSED"); - - oSelect.selectByIndex(2); - String selectedOption = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))).getFirstSelectedOption().getText(); - - System.out.println("Service Name selected is " +selectedOption); - log.info("VID-10 TC-2 PASSED"); - - //Submit button is clicked - driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click(); - - - //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); - //Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:")) - - - //Verify whether the page header is displayed "Global Customer ID" - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed(); - Assert.assertTrue(driver.getPageSource().contains("Global Customer ID")); - Assert.assertTrue(driver.getPageSource().contains("Subscriber Name")); - Assert.assertTrue(driver.getPageSource().contains("Service Type")); - Assert.assertTrue(driver.getPageSource().contains("Service Instance ID")); - - log.info("VID-12 TC-5 PASSED"); - log.info("VID-12 TC-11 PASSED"); - - WebElement serviceinstancetable =driver.findElement(By.xpath("//table[@class='tablesorter tablesorter-default ng-isolate-scope']")); - - List rows_table = serviceinstancetable.findElements(By.tagName("tr")); - //To calculate no of rows In table. - int rows_count = rows_table.size(); - - //Loop will execute till the last row of table. - for (int row=0; row Columns_row = rows_table.get(row).findElements(By.tagName("td")); - //To calculate no of columns(cells) In that specific row. - int columns_count = Columns_row.size(); - //System.out.println("Number of cells In Row "+row+" are "+columns_count); - - //Loop will execute till the last cell of that specific row. - for (int column=0; column exx= rows_table.get(1).findElements(By.tagName("td")); - eg=Columns_row.get(2).getText(); - // System.out.println("Cell value of row 1 and column 2 is" +eg); - } - } - - - - - //Verify View/Edit isDisplayed and Click - - driver.findElement(By.xpath("//a[@alt='View/Edit']")).isDisplayed(); - - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/tbody/tr[1]/td[1]/div/a")).click(); - - log.info("User clicked View/Edit"); - - //Verify the Subscriber Name displayed. - String header= driver.findElement(By.xpath("//h1[@class='heading1 ng-binding']")).getText(); - //System.out.println(header); - - - if(header.contains(eg)) - { - System.out.println("Header contains the subscriber name"); - }else - System.out.println("Header does not contain the subscriber name"); - - - - Assert.assertTrue(driver.getPageSource().contains("PerfTest Subscriber00020021")); - log.info("VID-12 TC-6 PASSED"); - - - - driver.navigate().back(); - //Cancel button isDisplayed - driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).isDisplayed(); - log.info("VID-12 TC-9 PASSED"); - - //Cancel button is clicked - driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).click(); - log.info("Cancel button is clicked"); - - //Verifying VID Home page is displayed - Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances")); - log.info("VID-12 TC-10 PASSED"); - - } - - - /** - * Refresh subscriber name. - */ - @Test(priority=9) - public void refreshSubscriberName() - { - log.info("VID-10 TC-4"); - - - driver.findElement(By.xpath(configProp.getProperty("refreshButtonSubscriberName"))).isDisplayed(); - - log.info("VID-10 TC-4 PASSED"); - - - } - - - /** - * Select subscriber type drop down. - * - * @throws InterruptedException the interrupted exception - */ - @Test(priority=9) - public void selectSubscriberTypeDropDown() throws InterruptedException - { - Thread.sleep(5000); - log.info("------------------VID-10 TC-3, VID-12 TC-12,--------------------"); - //Infrastructure Subscriber Type - Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown")))); - - List ielementCount = iSelect.getOptions(); - log.info("Select Element Count of Service type"); - System.out.println(ielementCount.size()); - iSelect.selectByIndex(1); - - log.info("VID-10 TC-3 PASSED"); - - - //Submit button is clicked - driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click(); - - //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); - //Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:")) - log.info("Page Header: Selected Subscriber's Service Instance Details"); - - - //Verify whether the page header is displayed "Global Customer ID" - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed(); - - //Assert.assertTrue(driver.getPageSource().contains("Global Customer ID")); - log.info("Table is displayed"); - - log.info("VID-12 TC-12 PASSED"); - - } - - - - /** - * Logout under profile. - */ - @Test(priority=10) - public void logoutUnderProfile() - { - - log.info("-----------VID-11 TC-5---------------------"); - //driver.findElement(By.partialLinkText("Click here to login")).click(); - //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); - - - driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).click(); - driver.findElement(By.xpath(".//*[@id='reg-logout-div']/a")).click(); - //Validate that the user has logged out of VID. Displays "Portal" - Assert.assertTrue(driver.getPageSource().contains("Portal")); - - log.info("VID-11 TC-5 PASSED"); - - } - - - - /** - * Tear down. - */ - @AfterClass - public void tearDown() - { - driver.close(); - - } - - - - } - - - - diff --git a/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java deleted file mode 100755 index 55aed8fb1..000000000 --- a/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java +++ /dev/null @@ -1,242 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.ecomp.vid.selenium; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -import org.apache.log4j.Logger; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.support.ui.Select; -import org.testng.Assert; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -/** - * The Class LogOutLeftPane. - */ -@Test(enabled=false) -public class LogOutLeftPane { - - /** The login button. */ - WebElement loginButton; - - /** The login. */ - WebElement login; - - /** The pwd. */ - WebElement pwd; - - /** The log. */ - Logger log; - - /** The errormessage. */ - WebElement errormessage; - - /** The driver. */ - WebDriver driver=new FirefoxDriver(); - - - /** The config prop. */ - private final Properties configProp = new Properties(); - - - /** - * Instantiates a new log out left pane. - */ - private LogOutLeftPane() { - // TODO Auto-generated constructor stub - // - try{ - // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties"); - //FileInputStream input1 = new FileInputStream("objectmap.properties"); - - InputStream input =new FileInputStream("objectconfig.properties"); - System.out.println("Read all properties from file"); - configProp.load(input); - System.out.println("Read all properties from file completed"); - } - catch(IOException e) { - - e.printStackTrace(); - } - } - - - - - /** - * Do before test. - */ - // TODO Auto-generated method stub - @BeforeTest - public void doBeforeTest() - { - //WebDriver driver=new FirefoxDriver(); - - log = Logger.getLogger(LogOutLeftPane.class.getName()); - - - - // Get url - driver.get("http://vid.onap.org:9080/vid/login_external.htm"); - driver.manage().window().maximize(); - - - login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']")); - pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']")); - loginButton = driver.findElement(By.id("loginBtn")); - } - - - /** - * Expand collapse panel. - * - * @throws InterruptedException the interrupted exception - */ - @Test(priority=1) - public void expandCollapsePanel() throws InterruptedException - { - - - - login.clear(); - login.sendKeys("su"); - pwd.clear(); - pwd.sendKeys("fusion"); - //driver.findElement(By.partialLinkText("Click here to login")).click(); - //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); - - loginButton.click(); - driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); - - - log.info("Clicking Profile link from left pane"); - Thread.sleep(3000); - System.out.println("properties file details --->"+configProp.getProperty("profilelink")); - driver.findElement(By.xpath(configProp.getProperty("profilelink"))).click(); - Thread.sleep(3000); - - //Verify whether the sub panel is displayed - //To verify the following :Search import from webphone and Self - driver.findElement(By.xpath(".//*[@id='panel4']")).isDisplayed(); - log.info("Expand and collapse passed for Profile link"); - - //For Admin - //Verify expand and collapse working for ADMIN - log.info("Clicking Admin link from left pane"); - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).click(); - //To verify the following: Roles, Roles Functions, Usages - driver.findElement(By.xpath(".//*[@id='panel5']")).isDisplayed(); - - - log.info("Expand and collapse passed for ADMIN link"); - - log.info("VID-11 TC-3 PASSED"); - - } - - - /** - * Drop down list. - * - * @throws InterruptedException the interrupted exception - */ - @Test(priority=2) - public void dropDownList() throws InterruptedException - { - //VID-12 TC-3 - log.info("VID-12 TC-3"); - //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")); - - //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")); - Thread.sleep(5000); - - //Infrastructure Subscriber Name - Select oSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))); - Select iSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select"))); - - List elementCount = oSelect.getOptions(); - log.info("Subscriber Name Drop Down"); - System.out.println(elementCount.size()); - oSelect.selectByIndex(1); - log.info("Subscriber name selected"); - //String selectedOption = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))).getFirstSelectedOption().getText(); - - - List count = iSelect.getOptions(); - log.info("Subscriber type drop down"); - System.out.println(count.size()); - oSelect.selectByIndex(1); - log.info("Subscriber type selected"); - - - - //Submit button is clicked - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).click(); - - - //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:" - driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed(); - log.info("VID-12 TC-3 PASSED"); - } - - - - - /** - * Logout left pane. - */ - @Test(priority=3) - public void logoutLeftPane() - { - //To Verify if the logout link redirects to Login page when clicked. - - - /*log.info("----------------VID-11 TC-4----------------"); - login.clear(); - login.sendKeys("testuser"); - pwd.clear(); - pwd.sendKeys("abc123"); - //driver.findElement(By.partialLinkText("Click here to login")).click(); - //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); - - loginButton.click(); - driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);*/ - log.info("----------------VID-11 TC-4----------------"); - driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a")).click(); - //Validate that the user has logged out of VID. Displays "Portal" - Assert.assertTrue(driver.getPageSource().contains("Portal")); - - log.info("VID 11 TC-4 PASSED"); - - driver.close(); - - } - -} diff --git a/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java b/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java deleted file mode 100755 index 2f5828b61..000000000 --- a/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java +++ /dev/null @@ -1,177 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.fusion.core; - -import java.io.IOException; - -import org.junit.Before; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.AnnotationConfigWebContextLoader; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.testng.annotations.Test; -import org.openecomp.portalsdk.core.conf.AppConfig; -import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.util.CacheManager; - -/** - * - * - * - * In order to write a unit test, - * 1. inherit this class - See SanityTest.java - * 2. place the "war" folder on your test class's classpath - * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path - * but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath - * -Dcontainer.classpath="classpath:" - * - */ - -@RunWith(SpringJUnit4ClassRunner.class) -@WebAppConfiguration -@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class}) -@ActiveProfiles(value="test") -@Test(enabled=false) -public class MockApplicationContextTestSuite { - - /** The wac. */ - @Autowired - public WebApplicationContext wac; - - /** The mock mvc. */ - private MockMvc mockMvc; - - /** - * Setup. - */ - @Before - public void setup() { - if(mockMvc == null) { - this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); - - } - } - - /** - * Gets the bean. - * - * @param name the name - * @return the bean - */ - public Object getBean(String name) { - return this.wac.getBean(name); - } - - - /** - * Gets the mock mvc. - * - * @return the mock mvc - */ - public MockMvc getMockMvc() { - return mockMvc; - } - - /** - * Sets the mock mvc. - * - * @param mockMvc the new mock mvc - */ - public void setMockMvc(MockMvc mockMvc) { - this.mockMvc = mockMvc; - } - - /** - * Gets the web application context. - * - * @return the web application context - */ - public WebApplicationContext getWebApplicationContext() { - return wac; - } - - - - -} - - - @Configuration - @ComponentScan(basePackages = "org.openecomp", - excludeFilters = { - // the following source configurations should not be scanned; instead of using Exclusion filter, we can use the @Profile annotation to exclude them - // see AppConfig class - //@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.*AppConfig*")//, - //@ComponentScan.Filter(type = FilterType.REGEX, pattern = org.openecomp.*.*AppConfig*") - } - ) - @Profile("test") - class MockAppConfig extends AppConfig { - - @Bean - public SystemProperties systemProperties(){ - return new MockSystemProperties(); - } - - @Bean - public AbstractCacheManager cacheManager() { - return new CacheManager() { - - public void configure() throws IOException { - - } - }; - } - - protected String[] tileDefinitions() { - return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"}; - } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout()); - //registry.addInterceptor(resourceInterceptor()); - } - - public static class MockSystemProperties extends SystemProperties { - - public MockSystemProperties() { - } - - } - - } - - - - diff --git a/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java b/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java deleted file mode 100755 index 0078cc6eb..000000000 --- a/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.fusionapp.controller; - -import org.junit.Assert; -import org.junit.Test; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - -import org.openecomp.fusion.core.MockApplicationContextTestSuite; - -/** - * The Class NetMapTest. - */ - -public class NetMapTest extends MockApplicationContextTestSuite { - - /** - * Test get net map. - * - * @throws Exception the exception - */ -// @Test - public void testGetNetMap() throws Exception { - ResultActions ra =getMockMvc().perform(MockMvcRequestBuilders.get("/net_map")); - //Assert.assertEquals(UrlAccessRestrictedException.class,ra.andReturn().getResolvedException().getClass()); - Assert.assertEquals("net_map_int",ra.andReturn().getModelAndView().getModel().get("frame_int")); - } - - -} diff --git a/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java b/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java deleted file mode 100755 index f8afbf8d8..000000000 --- a/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.fusionapp.service; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import org.openecomp.fusion.core.MockApplicationContextTestSuite; -import org.openecomp.portalsdk.core.domain.Profile; -import org.openecomp.portalsdk.core.domain.User; -import org.openecomp.portalsdk.core.service.ProfileService; -import org.openecomp.portalsdk.core.service.UserProfileService; - - -/** - * The Class ProfileServiceTest. - */ - -public class ProfileServiceTest extends MockApplicationContextTestSuite { - - /** The service. */ - @Autowired - ProfileService service; - - /** The user profile service. */ - @Autowired - UserProfileService userProfileService; - - /** - * Test find all. - */ - //@Test - public void testFindAll() { - try { - List profiles = service.findAll(); - Assert.assertTrue(profiles.size() > 0); - - } - catch (Exception e) { - // TODO: handle exception - } - } - - /** - * Test find all active. - */ -// @Test - public void testFindAllActive() { - - List users = userProfileService.findAllActive(); - List activeUsers = userProfileService.findAllActive(); - Assert.assertTrue(users.size() - activeUsers.size() >= 0); - } -} diff --git a/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java b/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java deleted file mode 100755 index 3ac91c220..000000000 --- a/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.src.main.java.org.vid.dao; - -import java.io.IOException; -import java.sql.SQLException; - -import org.junit.Test; - -import org.openecomp.vid.dao.FnAppDoaImpl; - -public class FnAppDoaImplTest { - - //@Test - public void testGetconnection() throws ClassNotFoundException, IOException, SQLException{ - FnAppDoaImpl impl=new FnAppDoaImpl(); - impl.getConnection(null,null,null, null); - - } - - //@Test - public void testProfileCount() throws ClassNotFoundException, IOException, SQLException{ - FnAppDoaImpl impl=new FnAppDoaImpl(); - impl.getProfileCount(null,null,null, null); - } - -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/RelatedToTest.java b/vid-app-common/src/test/java/org/openecomp/vid/RelatedToTest.java deleted file mode 100644 index 9d4930080..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/RelatedToTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.openecomp.vid; - -import java.util.Map; - -import org.junit.Test; - - -public class RelatedToTest { - - private RelatedTo createTestSubject() { - return new RelatedTo(); - } - - - @Test - public void testGetAdditionalProperties() throws Exception { - RelatedTo testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalProperties(); - } - - - @Test - public void testSetAdditionalProperty() throws Exception { - RelatedTo testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalProperty(name, value); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/TestSuite.java deleted file mode 100644 index 6e8b19602..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ RelatedToTest.class, org.openecomp.vid.aai.TestSuite.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/AaiGetVnfResponseTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/AaiGetVnfResponseTest.java deleted file mode 100644 index b959709d0..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/AaiGetVnfResponseTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.vid.aai; - -import java.util.Map; - -import org.junit.Test; - -public class AaiGetVnfResponseTest { - - private AaiGetVnfResponse createTestSubject() { - return new AaiGetVnfResponse(); - } - - @Test - public void testGetAdditionalProperties() throws Exception { - AaiGetVnfResponse testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalProperties(); - } - - @Test - public void testSetAdditionalProperty() throws Exception { - AaiGetVnfResponse testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalProperty(name, value); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/ServicePropertiesTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/ServicePropertiesTest.java deleted file mode 100644 index d3c50aff6..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/ServicePropertiesTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.vid.aai; - -import java.util.Map; - -import org.junit.Test; - -public class ServicePropertiesTest { - - private ServiceProperties createTestSubject() { - return new ServiceProperties(); - } - - @Test - public void testGetAdditionalProperties() throws Exception { - ServiceProperties testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalProperties(); - } - - @Test - public void testSetAdditionalProperty() throws Exception { - ServiceProperties testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalProperty(name, value); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/SubscriberAaiResponseTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/SubscriberAaiResponseTest.java deleted file mode 100644 index 26954011d..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/SubscriberAaiResponseTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openecomp.vid.aai; - -import org.junit.Test; -import org.openecomp.vid.model.SubscriberList; - -public class SubscriberAaiResponseTest { - - private SubscriberAaiResponse createTestSubject() { - return new SubscriberAaiResponse(new SubscriberList(), "", 0); - } - - - @Test - public void testGetSubscriberList() throws Exception { - SubscriberAaiResponse testSubject; - SubscriberList result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSubscriberList(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/SubscriberWithFilterTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/SubscriberWithFilterTest.java deleted file mode 100644 index 7fca7c99d..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/SubscriberWithFilterTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.openecomp.vid.aai; - -import org.junit.Test; - -public class SubscriberWithFilterTest { - - private SubscriberWithFilter createTestSubject() { - return new SubscriberWithFilter(); - } - - @Test - public void testGetIsPermitted() throws Exception { - SubscriberWithFilter testSubject; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getIsPermitted(); - } - - @Test - public void testSetIsPermitted() throws Exception { - SubscriberWithFilter testSubject; - boolean isPermitted = false; - - // default test - testSubject = createTestSubject(); - testSubject.setIsPermitted(isPermitted); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/TestSuite.java deleted file mode 100644 index 0629d78c8..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.aai; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ SubscriberAaiResponseTest.class, AaiGetVnfResponseTest.class, ServicePropertiesTest.class, - SubscriberWithFilterTest.class, VnfResultTest.class, org.openecomp.vid.aai.model.TestSuite.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/VnfResultTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/VnfResultTest.java deleted file mode 100644 index 6efa05aa0..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/VnfResultTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.vid.aai; - -import java.util.Map; - -import org.junit.Test; - -public class VnfResultTest { - - private VnfResult createTestSubject() { - return new VnfResult(); - } - - @Test - public void testGetAdditionalProperties() throws Exception { - VnfResult testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalProperties(); - } - - @Test - public void testSetAdditionalProperty() throws Exception { - VnfResult testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalProperty(name, value); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelatedToPropertyTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelatedToPropertyTest.java deleted file mode 100644 index 08a87173b..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelatedToPropertyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.openecomp.vid.aai.model; - -import org.junit.Test; - - -public class RelatedToPropertyTest { - - private RelatedToProperty createTestSubject() { - return new RelatedToProperty(); - } - - - @Test - public void testGetPropertyKey() throws Exception { - RelatedToProperty testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getPropertyKey(); - } - - - @Test - public void testSetPropertyKey() throws Exception { - RelatedToProperty testSubject; - String propertyKey = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setPropertyKey(propertyKey); - } - - - @Test - public void testGetPropertyValue() throws Exception { - RelatedToProperty testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getPropertyValue(); - } - - - @Test - public void testSetPropertyValue() throws Exception { - RelatedToProperty testSubject; - String propertyValue = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setPropertyValue(propertyValue); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelationshipDataTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelationshipDataTest.java deleted file mode 100644 index 4df27ccd8..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelationshipDataTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.openecomp.vid.aai.model; - -import org.junit.Test; - - -public class RelationshipDataTest { - - private RelationshipData createTestSubject() { - return new RelationshipData(); - } - - - @Test - public void testGetRelationshipKey() throws Exception { - RelationshipData testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelationshipKey(); - } - - - @Test - public void testSetRelationshipKey() throws Exception { - RelationshipData testSubject; - String relationshipKey = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setRelationshipKey(relationshipKey); - } - - - @Test - public void testGetRelationshipValue() throws Exception { - RelationshipData testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelationshipValue(); - } - - - @Test - public void testSetRelationshipValue() throws Exception { - RelationshipData testSubject; - String relationshipValue = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setRelationshipValue(relationshipValue); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelationshipTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelationshipTest.java deleted file mode 100644 index 4f5e33535..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/RelationshipTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.openecomp.vid.aai.model; - -import java.util.List; - -import org.junit.Test; - - -public class RelationshipTest { - - private Relationship createTestSubject() { - return new Relationship(); - } - - - @Test - public void testGetRelatedTo() throws Exception { - Relationship testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelatedTo(); - } - - - @Test - public void testSetRelatedTo() throws Exception { - Relationship testSubject; - String relatedTo = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setRelatedTo(relatedTo); - } - - - @Test - public void testGetRelatedLink() throws Exception { - Relationship testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelatedLink(); - } - - - @Test - public void testSetRelatedLink() throws Exception { - Relationship testSubject; - String relatedLink = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setRelatedLink(relatedLink); - } - - - @Test - public void testGetRelationDataList() throws Exception { - Relationship testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelationDataList(); - } - - - @Test - public void testSetRelationDataList() throws Exception { - Relationship testSubject; - List relationDataList = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRelationDataList(relationDataList); - } - - - @Test - public void testGetRelatedToPropertyList() throws Exception { - Relationship testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelatedToPropertyList(); - } - - - @Test - public void testSetRelatedToPropertyList() throws Exception { - Relationship testSubject; - List relatedToPropertyList = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRelatedToPropertyList(relatedToPropertyList); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/ServiceRelationshipsTest.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/model/ServiceRelationshipsTest.java deleted file mode 100644 index c67e3f8d9..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/ServiceRelationshipsTest.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.openecomp.vid.aai.model; - -import org.junit.Test; - - -public class ServiceRelationshipsTest { - - private ServiceRelationships createTestSubject() { - return new ServiceRelationships(); - } - - - @Test - public void testGetServiceInstanceId() throws Exception { - ServiceRelationships testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceInstanceId(); - } - - - @Test - public void testSetServiceInstanceId() throws Exception { - ServiceRelationships testSubject; - String serviceInstanceId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceInstanceId(serviceInstanceId); - } - - - @Test - public void testGetServiceInstanceName() throws Exception { - ServiceRelationships testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceInstanceName(); - } - - - @Test - public void testSetServiceInstanceName() throws Exception { - ServiceRelationships testSubject; - String serviceInstanceName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceInstanceName(serviceInstanceName); - } - - - @Test - public void testGetModelInvariantId() throws Exception { - ServiceRelationships testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getModelInvariantId(); - } - - - @Test - public void testSetModelInvariantId() throws Exception { - ServiceRelationships testSubject; - String modelInvariantId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setModelInvariantId(modelInvariantId); - } - - - @Test - public void testGetModelVersionId() throws Exception { - ServiceRelationships testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getModelVersionId(); - } - - - @Test - public void testSetModelVersionId() throws Exception { - ServiceRelationships testSubject; - String modelVersionId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setModelVersionId(modelVersionId); - } - - - @Test - public void testGetResourceVersion() throws Exception { - ServiceRelationships testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceVersion(); - } - - - @Test - public void testSetResourceVersion() throws Exception { - ServiceRelationships testSubject; - String resourceVersion = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceVersion(resourceVersion); - } - - - @Test - public void testGetOrchestrationStatus() throws Exception { - ServiceRelationships testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getOrchestrationStatus(); - } - - - @Test - public void testSetOrchestrationStatus() throws Exception { - ServiceRelationships testSubject; - String orchestrationStatus = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setOrchestrationStatus(orchestrationStatus); - } - - - @Test - public void testGetRelationshipList() throws Exception { - ServiceRelationships testSubject; - RelationshipList result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelationshipList(); - } - - - @Test - public void testSetRelationshipList() throws Exception { - ServiceRelationships testSubject; - RelationshipList relationshipList = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRelationshipList(relationshipList); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/aai/model/TestSuite.java deleted file mode 100644 index 34ca70bd8..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/aai/model/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.aai.model; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ ServiceRelationshipsTest.class, RelationshipTest.class, RelatedToPropertyTest.class, RelationshipDataTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/ArtifactTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/ArtifactTest.java deleted file mode 100644 index 8251ca0c5..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/ArtifactTest.java +++ /dev/null @@ -1,277 +0,0 @@ -package org.openecomp.vid.asdc.beans; - -import org.junit.Test; - - -public class ArtifactTest { - - private Artifact createTestSubject() { - return new Artifact(); - } - - - @Test - public void testGetArtifactName() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactName(); - } - - - @Test - public void testGetArtifactType() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactType(); - } - - - @Test - public void testGetArtifactGroupType() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactGroupType(); - } - - - @Test - public void testGetArtifactLabel() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactLabel(); - } - - - @Test - public void testGetArtifactURL() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactURL(); - } - - - @Test - public void testGetArtifactDescription() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactDescription(); - } - - - @Test - public void testGetArtifactTimeout() throws Exception { - Artifact testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactTimeout(); - } - - - @Test - public void testGetArtifactChecksum() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactChecksum(); - } - - - @Test - public void testGetArtifactUUID() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactUUID(); - } - - - @Test - public void testGetArtifactVersion() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactVersion(); - } - - - @Test - public void testGetGeneratedFromUUID() throws Exception { - Artifact testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGeneratedFromUUID(); - } - - - @Test - public void testSetArtifactName() throws Exception { - Artifact testSubject; - String artifactName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactName(artifactName); - } - - - @Test - public void testSetArtifactType() throws Exception { - Artifact testSubject; - String artifactType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactType(artifactType); - } - - - @Test - public void testSetArtifactGroupType() throws Exception { - Artifact testSubject; - String artifactGroupType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactGroupType(artifactGroupType); - } - - - @Test - public void testSetArtifactLabel() throws Exception { - Artifact testSubject; - String artifactLabel = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactLabel(artifactLabel); - } - - - @Test - public void testSetArtifactURL() throws Exception { - Artifact testSubject; - String artifactURL = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactURL(artifactURL); - } - - - @Test - public void testSetArtifactDescription() throws Exception { - Artifact testSubject; - String artifactDescription = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactDescription(artifactDescription); - } - - - @Test - public void testSetArtifactTimeout() throws Exception { - Artifact testSubject; - int artifactTimeout = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactTimeout(artifactTimeout); - } - - - @Test - public void testSetArtifactChecksum() throws Exception { - Artifact testSubject; - String artifactChecksum = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactChecksum(artifactChecksum); - } - - - @Test - public void testSetArtifactUUID() throws Exception { - Artifact testSubject; - String artifactUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactUUID(artifactUUID); - } - - - @Test - public void testSetArtifactVersion() throws Exception { - Artifact testSubject; - String artifactVersion = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactVersion(artifactVersion); - } - - - @Test - public void testSetGeneratedFromUUID() throws Exception { - Artifact testSubject; - String generatedFromUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setGeneratedFromUUID(generatedFromUUID); - } - - - @Test - public void testHashCode() throws Exception { - Artifact testSubject; - int result; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactUUID("48a52540-8772-4368-9cdb-1f124ea5c931"); - result = testSubject.hashCode(); - } - - - @Test - public void testEquals() throws Exception { - Artifact testSubject; - Object o = null; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.equals(o); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/ResourceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/ResourceTest.java deleted file mode 100644 index b73056002..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/ResourceTest.java +++ /dev/null @@ -1,391 +0,0 @@ -package org.openecomp.vid.asdc.beans; - -import java.util.Collection; - -import org.junit.Test; -import org.openecomp.vid.asdc.beans.Resource.LifecycleState; -import org.openecomp.vid.asdc.beans.Resource.Type; - - -public class ResourceTest { - - private Resource createTestSubject() { - return new Resource(); - } - - - @Test - public void testGetUuid() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUuid(); - } - - - @Test - public void testGetInvariantUUID() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInvariantUUID(); - } - - - @Test - public void testGetName() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getName(); - } - - - @Test - public void testGetDescription() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - - @Test - public void testGetVersion() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVersion(); - } - - - @Test - public void testGetToscaModelURL() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaModelURL(); - } - - - @Test - public void testGetCategory() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCategory(); - } - - - @Test - public void testGetSubCategory() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSubCategory(); - } - - - @Test - public void testGetResourceType() throws Exception { - Resource testSubject; - Type result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceType(); - } - - - @Test - public void testGetLifecycleState() throws Exception { - Resource testSubject; - LifecycleState result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLifecycleState(); - } - - - @Test - public void testGetLastUpdaterUserId() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterUserId(); - } - - - @Test - public void testGetLastUpdaterFullName() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterFullName(); - } - - - @Test - public void testGetToscaModel() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaModel(); - } - - - @Test - public void testGetToscaResourceName() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaResourceName(); - } - - - @Test - public void testGetArtifacts() throws Exception { - Resource testSubject; - Collection result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testGetResources() throws Exception { - Resource testSubject; - Collection result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResources(); - } - - - @Test - public void testSetUuid() throws Exception { - Resource testSubject; - String uuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUuid(uuid); - } - - - @Test - public void testSetInvariantUUID() throws Exception { - Resource testSubject; - String invariantUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setInvariantUUID(invariantUUID); - } - - - @Test - public void testSetName() throws Exception { - Resource testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setName(name); - } - - - @Test - public void testSetDescription() throws Exception { - Resource testSubject; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDescription(description); - } - - - @Test - public void testSetVersion() throws Exception { - Resource testSubject; - String version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVersion(version); - } - - - @Test - public void testSetToscaModelURL() throws Exception { - Resource testSubject; - String toscaModelURL = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaModelURL(toscaModelURL); - } - - - @Test - public void testSetCategory() throws Exception { - Resource testSubject; - String category = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCategory(category); - } - - - @Test - public void testSetSubCategory() throws Exception { - Resource testSubject; - String subCategory = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setSubCategory(subCategory); - } - - - @Test - public void testSetResourceType() throws Exception { - Resource testSubject; - Type resourceType = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceType(resourceType); - } - - - @Test - public void testSetLifecycleState() throws Exception { - Resource testSubject; - LifecycleState lifecycleState = null; - - // default test - testSubject = createTestSubject(); - testSubject.setLifecycleState(lifecycleState); - } - - - @Test - public void testSetLastUpdaterUserId() throws Exception { - Resource testSubject; - String lastUpdaterUserId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLastUpdaterUserId(lastUpdaterUserId); - } - - - @Test - public void testSetLastUpdaterFullName() throws Exception { - Resource testSubject; - String lastUpdaterFullName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLastUpdaterFullName(lastUpdaterFullName); - } - - - @Test - public void testSetToscaModel() throws Exception { - Resource testSubject; - String toscaModel = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaModel(toscaModel); - } - - - @Test - public void testSetToscaResourceName() throws Exception { - Resource testSubject; - String toscaResourceName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaResourceName(toscaResourceName); - } - - - @Test - public void testSetArtifacts() throws Exception { - Resource testSubject; - Collection artifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifacts(artifacts); - } - - - @Test - public void testSetResources() throws Exception { - Resource testSubject; - Collection resources = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResources(resources); - } - - - @Test - public void testHashCode() throws Exception { - Resource testSubject; - int result; - - // default test - testSubject = createTestSubject(); - testSubject.setUuid("cb49608f-5a24-4789-b0f7-2595473cb997"); - result = testSubject.hashCode(); - } - - - @Test - public void testEquals() throws Exception { - Resource testSubject; - Object o = null; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.equals(o); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/SubResourceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/SubResourceTest.java deleted file mode 100644 index 75b0e9869..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/SubResourceTest.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.openecomp.vid.asdc.beans; - -import java.util.Collection; - -import org.junit.Test; - - -public class SubResourceTest { - - private SubResource createTestSubject() { - return new SubResource(); - } - - - @Test - public void testGetResourceInstanceName() throws Exception { - SubResource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceInstanceName(); - } - - - @Test - public void testGetResourceName() throws Exception { - SubResource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceName(); - } - - - @Test - public void testGetResourceInvariantUUID() throws Exception { - SubResource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceInvariantUUID(); - } - - - @Test - public void testGetResourceVersion() throws Exception { - SubResource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceVersion(); - } - - - @Test - public void testGetResoucreType() throws Exception { - SubResource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResoucreType(); - } - - - @Test - public void testGetResourceUUID() throws Exception { - SubResource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceUUID(); - } - - - @Test - public void testGetArtifacts() throws Exception { - SubResource testSubject; - Collection result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testSetResourceInstanceName() throws Exception { - SubResource testSubject; - String resourceInstanceName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceInstanceName(resourceInstanceName); - } - - - @Test - public void testSetResourceName() throws Exception { - SubResource testSubject; - String resourceName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceName(resourceName); - } - - - @Test - public void testSetResourceInvariantUUID() throws Exception { - SubResource testSubject; - String resourceInvariantUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceInvariantUUID(resourceInvariantUUID); - } - - - @Test - public void testSetResourceVersion() throws Exception { - SubResource testSubject; - String resourceVersion = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceVersion(resourceVersion); - } - - - @Test - public void testSetResoucreType() throws Exception { - SubResource testSubject; - String resourceType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResoucreType(resourceType); - } - - - @Test - public void testSetResourceUUID() throws Exception { - SubResource testSubject; - String resourceUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceUUID(resourceUUID); - } - - - @Test - public void testSetArtifacts() throws Exception { - SubResource testSubject; - Collection artifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifacts(artifacts); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/TestSuite.java deleted file mode 100644 index 861c5c36e..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.asdc.beans; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ ArtifactTest.class, ResourceTest.class, SubResourceTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/CapabilityTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/CapabilityTest.java deleted file mode 100644 index 4eed93b59..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/CapabilityTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.openecomp.vid.asdc.beans.tosca; - -import java.util.Collection; -import java.util.Map; - -import org.junit.Test; - - -public class CapabilityTest { - - private Capability createTestSubject() { - return new Capability(); - } - - - @Test - public void testGetType() throws Exception { - Capability testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getType(); - } - - - @Test - public void testGetDescription() throws Exception { - Capability testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - - @Test - public void testGetOccurrences() throws Exception { - Capability testSubject; - Collection result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getOccurrences(); - } - - - @Test - public void testGetProperties() throws Exception { - Capability testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProperties(); - } - - - @Test - public void testGetValid_source_types() throws Exception { - Capability testSubject; - Collection result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getValid_source_types(); - } - - - @Test - public void testSetType() throws Exception { - Capability testSubject; - String type = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setType(type); - } - - - @Test - public void testSetDescription() throws Exception { - Capability testSubject; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDescription(description); - } - - - @Test - public void testSetOccurrences() throws Exception { - Capability testSubject; - Collection occurrences = null; - - // default test - testSubject = createTestSubject(); - testSubject.setOccurrences(occurrences); - } - - - @Test - public void testSetProperties() throws Exception { - Capability testSubject; - Map properties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setProperties(properties); - } - - - @Test - public void testSetValid_source_types() throws Exception { - Capability testSubject; - Collection valid_source_types = null; - - // default test - testSubject = createTestSubject(); - testSubject.setValid_source_types(valid_source_types); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ConstraintTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ConstraintTest.java deleted file mode 100644 index fb416f7e5..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ConstraintTest.java +++ /dev/null @@ -1,221 +0,0 @@ -package org.openecomp.vid.asdc.beans.tosca; - -import java.util.List; - -import org.junit.Test; - -public class ConstraintTest { - - private Constraint createTestSubject() { - return new Constraint(); - } - - - @Test - public void testGetvalid_values() throws Exception { - Constraint testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getvalid_values(); - } - - - @Test - public void testGetEqual() throws Exception { - Constraint testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getEqual(); - } - - - @Test - public void testGetGreater_than() throws Exception { - Constraint testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGreater_than(); - } - - - @Test - public void testGetGreater_or_equal() throws Exception { - Constraint testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGreater_or_equal(); - } - - - @Test - public void testGetLess_than() throws Exception { - Constraint testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLess_than(); - } - - - @Test - public void testGetLess_or_equal() throws Exception { - Constraint testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLess_or_equal(); - } - - - @Test - public void testGetIn_range() throws Exception { - Constraint testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getIn_range(); - } - - - @Test - public void testGetLength() throws Exception { - Constraint testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLength(); - } - - - @Test - public void testGetMin_length() throws Exception { - Constraint testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMin_length(); - } - - - @Test - public void testGetMax_length() throws Exception { - Constraint testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMax_length(); - } - - - @Test - public void testSetvalid_values() throws Exception { - Constraint testSubject; - List vlist = null; - - // default test - testSubject = createTestSubject(); - testSubject.setvalid_values(vlist); - } - - - @Test - public void testSetEqual() throws Exception { - Constraint testSubject; - Object e = null; - - // default test - testSubject = createTestSubject(); - testSubject.setEqual(e); - } - - - @Test - public void testSetGreater_than() throws Exception { - Constraint testSubject; - Object e = null; - - // default test - testSubject = createTestSubject(); - testSubject.setGreater_than(e); - } - - - @Test - public void testSetLess_than() throws Exception { - Constraint testSubject; - Object e = null; - - // default test - testSubject = createTestSubject(); - testSubject.setLess_than(e); - } - - - @Test - public void testSetIn_range() throws Exception { - Constraint testSubject; - List e = null; - - // default test - testSubject = createTestSubject(); - testSubject.setIn_range(e); - } - - - @Test - public void testSetLength() throws Exception { - Constraint testSubject; - Object e = null; - - // default test - testSubject = createTestSubject(); - testSubject.setLength(e); - } - - - @Test - public void testSetMin_length() throws Exception { - Constraint testSubject; - Object e = null; - - // default test - testSubject = createTestSubject(); - testSubject.setMin_length(e); - } - - - @Test - public void testSetMax_length() throws Exception { - Constraint testSubject; - Object e = null; - - // default test - testSubject = createTestSubject(); - testSubject.setMax_length(e); - } - - - @Test - public void testToString() throws Exception { - Constraint testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/GroupTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/GroupTest.java deleted file mode 100644 index d3a1e4bba..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/GroupTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.openecomp.vid.asdc.beans.tosca; - -import java.util.Collection; -import java.util.Map; - -import org.junit.Test; - - -public class GroupTest { - - private Group createTestSubject() { - return new Group(); - } - - - @Test - public void testGetMetadata() throws Exception { - Group testSubject; - ToscaMetadata result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMetadata(); - } - - - @Test - public void testSetMetadata() throws Exception { - Group testSubject; - ToscaMetadata metadata = null; - - // default test - testSubject = createTestSubject(); - testSubject.setMetadata(metadata); - } - - - @Test - public void testGetMembers() throws Exception { - Group testSubject; - Collection result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMembers(); - } - - - @Test - public void testSetMembers() throws Exception { - Group testSubject; - Collection members = null; - - // default test - testSubject = createTestSubject(); - testSubject.setMembers(members); - } - - - @Test - public void testGetType() throws Exception { - Group testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getType(); - } - - - @Test - public void testSetType() throws Exception { - Group testSubject; - String type = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setType(type); - } - - - @Test - public void testGetvf_module_type() throws Exception { - Group testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getvf_module_type(); - } - - - @Test - public void testSetvf_module_type() throws Exception { - Group testSubject; - String vf_module_type = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setvf_module_type(vf_module_type); - } - - - @Test - public void testGetProperties() throws Exception { - Group testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProperties(); - } - - - @Test - public void testSetProperties() throws Exception { - Group testSubject; - Map properties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setProperties(properties); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplateTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplateTest.java deleted file mode 100644 index 89177807e..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplateTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.openecomp.vid.asdc.beans.tosca; - -import java.util.Map; - -import org.junit.Test; - -public class NodeTemplateTest { - - private NodeTemplate createTestSubject() { - return new NodeTemplate(); - } - - @Test - public void testGetType() throws Exception { - NodeTemplate testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getType(); - } - - @Test - public void testSetType() throws Exception { - NodeTemplate testSubject; - String type = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setType(type); - } - - @Test - public void testGetMetadata() throws Exception { - NodeTemplate testSubject; - ToscaMetadata result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMetadata(); - } - - @Test - public void testSetMetadata() throws Exception { - NodeTemplate testSubject; - ToscaMetadata metadata = null; - - // default test - testSubject = createTestSubject(); - testSubject.setMetadata(metadata); - } - - @Test - public void testGetProperties() throws Exception { - NodeTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProperties(); - } - - @Test - public void testSetProperties() throws Exception { - NodeTemplate testSubject; - Map properties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setProperties(properties); - } - - @Test - public void testGetRequirements() throws Exception { - NodeTemplate testSubject; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequirements(); - } - - @Test - public void testSetRequirements() throws Exception { - NodeTemplate testSubject; - Object requirements = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRequirements(requirements); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/TestSuite.java deleted file mode 100644 index 40e086837..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.asdc.beans.tosca; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ GroupTest.class, TopologyTemplateTest.class, ToscaModelTest.class, CapabilityTest.class, ToscaMetadataTest.class, - ConstraintTest.class, NodeTemplateTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplateTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplateTest.java deleted file mode 100644 index a3b96c261..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplateTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.openecomp.vid.asdc.beans.tosca; - -import java.util.Map; - -import org.junit.Test; - - -public class TopologyTemplateTest { - - private TopologyTemplate createTestSubject() { - return new TopologyTemplate(); - } - - - @Test - public void testGetsubstitution_mappings() throws Exception { - TopologyTemplate testSubject; - SubstitutionMappings result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getsubstitution_mappings(); - } - - - @Test - public void testSetsubstitution_mappings() throws Exception { - TopologyTemplate testSubject; - SubstitutionMappings substitution_mappings = null; - - // default test - testSubject = createTestSubject(); - testSubject.setsubstitution_mappings(substitution_mappings); - } - - - @Test - public void testGetInputs() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInputs(); - } - - - @Test - public void testSetInputs() throws Exception { - TopologyTemplate testSubject; - Map inputs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInputs(inputs); - } - - - @Test - public void testGetnode_templates() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getnode_templates(); - } - - - @Test - public void testSetnode_templates() throws Exception { - TopologyTemplate testSubject; - Map node_templates = null; - - // default test - testSubject = createTestSubject(); - testSubject.setnode_templates(node_templates); - } - - - @Test - public void testGetGroups() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGroups(); - } - - - @Test - public void testSetGroups() throws Exception { - TopologyTemplate testSubject; - Map groups = null; - - // default test - testSubject = createTestSubject(); - testSubject.setGroups(groups); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadataTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadataTest.java deleted file mode 100644 index 4c6fed5c5..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadataTest.java +++ /dev/null @@ -1,443 +0,0 @@ -package org.openecomp.vid.asdc.beans.tosca; - -import org.junit.Test; - -public class ToscaMetadataTest { - - private ToscaMetadata createTestSubject() { - return new ToscaMetadata(); - } - - @Test - public void testGetType() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getType(); - } - - @Test - public void testGetInvariantUUID() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInvariantUUID(); - } - - @Test - public void testGetCustomizationUUID() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCustomizationUUID(); - } - - @Test - public void testGetUUID() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUUID(); - } - - @Test - public void testGetVersion() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVersion(); - } - - @Test - public void testGetName() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getName(); - } - - @Test - public void testGetDescription() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - @Test - public void testGetCategory() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCategory(); - } - - @Test - public void testGetSubcategory() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSubcategory(); - } - - @Test - public void testGetResourceVendor() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceVendor(); - } - - @Test - public void testGetResourceVendorRelease() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceVendorRelease(); - } - - @Test - public void testGetServiceEcompNaming() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceEcompNaming(); - } - - @Test - public void testGetNamingPolicy() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getNamingPolicy(); - } - - @Test - public void testIsServiceHoming() throws Exception { - ToscaMetadata testSubject; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isServiceHoming(); - } - - @Test - public void testIsEcompGeneratedNaming() throws Exception { - ToscaMetadata testSubject; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isEcompGeneratedNaming(); - } - - @Test - public void testSetType() throws Exception { - ToscaMetadata testSubject; - String type = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setType(type); - } - - @Test - public void testSetInvariantUUID() throws Exception { - ToscaMetadata testSubject; - String invariantUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setInvariantUUID(invariantUUID); - } - - @Test - public void testSetNamingPolicy() throws Exception { - ToscaMetadata testSubject; - String namingPolicy = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setNamingPolicy(namingPolicy); - } - - @Test - public void testSetUUID() throws Exception { - ToscaMetadata testSubject; - String uuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUUID(uuid); - } - - @Test - public void testSetCustomizationUUID() throws Exception { - ToscaMetadata testSubject; - String u = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCustomizationUUID(u); - } - - @Test - public void testSetVersion() throws Exception { - ToscaMetadata testSubject; - String version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVersion(version); - } - - @Test - public void testSetName() throws Exception { - ToscaMetadata testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setName(name); - } - - @Test - public void testSetDescription() throws Exception { - ToscaMetadata testSubject; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDescription(description); - } - - @Test - public void testSetCategory() throws Exception { - ToscaMetadata testSubject; - String category = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCategory(category); - } - - @Test - public void testSetServiceEcompNaming() throws Exception { - ToscaMetadata testSubject; - String serviceEcompNaming = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceEcompNaming(serviceEcompNaming); - } - - @Test - public void testSetServiceHoming() throws Exception { - ToscaMetadata testSubject; - boolean serviceHoming = false; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceHoming(serviceHoming); - } - - @Test - public void testSetEcompGeneratedNaming() throws Exception { - ToscaMetadata testSubject; - boolean ecompGeneratedNaming = false; - - // default test - testSubject = createTestSubject(); - testSubject.setEcompGeneratedNaming(ecompGeneratedNaming); - } - - @Test - public void testGettemplate_name() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.gettemplate_name(); - } - - @Test - public void testSettemplate_name() throws Exception { - ToscaMetadata testSubject; - String template_name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.settemplate_name(template_name); - } - - - @Test - public void testSetSubcategory() throws Exception { - ToscaMetadata testSubject; - String subcategory = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setSubcategory(subcategory); - } - - - @Test - public void testSetResourceVendor() throws Exception { - ToscaMetadata testSubject; - String resourceVendor = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceVendor(resourceVendor); - } - - - @Test - public void testSetResourceVendorRelease() throws Exception { - ToscaMetadata testSubject; - String resourceVendorRelease = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceVendorRelease(resourceVendorRelease); - } - - - @Test - public void testGetVfModuleModelName() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModuleModelName(); - } - - - @Test - public void testSetVfModuleModelName() throws Exception { - ToscaMetadata testSubject; - String vfModuleModelName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModuleModelName(vfModuleModelName); - } - - - @Test - public void testGetVfModuleModelInvariantUUID() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModuleModelInvariantUUID(); - } - - - @Test - public void testSetVfModuleModelInvariantUUID() throws Exception { - ToscaMetadata testSubject; - String vfModuleModelInvariantUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModuleModelInvariantUUID(vfModuleModelInvariantUUID); - } - - - @Test - public void testGetVfModuleModelUUID() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModuleModelUUID(); - } - - - @Test - public void testSetVfModuleModelUUID() throws Exception { - ToscaMetadata testSubject; - String vfModuleModelUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModuleModelUUID(vfModuleModelUUID); - } - - - @Test - public void testGetVfModuleModelVersion() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModuleModelVersion(); - } - - - @Test - public void testSetVfModuleModelVersion() throws Exception { - ToscaMetadata testSubject; - String vfModuleModelVersion = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModuleModelVersion(vfModuleModelVersion); - } - - - @Test - public void testSetVfModuleModelCustomizationUUID() throws Exception { - ToscaMetadata testSubject; - String u = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModuleModelCustomizationUUID(u); - } - - - @Test - public void testGetVfModuleModelCustomizationUUID() throws Exception { - ToscaMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModuleModelCustomizationUUID(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ToscaModelTest.java b/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ToscaModelTest.java deleted file mode 100644 index 6fb6f8932..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/asdc/beans/tosca/ToscaModelTest.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.openecomp.vid.asdc.beans.tosca; - -import java.util.Collection; -import java.util.Map; - -import org.junit.Test; - - -public class ToscaModelTest { - - private ToscaModel createTestSubject() { - return new ToscaModel(); - } - - - @Test - public void testGetMetadata() throws Exception { - ToscaModel testSubject; - ToscaMetadata result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMetadata(); - } - - - @Test - public void testSetMetadata() throws Exception { - ToscaModel testSubject; - ToscaMetadata metadata = null; - - // default test - testSubject = createTestSubject(); - testSubject.setMetadata(metadata); - } - - - @Test - public void testGettosca_definitions_version() throws Exception { - ToscaModel testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.gettosca_definitions_version(); - } - - - @Test - public void testSettosca_definitions_version() throws Exception { - ToscaModel testSubject; - String tosca_definitions_version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.settosca_definitions_version(tosca_definitions_version); - } - - - @Test - public void testGettopology_template() throws Exception { - ToscaModel testSubject; - TopologyTemplate result; - - // default test - testSubject = createTestSubject(); - result = testSubject.gettopology_template(); - } - - - @Test - public void testSettopology_template() throws Exception { - ToscaModel testSubject; - TopologyTemplate topology_template = null; - - // default test - testSubject = createTestSubject(); - testSubject.settopology_template(topology_template); - } - - - @Test - public void testGetDescription() throws Exception { - ToscaModel testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - - @Test - public void testSetDescription() throws Exception { - ToscaModel testSubject; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDescription(description); - } - - - @Test - public void testGetImports() throws Exception { - ToscaModel testSubject; - Collection>> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getImports(); - } - - - @Test - public void testSetImports() throws Exception { - ToscaModel testSubject; - Collection>> imports = null; - - // default test - testSubject = createTestSubject(); - testSubject.setImports(imports); - } - - - @Test - public void testGetnode_types() throws Exception { - ToscaModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getnode_types(); - } - - - @Test - public void testSetnode_types() throws Exception { - ToscaModel testSubject; - Map node_types = null; - - // default test - testSubject = createTestSubject(); - testSubject.setnode_types(node_types); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/client/FakeHttpSessionTest.java b/vid-app-common/src/test/java/org/openecomp/vid/client/FakeHttpSessionTest.java deleted file mode 100644 index f28558570..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/client/FakeHttpSessionTest.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.openecomp.vid.client; - -import java.util.Enumeration; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSessionContext; - -import org.junit.Test; - - -public class FakeHttpSessionTest { - - private FakeHttpSession createTestSubject() { - return new FakeHttpSession(); - } - - - @Test - public void testGetCreationTime() throws Exception { - FakeHttpSession testSubject; - long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCreationTime(); - } - - - @Test - public void testGetId() throws Exception { - FakeHttpSession testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getId(); - } - - - @Test - public void testGetLastAccessedTime() throws Exception { - FakeHttpSession testSubject; - long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastAccessedTime(); - } - - - @Test - public void testGetServletContext() throws Exception { - FakeHttpSession testSubject; - ServletContext result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServletContext(); - } - - - @Test - public void testSetMaxInactiveInterval() throws Exception { - FakeHttpSession testSubject; - int maxInactiveInterval = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setMaxInactiveInterval(maxInactiveInterval); - } - - - @Test - public void testGetMaxInactiveInterval() throws Exception { - FakeHttpSession testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMaxInactiveInterval(); - } - - - @Test - public void testGetSessionContext() throws Exception { - FakeHttpSession testSubject; - HttpSessionContext result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSessionContext(); - } - - - @Test - public void testGetAttribute() throws Exception { - FakeHttpSession testSubject; - String name = ""; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAttribute(name); - } - - - @Test - public void testGetValue() throws Exception { - FakeHttpSession testSubject; - String name = ""; - Object result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getValue(name); - } - - - @Test - public void testGetAttributeNames() throws Exception { - FakeHttpSession testSubject; - Enumeration result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAttributeNames(); - } - - - @Test - public void testGetValueNames() throws Exception { - FakeHttpSession testSubject; - String[] result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getValueNames(); - } - - - @Test - public void testSetAttribute() throws Exception { - FakeHttpSession testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAttribute(name, value); - } - - - @Test - public void testPutValue() throws Exception { - FakeHttpSession testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.putValue(name, value); - } - - - @Test - public void testRemoveAttribute() throws Exception { - FakeHttpSession testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.removeAttribute(name); - } - - - @Test - public void testRemoveValue() throws Exception { - FakeHttpSession testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.removeValue(name); - } - - - @Test - public void testInvalidate() throws Exception { - FakeHttpSession testSubject; - - // default test - testSubject = createTestSubject(); - testSubject.invalidate(); - } - - - @Test - public void testIsNew() throws Exception { - FakeHttpSession testSubject; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isNew(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/client/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/client/TestSuite.java deleted file mode 100644 index dbbd56910..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/client/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.client; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ FakeHttpSessionTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/controller/AaiControllerTest.java b/vid-app-common/src/test/java/org/openecomp/vid/controller/AaiControllerTest.java deleted file mode 100644 index e342940f3..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/controller/AaiControllerTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.openecomp.vid.controller; - -import javax.servlet.http.HttpServletRequest; - -import org.json.simple.JSONObject; -import org.junit.Test; -import org.springframework.http.ResponseEntity; -import org.springframework.web.servlet.ModelAndView; - -public class AaiControllerTest { - - private AaiController createTestSubject() { - return new AaiController(); - } - - @Test - public void testParseCustomerObjectForTenants() throws Exception { - JSONObject jsonObject = null; - String result; - - // default test - result = AaiController.parseCustomerObjectForTenants(jsonObject); - } - - @Test - public void testParseServiceSubscriptionObjectForTenants() throws Exception { - JSONObject jsonObject = null; - String result; - - // default test - result = AaiController.parseServiceSubscriptionObjectForTenants(jsonObject); - } - - @Test - public void testWelcome() throws Exception { - AaiController testSubject; - HttpServletRequest request = null; - ModelAndView result; - - // default test - testSubject = createTestSubject(); - result = testSubject.welcome(request); - } - - @Test - public void testGetViewName() throws Exception { - AaiController testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getViewName(); - } - - @Test - public void testSetViewName() throws Exception { - AaiController testSubject; - String viewName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setViewName(viewName); - } - - @Test - public void testGetTargetProvStatus() throws Exception { - AaiController testSubject; - ResponseEntity result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTargetProvStatus(); - } - - @Test - public void testViewEditGetTenantsFromServiceType() throws Exception { - AaiController testSubject; - HttpServletRequest request = null; - String globalCustomerId = ""; - String serviceType = ""; - ResponseEntity result; - - // default test - testSubject = createTestSubject(); - result = testSubject.viewEditGetTenantsFromServiceType(request, globalCustomerId, serviceType); - } - -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/controller/HealthCheckControllerTest.java b/vid-app-common/src/test/java/org/openecomp/vid/controller/HealthCheckControllerTest.java deleted file mode 100644 index 045ad9a61..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/controller/HealthCheckControllerTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.openecomp.vid.controller; - -import org.junit.Test; -import org.openecomp.vid.controller.HealthCheckController.HealthStatus; - -public class HealthCheckControllerTest { - - private HealthCheckController createTestSubject() { - return new HealthCheckController(); - } - - @Test - public void testGetProfileCount() throws Exception { - HealthCheckController testSubject; - String driver = ""; - String URL = ""; - String username = ""; - String password = ""; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProfileCount(driver, URL, username, password); - } - - @Test - public void testGethealthCheckStatusforIDNS() throws Exception { - HealthCheckController testSubject; - HealthStatus result; - - // default test - testSubject = createTestSubject(); - result = testSubject.gethealthCheckStatusforIDNS(); - } - - @Test - public void testGetHealthCheck() throws Exception { - HealthCheckController testSubject; - String UserAgent = ""; - String ECOMPRequestID = ""; - HealthStatus result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHealthCheck(UserAgent, ECOMPRequestID); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/controller/PropertyControllerTest.java b/vid-app-common/src/test/java/org/openecomp/vid/controller/PropertyControllerTest.java deleted file mode 100644 index cf7ada46a..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/controller/PropertyControllerTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.openecomp.vid.controller; - -import javax.servlet.http.HttpServletRequest; - -import org.junit.Test; -import org.springframework.http.ResponseEntity; -import org.springframework.web.servlet.ModelAndView; - -public class PropertyControllerTest { - - private PropertyController createTestSubject() { - return new PropertyController(); - } - - @Test - public void testWelcome() throws Exception { - PropertyController testSubject; - HttpServletRequest request = null; - ModelAndView result; - - // default test - testSubject = createTestSubject(); - result = testSubject.welcome(request); - } - - @Test - public void testGetViewName() throws Exception { - PropertyController testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getViewName(); - } - - @Test - public void testSetViewName() throws Exception { - PropertyController testSubject; - String _viewName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setViewName(_viewName); - } - - @Test - public void testGetProperty() throws Exception { - PropertyController testSubject; - String name = ""; - String defaultvalue = ""; - HttpServletRequest request = null; - ResponseEntity result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProperty(name, defaultvalue, request); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/controller/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/controller/TestSuite.java deleted file mode 100644 index c1b146429..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/controller/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.controller; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ HealthCheckControllerTest.class, PropertyControllerTest.class, AaiControllerTest.class, - ViewEditSubControllerTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/controller/ViewEditSubControllerTest.java b/vid-app-common/src/test/java/org/openecomp/vid/controller/ViewEditSubControllerTest.java deleted file mode 100644 index 2b234ee84..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/controller/ViewEditSubControllerTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.openecomp.vid.controller; - -import javax.servlet.http.HttpServletRequest; - -import org.junit.Test; -import org.springframework.web.servlet.ModelAndView; - -public class ViewEditSubControllerTest { - - private ViewEditSubController createTestSubject() { - return new ViewEditSubController(); - } - - @Test - public void testWelcome() throws Exception { - ViewEditSubController testSubject; - HttpServletRequest request = null; - ModelAndView result; - - // default test - testSubject = createTestSubject(); - result = testSubject.welcome(request); - } - - - @Test - public void testGetViewName() throws Exception { - ViewEditSubController testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getViewName(); - } - - @Test - public void testSetViewName() throws Exception { - ViewEditSubController testSubject; - String viewName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setViewName(viewName); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/model/ModelUtilTest.java b/vid-app-common/src/test/java/org/openecomp/vid/model/ModelUtilTest.java deleted file mode 100644 index 8a9f4de8d..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/model/ModelUtilTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.openecomp.vid.model; - -import org.junit.Assert; -import org.junit.Test; - - -public class ModelUtilTest { - - private ModelUtil createTestSubject() { - return new ModelUtil(); - } - - - @Test - public void testGetTags() throws Exception { - String[] namespaces; - String constantValue = "test"; - String[] result; - - // test 1 - namespaces = null; - result = ModelUtil.getTags(namespaces, constantValue); - Assert.assertNull(result); - - // test 2 - namespaces = new String[] { "" }; - result = ModelUtil.getTags(namespaces, constantValue); - Assert.assertArrayEquals(new String[] { constantValue }, result); - } - - - @Test - public void testIsType() throws Exception { - String type = "a"; - String[] tags; - boolean result; - - // test 1 - tags = null; - result = ModelUtil.isType(type, tags); - Assert.assertEquals(false, result); - - // test 2 - tags = new String[] { "a" }; - result = ModelUtil.isType(type, tags); - Assert.assertEquals(true, result); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/model/NewNodeTest.java b/vid-app-common/src/test/java/org/openecomp/vid/model/NewNodeTest.java deleted file mode 100644 index fb75c749e..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/model/NewNodeTest.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.openecomp.vid.model; - -import java.util.Map; - -import org.junit.Test; -import org.openecomp.vid.asdc.beans.tosca.Input; - - -public class NewNodeTest { - - private NewNode createTestSubject() { - return new NewNode(); - } - - - @Test - public void testGetUuid() throws Exception { - NewNode testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUuid(); - } - - - @Test - public void testGetInvariantUuid() throws Exception { - NewNode testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInvariantUuid(); - } - - - @Test - public void testGetDescription() throws Exception { - NewNode testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - - @Test - public void testGetName() throws Exception { - NewNode testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getName(); - } - - - @Test - public void testGetVersion() throws Exception { - NewNode testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVersion(); - } - - - @Test - public void testGetCustomizationUuid() throws Exception { - NewNode testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCustomizationUuid(); - } - - - @Test - public void testGetInputs() throws Exception { - NewNode testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInputs(); - } - - - @Test - public void testGetCommands() throws Exception { - NewNode testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCommands(); - } - - - @Test - public void testGetProperties() throws Exception { - NewNode testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProperties(); - } - - - @Test - public void testSetUuid() throws Exception { - NewNode testSubject; - String uuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUuid(uuid); - } - - - @Test - public void testSetInvariantUuid() throws Exception { - NewNode testSubject; - String invariantUuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setInvariantUuid(invariantUuid); - } - - - @Test - public void testSetDescription() throws Exception { - NewNode testSubject; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDescription(description); - } - - - @Test - public void testSetName() throws Exception { - NewNode testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setName(name); - } - - - @Test - public void testSetVersion() throws Exception { - NewNode testSubject; - String version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVersion(version); - } - - - @Test - public void testSetCustomizationUuid() throws Exception { - NewNode testSubject; - String u = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCustomizationUuid(u); - } - - - @Test - public void testSetInputs() throws Exception { - NewNode testSubject; - Map inputs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInputs(inputs); - } - - - @Test - public void testSetCommands() throws Exception { - NewNode testSubject; - Map m = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCommands(m); - } - - - @Test - public void testSetProperties() throws Exception { - NewNode testSubject; - Map p = null; - - // default test - testSubject = createTestSubject(); - testSubject.setProperties(p); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/model/NewServiceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/model/NewServiceTest.java deleted file mode 100644 index f78914279..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/model/NewServiceTest.java +++ /dev/null @@ -1,235 +0,0 @@ -package org.openecomp.vid.model; - -import java.util.Map; - -import org.junit.Test; -import org.openecomp.vid.asdc.beans.tosca.Input; - -public class NewServiceTest { - - private NewService createTestSubject() { - return new NewService(); - } - - - @Test - public void testGetUuid() throws Exception { - NewService testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUuid(); - } - - - @Test - public void testGetInvariantUuid() throws Exception { - NewService testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInvariantUuid(); - } - - - @Test - public void testGetName() throws Exception { - NewService testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getName(); - } - - - @Test - public void testGetVersion() throws Exception { - NewService testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVersion(); - } - - - @Test - public void testGetToscaModelURL() throws Exception { - NewService testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaModelURL(); - } - - - @Test - public void testGetCategory() throws Exception { - NewService testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCategory(); - } - - - @Test - public void testGetDescription() throws Exception { - NewService testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - - @Test - public void testGetInputs() throws Exception { - NewService testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInputs(); - } - - - @Test - public void testGetServiceEcompNaming() throws Exception { - NewService testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceEcompNaming(); - } - - - @Test - public void testSetUuid() throws Exception { - NewService testSubject; - String uuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUuid(uuid); - } - - - @Test - public void testSetInvariantUuid() throws Exception { - NewService testSubject; - String invariantUuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setInvariantUuid(invariantUuid); - } - - - @Test - public void testSetName() throws Exception { - NewService testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setName(name); - } - - - @Test - public void testSetVersion() throws Exception { - NewService testSubject; - String version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVersion(version); - } - - - @Test - public void testSetToscaModelURL() throws Exception { - NewService testSubject; - String toscaModelURL = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaModelURL(toscaModelURL); - } - - - @Test - public void testSetCategory() throws Exception { - NewService testSubject; - String category = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCategory(category); - } - - - @Test - public void testSetDescription() throws Exception { - NewService testSubject; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDescription(description); - } - - - @Test - public void testSetInputs() throws Exception { - NewService testSubject; - Map inputs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInputs(inputs); - } - - - @Test - public void testSetServiceEcompNaming() throws Exception { - NewService testSubject; - String serviceEcompNaming = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceEcompNaming(serviceEcompNaming); - } - - - @Test - public void testHashCode() throws Exception { - NewService testSubject; - int result; - - // default test - testSubject = createTestSubject(); - testSubject.setUuid("cb49608f-5a24-4789-b0f7-2595473cb997"); - result = testSubject.hashCode(); - } - - - @Test - public void testEquals() throws Exception { - NewService testSubject; - Object o = null; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.equals(o); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/model/NewVNFTest.java b/vid-app-common/src/test/java/org/openecomp/vid/model/NewVNFTest.java deleted file mode 100644 index 5f4f90b93..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/model/NewVNFTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.openecomp.vid.model; - -import java.util.Map; - -import org.junit.Test; - -public class NewVNFTest { - - private NewVNF createTestSubject() { - return new NewVNF(); - } - - - @Test - public void testGetModelCustomizationName() throws Exception { - NewVNF testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getModelCustomizationName(); - } - - - @Test - public void testGetVfModules() throws Exception { - NewVNF testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModules(); - } - - - @Test - public void testSetVfModules() throws Exception { - NewVNF testSubject; - Map vfModules = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModules(vfModules); - } - - - @Test - public void testGetVolumeGroups() throws Exception { - NewVNF testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVolumeGroups(); - } - - - @Test - public void testSetVolumeGroups() throws Exception { - NewVNF testSubject; - Map volumeGroups = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVolumeGroups(volumeGroups); - } - - - @Test - public void testSetModelCustomizationName() throws Exception { - NewVNF testSubject; - String modelCustomizationName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setModelCustomizationName(modelCustomizationName); - } - - - @Test - public void testNormalizeName() throws Exception { - String originalName = ""; - String result; - - // default test - result = NewVNF.normalizeName(originalName); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/model/ServiceModelTest.java b/vid-app-common/src/test/java/org/openecomp/vid/model/ServiceModelTest.java deleted file mode 100644 index 45f492016..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/model/ServiceModelTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.openecomp.vid.model; - -import java.util.Map; - -import org.junit.Test; -import org.openecomp.vid.asdc.beans.tosca.ToscaModel; -import org.openecomp.vid.model.Service; - -public class ServiceModelTest { - - private ServiceModel createTestSubject() { - return new ServiceModel(); - } - - @Test - public void testGetService() throws Exception { - ServiceModel testSubject; - Service result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getService(); - } - - @Test - public void testGetVnfs() throws Exception { - ServiceModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVnfs(); - } - - @Test - public void testGetNetworks() throws Exception { - ServiceModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getNetworks(); - } - - @Test - public void testSetService() throws Exception { - ServiceModel testSubject; - Service service = null; - - // default test - testSubject = createTestSubject(); - testSubject.setService(service); - } - - @Test - public void testSetVnfs() throws Exception { - ServiceModel testSubject; - Map vnfs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVnfs(vnfs); - } - - @Test - public void testSetNetworks() throws Exception { - ServiceModel testSubject; - Map networks = null; - - // default test - testSubject = createTestSubject(); - testSubject.setNetworks(networks); - } - - @Test - public void testGetVfModules() throws Exception { - ServiceModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModules(); - } - - @Test - public void testGetVolumeGroups() throws Exception { - ServiceModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVolumeGroups(); - } - - @Test - public void testSetVfModules() throws Exception { - ServiceModel testSubject; - Map vfModules = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModules(vfModules); - } - - @Test - public void testSetVolumeGroups() throws Exception { - ServiceModel testSubject; - Map volumeGroups = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVolumeGroups(volumeGroups); - } - - @Test - public void testAssociateGroups() throws Exception { - ServiceModel testSubject; - - // default test - testSubject = createTestSubject(); - testSubject.associateGroups(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/model/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/model/TestSuite.java deleted file mode 100644 index 3d7f57b38..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/model/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.model; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ ModelUtilTest.class, NewServiceTest.class, VolumeGroupTest.class, NewNodeTest.class, ServiceModelTest.class, - WorkflowTest.class, NewVNFTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/model/VolumeGroupTest.java b/vid-app-common/src/test/java/org/openecomp/vid/model/VolumeGroupTest.java deleted file mode 100644 index 038290b2a..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/model/VolumeGroupTest.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.openecomp.vid.model; - -import org.junit.Test; -import org.openecomp.vid.asdc.beans.tosca.Group; - - -public class VolumeGroupTest { - - private VolumeGroup createTestSubject() { - return new VolumeGroup(); - } - - - @Test - public void testGetUuid() throws Exception { - VolumeGroup testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUuid(); - } - - - @Test - public void testGetCustomizationUuid() throws Exception { - VolumeGroup testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCustomizationUuid(); - } - - - @Test - public void testGetModelCustomizationName() throws Exception { - VolumeGroup testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getModelCustomizationName(); - } - - - @Test - public void testGetInvariantUuid() throws Exception { - VolumeGroup testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInvariantUuid(); - } - - - @Test - public void testGetDescription() throws Exception { - VolumeGroup testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - - @Test - public void testGetName() throws Exception { - VolumeGroup testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getName(); - } - - - @Test - public void testGetVersion() throws Exception { - VolumeGroup testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVersion(); - } - - - @Test - public void testSetUuid() throws Exception { - VolumeGroup testSubject; - String uuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUuid(uuid); - } - - - @Test - public void testSetInvariantUuid() throws Exception { - VolumeGroup testSubject; - String invariantUuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setInvariantUuid(invariantUuid); - } - - - @Test - public void testSetDescription() throws Exception { - VolumeGroup testSubject; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDescription(description); - } - - - @Test - public void testSetName() throws Exception { - VolumeGroup testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setName(name); - } - - - @Test - public void testSetVersion() throws Exception { - VolumeGroup testSubject; - String version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVersion(version); - } - - - @Test - public void testSetCustomizationUuid() throws Exception { - VolumeGroup testSubject; - String u = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCustomizationUuid(u); - } - - - @Test - public void testSetModelCustomizationName() throws Exception { - VolumeGroup testSubject; - String u = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setModelCustomizationName(u); - } - - - -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/model/WorkflowTest.java b/vid-app-common/src/test/java/org/openecomp/vid/model/WorkflowTest.java deleted file mode 100644 index 5f8ec7d18..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/model/WorkflowTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.openecomp.vid.model; - -import java.util.Collection; - -import org.junit.Test; - -public class WorkflowTest { - - private Workflow createTestSubject() { - return new Workflow(); - } - - @Test - public void testGetId() throws Exception { - Workflow testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getId(); - } - - @Test - public void testGetWorkflowName() throws Exception { - Workflow testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getWorkflowName(); - } - - @Test - public void testGetVnfNames() throws Exception { - Workflow testSubject; - Collection result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVnfNames(); - } - - @Test - public void testSetId() throws Exception { - Workflow testSubject; - int id = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setId(id); - } - - @Test - public void testSetWorkflowName() throws Exception { - Workflow testSubject; - String workflowName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setWorkflowName(workflowName); - } - - @Test - public void testSetVnfName() throws Exception { - Workflow testSubject; - Collection vnfNames = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVnfName(vnfNames); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoLocalClientNewTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoLocalClientNewTest.java deleted file mode 100644 index 6e4097375..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoLocalClientNewTest.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.openecomp.vid.mso; - -import org.junit.Test; -import org.openecomp.vid.changeManagement.RequestDetails; - -public class MsoLocalClientNewTest { - - private MsoLocalClientNew createTestSubject() { - return new MsoLocalClientNew(); - } - - @Test - public void testCreateSvcInstance() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.createSvcInstance(requestDetails, endpoint); - } - - @Test - public void testCreateInstance() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails request = null; - String path = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.createInstance(request, path); - } - - @Test - public void testCreateVnf() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.createVnf(requestDetails, endpoint); - } - - @Test - public void testCreateNwInstance() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.createNwInstance(requestDetails, endpoint); - } - - @Test - public void testCreateVolumeGroupInstance() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String path = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.createVolumeGroupInstance(requestDetails, path); - } - - @Test - public void testCreateVfModuleInstance() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.createVfModuleInstance(requestDetails, endpoint); - } - - @Test - public void testDeleteSvcInstance() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.deleteSvcInstance(requestDetails, endpoint); - } - - @Test - public void testDeleteVnf() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.deleteVnf(requestDetails, endpoint); - } - - @Test - public void testDeleteVfModule() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.deleteVfModule(requestDetails, endpoint); - } - - @Test - public void testDeleteVolumeGroupInstance() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.deleteVolumeGroupInstance(requestDetails, endpoint); - } - - @Test - public void testDeleteNwInstance() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.deleteNwInstance(requestDetails, endpoint); - } - - @Test - public void testGetOrchestrationRequest() throws Exception { - MsoLocalClientNew testSubject; - String t = ""; - String sourceId = ""; - String endpoint = ""; - RestObject restObject = null; - - // default test - testSubject = createTestSubject(); - testSubject.getOrchestrationRequest(t, sourceId, endpoint, restObject); - } - - - @Test - public void testUpdateVnf() throws Exception { - MsoLocalClientNew testSubject; - RequestDetails requestDetails = null; - String vnf_endpoint = ""; - MsoResponseWrapper result; - - // default test - testSubject = createTestSubject(); - result = testSubject.updateVnf(requestDetails, vnf_endpoint); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoRestIntTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoRestIntTest.java deleted file mode 100644 index e32e4872b..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoRestIntTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openecomp.vid.mso; - -import org.junit.Test; -import org.openecomp.vid.mso.rest.RequestDetails; - -public class MsoRestIntTest { - - private MsoRestInt createTestSubject() { - return new MsoRestInt(); - } - - @Test - public void testLogRequest() throws Exception { - MsoRestInt testSubject; - RequestDetails r = null; - - // test 1 - testSubject = createTestSubject(); - r = null; - testSubject.logRequest(r); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoRestInterfaceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoRestInterfaceTest.java deleted file mode 100644 index 9c96e117a..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoRestInterfaceTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openecomp.vid.mso; - -import org.apache.poi.hssf.record.formula.functions.T; -import org.junit.Test; - -public class MsoRestInterfaceTest { - - private MsoRestInterface createTestSubject() { - return new MsoRestInterface(); - } - - @Test - public void testInitMsoClient() throws Exception { - MsoRestInterface testSubject; - - // default test - testSubject = createTestSubject(); - testSubject.initMsoClient(); - } - -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoUtilTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoUtilTest.java deleted file mode 100644 index 6a9816e3c..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/MsoUtilTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.openecomp.vid.mso; - -import org.apache.poi.hssf.record.formula.functions.T; -import org.glassfish.jersey.client.ClientResponse; -import org.junit.Assert; -import org.junit.Test; - -public class MsoUtilTest { - - private MsoUtil createTestSubject() { - return new MsoUtil(); - } - - @Test - public void testWrapResponse() throws Exception { - String body = ""; - int statusCode = 0; - MsoResponseWrapper result; - - // default test - result = MsoUtil.wrapResponse(body, statusCode); - } - - - @Test - public void testWrapResponse_2() throws Exception { - RestObject rs = null; - MsoResponseWrapper result; - - // test 1 - result = MsoUtil.wrapResponse(rs); - Assert.assertNotNull(result); - } - - @Test - public void testConvertPojoToString() throws Exception { - T t = null; - String result; - - // test 1 - t = null; - result = MsoUtil.convertPojoToString(t); - Assert.assertEquals("", result); - } - - @Test - public void testMain() throws Exception { - String[] args = new String[] { "" }; - - // default test - MsoUtil.main(args); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/RestMsoImplementationTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/RestMsoImplementationTest.java deleted file mode 100644 index 1f1e33950..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/RestMsoImplementationTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.openecomp.vid.mso; - -import org.apache.poi.hssf.record.formula.functions.T; -import org.junit.Test; -import org.openecomp.vid.changeManagement.RequestDetails; -import org.openecomp.vid.changeManagement.RequestDetailsWrapper; - -public class RestMsoImplementationTest { - - private RestMsoImplementation createTestSubject() { - return new RestMsoImplementation(); - } - - @Test - public void testInitMsoClient() throws Exception { - RestMsoImplementation testSubject; - - // default test - testSubject = createTestSubject(); - testSubject.initMsoClient(); - } - - @Test - public void testLogRequest() throws Exception { - RestMsoImplementation testSubject; - RequestDetails r = null; - - // test 1 - testSubject = createTestSubject(); - r = null; - testSubject.logRequest(r); - } - - @Test - public void testLogRequest_1() throws Exception { - RestMsoImplementation testSubject; - RequestDetails r = null; - - // test 1 - testSubject = createTestSubject(); - r = null; - testSubject.logRequest(r); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/TestSuite.java deleted file mode 100644 index aa30935cd..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.mso; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ MsoRestIntTest.class, MsoUtilTest.class, MsoRestInterfaceTest.class, MsoLocalClientNewTest.class, - RestMsoImplementationTest.class, org.openecomp.vid.mso.rest.TestSuite.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/AsyncRequestStatusTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/AsyncRequestStatusTest.java deleted file mode 100644 index 663d1f53c..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/AsyncRequestStatusTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import org.junit.Test; -import org.openecomp.vid.domain.mso.InstanceIds; -import org.openecomp.vid.domain.mso.RequestStatus; - - -public class AsyncRequestStatusTest { - - private AsyncRequestStatus createTestSubject() { - return new AsyncRequestStatus(); - } - - - @Test - public void testGetInstanceIds() throws Exception { - AsyncRequestStatus testSubject; - InstanceIds result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInstanceIds(); - } - - - @Test - public void testSetInstanceIds() throws Exception { - AsyncRequestStatus testSubject; - InstanceIds instanceIds = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInstanceIds(instanceIds); - } - - - @Test - public void testGetRequestStatus() throws Exception { - AsyncRequestStatus testSubject; - RequestStatus result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequestStatus(); - } - - - @Test - public void testSetRequestStatus() throws Exception { - AsyncRequestStatus testSubject; - RequestStatus requestStatus = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRequestStatus(requestStatus); - } - - - @Test - public void testToString() throws Exception { - AsyncRequestStatus testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testHashCode() throws Exception { - AsyncRequestStatus testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.hashCode(); - } - - - @Test - public void testEquals() throws Exception { - AsyncRequestStatus testSubject; - Object other = null; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.equals(other); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RelatedInstanceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RelatedInstanceTest.java deleted file mode 100644 index b3bee441f..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RelatedInstanceTest.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import java.util.Map; - -import org.junit.Test; -import org.openecomp.vid.domain.mso.ModelInfo; - - -public class RelatedInstanceTest { - - private RelatedInstance createTestSubject() { - return new RelatedInstance(); - } - - - @Test - public void testGetModelInfo() throws Exception { - RelatedInstance testSubject; - ModelInfo result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getModelInfo(); - } - - - @Test - public void testSetModelInfo() throws Exception { - RelatedInstance testSubject; - ModelInfo modelInfo = null; - - // default test - testSubject = createTestSubject(); - testSubject.setModelInfo(modelInfo); - } - - - @Test - public void testToString() throws Exception { - RelatedInstance testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testGetAdditionalProperties() throws Exception { - RelatedInstance testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalProperties(); - } - - - @Test - public void testSetAdditionalProperty() throws Exception { - RelatedInstance testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalProperty(name, value); - } - - - @Test - public void testHashCode() throws Exception { - RelatedInstance testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.hashCode(); - } - - - @Test - public void testEquals() throws Exception { - RelatedInstance testSubject; - Object other = null; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.equals(other); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RelatedModelTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RelatedModelTest.java deleted file mode 100644 index b08ff89bb..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RelatedModelTest.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import java.util.Map; - -import org.junit.Test; -import org.openecomp.vid.domain.mso.ModelInfo; - - -public class RelatedModelTest { - - private RelatedModel createTestSubject() { - return new RelatedModel(); - } - - - @Test - public void testGetModelInfo() throws Exception { - RelatedModel testSubject; - ModelInfo result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getModelInfo(); - } - - - @Test - public void testSetModelInfo() throws Exception { - RelatedModel testSubject; - ModelInfo modelInfo = null; - - // default test - testSubject = createTestSubject(); - testSubject.setModelInfo(modelInfo); - } - - - @Test - public void testToString() throws Exception { - RelatedModel testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testGetAdditionalProperties() throws Exception { - RelatedModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalProperties(); - } - - - @Test - public void testSetAdditionalProperty() throws Exception { - RelatedModel testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalProperty(name, value); - } - - - @Test - public void testHashCode() throws Exception { - RelatedModel testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.hashCode(); - } - - - @Test - public void testEquals() throws Exception { - RelatedModel testSubject; - Object other = null; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.equals(other); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RequestDetailsTest.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RequestDetailsTest.java deleted file mode 100644 index 41fbc7a1c..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/RequestDetailsTest.java +++ /dev/null @@ -1,182 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import java.util.List; -import java.util.Map; - -import org.junit.Test; -import org.openecomp.vid.domain.mso.*; - - -public class RequestDetailsTest { - - private RequestDetails createTestSubject() { - return new RequestDetails(); - } - - - @Test - public void testGetCloudConfiguration() throws Exception { - RequestDetails testSubject; - CloudConfiguration result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCloudConfiguration(); - } - - - @Test - public void testSetCloudConfiguration() throws Exception { - RequestDetails testSubject; - CloudConfiguration cloudConfiguration = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCloudConfiguration(cloudConfiguration); - } - - - @Test - public void testGetModelInfo() throws Exception { - RequestDetails testSubject; - ModelInfo result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getModelInfo(); - } - - - @Test - public void testSetModelInfo() throws Exception { - RequestDetails testSubject; - ModelInfo modelInfo = null; - - // default test - testSubject = createTestSubject(); - testSubject.setModelInfo(modelInfo); - } - - - @Test - public void testGetRelatedInstanceList() throws Exception { - RequestDetails testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelatedInstanceList(); - } - - - @Test - public void testSetRelatedInstanceList() throws Exception { - RequestDetails testSubject; - List relatedInstanceList = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRelatedInstanceList(relatedInstanceList); - } - - - @Test - public void testGetRequestInfo() throws Exception { - RequestDetails testSubject; - RequestInfo result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequestInfo(); - } - - - @Test - public void testSetRequestInfo() throws Exception { - RequestDetails testSubject; - RequestInfo requestInfo = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRequestInfo(requestInfo); - } - - - @Test - public void testGetSubscriberInfo() throws Exception { - RequestDetails testSubject; - SubscriberInfo result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSubscriberInfo(); - } - - - @Test - public void testSetSubscriberInfo() throws Exception { - RequestDetails testSubject; - SubscriberInfo subscriberInfo = null; - - // default test - testSubject = createTestSubject(); - testSubject.setSubscriberInfo(subscriberInfo); - } - - - @Test - public void testToString() throws Exception { - RequestDetails testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testGetAdditionalProperties() throws Exception { - RequestDetails testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalProperties(); - } - - - @Test - public void testSetAdditionalProperty() throws Exception { - RequestDetails testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalProperty(name, value); - } - - - @Test - public void testHashCode() throws Exception { - RequestDetails testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.hashCode(); - } - - - @Test - public void testEquals() throws Exception { - RequestDetails testSubject; - Object other = null; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.equals(other); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/TestSuite.java deleted file mode 100644 index ef86682fb..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/mso/rest/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ RelatedModelTest.class, AsyncRequestStatusTest.class, RequestDetailsTest.class, - RelatedInstanceTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyResponseWrapperTest.java b/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyResponseWrapperTest.java deleted file mode 100644 index 21a337253..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyResponseWrapperTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.openecomp.vid.policy; - -import org.junit.Test; - -public class PolicyResponseWrapperTest { - - private PolicyResponseWrapper createTestSubject() { - return new PolicyResponseWrapper(); - } - - @Test - public void testGetEntity() throws Exception { - PolicyResponseWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getEntity(); - } - - @Test - public void testGetStatus() throws Exception { - PolicyResponseWrapper testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getStatus(); - } - - @Test - public void testSetStatus() throws Exception { - PolicyResponseWrapper testSubject; - int v = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setStatus(v); - } - - @Test - public void testSetEntity() throws Exception { - PolicyResponseWrapper testSubject; - String v = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setEntity(v); - } - - @Test - public void testToString() throws Exception { - PolicyResponseWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - @Test - public void testGetResponse() throws Exception { - PolicyResponseWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResponse(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyRestIntTest.java b/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyRestIntTest.java deleted file mode 100644 index 541816562..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyRestIntTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openecomp.vid.policy; - -import org.junit.Test; -import org.openecomp.vid.policy.rest.RequestDetails; - -public class PolicyRestIntTest { - - private PolicyRestInt createTestSubject() { - return new PolicyRestInt(); - } - - @Test - public void testLogRequest() throws Exception { - PolicyRestInt testSubject; - RequestDetails r = null; - - // test 1 - testSubject = createTestSubject(); - r = null; - testSubject.logRequest(r); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyRestInterfaceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyRestInterfaceTest.java deleted file mode 100644 index 29e13624b..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyRestInterfaceTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.openecomp.vid.policy; - -import org.apache.poi.hssf.record.formula.functions.T; -import org.json.simple.JSONObject; -import org.junit.Test; -import org.openecomp.vid.policy.rest.RequestDetails; - -public class PolicyRestInterfaceTest { - - private PolicyRestInterface createTestSubject() { - return new PolicyRestInterface(); - } - - - @Test - public void testLogRequest() throws Exception { - PolicyRestInterface testSubject; - RequestDetails r = null; - - // default test - testSubject = createTestSubject(); - testSubject.logRequest(r); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyUtilTest.java b/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyUtilTest.java deleted file mode 100644 index b7f88ac3d..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/policy/PolicyUtilTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.openecomp.vid.policy; - -import org.apache.poi.hssf.record.formula.functions.T; -import org.glassfish.jersey.client.ClientResponse; -import org.junit.Assert; -import org.junit.Test; - -public class PolicyUtilTest { - - private PolicyUtil createTestSubject() { - return new PolicyUtil(); - } - - @Test - public void testWrapResponse() throws Exception { - String body = ""; - int statusCode = 0; - PolicyResponseWrapper result; - - // default test - result = PolicyUtil.wrapResponse(body, statusCode); - } - - - @Test - public void testWrapResponse_2() throws Exception { - RestObject rs = null; - PolicyResponseWrapper result; - - // test 1 - rs = null; - result = PolicyUtil.wrapResponse(rs); - Assert.assertNotNull(result); - } - - @Test - public void testConvertPojoToString() throws Exception { - T t = null; - String result; - - // test 1 - t = null; - result = PolicyUtil.convertPojoToString(t); - Assert.assertEquals("", result); - } - - @Test - public void testMain() throws Exception { - String[] args = new String[] { "" }; - - // default test - PolicyUtil.main(args); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/policy/RestObjectTest.java b/vid-app-common/src/test/java/org/openecomp/vid/policy/RestObjectTest.java deleted file mode 100644 index a961a1a4a..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/policy/RestObjectTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.openecomp.vid.policy; - -import org.apache.poi.hssf.record.formula.functions.T; -import org.junit.Test; - -public class RestObjectTest { - - private RestObject createTestSubject() { - return new RestObject(); - } - - @Test - public void testSet() throws Exception { - RestObject testSubject; - T t = null; - - // default test - testSubject = createTestSubject(); - testSubject.set(t); - } - - @Test - public void testGet() throws Exception { - RestObject testSubject; - - // default test - testSubject = createTestSubject(); - testSubject.get(); - } - - @Test - public void testSetStatusCode() throws Exception { - RestObject testSubject; - int v = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setStatusCode(v); - } - - @Test - public void testGetStatusCode() throws Exception { - RestObject testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getStatusCode(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/policy/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/policy/TestSuite.java deleted file mode 100644 index 7d0b4eb2d..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/policy/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.policy; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ RestObjectTest.class, PolicyResponseWrapperTest.class, PolicyRestIntTest.class, PolicyUtilTest.class, - PolicyRestInterfaceTest.class, org.openecomp.vid.policy.rest.TestSuite.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/policy/rest/RequestDetailsTest.java b/vid-app-common/src/test/java/org/openecomp/vid/policy/rest/RequestDetailsTest.java deleted file mode 100644 index 705775577..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/policy/rest/RequestDetailsTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.vid.policy.rest; - -import org.junit.Test; - - -public class RequestDetailsTest { - - private RequestDetails createTestSubject() { - return new RequestDetails(); - } - - - @Test - public void testGetPolicyName() throws Exception { - RequestDetails testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getPolicyName(); - } - - - @Test - public void testSetPolicyName() throws Exception { - RequestDetails testSubject; - String policyName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setPolicyName(policyName); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/policy/rest/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/policy/rest/TestSuite.java deleted file mode 100644 index 9b491c869..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/policy/rest/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.policy.rest; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ RequestDetailsTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/properties/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/properties/TestSuite.java deleted file mode 100644 index b29930843..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/properties/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.properties; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ VidPropertiesTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/properties/VidPropertiesTest.java b/vid-app-common/src/test/java/org/openecomp/vid/properties/VidPropertiesTest.java deleted file mode 100644 index 7d318c74b..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/properties/VidPropertiesTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.openecomp.vid.properties; - -import org.junit.Test; - - -public class VidPropertiesTest { - - private VidProperties createTestSubject() { - return new VidProperties(); - } - - - @Test - public void testGetAsdcModelNamespace() throws Exception { - String result; - - // default test - result = VidProperties.getAsdcModelNamespace(); - } - - - @Test - public void testGetPropertyWithDefault() throws Exception { - String propName = ""; - String defaultValue = ""; - String result; - - // default test - result = VidProperties.getPropertyWithDefault(propName, defaultValue); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/roles/RoleProviderTest.java b/vid-app-common/src/test/java/org/openecomp/vid/roles/RoleProviderTest.java deleted file mode 100644 index 97f9c47fe..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/roles/RoleProviderTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.openecomp.vid.roles; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.junit.Test; - - -public class RoleProviderTest { - - private RoleProvider createTestSubject() { - return new RoleProvider(); - } - - - @Test - public void testExtractRoleFromSession() throws Exception { - HttpServletRequest request = null; - List result; - - // default test - result = RoleProvider.extractRoleFromSession(request); - } - - - @Test - public void testGetUserRoles() throws Exception { - RoleProvider testSubject; - HttpServletRequest request = null; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUserRoles(request); - } - - - @Test - public void testSplitRole() throws Exception { - RoleProvider testSubject; - String roleAsString = ""; - String[] result; - - // default test - testSubject = createTestSubject(); - result = testSubject.splitRole(roleAsString); - } - -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/roles/RoleValidatorTest.java b/vid-app-common/src/test/java/org/openecomp/vid/roles/RoleValidatorTest.java deleted file mode 100644 index fc050baea..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/roles/RoleValidatorTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.openecomp.vid.roles; - -import org.junit.Test; -import org.openecomp.vid.mso.rest.RequestDetails; - -public class RoleValidatorTest { - - private RoleValidator createTestSubject() { - return new RoleValidator(null); - } - - @Test - public void testIsSubscriberPermitted() throws Exception { - RoleValidator testSubject; - String subscriberName = ""; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isSubscriberPermitted(subscriberName); - } - - @Test - public void testIsServicePermitted() throws Exception { - RoleValidator testSubject; - String subscriberName = ""; - String serviceType = ""; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isServicePermitted(subscriberName, serviceType); - } - - @Test - public void testIsMsoRequestValid() throws Exception { - RoleValidator testSubject; - RequestDetails mso_request = null; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isMsoRequestValid(mso_request); - } - - @Test - public void testIsTenantPermitted() throws Exception { - RoleValidator testSubject; - String globalCustomerId = ""; - String serviceType = ""; - String tenant = ""; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isTenantPermitted(globalCustomerId, serviceType, tenant); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/roles/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/roles/TestSuite.java deleted file mode 100644 index df87ac070..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/roles/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.roles; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ RoleValidatorTest.class, RoleProviderTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/GetTimeSlotsRestObjectTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/GetTimeSlotsRestObjectTest.java deleted file mode 100644 index 9041bdbfc..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/GetTimeSlotsRestObjectTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.vid.scheduler.RestObjects; - -import org.junit.Test; - - -public class GetTimeSlotsRestObjectTest { - - private GetTimeSlotsRestObject createTestSubject() { - return new GetTimeSlotsRestObject(); - } - - - @Test - public void testSetUUID() throws Exception { - GetTimeSlotsRestObject testSubject; - String uuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUUID(uuid); - } - - - @Test - public void testGetUUID() throws Exception { - GetTimeSlotsRestObject testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUUID(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/PostCreateNewVnfRestObjectTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/PostCreateNewVnfRestObjectTest.java deleted file mode 100644 index 79e978847..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/PostCreateNewVnfRestObjectTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.vid.scheduler.RestObjects; - -import org.junit.Test; - - -public class PostCreateNewVnfRestObjectTest { - - private PostCreateNewVnfRestObject createTestSubject() { - return new PostCreateNewVnfRestObject(); - } - - - @Test - public void testSetUUID() throws Exception { - PostCreateNewVnfRestObject testSubject; - String uuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUUID(uuid); - } - - - @Test - public void testGetUUID() throws Exception { - PostCreateNewVnfRestObject testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUUID(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObjectTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObjectTest.java deleted file mode 100644 index dd2e6f7c9..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObjectTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.vid.scheduler.RestObjects; - -import org.junit.Test; - - -public class PostSubmitVnfChangeRestObjectTest { - - private PostSubmitVnfChangeRestObject createTestSubject() { - return new PostSubmitVnfChangeRestObject(); - } - - - @Test - public void testSetUUID() throws Exception { - PostSubmitVnfChangeRestObject testSubject; - String uuid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUUID(uuid); - } - - - @Test - public void testGetUUID() throws Exception { - PostSubmitVnfChangeRestObject testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUUID(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/RestObjectTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/RestObjectTest.java deleted file mode 100644 index 5ab609ac6..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/RestObjectTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.openecomp.vid.scheduler.RestObjects; - -import org.apache.poi.hssf.record.formula.functions.T; -import org.junit.Test; - - -public class RestObjectTest { - - private RestObject createTestSubject() { - return new RestObject(); - } - - - @Test - public void testSet() throws Exception { - RestObject testSubject; - T t = null; - - // default test - testSubject = createTestSubject(); - testSubject.set(t); - } - - - @Test - public void testGet() throws Exception { - RestObject testSubject; - - // default test - testSubject = createTestSubject(); - testSubject.get(); - } - - - @Test - public void testSetStatusCode() throws Exception { - RestObject testSubject; - int v = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setStatusCode(v); - } - - - @Test - public void testGetStatusCode() throws Exception { - RestObject testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getStatusCode(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/TestSuite.java deleted file mode 100644 index 8e5321424..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/RestObjects/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.scheduler.RestObjects; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ RestObjectTest.class, GetTimeSlotsRestObjectTest.class, PostSubmitVnfChangeRestObjectTest.class, - PostCreateNewVnfRestObjectTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapperTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapperTest.java deleted file mode 100644 index 16675dd1f..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapperTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.openecomp.vid.scheduler.SchedulerResponseWrappers; - -import org.junit.Test; - - -public class PostCreateNewVnfWrapperTest { - - private PostCreateNewVnfWrapper createTestSubject() { - return new PostCreateNewVnfWrapper(); - } - - - @Test - public void testGetUuid() throws Exception { - PostCreateNewVnfWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUuid(); - } - - - @Test - public void testSetUuid() throws Exception { - PostCreateNewVnfWrapper testSubject; - String v = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUuid(v); - } - - - @Test - public void testToString() throws Exception { - PostCreateNewVnfWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testGetResponse() throws Exception { - PostCreateNewVnfWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResponse(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapperTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapperTest.java deleted file mode 100644 index ffe03bf06..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapperTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.openecomp.vid.scheduler.SchedulerResponseWrappers; - -import org.junit.Test; - - -public class PostSubmitVnfChangeTimeSlotsWrapperTest { - - private PostSubmitVnfChangeTimeSlotsWrapper createTestSubject() { - return new PostSubmitVnfChangeTimeSlotsWrapper(); - } - - - @Test - public void testGetUuid() throws Exception { - PostSubmitVnfChangeTimeSlotsWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUuid(); - } - - - @Test - public void testSetUuid() throws Exception { - PostSubmitVnfChangeTimeSlotsWrapper testSubject; - String v = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUuid(v); - } - - - @Test - public void testToString() throws Exception { - PostSubmitVnfChangeTimeSlotsWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testGetResponse() throws Exception { - PostSubmitVnfChangeTimeSlotsWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResponse(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapperTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapperTest.java deleted file mode 100644 index c0fcb591d..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapperTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.openecomp.vid.scheduler.SchedulerResponseWrappers; - -import org.junit.Test; - - -public class SchedulerResponseWrapperTest { - - private SchedulerResponseWrapper createTestSubject() { - return new SchedulerResponseWrapper(); - } - - - @Test - public void testGetEntity() throws Exception { - SchedulerResponseWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getEntity(); - } - - - @Test - public void testGetStatus() throws Exception { - SchedulerResponseWrapper testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getStatus(); - } - - - @Test - public void testSetStatus() throws Exception { - SchedulerResponseWrapper testSubject; - int v = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setStatus(v); - } - - - @Test - public void testSetEntity() throws Exception { - SchedulerResponseWrapper testSubject; - String v = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setEntity(v); - } - - - @Test - public void testToString() throws Exception { - SchedulerResponseWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testGetResponse() throws Exception { - SchedulerResponseWrapper testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResponse(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/TestSuite.java deleted file mode 100644 index a85a9f3d2..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/TestSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.openecomp.vid.scheduler.SchedulerResponseWrappers; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ PostSubmitVnfChangeTimeSlotsWrapperTest.class, PostCreateNewVnfWrapperTest.class, - SchedulerResponseWrapperTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceTest.java deleted file mode 100644 index 9dba924fb..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.openecomp.vid.scheduler; - -import org.apache.poi.hssf.record.formula.functions.T; -import org.json.simple.JSONObject; -import org.junit.Test; - -public class SchedulerRestInterfaceTest { - - private SchedulerRestInterface createTestSubject() { - return new SchedulerRestInterface(); - } - - - - @Test - public void testLogRequest() throws Exception { - SchedulerRestInterface testSubject; - JSONObject requestDetails = null; - - // default test - testSubject = createTestSubject(); - testSubject.logRequest(requestDetails); - } - - -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/TestSuite.java deleted file mode 100644 index 61ab05d02..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.scheduler; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ SchedulerRestInterfaceTest.class, org.openecomp.vid.scheduler.RestObjects.TestSuite.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/rest/RequestDetailsTest.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/rest/RequestDetailsTest.java deleted file mode 100644 index 190b8c5a7..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/rest/RequestDetailsTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.vid.scheduler.rest; - -import org.junit.Test; - - -public class RequestDetailsTest { - - private RequestDetails createTestSubject() { - return new RequestDetails(); - } - - - @Test - public void testGetDomain() throws Exception { - RequestDetails testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDomain(); - } - - - @Test - public void testSetDomain() throws Exception { - RequestDetails testSubject; - String domain = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDomain(domain); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/rest/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/scheduler/rest/TestSuite.java deleted file mode 100644 index 714d0b085..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/scheduler/rest/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.scheduler.rest; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ RequestDetailsTest.class }) -public class TestSuite { // nothing -} diff --git a/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceImplTest.java b/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceImplTest.java deleted file mode 100644 index bd1e72b70..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceImplTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.openecomp.vid.services; - -import static org.junit.Assert.*; -import java.util.*; - -import org.json.simple.JSONArray; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.vid.changeManagement.ChangeManagementRequest; -import org.openecomp.vid.changeManagement.RequestDetails; -import org.openecomp.vid.mso.rest.Request; -import org.springframework.http.ResponseEntity; - -public class ChangeManagementServiceImplTest { - - private ChangeManagementServiceImpl createTestSubject() { - return new ChangeManagementServiceImpl(); - } - - - /*@Test - public void testGetMSOChangeManagements() throws Exception { - ChangeManagementServiceImpl testSubject; - Collection result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMSOChangeManagements(); - } - - - @Test - public void testFindRequestByVnfName() throws Exception { - ChangeManagementServiceImpl testSubject;List requests = null; - String vnfName = ""; - RequestDetails result; - - // test 1 - testSubject=createTestSubject();requests = null; - result=Deencapsulation.invoke(testSubject, "findRequestByVnfName", new Object[]{List.class, vnfName}); - Assert.assertEquals(null, result); - }*/ - - - @Test - public void testDoChangeManagement() throws Exception { - ChangeManagementServiceImpl testSubject; - ChangeManagementRequest request = null; - String vnfName = ""; - ResponseEntity result; - - // test 1 - testSubject = createTestSubject(); - request = null; - result = testSubject.doChangeManagement(request, vnfName); - Assert.assertEquals(null, result); - } - - - @Test - public void testGetSchedulerChangeManagements() throws Exception { - ChangeManagementServiceImpl testSubject; - JSONArray result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSchedulerChangeManagements(); - } -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceTest.java deleted file mode 100644 index f770ab2ab..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openecomp.vid.services; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.vid.changeManagement.ChangeManagementRequest; -import org.openecomp.vid.changeManagement.ChangeManagementResponse; -import org.springframework.http.ResponseEntity; - -import junit.framework.Assert; - -import static org.junit.Assert.*; - - -public class ChangeManagementServiceTest { - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void doChangeManagement_requestTypeIsUpdateVnfNotFound_doUpdateAndReturnNull() throws Exception { - - } - -} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/openecomp/vid/services/TestSuite.java b/vid-app-common/src/test/java/org/openecomp/vid/services/TestSuite.java deleted file mode 100644 index c6c5eb1f0..000000000 --- a/vid-app-common/src/test/java/org/openecomp/vid/services/TestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.services; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses( - -{ ChangeManagementServiceImplTest.class, ChangeManagementServiceTest.class }) -public class TestSuite { // nothing -} -- cgit 1.2.3-korg