From 8379e2a201b65bfe911bc3887ffe6e604196302b Mon Sep 17 00:00:00 2001 From: Dilip kumar Pampana Date: Sun, 15 Jul 2018 01:49:23 -0400 Subject: Junits for Interface-services Junit test for vf-module-id to check for scope overlap Issue-ID: APPC-1079 Change-Id: I7345e709809f46df3532d8d8608ce5d53d04ed11 Signed-off-by: Dilip kumar Pampana --- .../serviceExecutor/TestServiceExecutor.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'appc-inbound/appc-interfaces-service/bundle') diff --git a/appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java b/appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java index e5bf0c0cd..4a8889022 100644 --- a/appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java +++ b/appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Copyright (C) 2018 IBM * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +30,10 @@ import static org.junit.Assert.*; import org.junit.Test; import org.onap.appc.interfaces.service.executorImpl.ServiceExecutorImpl; +import org.onap.appc.interfaces.service.data.ScopeOverlap; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.powermock.reflect.Whitebox; public class TestServiceExecutor { @@ -37,4 +43,15 @@ public class TestServiceExecutor { String requestData = "{\"vnf-id\":\"ibcx8888v\",\"current-request\" :{\"action\" : \"Audit\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id\",\"vnf-id\" : \"vnf-id\",\"vnfc-name\" : \"vnfc-name\",\"vf-module-id\" : \"vf-module-id\",\"vserver-id\": \"vserver-id\"}},\"in-progress-requests\" :[{\"action\" : \"HealthCheck\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id1\",\"vnf-id\" : \"vnf-id1\",\"vnfc-name\" : \"vnfc-name1\",\"vf-module-id\" : \"vf-module-id\",\"vserver-id\": \"vserver-id1\"}},{\"action\" : \"CheckLock\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id2\",\"vnf-id\" : \"vnf-id2\",\"vnfc-name\" : \"vnfc-name2\",\"vf-module-id\" : \"vf-module-id2\",\"vserver-id\": \"vserver-id2\"}}]}"; sei.isRequestOverLap(requestData); } + + @Test + public void isVserverOrVnfcIdOverLapTest() throws Exception{ + String requestData = "{\"vnf-id\":\"ibcx8888v\",\"current-request\" :{\"action\" : \"Audit\",\"action-identifiers\" : {\"vnf-id\" : \"vnf-id\",\"vf-module-id\" : \"vf-module-1234\"}},\"in-progress-requests\" :[{\"action\" : \"HealthCheck\",\"action-identifiers\" : {\"vnf-id\" : \"vnf-id1\",\"vf-module-id\":\"vf-module-1234\"}}]}"; + ServiceExecutorImpl sei = new ServiceExecutorImpl(); + ScopeOverlap scopeOverlap = new ScopeOverlap(); + ObjectMapper mapper = new ObjectMapper(); + scopeOverlap = mapper.readValue(requestData, ScopeOverlap.class); + boolean result = Whitebox.invokeMethod(sei, "isVserverOrVnfcIdOverLap",scopeOverlap); + assertEquals(true, result); + } } -- cgit 1.2.3-korg