workspaceInfo.setUserId(userInfo.getUniqueId());
metaStore.createWorkspace(workspaceInfo);
// create the project
String projectName = "Orion Project";
ProjectInfo projectInfo = new ProjectInfo();
projectInfo.setFullName(projectName);
projectInfo.setWorkspaceId(workspaceInfo.getUniqueId());
metaStore.createProject(projectInfo);
// update the content location
IFileStore projectLocation = metaStore.getDefaultContentLocation(projectInfo);
projectInfo.setContentLocation(projectLocation.toURI());
metaStore.updateProject(projectInfo);
// read the user back again
userInfo = metaStore.readUser(testUserLogin);
assertNotNull(userInfo);
assertTrue(userInfo.getUserName().equals(testUserLogin));
// move the user by changing the userName
String newUserName = "ahunter";
userInfo.setUserName(newUserName);
// update the user
metaStore.updateUser(userInfo);
// read the user back again
UserInfo readUserInfo2 = metaStore.readUser(newUserName);
assertNotNull(readUserInfo2);
assertTrue(readUserInfo2.getUserName().equals(newUserName));
// read the user using the cache
UserInfo readUserInfo3 = metaStore.readUserByProperty(UserConstants2.USER_NAME, testUserLogin, false, false);
assertNull(readUserInfo3);
// read the user using the cache
UserInfo readUserInfo4 = metaStore.readUserByProperty(UserConstants2.USER_NAME, newUserName, false, false);
assertNotNull(readUserInfo4);
assertEquals(readUserInfo4.getUniqueId(), userInfo.getUniqueId());
// read the moved workspace
List<String> workspaceIds = userInfo.getWorkspaceIds();
assertNotNull(workspaceIds);
assertEquals(1, workspaceIds.size());
String readWorkspaceId = workspaceIds.get(0);
assertTrue(readWorkspaceId.startsWith(newUserName));
WorkspaceInfo readWorkspaceInfo = metaStore.readWorkspace(readWorkspaceId);
assertNotNull(readWorkspaceInfo);
assertEquals(1, readWorkspaceInfo.getProjectNames().size());
// read the moved project
String readProjectName = readWorkspaceInfo.getProjectNames().get(0);
assertEquals(readProjectName, projectName);
ProjectInfo readProjectInfo = metaStore.readProject(readWorkspaceId, readProjectName);
assertNotNull(readProjectInfo);
assertEquals(readWorkspaceInfo.getUniqueId(), readProjectInfo.getWorkspaceId());
}