diff options
author | a.sreekumar <ajith.sreekumar@bell.ca> | 2020-07-03 11:08:04 +0100 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@bell.ca> | 2020-07-03 22:19:19 +0100 |
commit | fb826f241cb78b70910f842bbed0bb507b1236ca (patch) | |
tree | 6fdef2e9f89a4a81242e6813a0d38f10d7bd7f1b /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test | |
parent | 9519d1257b4fe4fbb68d3e9ab155de8ff0f13052 (diff) |
Fixing issue with policy chaining after CDS request failure in APEX
Change-Id: Id27343c21caaf69e30ee13076a2963c256fab55d
Issue-ID: POLICY-2687
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test')
-rw-r--r-- | plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java index 53d191e14..13ecaba6a 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 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. @@ -20,7 +21,6 @@ package org.onap.policy.apex.plugins.event.carrier.grpc; -import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.spy; import java.nio.file.Files; @@ -37,6 +37,7 @@ import org.onap.policy.cds.client.CdsProcessorGrpcClient; @RunWith(MockitoJUnitRunner.class) public class ApexGrpcProducerTest { + private static final String PRODUCER_NAME = "TestApexGrpcProducer"; private static final String HOST = "localhost"; @Mock private CdsProcessorGrpcClient grpcClient; @@ -56,30 +57,30 @@ public class ApexGrpcProducerTest { @Test(expected = ApexEventException.class) public void testInit_fail() throws ApexEventException { - apexGrpcProducer.init("TestApexGrpcProducer", new EventHandlerParameters()); + apexGrpcProducer.init(PRODUCER_NAME, new EventHandlerParameters()); } @Test public void testInit_pass() { // should not throw an exception - Assertions.assertThatCode(() -> apexGrpcProducer.init("TestApexGrpcProducer", eventHandlerParameters)) + Assertions.assertThatCode(() -> apexGrpcProducer.init(PRODUCER_NAME, eventHandlerParameters)) .doesNotThrowAnyException(); } @Test public void testStop() throws ApexEventException { - apexGrpcProducer.init("TestApexGrpcProducer", eventHandlerParameters); + apexGrpcProducer.init(PRODUCER_NAME, eventHandlerParameters); // should not throw an exception Assertions.assertThatCode(() -> apexGrpcProducer.stop()).doesNotThrowAnyException(); } @Test public void testSendEvent() throws ApexEventException { - apexGrpcProducer.init("TestApexGrpcProducer", eventHandlerParameters); - assertThatThrownBy(() -> { - apexGrpcProducer.sendEvent(123, null, "grpcEvent", - Files.readString(Paths.get("src/test/resources/executionServiceInputEvent.json"))); - }).hasMessageContaining("UNAVAILABLE: io exception"); + apexGrpcProducer.init(PRODUCER_NAME, eventHandlerParameters); + Assertions + .assertThatCode(() -> apexGrpcProducer.sendEvent(123, null, "grpcEvent", + Files.readString(Paths.get("src/test/resources/executionServiceInputEvent.json")))) + .doesNotThrowAnyException(); } private void populateEventHandlerParameters(String host, int timeout) { |