Examples of IMetaStore


Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testArchiveInvalidMetaDataFolderInServerWorkspaceRoot() 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 a invalid metadata folder
    IFileStore rootLocation = OrionConfiguration.getRootLocation();
    String invalid = "delete.me";
    IFileStore invalidFolderAtRoot = rootLocation.getChild(invalid);
    assertFalse(invalidFolderAtRoot.fetchInfo().exists());
    invalidFolderAtRoot.mkdir(EFS.NONE, null);
    assertTrue(invalidFolderAtRoot.fetchInfo().exists());
    assertTrue(invalidFolderAtRoot.fetchInfo().isDirectory());

    // read all the users which will trigger the archive
    List<String> users = metaStore.readAllUsers();
    assertNotNull(users);

    // verify the invalid metadata folder has moved to the archive
    IFileStore archiveFolder = rootLocation.getChild(SimpleMetaStoreUtil.ARCHIVE);
    assertTrue(archiveFolder.fetchInfo().exists());
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testDeleteUserByUniqueIdProperty() 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);

    // read the user
    UserInfo readUserInfo = metaStore.readUserByProperty(UserConstants2.USER_NAME, testUserLogin, false, false);
    assertNotNull(readUserInfo);
    assertEquals(readUserInfo.getUniqueId(), userInfo.getUniqueId());

    // delete the user
    metaStore.deleteUser(testUserLogin);

    // read the user again
    UserInfo readUserInfo2 = metaStore.readUserByProperty(UserConstants2.USER_NAME, testUserLogin, false, false);
    assertNull(readUserInfo2);
  }
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testEncodedProjectContentLocation() 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 projectName = "Orion Project";
    ProjectInfo projectInfo = new ProjectInfo();
    projectInfo.setFullName(projectName);
    projectInfo.setWorkspaceId(workspaceInfo.getUniqueId());
    IFileStore projectFolder = metaStore.getDefaultContentLocation(projectInfo);
    assertFalse(projectFolder.fetchInfo().exists());
    projectFolder.mkdir(EFS.NONE, null);
    assertTrue(projectFolder.fetchInfo().exists() && projectFolder.fetchInfo().isDirectory());
    projectInfo.setContentLocation(projectFolder.toURI());
    metaStore.createProject(projectInfo);

    // read the project
    ProjectInfo readProjectInfo = metaStore.readProject(workspaceInfo.getUniqueId(), projectInfo.getFullName());
    assertNotNull(readProjectInfo);
    assertEquals(readProjectInfo.getFullName(), projectInfo.getFullName());
    // ensure content location was written and read back successfully
    assertEquals(projectInfo.getContentLocation(), readProjectInfo.getContentLocation());
  }
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testGetDefaultContentLocation() 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 projectName = "Orion Project";
    ProjectInfo projectInfo = new ProjectInfo();
    projectInfo.setFullName(projectName);
    projectInfo.setWorkspaceId(workspaceInfo.getUniqueId());
    metaStore.createProject(projectInfo);

    // get the default content location
    IFileStore defaultContentLocation = metaStore.getDefaultContentLocation(projectInfo);
    String location = defaultContentLocation.toLocalFile(EFS.NONE, null).toString();

    IFileStore root = OrionConfiguration.getRootLocation();
    IFileStore projectHome = root.getChild("te/testGetDefaultContentLocation/OrionContent").getChild(projectName);
    String correctLocation = projectHome.toLocalFile(EFS.NONE, null).toString();
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testGetUserHome() 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);

    // get the user home
    IFileStore userHome = metaStore.getUserHome(userInfo.getUniqueId());
    String location = userHome.toLocalFile(EFS.NONE, null).toString();

    IFileStore root = OrionConfiguration.getRootLocation();
    IFileStore child = root.getChild("te/testGetUserHome");
    String correctLocation = child.toLocalFile(EFS.NONE, null).toString();
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testGetUserHomeWithNullArgument() {
    // create the MetaStore
    IMetaStore metaStore = OrionConfiguration.getMetaStore();

    // get the root location
    IFileStore rootLocation = OrionConfiguration.getRootLocation();

    // get the root location using the old API
    IFileStore root = metaStore.getUserHome(null);

    // ensure valid
    assertNotNull(rootLocation);
    assertNotNull(root);
    assertEquals(rootLocation, root);
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testGetWorkspaceContentLocation() 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);

    // get the workspace content location
    IFileStore workspaceHome = metaStore.getWorkspaceContentLocation(workspaceInfo.getUniqueId());
    String location = workspaceHome.toLocalFile(EFS.NONE, null).toString();

    IFileStore root = OrionConfiguration.getRootLocation();
    IFileStore childLocation = root.getChild("te/testGetWorkspaceContentLocation/OrionContent");
    String correctLocation = childLocation.toLocalFile(EFS.NONE, null).toString();
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testMoveProjectLinked() 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 projectName = "Orion Project";
    ProjectInfo projectInfo = new ProjectInfo();
    projectInfo.setFullName(projectName);
    projectInfo.setWorkspaceId(workspaceInfo.getUniqueId());
    IFileStore linkedFolder = metaStore.getUserHome(userInfo.getUniqueId()).getChild("Linked Project");
    projectInfo.setContentLocation(linkedFolder.toURI());

    metaStore.createProject(projectInfo);

    // create a project directory and file
    IFileStore projectFolder = projectInfo.getProjectStore();
    if (!projectFolder.fetchInfo().exists()) {
      projectFolder.mkdir(EFS.NONE, null);
    }
    assertTrue(projectFolder.fetchInfo().exists() && projectFolder.fetchInfo().isDirectory());
    String fileName = "file.html";
    IFileStore file = projectFolder.getChild(fileName);
    try {
      OutputStream outputStream = file.openOutputStream(EFS.NONE, null);
      outputStream.write("<!doctype html>".getBytes());
      outputStream.close();
    } catch (IOException e) {
      fail("Count not create a test file in the Orion Project:" + e.getLocalizedMessage());
    }
    assertTrue("the file in the project folder should exist.", file.fetchInfo().exists());

    // move the project by renaming the project by changing the projectName
    String movedProjectName = "Moved Orion Project";
    projectInfo.setFullName(movedProjectName);

    // update the project
    metaStore.updateProject(projectInfo);

    // read the project back again
    ProjectInfo readProjectInfo = metaStore.readProject(workspaceInfo.getUniqueId(), projectInfo.getFullName());
    assertNotNull(readProjectInfo);
    assertTrue(readProjectInfo.getFullName().equals(movedProjectName));

    // linked folder hasn't moved
    projectFolder = readProjectInfo.getProjectStore();
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testMoveProjectWithBarInProjectName() 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 with a bar in the project name
    String projectName = "anthony | Project";
    ProjectInfo projectInfo = new ProjectInfo();
    projectInfo.setFullName(projectName);
    try {
      projectInfo.setContentLocation(new URI("file:/home/anthony/orion/project"));
    } catch (URISyntaxException e) {
      // should not get an exception here, simple URI
    }
    projectInfo.setWorkspaceId(workspaceInfo.getUniqueId());
    metaStore.createProject(projectInfo);

    // move the project by renaming the project by changing the projectName
    String movedProjectName = "anthony | Moved Orion Project";
    projectInfo.setFullName(movedProjectName);

    // update the project
    metaStore.updateProject(projectInfo);

    // read the project back again
    ProjectInfo readProjectInfo = metaStore.readProject(workspaceInfo.getUniqueId(), projectInfo.getFullName());
    assertNotNull(readProjectInfo);
    assertTrue(readProjectInfo.getFullName().equals(movedProjectName));
  }
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

  }

  @Test
  public void testMoveSimpleProject() 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 projectName = "Orion Project";
    ProjectInfo projectInfo = new ProjectInfo();
    projectInfo.setFullName(projectName);
    projectInfo.setWorkspaceId(workspaceInfo.getUniqueId());
    metaStore.createProject(projectInfo);

    // create a project directory and file
    IFileStore projectFolder = metaStore.getDefaultContentLocation(projectInfo);
    if (!projectFolder.fetchInfo().exists()) {
      projectFolder.mkdir(EFS.NONE, null);
    }
    assertTrue(projectFolder.fetchInfo().exists());
    assertTrue(projectFolder.fetchInfo().isDirectory());
    String fileName = "file.html";
    IFileStore file = projectFolder.getChild(fileName);
    try {
      OutputStream outputStream = file.openOutputStream(EFS.NONE, null);
      outputStream.write("<!doctype html>".getBytes());
      outputStream.close();
    } catch (IOException e) {
      fail("Count not create a test file in the Orion Project:" + e.getLocalizedMessage());
    }
    assertTrue("the file in the project folder should exist.", file.fetchInfo().exists());

    // update the project with the content location
    projectInfo.setContentLocation(projectFolder.toLocalFile(EFS.NONE, null).toURI());
    metaStore.updateProject(projectInfo);

    // move the project by renaming the project by changing the projectName
    String movedProjectName = "Moved Orion Project";
    projectInfo.setFullName(movedProjectName);

    // update the project
    metaStore.updateProject(projectInfo);

    // read the project back again
    ProjectInfo readProjectInfo = metaStore.readProject(workspaceInfo.getUniqueId(), projectInfo.getFullName());
    assertNotNull(readProjectInfo);
    assertTrue(readProjectInfo.getFullName().equals(movedProjectName));

    // verify the local project has moved
    IFileStore workspaceFolder = metaStore.getWorkspaceContentLocation(workspaceInfo.getUniqueId());
    projectFolder = workspaceFolder.getChild(projectName);
    assertFalse("the original project folder should not exist.", projectFolder.fetchInfo().exists());
    projectFolder = workspaceFolder.getChild(movedProjectName);
    assertTrue("the new project folder should exist.", projectFolder.fetchInfo().exists() && projectFolder.fetchInfo().isDirectory());
    file = projectFolder.getChild(fileName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.