Package org.eclipse.core.filesystem

Examples of org.eclipse.core.filesystem.IFileStore


    workspaceInfo.setFullName(workspaceName);
    workspaceInfo.setUserId(userInfo.getUniqueId());
    metaStore.createWorkspace(workspaceInfo);

    // create a invalid metadata folder
    IFileStore rootLocation = OrionConfiguration.getRootLocation();
    String orgFolderName = "te";
    IFileStore orgFolder = rootLocation.getChild(orgFolderName);
    assertTrue(orgFolder.fetchInfo().exists());
    assertTrue(orgFolder.fetchInfo().isDirectory());
    String invalid = "delete.me";
    IFileStore invalidFolderInOrg = orgFolder.getChild(invalid);
    assertFalse(invalidFolderInOrg.fetchInfo().exists());
    invalidFolderInOrg.mkdir(EFS.NONE, null);
    assertTrue(invalidFolderInOrg.fetchInfo().exists());
    assertTrue(invalidFolderInOrg.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());
    assertTrue(archiveFolder.fetchInfo().isDirectory());
    IFileStore archiveOrgFolder = archiveFolder.getChild(orgFolderName);
    assertTrue(archiveOrgFolder.fetchInfo().exists());
    assertTrue(archiveOrgFolder.fetchInfo().isDirectory());
    IFileStore archivedFolder = archiveOrgFolder.getChild(invalid);
    assertTrue(archivedFolder.fetchInfo().exists());
    assertTrue(archivedFolder.fetchInfo().isDirectory());
    assertFalse(invalidFolderInOrg.fetchInfo().exists());
  }
View Full Code Here


    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());
    assertTrue(archiveFolder.fetchInfo().isDirectory());
    IFileStore archivedFolder = archiveFolder.getChild(invalid);
    assertTrue(archivedFolder.fetchInfo().exists());
    assertFalse(invalidFolderAtRoot.fetchInfo().exists());
  }
View Full Code Here

    // create a folder under the user on the filesystem
    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());

    // read the project, project json will be created
    ProjectInfo readProjectInfo = metaStore.readProject(workspaceInfo.getUniqueId(), projectName);
    assertNotNull(readProjectInfo);
  }
View Full Code Here

    // create the first project
    String projectName = "Project";
    ProjectInfo projectInfo1 = new ProjectInfo();
    projectInfo1.setFullName(projectName);
    projectInfo1.setWorkspaceId(workspaceInfo.getUniqueId());
    IFileStore projectFolder = metaStore.getDefaultContentLocation(projectInfo1);
    assertFalse(projectFolder.fetchInfo().exists());
    projectInfo1.setContentLocation(projectFolder.toURI());
    metaStore.createProject(projectInfo1);
    assertTrue(projectFolder.fetchInfo().exists());

    // read the workspace
    WorkspaceInfo readWorkspaceInfo = metaStore.readWorkspace(workspaceInfo.getUniqueId());
    assertNotNull(readWorkspaceInfo);
    assertEquals(readWorkspaceInfo.getFullName(), workspaceInfo.getFullName());
    assertEquals(1, readWorkspaceInfo.getProjectNames().size());
    assertTrue(readWorkspaceInfo.getProjectNames().contains(projectInfo1.getFullName()));
    assertTrue(readWorkspaceInfo.getProjectNames().contains(projectName));

    // create the first again project
    ProjectInfo projectInfo2 = new ProjectInfo();
    projectInfo2.setFullName(projectName);
    projectInfo2.setWorkspaceId(workspaceInfo.getUniqueId());
    IFileStore projectFolder2 = metaStore.getDefaultContentLocation(projectInfo2);
    projectInfo2.setContentLocation(projectFolder2.toURI());
    try {
      metaStore.createProject(projectInfo1);
    } catch (RuntimeException e) {
      // we expect to get a runtime exception here
      String message = e.getMessage();
View Full Code Here

      // should not get an exception here, simple URI
    }
    projectInfo.setWorkspaceId(workspaceInfo.getUniqueId());
    metaStore.createProject(projectInfo);

    IFileStore defaultLocation = metaStore.getDefaultContentLocation(projectInfo);
    // Test that the project is linked
    assertFalse(defaultLocation == projectInfo.getProjectStore());
    // Test that no content folder is created
    assertFalse(defaultLocation.fetchInfo().exists());
  }
View Full Code Here

    // 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);
View Full Code Here

    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();

    assertEquals(correctLocation, location);
  }
View Full Code Here

    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();

    assertEquals(correctLocation, location);
  }
View Full Code Here

  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

    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();

    assertEquals(correctLocation, location);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.filesystem.IFileStore

Copyright © 2018 www.massapicom. 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.