diff options
author | Boslet, Cory <cory.boslet@att.com> | 2019-11-21 20:48:40 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-11-21 20:48:41 -0500 |
commit | f89d9e0887e41de727b4e829916ae60dd6926e0e (patch) | |
tree | df4e980859cb4756abb4ee878ab351fe47cde96d /mso-api-handlers/mso-requests-db/src/test/java | |
parent | df2db9f4a7c3fccc5f617792a057d8dbc6bf9d34 (diff) |
Updated and added to get request processing data
Updated and added to get request processing data by internal data flag
Committing file that I forgot to commit.
Added junit test and change method to not use bowman client.
Added and updated orch request unit test
ran formatter so verify job will pass and not cry
Added an intergration test for new jpa method.
Format unit test class for the verify job build
Update param key in jpa and also changed return type.
Updated method name in request client to avoid confusion
Issue-ID: SO-2534
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I420f1a887835dd0d9d0ad991e5b17dddb1db5376
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/test/java')
-rw-r--r-- | mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java index fff6ad1013..0ad8d1458e 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java @@ -4,22 +4,35 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.times; import java.net.URI; +import javax.ws.rs.core.UriBuilder; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.logging.filter.spring.SpringClientPayloadFilter; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.RequestProcessingData; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; +import uk.co.blackpepper.bowman.ClientFactory; +import uk.co.blackpepper.bowman.Configuration; @RunWith(MockitoJUnitRunner.class) public class RequestDbClientTest { - + @Spy @InjectMocks protected RequestsDbClient requestsDbClient; @@ -44,4 +57,16 @@ public class RequestDbClientTest { Mockito.verify(restTemplate, times(1)).exchange(eq(uri), eq(HttpMethod.PATCH), isA(HttpEntity.class), eq(String.class)); } + + @Test + public void testGetRequestProcessingDataBySoRequestIdAndIsInternalData() { + Mockito.doReturn("host").when(requestsDbClient).getEndpoint(); + requestsDbClient.getExternalRequestProcessingDataBySoRequestId("12345"); + URI uri = URI.create(UriBuilder + .fromUri("host/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc") + .queryParam("SO_REQUEST_ID", "12345").queryParam("IS_INTERNAL_DATA", false).build().toString()); + Mockito.verify(restTemplate, times(1)).exchange(eq(uri), eq(HttpMethod.GET), isA(HttpEntity.class), + eq(RequestProcessingData[].class)); + } + } |