diff options
19 files changed, 1280 insertions, 2 deletions
diff --git a/docs/Install_and_Configure_an_Ubuntu_VM.rst b/docs/Install_and_Configure_an_Ubuntu_VM.rst new file mode 100644 index 0000000000..02289e1149 --- /dev/null +++ b/docs/Install_and_Configure_an_Ubuntu_VM.rst @@ -0,0 +1,93 @@ +.. _open_cli_schema_version_1_0:
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2017 Huawei Technologies Co., Ltd.
+
+Install and Configure an Ubuntu VM
+==================================
+
+Get Ubuntu
+----------
+Get the Ubuntu ISO image from ubuntu.com. The recommended version is 16.04.3 LTS (Long Term Support), desktop edition.
+
+Get VirtualBox and VirtualBox Guest Additions
+---------------------------------------------
+Make sure you have the VirtualBox Guest Additions ISO for your version of VirtualBox. I'm using VirtualBox 5.1.28. Save the Guest Additions ISO on your host computer along with the Ubuntu ISO. Get the Guest Additions ISO from here:
+ http://download.virtualbox.org/virtualbox
+*NOTE*: Guest Additions versions prior to 5.1 will not work with Ubuntu 16.04.3. If you have an earlier version of VirtualBox, you should upgrade to the latest 5.1 version.
+
+Create a new VM in VirtualBox for Ubuntu
+----------------------------------------
+Type: Linux
+Version: Ubuntu (64-bit)
+At least 2048 MB memory
+At least 40 GB VDI
+Network: Attached to: NAT
+
+Create a port-forwarding rule for SSH
+-------------------------------------
+Create a port-forwarding rule so that you can use PuTTY (or other SSH client) to connect to the VM.
+Go to "Network" settings in VirtualBox, add a port forwarding rule:
+Name: SSH
+Protocol: TCP
+Host IP: 127.0.0.1
+Host Port: 1022
+Guest IP: <leave blank>
+Guest Port: 22
+
+Create Shared Folder
+--------------------
+This is oriented to Windows users. If you're using a MAC or a Linux host computer, the details may be different. You can share any folder on the host computer with the Ubuntu VM. On Windows, a practical choice is to share the C:\Users folder, so that your Windows home directory will be accessible from the Ubuntu VM.
+Go to "Shared Folders" settings in VirtualBox, add a share:
+Folder Path: C:\Users
+Folder Name: Users
+Auto-mount: <checked>
+Read-only: <unchecked>
+
+Install Ubuntu in the VM
+------------------------
+On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image". Select your Ubuntu ISO image.
+
+After selecting the ISO image, start the VM.
+Follow the prompts to install Ubuntu.
+
+Proxy Configuration (optional)
+------------------------------
+If you're behind a corporate firewall, configure some proxy settings. NOTE: your proxy configuration may require username and password credentials, not shown here.
+**Ubuntu system proxy setting:**
+ System Settings → Network → Network proxy
+ (Replace "proxyhost" and port with your actual proxy information)
+
+**apt proxy setting:**
+ Edit /etc/apt/apt.conf and add one line at the top (replace "proxyhost:port" with your actual proxy information):
+ Acquire::http::Proxy "http://proxyhost:port";
+ Reboot the VM.
+
+Install SSH Server
+------------------
+sudo apt update
+sudo apt install openssh-server
+
+Connect to the VM from your host computer
+-----------------------------------------
+ The PuTTY SSH client is popular. A connection to localhost:1022 (or whatever port you have forwarded) will go to the VM.
+
+Install VirtualBox Guest Additions
+----------------------------------
+On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image". Select your VirtualBox Guest Additions ISO image.
+
+In a VM terminal window, mount the cdrom:
+ sudo mkdir -p /media/cdrom
+ sudo mount /dev/cdrom /media/cdrom
+Install necessary dependencies:
+ sudo apt update
+ sudo apt install gcc g++ dkms
+Install the guest additions. NOTE: look for errors in the command output! If you see an error that says you are missing kernel headers, the most likely cause is that you are using a VirtualBox version that is too old. The error message is misleading.
+ cd /media/cdrom
+ sudo ./VBoxLinuxAdditions.run
+
+Add yourself to the vboxsf user group (replace "userid" with your user ID):
+ sudo usermod -a -G vboxsf userid
+Reboot the VM.
+In a VM terminal window, verify that you can access your home directory on the host computer, which should be mounted under here:
+ /media/sf_Users
\ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 3ef709c232..b540dc2e9f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,5 +8,4 @@ ONAP Service Orchestration Documentation .. toctree::
:maxdepth: 1
-
- ONAP SO Env Setup.pdf
\ No newline at end of file + Install_and_Configure_an_Ubuntu_VM.rst
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index f9150fabf0..5a2c541225 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -240,6 +240,12 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.10.19</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.jmockit</groupId> <artifactId>jmockit</artifactId> <version>1.8</version> diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java new file mode 100644 index 0000000000..9028109735 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs; + +public class BeanTest { + + @Test + public void testVnfInputs(){ + VnfInputs bean = new VnfInputs(); + bean.setAicCloudRegion("south"); + bean.setAicNodeClli("38982"); + bean.setAsdcServiceModelVersion("v2"); + bean.setBackoutOnFailure(false); + bean.setIsBaseVfModule(true); + bean.setPersonaModelId("2017"); + bean.setPersonaModelVersion("v3"); + bean.setProvStatus("active"); + bean.setServiceId("123456"); + bean.setServiceInstanceId("aaa1234"); + bean.setServiceType("vnf"); + bean.setTenantId("89903042"); + bean.setVfModuleId("4993022"); + bean.setVfModuleModelName("m1"); + bean.setVnfId("34"); + bean.setVnfName("test"); + bean.setVnfPersonaModelId("1002"); + bean.setVnfPersonaModelVersion("v3"); + bean.setVnfType("fddf"); + bean.setVolumeGroupId("7889"); + bean.setVolumeGroupName("test"); + + String str = bean.toString(); + assertTrue(str != null); + + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java new file mode 100644 index 0000000000..e18bc5e911 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import javax.ws.rs.core.Response; + +public class ManualTasksTest { + + ManualTasks task = new ManualTasks(); + + @Test + public void completeTaskTest(){ + Response resp = task.completeTask("test", "v2", "1882993"); + assertTrue(resp.getEntity().toString() != null); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java new file mode 100644 index 0000000000..445fab329f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequest; +import org.openecomp.mso.requestsdb.InfraRequests; + +public class NetworkInfoHandlerTest { + + NetworkInfoHandler handler = new NetworkInfoHandler(); + + @Test + public void fillVnfRequestTest(){ + NetworkRequest qr = new NetworkRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("2990102"); + ar.setVnfParams("test"); + handler.fillNetworkRequest(qr, ar, "v3"); + String vnfid = (String)qr.getNetworkParams(); + assertTrue(vnfid.equals("test")); + } + + @Test + public void fillVnfRequestTestV2(){ + NetworkRequest qr = new NetworkRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("2990102"); + ar.setVnfParams("test"); + handler.fillNetworkRequest(qr, ar, "v2"); + String vnfid = (String)qr.getNetworkParams(); + assertTrue(vnfid.equals("test")); + } + + @Test + public void fillVnfRequestTestV1(){ + NetworkRequest qr = new NetworkRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("2990102"); + ar.setVnfParams("test"); + handler.fillNetworkRequest(qr, ar, "v1"); + String vnfid = (String)qr.getNetworkParams(); + assertTrue(vnfid.equals("test")); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java new file mode 100644 index 0000000000..3feb168f51 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import java.lang.reflect.Field; +import java.net.URI; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import mockit.Mock; +import mockit.MockUp; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequest; +import org.openecomp.mso.requestsdb.InfraRequests; + +public class NetworkRequestHandlerTest { + + NetworkRequestHandler handler = null; + +UriInfo uriInfo = null; + + @Before + public void setup() throws Exception{ + + uriInfo = Mockito.mock(UriInfo.class); + Class<?> clazz = NetworkRequestHandler.class; + handler = (NetworkRequestHandler)clazz.newInstance(); + + Field f1 = handler.getClass().getDeclaredField("uriInfo"); + + f1.setAccessible(true); + f1.set(handler, uriInfo); + } + + @Test + public void manageVnfRequestTest(){ + Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2"); + assertTrue(null != resp); + } + + @Test + public void manageVnfRequest2Test(){ + Mockito.when(uriInfo.getRequestUri()) + .thenReturn(URI.create("http://localhost:8080/test")); + + new MockUp<MsoPropertiesUtils>() { + @Mock + public synchronized final boolean getNoPropertiesState() { + return false; + } + }; + Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2"); + assertTrue(null != resp); + } + + @Test + public void fillNetworkRequestTestV1(){ + NetworkRequest qr = new NetworkRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + handler.fillNetworkRequest(qr, ar, "v1"); + String param = (String)qr.getNetworkParams(); + assertTrue(param.equals("test")); + } + @Test + public void fillNetworkRequestTestV2(){ + NetworkRequest qr = new NetworkRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + handler.fillNetworkRequest(qr, ar, "v2"); + String param = (String)qr.getNetworkParams(); + assertTrue(param.equals("test")); + } + @Test + public void fillNetworkRequestTestV3(){ + NetworkRequest qr = new NetworkRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + handler.fillNetworkRequest(qr, ar, "v3"); + String param = (String)qr.getNetworkParams(); + assertTrue(param.equals("test")); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java new file mode 100644 index 0000000000..3738e2f94a --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.core.Response; + +import mockit.Mock; +import mockit.MockUp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.NetworkResource; + +public class NetworkTypesHandlerTest { + + NetworkTypesHandler handler = new NetworkTypesHandler(); + + @Test + public void getNetworkTypesTest(){ + Response resp = handler.getNetworkTypes("v2"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void getNetworkTypesTest2(){ + new MockUp<CatalogDatabase>() { + @Mock + public List <NetworkResource> getAllNetworkResources(){ + return null; + } + }; + Response resp = handler.getNetworkTypes("v2"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void getNetworkTypesTest3(){ + List <NetworkResource> netList = new ArrayList<>(); + new MockUp<CatalogDatabase>() { + @Mock + public List <NetworkResource> getAllNetworkResources(){ + NetworkResource ns = new NetworkResource(); + netList.add(ns); + return netList; + } + }; + Response resp = handler.getNetworkTypes("v2"); + assertTrue(resp.getEntity().toString() != null); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java new file mode 100644 index 0000000000..82eb8d4a60 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.junit.Test; +import org.mockito.Mockito; + +public class OrchestrationRequestsTest { + + OrchestrationRequests req = new OrchestrationRequests(); + + @Test + public void getOrchestrationRequestTest(){ + Response resp = req.getOrchestrationRequest("1001", "v3"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void getE2EServiceInstancesTest(){ + Response resp = req.getE2EServiceInstances("1001", "v3","599934"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void getOrchestrationRequest2Test(){ + UriInfo uriInfo = Mockito.mock(UriInfo.class); + Response resp = req.getOrchestrationRequest(uriInfo, "v3"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void unlockOrchestrationRequestTest(){ + Response resp = req.unlockOrchestrationRequest("{\"result\":\"success\"}","1001", "v3"); + assertTrue(resp.getEntity().toString() != null); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java new file mode 100644 index 0000000000..4926da77b1 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import javax.ws.rs.core.Response; + +import org.junit.Test; + +public class TasksHandlerTest { + + TasksHandler handler = new TasksHandler(); + + @Test + public void queryFiltersTest(){ + Response resp = handler.queryFilters("10020", "399495", "test", "nfRole", "buildingBlockName", "originalRequestDate", "originalRequestorId", "v2"); + assertTrue(resp.getEntity().toString() != null); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java new file mode 100644 index 0000000000..4305db3e72 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import mockit.Mock; +import mockit.MockUp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VnfResource; + +import javax.ws.rs.core.Response; +public class VfModuleModelNamesHandlerTest { + + VfModuleModelNamesHandler handler = new VfModuleModelNamesHandler(); + + @Test + public void getVfModuleModelNamesTest(){ + Response resp = handler.getVfModuleModelNames("v2"); + assertTrue(resp.getEntity().toString()!= null); + } + + @Test + public void getVfModuleModelNamesTest2(){ + new MockUp<CatalogDatabase>() { + @Mock + public List <VfModule> getAllVfModules(){ + List <VfModule> list = new ArrayList<VfModule>(); + VfModule resource = new VfModule(); + list.add(resource); + return list; + } + }; + Response resp = handler.getVfModuleModelNames("v2"); + assertTrue(resp.getEntity().toString()!= null); + } + + + @Test + public void getVfModuleModelNamesTest3(){ + new MockUp<CatalogDatabase>() { + @Mock + public List <VfModule> getAllVfModules(){ + return null; + } + }; + Response resp = handler.getVfModuleModelNames("v2"); + assertTrue(resp.getEntity().toString()!= null); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java new file mode 100644 index 0000000000..fd22af012f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; +import org.openecomp.mso.requestsdb.InfraRequests; + +public class VnfInfoHandlerTest { + + VnfInfoHandler handler = new VnfInfoHandler(); + + @Test + public void fillVnfRequestTest(){ + VnfRequest qr = new VnfRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("2990102"); + ar.setVnfParams("test"); + handler.fillVnfRequest(qr, ar, "v3"); + String vnfid = (String)qr.getVnfParams(); + assertTrue(vnfid.equals("test")); + } + + @Test + public void fillVnfRequestTestV2(){ + VnfRequest qr = new VnfRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("2990102"); + ar.setVnfParams("test"); + handler.fillVnfRequest(qr, ar, "v2"); + String vnfid = (String)qr.getVnfParams(); + assertTrue(vnfid.equals("test")); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java new file mode 100644 index 0000000000..8d06b40074 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import java.lang.reflect.Field; +import java.net.URI; + +import mockit.Mock; +import mockit.MockUp; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; +import org.openecomp.mso.requestsdb.InfraRequests; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +public class VnfRequestHandlerTest { + VnfRequestHandler handler = null; + UriInfo uriInfo = null; + + @Before + public void setup() throws Exception{ + + uriInfo = Mockito.mock(UriInfo.class); + Class<?> clazz = VnfRequestHandler.class; + handler = (VnfRequestHandler)clazz.newInstance(); + + Field f1 = handler.getClass().getDeclaredField("uriInfo"); + + f1.setAccessible(true); + f1.set(handler, uriInfo); + } + + @Test + public void manageVnfRequestTest(){ + Response resp = handler.manageVnfRequest("<name>Test</name>", "v2"); + assertTrue(null != resp); + } + + @Test + public void manageVnfRequest2Test(){ + Mockito.when(uriInfo.getRequestUri()) + .thenReturn(URI.create("http://localhost:8080/test")); + + new MockUp<MsoPropertiesUtils>() { + @Mock + public synchronized final boolean getNoPropertiesState() { + return false; + } + }; + Response resp = handler.manageVnfRequest("<name>Test</name>", "v2"); + assertTrue(null != resp); + } + + @Test + public void fillVnfRequestTest(){ + VnfRequest qr = new VnfRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + handler.fillVnfRequest(qr, ar, "v1"); + String param = (String)qr.getVnfParams(); + assertTrue(param.equals("test")); + } + + @Test + public void fillVnfRequestTestV2(){ + VnfRequest qr = new VnfRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + handler.fillVnfRequest(qr, ar, "v2"); + String param = (String)qr.getVnfParams(); + assertTrue(param.equals("test")); + } + @Test + public void fillVnfRequestTestV3(){ + VnfRequest qr = new VnfRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + ar.setServiceInstanceId("38829"); + handler.fillVnfRequest(qr, ar, "v3"); + String param = (String)qr.getVnfParams(); + assertTrue(param.equals("test")); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java new file mode 100644 index 0000000000..7eabc1ac2a --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import mockit.Mock; +import mockit.MockUp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.NetworkResource; +import org.openecomp.mso.db.catalog.beans.VnfResource; + +import javax.ws.rs.core.Response; + +public class VnfTypesHandlerTest { + + VnfTypesHandler handler = new VnfTypesHandler(); + + @Test + public void getVnfTypesTest(){ + Response resp = handler.getVnfTypes(null, "v2"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void getVnfTypesTest2(){ + new MockUp<CatalogDatabase>() { + @Mock + public List <VnfResource> getAllVnfResources(){ + return null; + } + }; + Response resp = handler.getVnfTypes(null, "v2"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void getVnfTypesTest3(){ + new MockUp<CatalogDatabase>() { + @Mock + public List <VnfResource> getAllVnfResources(){ + List <VnfResource> list = new ArrayList<VnfResource>(); + VnfResource resource = new VnfResource(); + list.add(resource); + return list; + } + }; + Response resp = handler.getVnfTypes(null, "v2"); + assertTrue(resp.getEntity().toString() != null); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java new file mode 100644 index 0000000000..78ed076b55 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest; +import org.openecomp.mso.requestsdb.InfraRequests; + +public class VolumeInfoHandlerTest { + + VolumeInfoHandler handler = new VolumeInfoHandler(); + + @Test + public void fillVnfRequestTestV3(){ + VolumeRequest qr = new VolumeRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("2990102"); + ar.setVnfParams("test"); + handler.fillVolumeRequest(qr, ar, "v3"); + String vnfid = (String)qr.getVolumeParams(); + assertTrue(vnfid.equals("test")); + } + + @Test + public void fillVnfRequestTestV2(){ + VolumeRequest qr = new VolumeRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("2990102"); + ar.setVnfParams("test"); + handler.fillVolumeRequest(qr, ar, "v2"); + String vnfid = (String)qr.getVolumeParams(); + assertTrue(vnfid.equals("test")); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java new file mode 100644 index 0000000000..be41944b31 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.mso.apihandlerinfra; + +import static org.junit.Assert.assertTrue; + +import java.lang.reflect.Field; +import java.net.URI; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import mockit.Mock; +import mockit.MockUp; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +public class VolumeRequestHandlerTest { + VolumeRequestHandler handler = null; + + UriInfo uriInfo = null; + + @Before + public void setup() throws Exception{ + + uriInfo = Mockito.mock(UriInfo.class); + Class<?> clazz = VolumeRequestHandler.class; + handler = (VolumeRequestHandler)clazz.newInstance(); + + Field f1 = handler.getClass().getDeclaredField("uriInfo"); + + f1.setAccessible(true); + f1.set(handler, uriInfo); + } + + @Test + public void manageVnfRequestTest(){ + Response resp = handler.manageVolumeRequest("<name>Test</name>", "v2"); + assertTrue(null != resp); + } + + @Test + public void manageVnfRequest2Test(){ + Mockito.when(uriInfo.getRequestUri()) + .thenReturn(URI.create("http://localhost:8080/test")); + + new MockUp<MsoPropertiesUtils>() { + @Mock + public synchronized final boolean getNoPropertiesState() { + return false; + } + }; + Response resp = handler.manageVolumeRequest("<name>Test</name>", "v2"); + assertTrue(null != resp); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java new file mode 100644 index 0000000000..9409a642ec --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java @@ -0,0 +1,63 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.mso.db.catalog.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Timestamp;
+
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+
+/**
+ */
+
+public class VfModuleTest {
+
+ @Test
+ public final void vfModuleDataTest() {
+ VfModule vfModule = new VfModule();
+ vfModule.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(vfModule.getCreated() != null);
+ vfModule.setDescription("description");
+ assertTrue(vfModule.getDescription().equalsIgnoreCase("description"));
+
+ vfModule.setModelInvariantUUID("action");
+ assertTrue(vfModule.getModelInvariantUUID().equalsIgnoreCase("action"));
+
+ vfModule.setModelName("modelName");
+ assertTrue(vfModule.getModelName().equalsIgnoreCase("modelName"));
+
+ vfModule.setModelUUID("modelUUID");
+ assertTrue(vfModule.getModelUUID().equalsIgnoreCase("modelUUID"));
+ vfModule.setModelVersion("modelVersion");
+ assertTrue(vfModule.getModelVersion().equalsIgnoreCase("modelVersion"));
+ vfModule.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");
+ assertTrue(vfModule.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
+ vfModule.setVnfResourceModelUUId("vnfResourceModelUUId");
+ assertTrue(vfModule.getVnfResourceModelUUId().equalsIgnoreCase("vnfResourceModelUUId"));
+ vfModule.setIsBase(1);
+ assertTrue(vfModule.isBase());
+// assertTrue(vfModule.toString() == null);
+
+ }
+
+}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java new file mode 100644 index 0000000000..95e45f7b52 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java @@ -0,0 +1,63 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.mso.db.catalog.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Timestamp;
+
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+
+/**
+ */
+
+public class VnfRecipeTest {
+
+ @Test
+ public final void vnfRecipeDataTest() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ vnfRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(vnfRecipe.getCreated() != null);
+ vnfRecipe.setDescription("description");
+ assertTrue(vnfRecipe.getDescription().equalsIgnoreCase("description"));
+
+ vnfRecipe.setOrchestrationUri("orchestrationUri");
+ assertTrue(vnfRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
+
+ vnfRecipe.setRecipeTimeout(1);
+ assertTrue(vnfRecipe.getRecipeTimeout() == 1);
+ vnfRecipe.setVnfType("vnfType");
+ assertTrue(vnfRecipe.getVnfType().equalsIgnoreCase("vnfType"));
+
+ vnfRecipe.setServiceType("serviceType");
+ assertTrue(vnfRecipe.getServiceType().equalsIgnoreCase("serviceType"));
+ vnfRecipe.setVersion("version");
+ assertTrue(vnfRecipe.getVersion().equalsIgnoreCase("version"));
+ vnfRecipe.setVnfParamXSD("vnfParamXSD");
+ assertTrue(vnfRecipe.getVnfParamXSD().equalsIgnoreCase("vnfParamXSD"));
+ vnfRecipe.setVfModuleId("vfModuleId");
+ assertTrue(vnfRecipe.getVfModuleId().equalsIgnoreCase("vfModuleId"));
+// assertTrue(vnfRecipe.toString() == null);
+
+ }
+
+}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java new file mode 100644 index 0000000000..68749e397e --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java @@ -0,0 +1,82 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.mso.db.catalog.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Timestamp;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
+
+/**
+ */
+
+public class VnfResourceTest {
+
+ @Test
+ public final void vnfResourceDataTest() {
+
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(vnfResource.getCreated() != null);
+ vnfResource.setDescription("description");
+ assertTrue(vnfResource.getDescription().equalsIgnoreCase("description"));
+
+ vnfResource.setAicVersionMax("aicVersionMax");
+ assertTrue(vnfResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
+
+ vnfResource.setAicVersionMin("aicVersionMin");
+ assertTrue(vnfResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
+ vnfResource.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");
+ assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
+
+ vnfResource.setModelInvariantUuid("modelInvariantUuid");
+ assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));
+ vnfResource.setModelName("modelName");
+ assertTrue(vnfResource.getModelName().equalsIgnoreCase("modelName"));
+ vnfResource.setModelUuid("modelUuid");
+ assertTrue(vnfResource.getModelUuid().equalsIgnoreCase("modelUuid"));
+ vnfResource.setModelVersion("modelVersion");
+ assertTrue(vnfResource.getModelVersion().equalsIgnoreCase("modelVersion"));
+ vnfResource.setOrchestrationMode("orchestrationMode");
+ assertTrue(vnfResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode"));
+ vnfResource.setTemplateId("heatTemplateArtifactUUId");
+ assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
+ vnfResource.setModelInvariantUuid("modelInvariantUuid");
+ assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));
+ Set<VnfResourceCustomization> list = new HashSet<>();
+ list.add(new VnfResourceCustomization());
+ vnfResource.setVnfResourceCustomizations(list);
+ assertTrue(vnfResource.getVfModuleCustomizations() != null);
+ Set<VfModule> vfModules = new HashSet<>();
+ vfModules.add(new VfModule());
+ vnfResource.setVfModules(vfModules);
+ assertTrue(vnfResource.getVfModules() != null);
+// assertTrue(vnfResource.toString() != null);
+
+ }
+
+}
|