Skip to content

Instantly share code, notes, and snippets.

@livando
Created January 10, 2012 21:32
Show Gist options
  • Save livando/1591323 to your computer and use it in GitHub Desktop.
Save livando/1591323 to your computer and use it in GitHub Desktop.
EnterMedia ingest without http
public void testVisualDataIngest() throws Exception {
String testname = "ingest";
String sourcepath = "test/" + testname + ".mp4";
PostMethod method = getIngestPostMethod(sourcepath, testname);
assertEquals(200, getClient().executeMethod(method));
Element root = getXml(method.getResponseBodyAsStream());
assertTrue(root.elements().size() > 0);
String id = ((Element) root.elements().get(0)).attributeValue("id");
assertNotNull(id);
}
private PostMethod getIngestPostMethod(String sourcepath, String testname){
PostMethod method = new PostMethod(getServerUrl()
+ getDefaultApplicationId() + "/services/rest/importassets.xml");
method.addParameter("catalogid", getDefaultCatalogId());
method.addParameter("sourcepath", sourcepath);
method.addParameter("field", "caption");
method.addParameter("caption.value", testname);
method.addParameter("field", "editstatus");
method.addParameter("editstatus.value", "1");
return method;
}
protected String getServerUrl() {
return QA;
}
protected String getDefaultCatalogId() {
return "media/catalogs/client1";
}
protected String getDefaultApplicationId() {
return "media";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment