Search in sources :

Example 6 with StoredContent

use of com.intellij.history.core.StoredContent 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());
}
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) DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Test(org.junit.Test)

Example 7 with StoredContent

use of com.intellij.history.core.StoredContent 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 8 with StoredContent

use of com.intellij.history.core.StoredContent in project intellij-community by JetBrains.

the class StreamTest method testContentChange.

@Test
public void testContentChange() throws IOException {
    Change c = new ContentChange(nextId(), "file", new StoredContent(333), 2L);
    StreamUtil.writeChange(os, c);
    Change read = StreamUtil.readChange(is);
    assertEquals(ContentChange.class, read.getClass());
    ContentChange result = (ContentChange) read;
    assertEquals("file", result.getPath());
    assertEquals(333, ((StoredContent) result.getOldContent()).getContentId());
    assertEquals(2L, result.getOldTimestamp());
}
Also used : StoredContent(com.intellij.history.core.StoredContent) Test(org.junit.Test)

Aggregations

StoredContent (com.intellij.history.core.StoredContent)8 Test (org.junit.Test)7 DirectoryEntry (com.intellij.history.core.tree.DirectoryEntry)5 Entry (com.intellij.history.core.tree.Entry)4 FileEntry (com.intellij.history.core.tree.FileEntry)4 RootEntry (com.intellij.history.core.tree.RootEntry)4 Ignore (org.junit.Ignore)2 Document (com.intellij.openapi.editor.Document)1 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)1 VirtualFileSystemEntry (com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry)1 Nullable (org.jetbrains.annotations.Nullable)1