diff options
Diffstat (limited to 'models-interactions/model-actors/actor.vfc')
3 files changed, 14 insertions, 9 deletions
diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java index 827109d10..573ee2698 100644 --- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java +++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java @@ -119,6 +119,7 @@ public abstract class VfcOperation extends HttpOperation<VfcResponse> { if (getCount++ >= getMaxGets()) { logger.warn("{}: execeeded 'get' limit {} for {}", getFullName(), getMaxGets(), params.getRequestId()); setOutcome(outcome, PolicyResult.FAILURE_TIMEOUT); + outcome.setResponse(response); outcome.setMessage(VFC_RESPONSE_CODE + " " + outcome.getMessage()); return CompletableFuture.completedFuture(outcome); } @@ -179,6 +180,7 @@ public abstract class VfcOperation extends HttpOperation<VfcResponse> { // set default result and message setOutcome(outcome, result); + outcome.setResponse(response); outcome.setMessage(rawResponse.getStatus() + " " + outcome.getMessage()); return outcome; } diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java index 5fe4973ce..d8ba7e4e8 100644 --- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java +++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java @@ -22,6 +22,7 @@ package org.onap.policy.controlloop.actor.vfc; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.concurrent.CompletableFuture; import org.apache.commons.lang3.tuple.Pair; @@ -33,6 +34,7 @@ import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.vfc.VfcRequest; +import org.onap.policy.vfc.VfcResponse; public class RestartTest extends BasicVfcOperation { private Restart restartOper; @@ -72,6 +74,7 @@ public class RestartTest extends BasicVfcOperation { outcome = restartOper.start().get(); assertEquals(PolicyResult.SUCCESS, outcome.getResult()); + assertTrue(outcome.getResponse() instanceof VfcResponse); } @Test diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java index 4d98b97c9..0b58fd4a3 100644 --- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java +++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java @@ -82,30 +82,30 @@ public class VfcOperationTest extends BasicVfcOperation { response.setResponseDescriptor(new VfcResponseDescriptor()); response.setJobId("sampleJobId"); + + // null status CompletableFuture<OperationOutcome> future2 = oper.postProcessResponse(outcome, PATH, rawResponse, response); assertFalse(future2.isDone()); - // assertSame(outcome, future2.get()); TODO Hanging - assertEquals(PolicyResult.SUCCESS, outcome.getResult()); response.getResponseDescriptor().setStatus("FinisHeD"); future2 = oper.postProcessResponse(outcome, PATH, rawResponse, response); assertTrue(future2.isDone()); assertSame(outcome, future2.get()); assertEquals(PolicyResult.SUCCESS, outcome.getResult()); + assertSame(response, outcome.getResponse()); + // failed response.getResponseDescriptor().setStatus("eRRor"); future2 = oper.postProcessResponse(outcome, PATH, rawResponse, response); assertTrue(future2.isDone()); assertSame(outcome, future2.get()); assertEquals(PolicyResult.FAILURE, outcome.getResult()); + assertSame(response, outcome.getResponse()); - // failed - /* - * response.getResponseDescriptor().setStatus("anything but finished"); future2 = - * oper.postProcessResponse(outcome, PATH, rawResponse, response); - * assertTrue(future2.isDone()); assertSame(outcome, future2.get()); - * assertEquals(PolicyResult.FAILURE, outcome.getResult()); - */ + // unfinished + response.getResponseDescriptor().setStatus("anything but finished"); + future2 = oper.postProcessResponse(outcome, PATH, rawResponse, response); + assertFalse(future2.isDone()); } @Test |