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;
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;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+
import org.apache.commons.io.IOUtils;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
"policyType=" + policyType);
}
-
-
@Override
public void publishPolicy(String id, String name, boolean isRoot, InputStream policy, OnapPDPGroup group)
throws PAPException {
}
}
- URL url = new URL(fullURL);
-
//
// Open up the connection
//
- connection = (HttpURLConnection) url.openConnection();
+ connection = (HttpURLConnection) makeConnection(fullURL);
//
// Setup our method and headers
//
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();
+ }
}