.setHost(DC_HOST) //
.setPort(DC_HTTP_PORT) //
.setUsername(MANAGEMENT_USERNAME) //
.setPassword(MANAGEMENT_PASSWORD) //
.createASConnectionParams();
ASUploadConnection conn = new ASUploadConnection(asConnectionParams, fileName);
OutputStream os = conn.getOutputStream();
InputStream fis = getClass().getClassLoader().getResourceAsStream(deploymentPath);
if (fis == null) {
File inputFile = new File(deploymentPath);
if (!inputFile.canRead()) {
throw new FileNotFoundException("Input stream for path [" + deploymentPath
+ "] could not be opened - does the file exist either in the test classpath or on the filesystem?");
}
fis = new FileInputStream(inputFile);
}
StreamUtil.copy(fis, os, false);
try {
fis.close();
} catch (IOException e) {
// ignore
}
JsonNode node = conn.finishUpload();
// System.out.println(node);
assert node != null : "No result from upload - node was null";
assert node.has("outcome") : "No outcome from upload";
String outcome = node.get("outcome").getTextValue();
assert outcome.equals("success") : "Upload was no success, but: [" + outcome + "]";