Examples of IMetaStore


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

  }

  @Test
  public void testCreateWorkspaceWithNoUserId() 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 without specifying a userid.
    String workspaceName = SimpleMetaStore.DEFAULT_WORKSPACE_NAME;
    WorkspaceInfo workspaceInfo = new WorkspaceInfo();
    workspaceInfo.setFullName(workspaceName);
    try {
      metaStore.createWorkspace(workspaceInfo);
    } catch (CoreException e) {
      // we expect to get a core exception here
      String message = e.getMessage();
      assertTrue(message.contains("user id is null"));
    }
View Full Code Here

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

  }

  @Test
  public void testCreateWorkspaceWithNoWorkspaceName() 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 without specifying a workspace name.
    WorkspaceInfo workspaceInfo = new WorkspaceInfo();
    workspaceInfo.setUserId(userInfo.getUniqueId());
    try {
      metaStore.createWorkspace(workspaceInfo);
    } catch (CoreException e) {
      // we expect to get a core exception here
      String message = e.getMessage();
      assertTrue(message.contains("workspace name is null"));
    }
View Full Code Here

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

  }

  @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()));
  }
View Full Code Here

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

  }

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

    // delete the user
    metaStore.deleteUser(userInfo.getUniqueId());

    // make sure the user is not the list of all users
    List<String> allUsers = metaStore.readAllUsers();
    assertFalse(allUsers.contains(userInfo.getUniqueId()));
  }
View Full Code Here

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

  }

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

    // read the user
    UserInfo readUserInfo = metaStore.readUser(userInfo.getUniqueId());
    assertNotNull(readUserInfo);
    assertEquals(readUserInfo.getUserName(), userInfo.getUserName());
    assertEquals("Should be one workspace", 1, readUserInfo.getWorkspaceIds().size());
    assertTrue(readUserInfo.getWorkspaceIds().contains(workspaceInfo.getUniqueId()));

    // delete the workspace
    metaStore.deleteWorkspace(userInfo.getUniqueId(), workspaceInfo.getUniqueId());

    // read the user
    UserInfo readUserInfo2 = metaStore.readUser(userInfo.getUniqueId());
    assertNotNull(readUserInfo2);
    assertEquals(readUserInfo2.getUserName(), userInfo.getUserName());
    assertEquals("Should be zero workspaces", 0, readUserInfo2.getWorkspaceIds().size());
    assertFalse(readUserInfo2.getWorkspaceIds().contains(workspaceInfo.getUniqueId()));
  }
View Full Code Here

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

  }

  public void start(BundleContext context) throws Exception {
    singleton = this;
    bundleContext = context;
    IMetaStore metastore =  OrionConfiguration.getMetaStore();
    List<String> keys = new ArrayList<String>();
    keys.add(UserConstants2.EMAIL);
    keys.add(UserConstants2.OAUTH);
    keys.add(UserConstants2.OPENID);
    metastore.registerUserProperties(keys);
    Logger logger = LoggerFactory.getLogger("org.eclipse.orion.server.config"); //$NON-NLS-1$
    if (logger.isDebugEnabled()) {
      logger.debug("Started orion server authentication."); //$NON-NLS-1$
    }
View Full Code Here

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

public class SimpleMetaStoreTests extends AbstractServerTest {

  @Test
  public void testArchiveEmptyOrganizationalFolder() 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 an empty organizational folder
    IFileStore rootLocation = OrionConfiguration.getRootLocation();
    String orgFolderName = "zz";
    IFileStore orgFolder = rootLocation.getChild(orgFolderName);
    assertFalse(orgFolder.fetchInfo().exists());
    orgFolder.mkdir(EFS.NONE, null);
    assertTrue(orgFolder.fetchInfo().exists());
    assertTrue(orgFolder.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 testArchiveInvalidMetaDataFileInOrganizationalFolder() 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 file
    IFileStore rootLocation = OrionConfiguration.getRootLocation();
    String orgFolderName = "te";
    IFileStore orgFolder = rootLocation.getChild(orgFolderName);
    assertTrue(orgFolder.fetchInfo().exists());
    assertTrue(orgFolder.fetchInfo().isDirectory());
    String invalid = "delete.html";
    IFileStore invalidFileInOrg = orgFolder.getChild(invalid);
    try {
      OutputStream outputStream = invalidFileInOrg.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(invalidFileInOrg.fetchInfo().exists());

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

    // verify the invalid metadata file 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 testArchiveInvalidMetaDataFileInServerWorkspaceRoot() 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 file
    IFileStore rootLocation = OrionConfiguration.getRootLocation();
    String invalid = "delete.html";
    IFileStore invalidFileAtRoot = rootLocation.getChild(invalid);
    try {
      OutputStream outputStream = invalidFileAtRoot.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(invalidFileAtRoot.fetchInfo().exists());

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

    // verify the invalid metadata file 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 testArchiveInvalidMetaDataFolderInOrganizationalFolder() 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 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());
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.