use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class ChangesRevertingTest method testDeletingFile.
@Test
public void testDeletingFile() {
createFile(root, "file", "content", 18L, true);
StructuralChange c = delete(root, "file");
assertFalse(root.hasEntry("file"));
c.revertOn(root, true);
assertTrue(root.hasEntry("file"));
Entry e = root.getEntry("file");
assertContent("content", e.getContent());
assertEquals(18L, e.getTimestamp());
assertTrue(e.isReadOnly());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class ChangesRevertingTest method testDeletionRevertionCopiesRestoredEntry.
@Test
public void testDeletionRevertionCopiesRestoredEntry() {
createFile(root, "file");
DeleteChange c = delete(root, "file");
assertFalse(root.hasEntry("file"));
c.revertOn(root, true);
assertTrue(root.hasEntry("file"));
Entry restored = root.findEntry("file");
assertNotSame(restored, c.getDeletedEntry());
c.getDeletedEntry().setName("fff");
assertEquals("file", restored.getName());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class RootEntryDirectoriesTest method testCreatingFilesUnderDirectory.
@Test
public void testCreatingFilesUnderDirectory() {
createDirectory(root, "dir");
createFile(root, "dir/file");
assertTrue(root.hasEntry("dir"));
assertTrue(root.hasEntry("dir/file"));
Entry dir = root.getEntry("dir");
Entry file = root.getEntry("dir/file");
assertEquals(1, dir.getChildren().size());
assertSame(file, dir.getChildren().get(0));
assertSame(dir, file.getParent());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class StreamTest method testFileEntry.
@Test
public void testFileEntry() throws Exception {
Entry e = new FileEntry("file", new StoredContent(333), 123L, true);
StreamUtil.writeEntry(os, e);
Entry result = StreamUtil.readEntry(is);
assertEquals(FileEntry.class, result.getClass());
assertEquals("file", result.getName());
assertEquals(333, ((StoredContent) result.getContent()).getContentId());
assertEquals(123L, result.getTimestamp());
assertTrue(result.isReadOnly());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class StreamTest method testROStatusChange.
@Test
public void testROStatusChange() throws IOException {
Entry root = new RootEntry();
Change c = new ROStatusChange(nextId(), "f", true);
StreamUtil.writeChange(os, c);
Change read = StreamUtil.readChange(is);
assertEquals(ROStatusChange.class, read.getClass());
ROStatusChange result = ((ROStatusChange) read);
assertEquals("f", result.getPath());
assertEquals(true, result.getOldStatus());
}
Aggregations