use of com.box.sdk.CreateUserParams in project camel by apache.
the class BoxUsersManagerIntegrationTest method testCreateAppUser.
@Test
public void testCreateAppUser() throws Exception {
com.box.sdk.BoxUser result = null;
try {
CreateUserParams params = new CreateUserParams();
// 1 GB
params.setSpaceAmount(1073741824);
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.name", CAMEL_TEST_CREATE_APP_USER_NAME);
// parameter type is com.box.sdk.CreateUserParams
headers.put("CamelBox.params", params);
result = requestBodyAndHeaders("direct://CREATEAPPUSER", null, headers);
assertNotNull("createAppUser result", result);
LOG.debug("createAppUser: " + result);
} finally {
if (result != null) {
try {
result.delete(false, true);
} catch (Throwable t) {
}
}
}
}
use of com.box.sdk.CreateUserParams in project camel by apache.
the class BoxCollaborationsManagerIntegrationTest method testAddFolderCollaboration.
@Test
public void testAddFolderCollaboration() throws Exception {
// delete collaborator created by setupTest
deleteTestCollaborator();
BoxUser user = null;
try {
// create test collaborator
CreateUserParams params = new CreateUserParams();
// 1 GB
params.setSpaceAmount(1073741824);
user = BoxUser.createAppUser(getConnection(), CAMEL_TEST_COLLABORATOR_NAME, params).getResource();
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.folderId", testFolder.getID());
// parameter type is String
headers.put("CamelBox.collaborator", user);
// parameter type is com.box.sdk.BoxCollaboration.Role
headers.put("CamelBox.role", BoxCollaboration.Role.EDITOR);
final com.box.sdk.BoxCollaboration result = requestBodyAndHeaders("direct://ADDFOLDERCOLLABORATION", testFolder.getID(), headers);
assertNotNull("addFolderCollaboration result", result);
LOG.debug("addFolderCollaboration: " + result);
} catch (BoxAPIException e) {
throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
} finally {
if (user != null) {
user.delete(false, true);
}
}
}
use of com.box.sdk.CreateUserParams in project camel by apache.
the class BoxUsersManagerIntegrationTest method testCreateEnterpriseUser.
@Test
public void testCreateEnterpriseUser() throws Exception {
com.box.sdk.BoxUser result = null;
try {
CreateUserParams params = new CreateUserParams();
// 1 GB
params.setSpaceAmount(1073741824);
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.login", CAMEL_TEST_CREATE_ENTERPRISE_USER_LOGIN);
// parameter type is String
headers.put("CamelBox.name", CAMEL_TEST_CREATE_ENTERPRISE_USER_NAME);
// parameter type is com.box.sdk.CreateUserParams
headers.put("CamelBox.params", params);
result = requestBodyAndHeaders("direct://CREATEENTERPRISEUSER", null, headers);
assertNotNull("createEnterpriseUser result", result);
LOG.debug("createEnterpriseUser: " + result);
} finally {
if (result != null) {
try {
result.delete(false, true);
} catch (Throwable t) {
}
}
}
}
Aggregations