/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Bell Canada. All rights reserved.
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
private static final String SUBREQUEST_ID = "123456";
private static final String CDS_RECIPE = "test-cds-recipe";
private static final String SUBREQUEST_ID = "123456";
private static final String CDS_RECIPE = "test-cds-recipe";
@Test
public void testConstructRequestWhenMissingCdsParamsInPolicyPayload() {
policy.setPayload(new HashMap<>());
@Test
public void testConstructRequestWhenMissingCdsParamsInPolicyPayload() {
policy.setPayload(new HashMap<>());
- Optional<ExecutionServiceInput> cdsRequestOpt = cdsActor
- .constructRequest(onset, operation, policy, aaiParams);
+ Optional<ExecutionServiceInput> cdsRequestOpt = cdsActor.constructRequest(onset, operation, policy, aaiParams);
- Optional<ExecutionServiceInput> cdsRequestOpt = cdsActor
- .constructRequest(onset, operation, policy, aaiParams);
+ Optional<ExecutionServiceInput> cdsRequestOpt = cdsActor.constructRequest(onset, operation, policy, aaiParams);
public void testSendRequestToCdsLatchInterrupted() throws InterruptedException {
// Reset cdsClient
CountDownLatch countDownLatch = mock(CountDownLatch.class);
public void testSendRequestToCdsLatchInterrupted() throws InterruptedException {
// Reset cdsClient
CountDownLatch countDownLatch = mock(CountDownLatch.class);
- doThrow(new InterruptedException("Test latch interrupted failure")).when(countDownLatch)
- .await(anyLong(), any(TimeUnit.class));
+ doThrow(new InterruptedException("Test latch interrupted failure")).when(countDownLatch).await(anyLong(),
+ any(TimeUnit.class));
when(cdsClient.sendRequest(any(ExecutionServiceInput.class))).thenReturn(countDownLatch);
CdsActorServiceProvider.CdsActorServiceManager cdsActorSvcMgr = cdsActor.new CdsActorServiceManager();
when(cdsClient.sendRequest(any(ExecutionServiceInput.class))).thenReturn(countDownLatch);
CdsActorServiceProvider.CdsActorServiceManager cdsActorSvcMgr = cdsActor.new CdsActorServiceManager();
- CdsResponse response = cdsActorSvcMgr
- .sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build());
+ CdsResponse response =
+ cdsActorSvcMgr.sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build());
assertTrue(Thread.interrupted());
assertNotNull(response);
assertEquals(CdsActorConstants.INTERRUPTED, response.getStatus());
assertTrue(Thread.interrupted());
assertNotNull(response);
assertEquals(CdsActorConstants.INTERRUPTED, response.getStatus());
@Test
public void testSendRequestToCdsLatchTimedOut() {
CdsActorServiceProvider.CdsActorServiceManager cdsActorSvcMgr = cdsActor.new CdsActorServiceManager();
@Test
public void testSendRequestToCdsLatchTimedOut() {
CdsActorServiceProvider.CdsActorServiceManager cdsActorSvcMgr = cdsActor.new CdsActorServiceManager();
- CdsResponse response = cdsActorSvcMgr
- .sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build());
+ CdsResponse response =
+ cdsActorSvcMgr.sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build());