diff options
2 files changed, 12 insertions, 27 deletions
diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/RestconfApiController.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/RestconfApiController.java index e2cd864d7..7c4717da8 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/RestconfApiController.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/RestconfApiController.java @@ -1,27 +1,10 @@ package org.onap.ccsdk.sli.core.sliapi.springboot; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.Properties; - -import javax.servlet.http.HttpServletRequest; -import javax.validation.Valid; - import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.*; -import org.onap.ccsdk.sli.core.sli.ConfigurationException; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicLoader; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; -import org.onap.ccsdk.sli.core.sli.provider.base.HashMapResolver; -import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider; -import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicResolver; -import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase; -import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase; +import org.onap.ccsdk.sli.core.sli.*; +import org.onap.ccsdk.sli.core.sli.provider.base.*; import org.onap.ccsdk.sli.core.sliapi.model.ExecuteGraphInput; import org.onap.ccsdk.sli.core.sliapi.model.ResponseFields; import org.slf4j.Logger; @@ -30,7 +13,13 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import com.fasterxml.jackson.databind.ObjectMapper; +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; @javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-02-20T12:50:11.207-05:00") @@ -75,7 +64,7 @@ public class RestconfApiController implements RestconfApi { return; } - String serviceLogicDirectory = System.getProperty("serviceLogicDirectory"); + String serviceLogicDirectory = System.getProperty("serviceLogicDirectory", "src/main/resources"); System.out.println("serviceLogicDirectory is " + serviceLogicDirectory); SvcLogicLoader loader = new SvcLogicLoader(serviceLogicDirectory, store); diff --git a/sliapi/springboot/src/test/java/org/onap/ccsdk/sli/core/sliapi/springboot/RestconfApiControllerTest.java b/sliapi/springboot/src/test/java/org/onap/ccsdk/sli/core/sliapi/springboot/RestconfApiControllerTest.java index af55a5181..701cb3eb3 100644 --- a/sliapi/springboot/src/test/java/org/onap/ccsdk/sli/core/sliapi/springboot/RestconfApiControllerTest.java +++ b/sliapi/springboot/src/test/java/org/onap/ccsdk/sli/core/sliapi/springboot/RestconfApiControllerTest.java @@ -9,7 +9,6 @@ import org.onap.ccsdk.sli.core.sliapi.model.ExecutegraphinputInput; import org.onap.ccsdk.sli.core.sliapi.model.ResponseFields; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @@ -25,8 +24,6 @@ public class RestconfApiControllerTest { @Autowired private MockMvc mvc; - @MockBean - private RestconfApiController restconfApiController; @Test public void testHealthcheck() throws Exception { @@ -82,8 +79,7 @@ public class RestconfApiControllerTest { MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(url).contentType(MediaType.APPLICATION_JSON_VALUE).content(jsonString)).andReturn(); - // Note: this really should return 401 (and truly does), but mockito always returns a 200. - assertEquals(200, mvcResult.getResponse().getStatus()); + assertEquals(401, mvcResult.getResponse().getStatus()); } |