summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-12 20:31:28 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-12 20:34:07 -0400
commit2549b269956aebda13e9af1d00ebc3015301a7ad (patch)
tree8edc6b04409166a079ffff7b8af1a91194011cf4 /mso-api-handlers/mso-api-handler-infra/src
parent48478b9531fb2901c392ce1142f9443b5d805148 (diff)
Updated ServicesInstancesTest with mocks
- Updated ServicesInstancesTest with mocks for RequestDb.InfraActiveRequests query. Tests in ServicesInstancesTest were not failing, but seeing 'HTTP method does not match' messages on the console for most of the tests. Change-Id: Ic029cc50da1f414d3228f80b02721e132a15c264 Issue-ID: SO-1783 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java2
2 files changed, 7 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
index da37be98b2..5da16f4326 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
@@ -28,10 +28,12 @@ import javax.transaction.Transactional;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
@@ -52,6 +54,9 @@ public abstract class BaseTest {
protected Logger logger = LoggerFactory.getLogger(BaseTest.class);
protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+ @SpyBean
+ protected RequestsDbClient requestsDbClient;
+
@Autowired
protected Environment env;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 1bb3932cff..db6273dc4a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -55,6 +55,7 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -124,6 +125,7 @@ public class ServiceInstancesTest extends BaseTest {
}
wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests.*")).willReturn(aResponse()
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
+ Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any());
}
public String inputStream(String JsonInput) throws IOException {