Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
269,100
void () { Entry e1 = new DirectoryEntry("name1"); Entry e2 = new DirectoryEntry("name2"); Entry child1 = new FileEntry("name", c("content1"), -1, false); Entry child2 = new FileEntry("name", c("content2"), -1, false); e1.addChild(child1); e2.addChild(child2); List<Difference> dd = Entry.getDifferencesBetween(e1, e2); a...
testDifferenceWithModifiedBothSubjectAndChild
269,101
void () { Entry dir1 = new DirectoryEntry("dir1"); Entry dir2 = new DirectoryEntry("dir2"); Entry subDir1 = new DirectoryEntry("subDir"); Entry subDir2 = new DirectoryEntry("subDir"); Entry child1 = new FileEntry("name", c("content"), -1, false); Entry child2 = new FileEntry("name", c("content"), -1, false); dir1.addCh...
testIncludesDifferenceForChildrenWhenParentWasModified
269,102
void (Difference d, Entry left, Entry right) { assertDifference(d, left, right, false); }
assertDirDifference
269,103
void (Difference d, Entry left, Entry right) { assertDifference(d, left, right, true); }
assertFileDifference
269,104
void (Difference d, Entry left, Entry right, boolean isFile) { assertEquals(isFile, d.isFile()); assertSame(left, d.getLeft()); assertSame(right, d.getRight()); }
assertDifference
269,105
void () { Entry e = new MyEntry() { @Override public String getPath() { return "path"; } }; assertTrue(e.pathEquals("path")); assertFalse(e.pathEquals("bla-bla-bla")); Paths.setCaseSensitive(true); assertFalse(e.pathEquals("PATH")); Paths.setCaseSensitive(false); assertTrue(e.pathEquals("PATH")); }
testPathEquality
269,106
String () { return "path"; }
getPath
269,107
long () { throw new UnsupportedOperationException(); }
getTimestamp
269,108
Entry () { throw new UnsupportedOperationException(); }
copy
269,109
void (@NotNull Entry e, @NotNull List<? super Difference> result, boolean isRightContentCurrent) { throw new UnsupportedOperationException(); }
collectDifferencesWith
269,110
void (@NotNull List<? super Difference> result, boolean isRightContentCurrent) { throw new UnsupportedOperationException(); }
collectCreatedDifferences
269,111
void (@NotNull List<? super Difference> result, boolean isRightContentCurrent) { throw new UnsupportedOperationException(); }
collectDeletedDifferences
269,112
void () { root = new RootEntry(); child = new DirectoryEntry("child"); root.addChild(child); }
setUp
269,113
void () { assertEquals("child", child.getPath()); }
testPathToChildren
269,114
void () { Entry copy = root.copy(); assertEquals(RootEntry.class, copy.getClass()); assertEquals(1, copy.getChildren().size()); assertNotSame(child, copy.getChildren().get(0)); assertEquals("child", copy.getChildren().get(0).getName()); }
testCopying
269,115
void () { Entry e1 = new FileEntry(null, c("abc"), -1, false); Entry e2 = new FileEntry(null, new StoredContent(-1), -1, false); assertFalse(e1.hasUnavailableContent()); assertTrue(e2.hasUnavailableContent()); }
testHasUnavailableContent
269,116
void () { FileEntry file = new FileEntry("name", c("content"), 123L, true); Entry copy = file.copy(); assertEquals("name", copy.getName()); assertContent("content", copy.getContent()); assertEquals(123L, copy.getTimestamp()); assertTrue(copy.isReadOnly()); }
testCopying
269,117
void () { DirectoryEntry parent = new DirectoryEntry(null); FileEntry file = new FileEntry(null, null, -1, false); parent.addChild(file); Entry copy = file.copy(); assertNull(copy.getParent()); }
testDoesNotCopyParent
269,118
void () { Entry e = new FileEntry("name", null, -1, false); e.setName("new name"); assertEquals("new name", e.getName()); }
testRenaming
269,119
void () { Entry e = new FileEntry("name", null, 2L, false); assertTrue(e.isOutdated(1L)); assertTrue(e.isOutdated(3L)); assertFalse(e.isOutdated(2L)); }
testOutdated
269,120
void () { FileEntry e1 = new FileEntry("name", c("content"), -1, false); FileEntry e2 = new FileEntry("name", c("content"), -1, false); assertTrue(Entry.getDifferencesBetween(e1, e2).isEmpty()); }
testNoDifference
269,121
void () { Entry e1 = new FileEntry("name", c("content"), -1, false); Entry e2 = new FileEntry("another name", c("content"), -1, false); List<Difference> dd = Entry.getDifferencesBetween(e1, e2); assertDifference(dd, e1, e2); }
testDifferenceInName
269,122
void () { Entry e1 = new FileEntry("name", c(""), -1, false); Entry e2 = new FileEntry("NAME", c(""), -1, false); Paths.setCaseSensitive(false); assertEquals(1, Entry.getDifferencesBetween(e1, e2).size()); Paths.setCaseSensitive(true); assertEquals(1, Entry.getDifferencesBetween(e1, e2).size()); }
testDifferenceInNameIsAlwaysCaseSensitive
269,123
void () { FileEntry e1 = new FileEntry("name", c("content"), -1, false); FileEntry e2 = new FileEntry("name", c("another content"), -1, false); List<Difference> dd = Entry.getDifferencesBetween(e1, e2); assertDifference(dd, e1, e2); }
testDifferenceInContent
269,124
void () { FileEntry e1 = new FileEntry("name", c("content"), -1, true); FileEntry e2 = new FileEntry("name", c("content"), -1, false); List<Difference> dd = Entry.getDifferencesBetween(e1, e2); assertDifference(dd, e1, e2); }
testDifferenceInROStatus
269,125
void () { FileEntry e = new FileEntry(null, null, -1, false); assertDifference(Entry.getDifferencesBetween(null, e), null, e); }
testAsCreatedDifference
269,126
void () { FileEntry e = new FileEntry(null, null, -1, false); assertDifference(Entry.getDifferencesBetween(e, null), e, null); }
testAsDeletedDifference
269,127
void (List<Difference> dd, Entry left, Entry right) { assertEquals(1, dd.size()); Difference d = dd.get(0); assertTrue(d.isFile()); assertSame(left, d.getLeft()); assertSame(right, d.getRight()); }
assertDifference
269,128
void () { setContent(f, "file"); setDocumentTextFor(f, "doc1"); LocalHistoryAction a = LocalHistory.getInstance().startAction("action"); setDocumentTextFor(f, "doc2"); a.finish(); saveDocument(f); setContent(f, "doc3"); }
doRun
269,129
void (VirtualFile f) { FileDocumentManager dm = FileDocumentManager.getInstance(); Document document = dm.getDocument(f); assertNotNull(f.getPath(), document); dm.saveDocument(document); }
saveDocument
269,130
void () { assertEquals(myRoot, myGateway.findVirtualFile(myRoot.getPath())); assertNull(myGateway.findVirtualFile(myRoot.getPath() + "/nonexistent")); }
testFindingFile
269,131
void () { VirtualFile dir = createDirectory("dir"); delete(dir); dir = createDirectory("dir"); assertThat(getRevisionsFor(dir)).hasSize(4); }
testRevisionForDirectoryWithTheSameNameAsDeletedOne
269,132
void () { VirtualFile dir = createDirectory("dir"); VirtualFile f = TemporaryDirectory.createVirtualFile(dir, "file.txt", null); rename(dir, "newDir"); setContent(f, "xxx"); List<Revision> rr = getRevisionsFor(f); assertEquals(4, rr.size()); assertEquals(myRoot.getPath() + "/newDir/file.txt", rr.get(0).findEntry().getP...
testGettingEntryFromRevisionInRenamedDir
269,133
void () { setContent(f, "1", TIMESTAMP_INCREMENT); setContent(f, "2", TIMESTAMP_INCREMENT * 2); assertContentAt(0, null); assertContentAt(TIMESTAMP_INCREMENT, "1"); assertContentAt(TIMESTAMP_INCREMENT + TIMESTAMP_INCREMENT / 2, null); assertContentAt(TIMESTAMP_INCREMENT * 2, "2"); assertContentAt(TIMESTAMP_INCREMENT * ...
testContentAtDate
269,134
void () { VirtualFile f = createChildData(myRoot, "f.class"); setContent(f, "1", 1111); assertContentAt(1111, null); }
testContentAtDateForFilteredFilesIsNull
269,135
void () { Clock.setTime(1); setContent(f, "1", TIMESTAMP_INCREMENT); Clock.setTime(2); setContent(f, "2", TIMESTAMP_INCREMENT * 2); Clock.setTime(3); setContent(f, "3", TIMESTAMP_INCREMENT * 3); getVcs().getChangeListInTests().purgeObsolete(2); assertContentAt(TIMESTAMP_INCREMENT, null); assertContentAt(TIMESTAMP_INCRE...
testGettingFirstAvailableContentAfterPurge
269,136
void () { setContent(f, "1", TIMESTAMP_INCREMENT); setContent(f, "2", TIMESTAMP_INCREMENT * 2); FileRevisionTimestampComparator c = new FileRevisionTimestampComparator() { @Override public boolean isSuitable(long revisionTimestamp) { return revisionTimestamp < 10000; } }; assertContentAt(c, "2"); }
testGettingMostRecentRevisionContent
269,137
boolean (long revisionTimestamp) { return revisionTimestamp < 10000; }
isSuitable
269,138
void () { setContent(f, "FILE1", TIMESTAMP_INCREMENT); Clock.setTime(TIMESTAMP_INCREMENT * 2); LocalHistoryAction a = LocalHistory.getInstance().startAction(null); setDocumentTextFor(f, "DOC1"); a.finish(); Clock.setTime(TIMESTAMP_INCREMENT * 3); a = LocalHistory.getInstance().startAction(null); setDocumentTextFor(f, "...
testWithUnsavedDocuments
269,139
boolean (long revisionTimestamp) { return revisionTimestamp == TIMESTAMP_INCREMENT * 4; }
isSuitable
269,140
boolean (long revisionTimestamp) { return revisionTimestamp == TIMESTAMP_INCREMENT * 3; }
isSuitable
269,141
boolean (long revisionTimestamp) { return revisionTimestamp == TIMESTAMP_INCREMENT * 2; }
isSuitable
269,142
boolean (long revisionTimestamp) { return revisionTimestamp == TIMESTAMP_INCREMENT; }
isSuitable
269,143
void (long timestamp, String expected) { assertContentAt(comparator(timestamp), expected); }
assertContentAt
269,144
void (FileRevisionTimestampComparator c, String expected) { byte[] actual = LocalHistory.getInstance().getByteContent(f, c); assertEquals(expected, actual == null ? null : new String(actual, StandardCharsets.UTF_8)); }
assertContentAt
269,145
FileRevisionTimestampComparator (final long timestamp) { return new FileRevisionTimestampComparator() { @Override public boolean isSuitable(long revisionTimestamp) { return revisionTimestamp == timestamp; } }; }
comparator
269,146
boolean (long revisionTimestamp) { return revisionTimestamp == timestamp; }
isSuitable
269,147
void (final String expected) { TestVisitor visitor = new TestVisitor(); assertVisitorLog(expected, visitor); }
assertVisitorLog
269,148
void (String expected, TestVisitor visitor) { getVcs().accept(visitor); assertThat(visitor.log.trim()).isEqualTo(expected.trim()); }
assertVisitorLog
269,149
void (ChangeSet c) { log += "end "; }
end
269,150
void (RenameChange c) { log += "rename "; }
visit
269,151
void () { log += "finished "; }
finished
269,152
void () { for (VirtualFile f : myRoot.getChildren()) { VfsTestUtil.deleteFile(f); } }
clearRoot
269,153
void (@NotNull VirtualFile dir, @NotNull String name) { createChildData(dir, name); VirtualFile file = dir.findChild(name); setFileText(file, "some content"); }
createChildDataWithContent
269,154
void (@NotNull VirtualFile dir, @NotNull String name) { createChildData(dir, name); dir.findChild(name); }
createChildDataWithoutContent
269,155
VirtualFile (@NotNull String name) { return VfsTestUtil.createDir(myRoot, name); }
createDirectory
269,156
void (@NotNull VirtualFile f, @NotNull String content) { setContent(f, content, f.getTimeStamp() + TIMESTAMP_INCREMENT); }
setContent
269,157
void (VirtualFile f, String content, long timestamp) { setBinaryContent(f, content.getBytes(StandardCharsets.UTF_8), -1, timestamp, this); }
setContent
269,158
String (String name) { File f = new File(myRoot.getPath(), name); assertTrue(f.getPath(), f.mkdirs() || f.isDirectory()); return FileUtil.toSystemIndependentName(f.getPath()); }
createDirectoryExternally
269,159
void (VirtualFile f, String text) { Document document = FileDocumentManager.getInstance().getDocument(f); assertNotNull(f.getPath(), document); ApplicationManager.getApplication().runWriteAction(() -> document.setText(text)); }
setDocumentTextFor
269,160
LocalHistoryFacade () { return LocalHistoryImpl.getInstanceImpl().getFacade(); }
getVcs
269,161
List<Revision> (@NotNull VirtualFile f) { return getRevisionsFor(f, null); }
getRevisionsFor
269,162
List<Revision> (@NotNull VirtualFile f, @Nullable String pattern) { return ReadAction.compute(() -> { return LocalHistoryTestCase.collectRevisions(getVcs(), getRootEntry(), f.getPath(), myProject.getLocationHash(), pattern); }); }
getRevisionsFor
269,163
RootEntry () { return myGateway.createTransientRootEntry(); }
getRootEntry
269,164
void (@NotNull String path) { addContentRoot(myModule, path); }
addContentRoot
269,165
void (@NotNull Module module, @NotNull String path) { ApplicationManager.getApplication().runWriteAction(() -> ModuleRootModificationUtil.addContentRoot(module, FileUtil.toSystemIndependentName(path))); }
addContentRoot
269,166
void (final String path) { ApplicationManager.getApplication().runWriteAction(() -> { ModuleRootManager rm = ModuleRootManager.getInstance(myModule); ModifiableRootModel m = rm.getModifiableModel(); for (ContentEntry e : m.getContentEntries()) { if (!Comparing.equal(e.getFile(), myRoot)) continue; e.addExcludeFolder(Vf...
addExcludedDir
269,167
void (VirtualFileListener l, Runnable r) { VirtualFileManager.getInstance().addVirtualFileListener(l); try { r.run(); } finally { VirtualFileManager.getInstance().removeVirtualFileListener(l); } }
addFileListenerDuring
269,168
void (String expected, Entry e) { assertEquals(expected, new String(e.getContent().getBytes(), StandardCharsets.UTF_8)); }
assertContent
269,169
String () { return myName; }
getName
269,170
boolean (@NotNull String name) { return Paths.isCaseSensitive() ? myName.equals(name) : myName.equalsIgnoreCase(name); }
nameEquals
269,171
boolean () { return IsDirectory; }
isDirectory
269,172
String () { if (myParent == null) return myName; return myParent.getPath() + "/" + myName; }
getPath
269,173
long () { return myTimestamp; }
getTimeStamp
269,174
VirtualFile[] () { return VfsUtil.toVirtualFileArray(myChildren); }
getChildren
269,175
void (TestVirtualFile f) { f.myParent = this; myChildren.add(f); }
addChild
269,176
long () { return myContent == null ? 0 : myContent.getBytes(StandardCharsets.UTF_8).length; }
getLength
269,177
VirtualFileSystem () { return new MockLocalFileSystem() { @Override public boolean equals(Object o) { return o != null; } }; }
getFileSystem
269,178
boolean (Object o) { return o != null; }
equals
269,179
boolean () { return !isReadOnly; }
isWritable
269,180
boolean () { return true; }
isValid
269,181
VirtualFile () { return myParent; }
getParent
269,182
OutputStream (Object requestor, long newModificationStamp, long newTimeStamp) { throw new UnsupportedOperationException(); }
getOutputStream
269,183
void (boolean asynchronous, boolean recursive, Runnable postRunnable) { throw new UnsupportedOperationException(); }
refresh
269,184
InputStream () { throw new UnsupportedOperationException(); }
getInputStream
269,185
void () { // shouldn't throw CommandProcessor.getInstance().executeCommand(myProject, ExternalChangesAndRefreshingTest::refreshVFS, "", null); }
testRefreshDuringCommand
269,186
void (@NotNull VirtualFileEvent e) { executeSomeCommand(); }
fileCreated
269,187
void () { CommandProcessor.getInstance().executeCommand(myProject, () -> { }, "", null); }
executeSomeCommand
269,188
void (@NotNull VirtualFileEvent e) { try { if (!e.getFile().getPath().equals(path)) { return; } content[0] = new String(e.getFile().contentsToByteArray(), StandardCharsets.UTF_8); } catch (IOException ex) { throw new RuntimeException(ex); } }
fileCreated
269,189
void () { int before = getRevisionsFor(myRoot).size(); createChildDirectory(myRoot, FILTERED_DIR_NAME); String path = Paths.appended(myRoot.getPath(), FILTERED_DIR_NAME); FileUtil.delete(new File(path)); assertEquals(before, getRevisionsFor(myRoot).size()); refreshVFS(); assertEquals(before, getRevisionsFor(myRoot).siz...
testDeletionOfFilteredDirectoryExternallyDoesNotThrowExceptionDuringRefresh
269,190
void () { refreshVFS(false); }
refreshVFS
269,191
void (boolean async) { try { final Semaphore s = new Semaphore(1); s.acquire(); VirtualFileManager fm = VirtualFileManager.getInstance(); if (async) { fm.asyncRefresh(s::release); } else { try { fm.syncRefresh(); } finally { s.release(); } } assertTrue(s.tryAcquire(1, TimeUnit.MINUTES)); } catch (InterruptedException e...
refreshVFS
269,192
void () { final VirtualFile[] f = new VirtualFile[1]; ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(myProject, new RunnableAdapter() { @Override public void doRun() throws IOException { f[0] = createChildData(myRoot, "f1.txt"); f[0].setBinaryContent(new byte[]{1}...
testProcessingCommands
269,193
void () { VirtualFile f = createChildData(myRoot, "f.txt"); LocalHistory.getInstance().putUserLabel(myProject, "global"); assertEquals(3, getRevisionsFor(f).size()); assertThat(getRevisionsFor(myRoot)).hasSize(4); LocalHistory.getInstance().putUserLabel(myProject, "file"); List<Revision> rr = getRevisionsFor(f); assert...
testPuttingUserLabel
269,194
void () { VirtualFile f = createChildData(myRoot, "file.txt"); assertEquals(2, getRevisionsFor(f).size()); assertEquals(3, getRevisionsFor(myRoot).size()); LocalHistory.getInstance().putSystemLabel(myProject, "label"); List<Revision> rr = getRevisionsFor(f); assertEquals(3, rr.size()); assertEquals("label", rr.get(1).g...
testPuttingSystemLabel
269,195
void () { VirtualFile f = createChildData(myRoot, "f.txt"); setContent(f, "1"); setDocumentTextFor(f, "2"); LocalHistory.getInstance().putSystemLabel(myProject, "label"); setDocumentTextFor(f, "3"); LocalHistory.getInstance().putUserLabel(myProject, "label"); setDocumentTextFor(f, "4"); LocalHistory.getInstance().putUs...
testPuttingLabelWithUnsavedDocuments
269,196
void () { VirtualFile f = createChildData(myRoot, "f.txt"); setContent(f, "1"); setDocumentTextFor(f, "2"); LocalHistory.getInstance().putSystemLabel(myProject, "label"); LocalHistory.getInstance().putUserLabel(myProject, "label"); List<Revision> rr = getRevisionsFor(f); assertEquals(6, rr.size()); // 3 changes + 2 lab...
testDoNotRegisterSameUnsavedDocumentContentTwice
269,197
void () { VirtualFile f1 = createChildData(myRoot, "file.txt"); VirtualFile f2 = createChildData(myRoot, "file." + FileListeningTest.IGNORED_EXTENSION); assertTrue(LocalHistory.getInstance().isUnderControl(f1)); assertFalse(LocalHistory.getInstance().isUnderControl(f2)); }
testIsUnderControl
269,198
StringBuilder (@NotNull VirtualFile from, int level, @NotNull StringBuilder builder) { List<VirtualFile> children = new ArrayList<>(((NewVirtualFile)from).getCachedChildren()); Collections.sort(children, Comparator.comparing(VirtualFile::getName)); for (VirtualFile eachChild : children) { builder.append(StringUtil.repe...
buildDBFileStructure
269,199
void (@NotNull VirtualFilePropertyEvent e) { log[0] = getRevisionsFor(file).size(); }
beforePropertyChange