Fixes to support dependency upgrade 29/102229/3
authorPamela Dragosh <pdragosh@research.att.com>
Mon, 24 Feb 2020 12:38:20 +0000 (07:38 -0500)
committerPamela Dragosh <pdragosh@research.att.com>
Mon, 24 Feb 2020 13:57:04 +0000 (08:57 -0500)
Uped the time for Thread.sleep due to new http core dependency. It
seems to randomly timeout inconsistently due to that upgrade.

Google gson seems to have changed its layout. Did not see any
problems with the other repos.

Issue-ID: POLICY-2381
Change-Id: Id2a9bfffd42a2c713af042bd2a8cc4abafba2d9f
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java

index 82faa05..0aec411 100644 (file)
@@ -486,7 +486,7 @@ public class HttpServerTest {
     private String http(String urlString)
             throws IOException, InterruptedException {
         URL url = new URL(urlString);
-        if (!NetworkUtil.isTcpPortOpen(url.getHost(), url.getPort(), 25, 2)) {
+        if (!NetworkUtil.isTcpPortOpen(url.getHost(), url.getPort(), 25, 100)) {
             throw new IllegalStateException("port never opened: " + url);
         }
         return response(url.openConnection());
@@ -502,7 +502,7 @@ public class HttpServerTest {
     private String http(String urlString, String mediaType, String post)
             throws IOException, InterruptedException {
         URL url = new URL(urlString);
-        if (!NetworkUtil.isTcpPortOpen(url.getHost(), url.getPort(), 25, 2)) {
+        if (!NetworkUtil.isTcpPortOpen(url.getHost(), url.getPort(), 25, 100)) {
             throw new IllegalStateException("port never opened: " + url);
         }
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
index 8f714a4..af98e30 100644 (file)
@@ -336,9 +336,9 @@ public class ResourceUtilsTest {
         assertEquals(189, resultJ0.size());
         assertEquals("com/google/", normalizePath(resultJ0.iterator().next()));
 
-        Set<String> resultJ1 = ResourceUtils.getDirectoryContents("com/google/gson/util");
-        assertEquals(1, resultJ1.size());
-        assertEquals("com/google/gson/util/VersionUtils.class", normalizePath(resultJ1.iterator().next()));
+        Set<String> resultJ1 = ResourceUtils.getDirectoryContents("com/google/gson");
+        assertTrue(resultJ1.size() > 1);
+        assertTrue(resultJ1.contains("com/google/gson/JsonElement.class"));
 
         URL dummyUrl = new URL("http://even/worse");
         assertTrue(ResourceUtils.getDirectoryContentsJar(dummyUrl, "nonexistantdirectory").isEmpty());