use of com.box.sdk.Metadata in project camel by apache.
the class BoxFilesManagerIntegrationTest method testGetFileMetadata.
@Test
public void testGetFileMetadata() throws Exception {
testFile.createMetadata(new Metadata());
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.fileId", testFile.getID());
// parameter type is String
headers.put("CamelBox.typeName", null);
final com.box.sdk.Metadata result = requestBodyAndHeaders("direct://GETFILEMETADATA", null, headers);
assertNotNull("getFileMetadata result", result);
LOG.debug("getFileMetadata: " + result);
}
use of com.box.sdk.Metadata in project camel by apache.
the class BoxFilesManagerIntegrationTest method testCreateFileMetadata.
@Test
public void testCreateFileMetadata() throws Exception {
Metadata metadata = new Metadata();
metadata.add("/foo", "bar");
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.fileId", testFile.getID());
// parameter type is com.box.sdk.Metadata
headers.put("CamelBox.metadata", metadata);
// parameter type is String
headers.put("CamelBox.typeName", null);
final com.box.sdk.Metadata result = requestBodyAndHeaders("direct://CREATEFILEMETADATA", null, headers);
assertNotNull("createFileMetadata result", result);
assertEquals("createFileMetadata result", "bar", result.get("/foo"));
LOG.debug("createFileMetadata: " + result);
}
use of com.box.sdk.Metadata in project camel by apache.
the class BoxFilesManagerIntegrationTest method testDeleteFileMetadata.
@Test
public void testDeleteFileMetadata() throws Exception {
testFile.createMetadata(new Metadata());
// using String message body for single parameter "fileId"
requestBody("direct://DELETEFILEMETADATA", testFile.getID());
try {
testFile.getMetadata();
} catch (BoxAPIException e) {
if (e.getResponseCode() == 404) {
// Box API should return a
return;
}
}
fail("deleteFileMetadata metadata");
}
use of com.box.sdk.Metadata in project camel by apache.
the class BoxFilesManagerIntegrationTest method testUpdateFileMetadata.
@Test
public void testUpdateFileMetadata() throws Exception {
Metadata metadata = new Metadata();
// metadata.add("/foo", "bar");
metadata = testFile.createMetadata(metadata);
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.fileId", testFile.getID());
// parameter type is com.box.sdk.Metadata
headers.put("CamelBox.metadata", metadata);
final com.box.sdk.Metadata result = requestBodyAndHeaders("direct://UPDATEFILEMETADATA", null, headers);
assertNotNull("updateFileMetadata result", result);
LOG.debug("updateFileMetadata: " + result);
}
Aggregations