use of org.eclipse.che.api.vfs.VirtualFile in project che by eclipse.
the class LocalVirtualFileTest method getsEmptyPropertiesMapIfFileDoesNotHaveProperties.
@Test
public void getsEmptyPropertiesMapIfFileDoesNotHaveProperties() throws Exception {
VirtualFile root = getRoot();
VirtualFile file = root.createFile(generateFileName(), DEFAULT_CONTENT);
assertionHelper.assertThatMetadataIoFileDoesNotExist(file.getPath());
assertTrue(file.getProperties().isEmpty());
}
use of org.eclipse.che.api.vfs.VirtualFile in project che by eclipse.
the class LocalVirtualFileTest method doesNotAddNewlyCreatedFolderInSearcher.
@Test
public void doesNotAddNewlyCreatedFolderInSearcher() throws Exception {
VirtualFile folder = getRoot().createFolder(generateFolderName());
verify(searcher, never()).add(folder);
}
use of org.eclipse.che.api.vfs.VirtualFile in project che by eclipse.
the class LocalVirtualFileTest method updatesFileInSearcherWhenContentUpdatedByStream.
@Test
public void updatesFileInSearcherWhenContentUpdatedByStream() throws Exception {
VirtualFile file = getRoot().createFile(generateFileName(), "");
file.updateContent(new ByteArrayInputStream(DEFAULT_CONTENT_BYTES));
verify(searcher).update(file);
}
use of org.eclipse.che.api.vfs.VirtualFile in project che by eclipse.
the class LocalVirtualFileTest method copiesFileUnderNewName.
@Test
public void copiesFileUnderNewName() throws Exception {
VirtualFile root = getRoot();
VirtualFile file = root.createFile(generateFileName(), DEFAULT_CONTENT);
file.setProperty("property1", "value1");
VirtualFile targetFolder = root.createFolder(generateFolderName());
VirtualFile copy = file.copyTo(targetFolder, "new name", false);
assertionHelper.assertThatIoFilesHaveSameContent(file.getPath(), copy.getPath());
assertionHelper.assertThatMetadataIoFilesHaveSameContent(file.getPath(), copy.getPath());
}
use of org.eclipse.che.api.vfs.VirtualFile in project che by eclipse.
the class LocalVirtualFileTest method movesFolderUnderNewNameAndReplaceExistedItem.
@Test
public void movesFolderUnderNewNameAndReplaceExistedItem() throws Exception {
VirtualFile folder = getRoot().createFolder(generateFolderName());
VirtualFile file = folder.createFile(generateFileName(), DEFAULT_CONTENT);
Path folderPath = folder.getPath();
VirtualFile targetFolder = getRoot().createFolder(generateFolderName());
targetFolder.createFolder("new_name");
VirtualFile movedFolder = folder.moveTo(targetFolder, "new_name", true, null);
VirtualFile movedFile = movedFolder.getChild(Path.of(file.getName()));
assertionHelper.assertThatIoFileExists(movedFolder.getPath());
assertionHelper.assertThatIoFileHasContent(movedFile.getPath(), DEFAULT_CONTENT_BYTES);
assertionHelper.assertThatIoFileDoesNotExist(folderPath);
}
Aggregations