本文整理汇总了Java中com.intellij.testFramework.VfsTestUtil类的典型用法代码示例。如果您正苦于以下问题:Java VfsTestUtil类的具体用法?Java VfsTestUtil怎么用?Java VfsTestUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VfsTestUtil类属于com.intellij.testFramework包,在下文中一共展示了VfsTestUtil类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createRootStructure
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
private List<VirtualFile> createRootStructure(Pair<String, String>... pathAndVcs) {
List<VirtualFile> roots = new ArrayList<VirtualFile>();
List<VcsDirectoryMapping> mappings = new ArrayList<VcsDirectoryMapping>();
for (Pair<String, String> pathAndVc : pathAndVcs) {
String path = pathAndVc.first;
String vcs = pathAndVc.second;
VirtualFile vf;
if (path.equals(myBaseDir.getPath())) {
vf = myBaseDir;
} else {
vf = VfsTestUtil.createDir(myBaseDir, path);
}
mappings.add(new VcsDirectoryMapping(vf.getPath(), vcs));
roots.add(vf);
}
ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings(mappings);
return roots;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LocalChangesUnderRootsTest.java
示例2: doCheckResult
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
/**
* Check the result against a plain text file. Creates file if missing.
* Avoids the default sandboxing in IntelliJ.
*/
public static void doCheckResult(String fullPath, String targetDataName, String text) throws IOException {
text = text.trim();
String expectedFileName = fullPath + File.separator + targetDataName;
if (OVERWRITE_TESTDATA) {
VfsTestUtil.overwriteTestData(expectedFileName, text);
System.out.println("File " + expectedFileName + " created.");
}
try {
String expectedText = doLoadFile(fullPath, targetDataName);
if (!Comparing.equal(expectedText, text)) {
throw new FileComparisonFailure(targetDataName, expectedText, text, expectedFileName);
}
} catch(FileNotFoundException e){
VfsTestUtil.overwriteTestData(expectedFileName, text);
fail("No output text found. File " + expectedFileName + " created.");
}
}
开发者ID:carymrobbins,项目名称:intellij-haskforce,代码行数:22,代码来源:HaskellLexerTestBase.java
示例3: doCheckResult
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
private static void doCheckResult(String path, String text) throws IOException {
text = text.trim();
if (OVERWRITE_TESTDATA) {
VfsTestUtil.overwriteTestData(path, text);
System.out.println("File " + path + " created.");
}
try {
String expectedText = doLoadFile(path);
if (!Comparing.equal(expectedText, text)) {
throw new FileComparisonFailure(path, expectedText, text, path);
}
}
catch (FileNotFoundException e) {
VfsTestUtil.overwriteTestData(path, text);
fail("No output text found. File " + path + " created.");
}
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ResolvingTestCase.java
示例4: doCheckResult
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
public static void doCheckResult(String fullPath, String targetDataName, String text) throws IOException {
text = text.trim();
String expectedFileName = fullPath + File.separatorChar + targetDataName;
if (OVERWRITE_TESTDATA) {
VfsTestUtil.overwriteTestData(expectedFileName, text);
System.out.println("File " + expectedFileName + " created.");
}
try {
String expectedText = doLoadFile(fullPath, targetDataName);
if (!Comparing.equal(expectedText, text)) {
throw new FileComparisonFailure(targetDataName, expectedText, text, expectedFileName);
}
}
catch (FileNotFoundException e) {
VfsTestUtil.overwriteTestData(expectedFileName, text);
fail("No output text found. File " + expectedFileName + " created.");
}
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:OneFileAtProjectTestCase.java
示例5: testFilesWithTheSameNameButDifferentPathsEndUpInDifferentGroups
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
public void testFilesWithTheSameNameButDifferentPathsEndUpInDifferentGroups() throws IOException {
File ioDir = FileUtil.createTempDirectory("t", null, false);
VirtualFile dir = null;
try {
dir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ioDir);
PsiFile f1 = getPsiManager().findFile(VfsTestUtil.createFile(dir, "/x/X.java", "class X{}"));
PsiFile f2 = getPsiManager().findFile(VfsTestUtil.createFile(dir, "/y/X.java", "class X{}"));
PsiElement class1 = ArrayUtil.getLastElement(f1.getChildren());
PsiElement class2 = ArrayUtil.getLastElement(f2.getChildren());
FileGroupingRule fileGroupingRule = new FileGroupingRule(getProject());
UsageGroup group1 = fileGroupingRule.getParentGroupFor(new UsageInfo2UsageAdapter(new UsageInfo(class1)), UsageTarget.EMPTY_ARRAY);
UsageGroup group2 = fileGroupingRule.getParentGroupFor(new UsageInfo2UsageAdapter(new UsageInfo(class2)), UsageTarget.EMPTY_ARRAY);
int compareTo = group1.compareTo(group2);
assertTrue(String.valueOf(compareTo), compareTo < 0);
}
finally {
if (dir != null) {
VfsTestUtil.deleteFile(dir);
}
FileUtil.delete(ioDir);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:UsageNodeTreeBuilderTest.java
示例6: testGeneratedSourceRoot
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
public void testGeneratedSourceRoot() throws Exception {
VirtualFile genRoot = getVirtualFile(createTempDir("genSrcRoot"));
VirtualFile srcRoot = getVirtualFile(createTempDir("srcRoot"));
JavaSourceRootProperties properties = JpsJavaExtensionService.getInstance().createSourceRootProperties("", true);
PsiTestUtil.addSourceRoot(myModule, genRoot, JavaSourceRootType.SOURCE, properties);
PsiTestUtil.addSourceRoot(myModule, srcRoot);
VirtualFile genClass = VfsTestUtil.createFile(genRoot, "Gen.java", "class Gen{}");
VirtualFile srcClass = VfsTestUtil.createFile(srcRoot, "Src.java", "class Src{}");
AnalysisScope scope = new AnalysisScope(myModule);
assertTrue(scope.contains(srcClass));
assertFalse(scope.contains(genClass));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AnalysisScopeTest.java
示例7: createChangeForPath
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
private Change createChangeForPath(String path) {
VirtualFile file = VfsTestUtil.createFile(myBaseDir, path);
FilePath filePath = VcsUtil.getFilePath(file);
ContentRevision beforeRevision = new MockContentRevision(filePath, new VcsRevisionNumber.Int(1));
ContentRevision afterRevision = new MockContentRevision(filePath, new VcsRevisionNumber.Int(2));
return new Change(beforeRevision, afterRevision);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:LocalChangesUnderRootsTest.java
示例8: createProjectFiles
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
protected void createProjectFiles() {
VfsTestUtil.createFile(myProjectRoot, "file.txt", "file.txt content");
VfsTestUtil.createFile(myProjectRoot, "file", "file content");
VfsTestUtil.createFile(myProjectRoot, "folder/file1", "file1 content");
VfsTestUtil.createFile(myProjectRoot, "folder/file2", "file2 content");
VfsTestUtil.createFile(myProjectRoot, "folder/empty_file");
VfsTestUtil.createFile(myProjectRoot, "folder/dir/file3", "file3 content");
VfsTestUtil.createDir (myProjectRoot, "folder/empty_folder");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GithubTest.java
示例9: setUp
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
VirtualFile virtualFile = myFixture.copyFileToProject("ide-blade.json");
VfsTestUtil.createDir(virtualFile.getParent(), "res");
}
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:8,代码来源:ViewCollectorTest.java
示例10: copyFilesFillingEditorInfos
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
protected LinkedHashMap<VirtualFile, EditorInfo> copyFilesFillingEditorInfos(final VirtualFile fromDir, final VirtualFile toDir, final String... relativePaths) throws IOException {
LinkedHashMap<VirtualFile, EditorInfo> editorInfos = new LinkedHashMap<VirtualFile, EditorInfo>();
List<OutputStream> streamsToClose = new ArrayList<OutputStream>();
for (String relativePath : relativePaths) {
if (relativePath.startsWith("/")) {
relativePath = relativePath.substring(1);
}
final VirtualFile fromFile = fromDir.findFileByRelativePath(relativePath);
assertNotNull(fromDir.getPath() + "/" + relativePath, fromFile);
VirtualFile toFile = toDir.findFileByRelativePath(relativePath);
if (toFile == null) {
final File file = new File(toDir.getPath(), relativePath);
FileUtil.createIfDoesntExist(file);
toFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
assertNotNull(file.getCanonicalPath(), toFile);
}
toFile.putUserData(VfsTestUtil.TEST_DATA_FILE_PATH, FileUtil.toSystemDependentName(fromFile.getPath()));
editorInfos.put(toFile, copyContent(fromFile, toFile, streamsToClose));
}
for(int i = streamsToClose.size() -1; i >= 0 ; --i) {
streamsToClose.get(i).close();
}
return editorInfos;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:CodeInsightTestCase.java
示例11: setUp
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
VirtualFile virtualFile = myFixture.copyFileToProject("classes.php");
VfsTestUtil.createDir(virtualFile.getParent(), "Resources/views");
}
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:8,代码来源:BundleTwigNamespaceExtensionTest.java
示例12: copyFilesFillingEditorInfos
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
protected LinkedHashMap<VirtualFile, EditorInfo> copyFilesFillingEditorInfos(final VirtualFile fromDir, final VirtualFile toDir, final String... relativePaths) throws IOException
{
LinkedHashMap<VirtualFile, EditorInfo> editorInfos = new LinkedHashMap<VirtualFile, EditorInfo>();
List<OutputStream> streamsToClose = new ArrayList<OutputStream>();
for(String relativePath : relativePaths)
{
if(relativePath.startsWith("/"))
{
relativePath = relativePath.substring(1);
}
final VirtualFile fromFile = fromDir.findFileByRelativePath(relativePath);
assertNotNull(fromDir.getPath() + "/" + relativePath, fromFile);
VirtualFile toFile = toDir.findFileByRelativePath(relativePath);
if(toFile == null)
{
final File file = new File(toDir.getPath(), relativePath);
FileUtil.createIfDoesntExist(file);
toFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
assertNotNull(file.getCanonicalPath(), toFile);
}
toFile.putUserData(VfsTestUtil.TEST_DATA_FILE_PATH, FileUtil.toSystemDependentName(fromFile.getPath()));
editorInfos.put(toFile, copyContent(fromFile, toFile, streamsToClose));
}
for(int i = streamsToClose.size() - 1; i >= 0; --i)
{
streamsToClose.get(i).close();
}
return editorInfos;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:33,代码来源:CodeInsightTestCase.java
示例13: createFile
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
protected VirtualFile createFile(final String path, final String text) {
return VfsTestUtil.createFile(getBaseDir(), path, text);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PackagingElementsTestCase.java
示例14: createDir
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
protected VirtualFile createDir(final String path) {
return VfsTestUtil.createDir(getBaseDir(), path);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PackagingElementsTestCase.java
示例15: createChanges
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
protected void createChanges() {
VfsTestUtil.createFile(myProjectRoot, "file.txt", "file.txt content");
git("add file.txt");
git("commit -m changes");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:GithubCreatePullRequestTestBase.java
示例16: file
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
@Given("^unversioned file (.*)$")
public void unversioned_file(String filePath) throws Throwable {
cd(GitCucumberWorld.myRepository);
VirtualFile file = VfsTestUtil.createFile(GitCucumberWorld.myProjectDir, filePath);
VcsDirtyScopeManager.getInstance(myProject).fileDirty(file);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GitAddSteps.java
示例17: file
import com.intellij.testFramework.VfsTestUtil; //导入依赖的package包/类
@Given("^unversioned file (.*)$")
public void unversioned_file(String filePath) throws Throwable {
cd(myRepository);
VfsTestUtil.createFile(myProjectDir, filePath);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:GitAddSteps.java
注:本文中的com.intellij.testFramework.VfsTestUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论