Fix license on updated engine files
[policy/engine.git] / POLICY-SDK-APP / src / main / java / org / onap / policy / admin / RESTfulPAPEngine.java
index a500c1d..c0987c3 100644 (file)
 
 package org.onap.policy.admin;
 
-import com.att.research.xacml.api.pap.PAPException;
-import com.att.research.xacml.api.pap.PDPPolicy;
-import com.att.research.xacml.api.pap.PDPStatus;
-import com.att.research.xacml.util.XACMLProperties;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.type.CollectionType;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -37,6 +30,7 @@ import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.net.URLConnection;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
@@ -61,6 +55,13 @@ import org.onap.policy.xacml.std.pap.StdPDPGroup;
 import org.onap.policy.xacml.std.pap.StdPDPItemSetChangeNotifier;
 import org.onap.policy.xacml.std.pap.StdPDPPolicy;
 import org.onap.policy.xacml.std.pap.StdPDPStatus;
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.api.pap.PDPPolicy;
+import com.att.research.xacml.api.pap.PDPStatus;
+import com.att.research.xacml.util.XACMLProperties;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.CollectionType;
 
 /**
  * Implementation of the PAPEngine interface that communicates with a PAP engine in a remote servlet through a RESTful
@@ -379,12 +380,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 +526,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();
+    }
 }