X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fadmin%2FRESTfulPAPEngine.java;fp=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fadmin%2FRESTfulPAPEngine.java;h=fc47179c152347299020f5a2ad0775840abb2a64;hp=a500c1dbe90242d9961f0265ab114c78e4c37354;hb=b2341e2ee94605af08728a38f835e9545ab60cac;hpb=ca8e0c7e1182faf67a1049d521e3d5ac2c899cff diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java index a500c1dbe..fc47179c1 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/RESTfulPAPEngine.java @@ -36,7 +36,9 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; +import java.net.MalformedURLException; import java.net.URL; +import java.net.URLConnection; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.Arrays; @@ -379,12 +381,10 @@ public class RESTfulPAPEngine extends StdPDPItemSetChangeNotifier implements PAP } } - URL url = new URL(fullURL); - // // Open up the connection // - connection = (HttpURLConnection) url.openConnection(); + connection = (HttpURLConnection) makeConnection(fullURL); // // Setup our method and headers // @@ -527,4 +527,10 @@ public class RESTfulPAPEngine extends StdPDPItemSetChangeNotifier implements PAP LOGGER.info("JSON response from PAP: " + json); return json; } + + // these may be overridden by junit tests + + protected URLConnection makeConnection(String fullURL) throws IOException { + return new URL(fullURL).openConnection(); + } }