aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-07-17 15:35:47 +0100
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-07-18 16:10:29 +0100
commitdcae33d8d9a3dcb8a9249d5d33f103f1e97d2e6c (patch)
treee9c54c365154595a9fbd996204ee3fa9eca69025 /core
parent84c349f342da7f67fe728bb2ef3a3b59afb4cd7e (diff)
Refactoring Metrics test
Change-Id: I99290a3dec61b3ce0f4d5fd33d6b429d091b48ca Issue-ID: POLICY-954 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'core')
-rw-r--r--core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
index e18c327c0..21c5ee984 100644
--- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
+++ b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
@@ -52,18 +52,25 @@ public class EndToEndStringMessagingTest {
assertNotNull(server);
server.start(new WSStringServerMessageListener());
- client = new WSStringMessageClient("localhost", 44441);
- assertNotNull(client);
- client.start(new WSStringClientMessageListener());
+ try {
+ client = new WSStringMessageClient("localhost", 44441);
+ assertNotNull(client);
+ client.start(new WSStringClientMessageListener());
- client.sendString("Hello, client here");
+ client.sendString("Hello, client here");
- while (!finished) {
- ThreadUtilities.sleep(50);
- }
- client.stop();
+ while (!finished) {
+ ThreadUtilities.sleep(50);
+ }
+ } finally {
+ if (client != null) {
+ client.stop();
+ }
+ if (server != null) {
+ server.stop();
+ }
- server.stop();
+ }
logger.debug("end to end messaging test finished");
}