}
@Test
public void testDeleteSimpleProject() throws CoreException {
// create the MetaStore
IMetaStore metaStore = OrionConfiguration.getMetaStore();
// create the user
UserInfo userInfo = new UserInfo();
userInfo.setUserName(testUserLogin);
userInfo.setFullName(testUserLogin);
metaStore.createUser(userInfo);
// create the workspace
String workspaceName = SimpleMetaStore.DEFAULT_WORKSPACE_NAME;
WorkspaceInfo workspaceInfo = new WorkspaceInfo();
workspaceInfo.setFullName(workspaceName);
workspaceInfo.setUserId(userInfo.getUniqueId());
metaStore.createWorkspace(workspaceInfo);
// create the project
String projectName1 = "Orion Project";
ProjectInfo projectInfo1 = new ProjectInfo();
projectInfo1.setFullName(projectName1);
try {
projectInfo1.setContentLocation(new URI("file://root/folder/orion"));
} catch (URISyntaxException e) {
// should not get an exception here, simple URI
}
projectInfo1.setWorkspaceId(workspaceInfo.getUniqueId());
metaStore.createProject(projectInfo1);
// create another project
String projectName2 = "Another Project";
ProjectInfo projectInfo2 = new ProjectInfo();
projectInfo2.setFullName(projectName2);
try {
projectInfo2.setContentLocation(new URI("file://root/folder/another"));
} catch (URISyntaxException e) {
// should not get an exception here, simple URI
}
projectInfo2.setWorkspaceId(workspaceInfo.getUniqueId());
metaStore.createProject(projectInfo2);
// delete the first project
metaStore.deleteProject(workspaceInfo.getUniqueId(), projectInfo1.getFullName());
// read the workspace
WorkspaceInfo readWorkspaceInfo = metaStore.readWorkspace(workspaceInfo.getUniqueId());
assertNotNull(readWorkspaceInfo);
assertEquals(readWorkspaceInfo.getFullName(), workspaceInfo.getFullName());
assertFalse(readWorkspaceInfo.getProjectNames().contains(projectInfo1.getFullName()));
assertTrue(readWorkspaceInfo.getProjectNames().contains(projectInfo2.getFullName()));
}