X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=vid-app-common%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fvid%2Fmso%2FMsoBusinessLogicImplTest.java;h=8a821c27a9f137643a46afdc5b6886691b99138c;hb=6ad41e3ccd398a2721f41ad61c80b7bb03f7d127;hp=718e22fb4e56adb746fa865bf86c64082cc69b44;hpb=5ec29ff5e3864f1ba6ecac71f8bffbefa400cf27;p=vid.git diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java index 718e22fb4..8a821c27a 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java @@ -22,6 +22,7 @@ package org.onap.vid.mso; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -41,7 +42,6 @@ import org.togglz.core.manager.FeatureManager; import java.io.IOException; import java.net.URL; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; @@ -206,7 +206,7 @@ public class MsoBusinessLogicImplTest { String vnfEndpoint = String.format(endpointTemplate, serviceInstanceId, vnfInstanceId); org.onap.vid.changeManagement.RequestDetails requestDetails = readRequest( "scaleOutVfModulePayload.json"); - org.onap.vid.changeManagement.RequestDetailsWrapper expectedRequest = readExpectedRequest( + org.onap.vid.changeManagement.RequestDetailsWrapper expectedRequest = readExpectedRequest( "scaleOutVfModulePayloadToMso.json"); MsoResponseWrapper expectedMsoResponseWrapper = createOkResponse(); given( @@ -229,7 +229,7 @@ public class MsoBusinessLogicImplTest { return objectMapper.readValue(url, org.onap.vid.changeManagement.RequestDetails.class); } - private org.onap.vid.changeManagement.RequestDetailsWrapper readExpectedRequest(String requestJsonFilename) + private org.onap.vid.changeManagement.RequestDetailsWrapper readExpectedRequest(String requestJsonFilename) throws IOException { Path path = Paths.get("payload_jsons", requestJsonFilename); URL url = this.getClass().getClassLoader().getResource(path.toString()); @@ -252,15 +252,15 @@ public class MsoBusinessLogicImplTest { } @Test - public void shouldFilterOutOrchestrationRequestsNotAllowedInDashboard() throws IOException { + public void shouldFilterOutOrchestrationRequestsNotAllowedInDashboard() throws Exception { //given String vnfModelTypeOrchestrationRequests = getFileContentAsString("mso_model_info_sample_response.json"); String scaleOutActionOrchestrationRequests = getFileContentAsString("mso_action_scaleout_sample_response.json"); MsoResponseWrapper msoResponseWrapperMock = mock(MsoResponseWrapper.class); given(msoInterface - .getOrchestrationRequestsForDashboard(any(String.class), any(String.class), any(String.class), - any(RestObject.class))) + .getOrchestrationRequest(any(String.class), any(String.class), any(String.class), + any(RestObject.class), anyBoolean())) .willReturn(msoResponseWrapperMock); given(msoResponseWrapperMock.getEntity()) .willReturn(vnfModelTypeOrchestrationRequests, scaleOutActionOrchestrationRequests); @@ -276,14 +276,14 @@ public class MsoBusinessLogicImplTest { .map(el -> el.getRequestType().toUpperCase()) .collect(Collectors.toList())); assertThat(filteredOrchestrationReqs) - .extracting(org.onap.vid.domain.mso.Request::getRequestScope) + .extracting(Request::getRequestScope) .containsOnly("vnf", "vfModule"); } - private String getFileContentAsString(String resourceName) throws IOException { - URL url = this.getClass().getClassLoader().getResource("."); - Path path = Paths.get(url.getPath(), "payload_jsons", resourceName); - return new String(Files.readAllBytes(path)); + private String getFileContentAsString(String resourceName) throws Exception { + Path path = Paths.get("payload_jsons", resourceName); + URL url = this.getClass().getClassLoader().getResource(path.toString()); + return IOUtils.toString(url.toURI(), "UTF-8"); } private static class MsoRequestWrapperMatcher implements