Package rabbit.data.access.model

Examples of rabbit.data.access.model.WorkspaceStorage


public class WorkspaceStorageLabelProviderTest extends NullLabelProviderTest {

  @Test
  public void getForegroundShouldReturnAColorIfWorkspacePathIsNull() {
    IPath storage = Path.fromPortableString("/");
    WorkspaceStorage ws = new WorkspaceStorage(storage, null);
    assertThat(provider.getForeground(ws), notNullValue());
  }
View Full Code Here


  @Test
  public void getImageShouldReturnANonnullImage() {
    IPath workspace = new Path(System.getProperty("user.home"));
    IPath storage = Path.fromPortableString("/storage");
    WorkspaceStorage ws = new WorkspaceStorage(storage, workspace);
    assertThat(provider.getImage(ws), notNullValue());
  }
View Full Code Here

    // Currently if the workspace is at: /home/user/workspace,
    // then the folder storing data for that workspace is named:
    // .home.user.workspace,
    // which is done by replacing all the separators with a dot.
    IPath storage = Path.fromPortableString("/Rabbit/.Hello.World");
    WorkspaceStorage ws = new WorkspaceStorage(storage, null);
    assertThat(provider.getText(ws), equalTo("Unknown"));
  }
View Full Code Here

  @Test
  public void getTextShouldReturnTheWorkspaceFolderNameIfThereIsOne() {
    IPath workspace = new Path(System.getProperty("user.home"));
    IPath storage = Path.fromPortableString("/storage");
    WorkspaceStorage ws = new WorkspaceStorage(storage, workspace);

    String expected = ws.getWorkspacePath().lastSegment();
    assertThat(provider.getText(ws), equalTo(expected));
  }
View Full Code Here

  }

  @Override
  public String getText(Object element) {
    if (element instanceof WorkspaceStorage) {
      WorkspaceStorage ws = (WorkspaceStorage) element;
      if (ws.getWorkspacePath() != null) {
        return ws.getWorkspacePath().lastSegment();
      } else {
        return "Unknown";
      }
    }
    return super.getText(element);
View Full Code Here

    File file = accessor.getDataStore().getDataFile(date);
    writeData(element, date, file);

    Collection<T> data = accessor.getData(date, date);
    assertThat(data.size(), is(1));
    WorkspaceStorage ws = new WorkspaceStorage(new Path(
        file.getParentFile().getAbsolutePath()), currentWorkspacePath());
    assertValues(element, date, ws, data.iterator().next());
  }
View Full Code Here

    writeData(element, date, file);

    Collection<T> data = accessor.getData(date, date);
    assertThat(data.size(), is(1));

    WorkspaceStorage ws = new WorkspaceStorage(
    // null because the custom storage folder is not mapped.
        new Path(file.getParentFile().getAbsolutePath()), null);
    assertValues(element, date, ws, data.iterator().next());
  }
View Full Code Here

  }

  @Test
  public void shouldCreateADataNodeCorrectly() throws Exception {
    LocalDate date = new LocalDate();
    WorkspaceStorage ws = new WorkspaceStorage(new Path(""), new Path("/a"));
    E expected = createElement();
    T actual = accessor.createDataNode(date, ws, expected);
    assertValues(expected, date, ws, actual);
  }
View Full Code Here

        LinkedListMultimap.create(storagePaths.length);

    for (IPath storagePath : storagePaths) {
      List<File> fileList = getDataStore().getDataFiles(start, end, storagePath);
      IPath workspacePath = plugin.getWorkspacePath(storagePath);
      files.putAll(new WorkspaceStorage(storagePath, workspacePath), fileList);
    }

    for (Map.Entry<WorkspaceStorage, File> entry : files.entries()) {
      for (S list : getCategories(getDataStore().read(entry.getValue()))) {
View Full Code Here

    root = ResourcesPlugin.getWorkspace().getRoot();
    fileHasParentFolder = root.getFile(new Path("/project/folder/file.txt"));
    duration = new Duration(100);
    date = new LocalDate().minusDays(1);
    ws = new WorkspaceStorage(new Path(".a"), new Path("/a"));

    data = mock(ITaskData.class);
    given(data.get(ITaskData.DATE)).willReturn(date);
    given(data.get(ITaskData.DURATION)).willReturn(duration);
    given(data.get(ITaskData.FILE)).willReturn(fileHasParentFolder);
View Full Code Here

TOP

Related Classes of rabbit.data.access.model.WorkspaceStorage

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.