aboutsummaryrefslogtreecommitdiffstats
path: root/gui-pdp-monitoring/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-02-11 15:55:33 -0500
committerJim Hahn <jrh3@att.com>2021-02-19 18:38:01 +0000
commit13a50bb9b035c6408019ef58297009f7e3fe2779 (patch)
tree8f773bef932f1e1cc1d04d32741c70788b50c2c7 /gui-pdp-monitoring/src/test
parentb3982731bc994a0de656e36905ae42ea5246595d (diff)
Fix sonars in gui
Addressed the following issues (java only): - assignment to static field - expression is always true - duplicate character in regex - duplicate code - remove Thread.sleep() from junit test Issue-ID: POLICY-3063 Change-Id: I70951ed47defad5baa6c957852663688e51fa88a Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'gui-pdp-monitoring/src/test')
-rw-r--r--gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java b/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java
index 6421b01..b680cac 100644
--- a/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java
+++ b/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -150,9 +151,18 @@ public class MonitoringMainTest {
try {
monThread.start();
- Thread.sleep(2000);
+ /*
+ * For some reason, getResource("webapp") returns null to PdpMonitoringServer,
+ * which results in an NPE, thus the server never gets started (in ANY of
+ * these test cases). Therefore, commented out the code that waits for it to
+ * start.
+ */
+ // assertThat(monRestMain.awaitStart(5, TimeUnit.SECONDS)).isTrue();
monRestMain.shutdown();
+ monThread.join(5000);
+ assertThat(monThread.isAlive()).isFalse();
} catch (Exception ex) {
+ monRestMain.shutdown();
fail("test should not throw an exception");
}
}