use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class StreamTest method testDeleteChange.
@Test
public void testDeleteChange() throws IOException {
DirectoryEntry dir = new DirectoryEntry("dir");
dir.addChild(new FileEntry("file", new StoredContent(333), -1, false));
dir.addChild(new DirectoryEntry("subDir"));
Change c = new DeleteChange(nextId(), "entry", dir);
StreamUtil.writeChange(os, c);
Change read = StreamUtil.readChange(is);
assertEquals(DeleteChange.class, read.getClass());
DeleteChange result = (DeleteChange) read;
assertEquals("entry", result.getPath());
Entry e = result.getDeletedEntry();
assertEquals(DirectoryEntry.class, e.getClass());
assertEquals("dir", e.getName());
assertEquals(2, e.getChildren().size());
assertEquals("dir/file", e.getChildren().get(0).getPath());
assertEquals("dir/subDir", e.getChildren().get(1).getPath());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class ChangesRevertingTest method testChangingFileContent.
@Test
public void testChangingFileContent() {
createFile(root, "file", "old content", 11L, false);
StructuralChange c = changeContent(root, "file", "new content", 22L);
c.revertOn(root, true);
Entry e = root.getEntry("file");
assertContent("old content", e.getContent());
assertEquals(11L, e.getTimestamp());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class RootEntryDirectoriesTest method testCeatingDirectory.
@Test
public void testCeatingDirectory() {
assertFalse(root.hasEntry("dir"));
createDirectory(root, "dir");
assertTrue(root.hasEntry("dir"));
Entry e = root.getEntry("dir");
assertEquals(DirectoryEntry.class, e.getClass());
assertTrue(e.getChildren().isEmpty());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class RootEntryDirectoriesTest method testMovingFilesBetweenDirectories.
@Test
public void testMovingFilesBetweenDirectories() {
createDirectory(root, "dir1");
createDirectory(root, "dir2");
createFile(root, "dir1/file", "content");
move(root, "dir1/file", "dir2");
assertTrue(root.hasEntry("dir2/file"));
assertFalse(root.hasEntry("dir1/file"));
Entry e = root.getEntry("dir2/file");
assertContent("content", e.getContent());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class StreamTest method testDoesNotWriteEntryParent.
@Test
public void testDoesNotWriteEntryParent() throws IOException {
Entry parent = new DirectoryEntry("");
Entry e = new FileEntry("", new StoredContent(333), -1, false);
parent.addChild(e);
StreamUtil.writeEntry(os, e);
assertNull(StreamUtil.readEntry(is).getParent());
}
Aggregations