@Test
public void testModifyProject() throws CatalogException {
String newProjectName = "ProjectName " + StringUtils.randomString(10);
String projectId = catalogManager.getUserManager().get("user", null, new QueryOptions(), sessionIdUser).first().getProjects().get(0)
.getId();
ObjectMap options = new ObjectMap();
options.put("name", newProjectName);
ObjectMap attributes = new ObjectMap("myBoolean", true);
attributes.put("value", 6);
attributes.put("object", new ObjectMap("id", 1234));
options.put("attributes", attributes);
catalogManager.getProjectManager().update(projectId, options, null, sessionIdUser);
QueryResult<Project> result = catalogManager.getProjectManager().get(projectId, null, sessionIdUser);
Project project = result.first();
System.out.println(result);
assertEquals(newProjectName, project.getName());
for (Map.Entry<String, Object> entry : attributes.entrySet()) {
assertEquals(project.getAttributes().get(entry.getKey()), entry.getValue());
}
options = new ObjectMap();
options.put(ProjectDBAdaptor.QueryParams.ID.key(), "newProjectId");
catalogManager.getProjectManager().update(projectId, options, null, sessionIdUser);
thrown.expect(CatalogException.class);
thrown.expectMessage("not found");
catalogManager.getProjectManager().update(projectId, options, null, sessionIdUser);
}