Search in sources :

Example 31 with Entry

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());
}
Also used : Entry(com.intellij.history.core.tree.Entry) RootEntry(com.intellij.history.core.tree.RootEntry) Test(org.junit.Test)

Example 32 with Entry

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());
}
Also used : Entry(com.intellij.history.core.tree.Entry) RootEntry(com.intellij.history.core.tree.RootEntry) Test(org.junit.Test)

Example 33 with Entry

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());
}
Also used : DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Entry(com.intellij.history.core.tree.Entry) RootEntry(com.intellij.history.core.tree.RootEntry) Test(org.junit.Test)

Example 34 with Entry

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());
}
Also used : DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Entry(com.intellij.history.core.tree.Entry) RootEntry(com.intellij.history.core.tree.RootEntry) FileEntry(com.intellij.history.core.tree.FileEntry) FileEntry(com.intellij.history.core.tree.FileEntry) StoredContent(com.intellij.history.core.StoredContent) Test(org.junit.Test)

Example 35 with Entry

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());
}
Also used : DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Entry(com.intellij.history.core.tree.Entry) RootEntry(com.intellij.history.core.tree.RootEntry) FileEntry(com.intellij.history.core.tree.FileEntry) RootEntry(com.intellij.history.core.tree.RootEntry) Test(org.junit.Test)

Aggregations

Entry (com.intellij.history.core.tree.Entry)37 RootEntry (com.intellij.history.core.tree.RootEntry)25 FileEntry (com.intellij.history.core.tree.FileEntry)12 Test (org.junit.Test)12 DirectoryEntry (com.intellij.history.core.tree.DirectoryEntry)11 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 Revision (com.intellij.history.core.revisions.Revision)5 StoredContent (com.intellij.history.core.StoredContent)4 Difference (com.intellij.history.core.revisions.Difference)3 NewVirtualFile (com.intellij.openapi.vfs.newvfs.NewVirtualFile)2 ByteContent (com.intellij.history.ByteContent)1 Content (com.intellij.history.core.Content)1 Change (com.intellij.history.core.changes.Change)1 DeleteChange (com.intellij.history.core.changes.DeleteChange)1 StructuralChange (com.intellij.history.core.changes.StructuralChange)1 SelectionCalculator (com.intellij.history.integration.ui.models.SelectionCalculator)1 VirtualFileSystemEntry (com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry)1 THashSet (gnu.trove.THashSet)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1