import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.portalsdk.core.util.SystemProperties;
-import org.onap.vid.aai.util.AAIRestInterface;
import org.onap.vid.aai.util.HttpsAuthClient;
import org.onap.vid.aai.util.ServletRequestHelper;
import org.onap.vid.aai.util.SystemPropertyHelper;
import org.onap.vid.testUtils.TestUtils;
import org.onap.vid.utils.Logging;
import org.onap.vid.utils.SystemPropertiesWrapper;
-import org.onap.vid.utils.Unchecked;
import org.springframework.http.HttpMethod;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
@Mock
SyncRestClient syncRestClient;
- @InjectMocks
- private AAIRestInterface aaiRestInterface;
-
@Captor
private ArgumentCaptor<MultivaluedMap<String, Object>> multivaluedMapArgumentCaptor;
return headersCapture;
}
- @DataProvider
- public Object[][] aaiMethods() {
- return Stream.<ThrowingConsumer<AAIRestInterface>>of(
-
- client -> client.RestGet("from app id", "some transId", Unchecked.toURI("/any path"), false),
- client -> client.RestPost("from app id", "/any path", "some payload", false),
- client -> client.doRest("from app id", "some transId", Unchecked.toURI("/any path"), "somebody", HttpMethod.GET, false, true),
- client -> client.RestPut("from app id", "/any path", "some payload", false, false)
-
- ).map(l -> ImmutableList.of(l).toArray()).collect(Collectors.toList()).toArray(new Object[][]{});
- }
-
- @Test(dataProvider = "aaiMethods")
- public void aai(Consumer<AAIRestInterface> f) throws Exception {
- //given
- final TestUtils.JavaxRsClientMocks mocks = setAndGetMocksInsideRestImpl(aaiRestInterface);
- //when
- f.accept(aaiRestInterface);
- //then
- HeadersVerifier headersVerifier = new HeadersVerifier().verifyFirstCall(mocks.getFakeBuilder());
-
- //verify requestId is same in next call but invocationId is different
- //given
- final TestUtils.JavaxRsClientMocks mocks2 = setAndGetMocksInsideRestImpl(aaiRestInterface);
- //when
- f.accept(aaiRestInterface);
- //then
- headersVerifier.verifySecondCall(mocks2.getFakeBuilder());
-
- }
-
// @Test(dataProvider = "schedulerMethods")
// public void scheduler(Consumer<AAIRestInterface> f) throws Exception {
//