本文整理汇总了Java中com.intellij.rt.coverage.data.ProjectData类的典型用法代码示例。如果您正苦于以下问题:Java ProjectData类的具体用法?Java ProjectData怎么用?Java ProjectData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectData类属于com.intellij.rt.coverage.data包,在下文中一共展示了ProjectData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: collectBaseFileCoverage
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Nullable
protected FileCoverageInfo collectBaseFileCoverage(@NotNull final VirtualFile file,
@NotNull final Annotator annotator,
@NotNull final ProjectData projectData,
@NotNull final Map<String, String> normalizedFiles2Files)
{
final String filePath = normalizeFilePath(file.getPath());
// process file
final FileCoverageInfo info;
final ClassData classData = getClassData(filePath, projectData, normalizedFiles2Files);
if (classData != null) {
// fill info from coverage data
info = fileInfoForCoveredFile(classData);
}
else {
// file wasn't mentioned in coverage information
info = fillInfoForUncoveredFile(VfsUtilCore.virtualToIoFile(file));
}
if (info != null) {
annotator.annotateFile(filePath, info);
}
return info;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SimpleCoverageAnnotator.java
示例2: annotate
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
public void annotate(@NotNull final VirtualFile contentRoot,
@NotNull final CoverageSuitesBundle suite,
final @NotNull CoverageDataManager dataManager, @NotNull final ProjectData data,
final Project project,
final Annotator annotator)
{
if (!contentRoot.isValid()) {
return;
}
// TODO: check name filter!!!!!
final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
@SuppressWarnings("unchecked") final Set<String> files = data.getClasses().keySet();
final Map<String, String> normalizedFiles2Files = ContainerUtil.newHashMap();
for (final String file : files) {
normalizedFiles2Files.put(normalizeFilePath(file), file);
}
collectFolderCoverage(contentRoot, dataManager, annotator, data,
suite.isTrackTestFolders(),
index,
suite.getCoverageEngine(),
ContainerUtil.<VirtualFile>newHashSet(),
Collections.unmodifiableMap(normalizedFiles2Files));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SimpleCoverageAnnotator.java
示例3: loadCoverageData
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Nullable
@Override
public ProjectData loadCoverageData(File sessionDataFile, @Nullable CoverageSuite suite) {
if (!(suite instanceof BlazeCoverageSuite)) {
return null;
}
BlazeProjectData blazeProjectData =
BlazeProjectDataManager.getInstance(suite.getProject()).getBlazeProjectData();
if (blazeProjectData == null) {
return null;
}
try (FileInputStream stream = new FileInputStream(sessionDataFile)) {
return parseCoverage(blazeProjectData.workspacePathResolver, stream);
} catch (IOException e) {
logger.warn(e);
}
return null;
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:19,代码来源:BlazeCoverageRunner.java
示例4: createRenewRequest
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
/**
* Override default implementation to stop annotating at the deepest common parent directory.
*
* <p>We can't simply modify the parent class implementation without duplicating the entire class,
* as it uses private subclasses. So instead, we let it run, then filter the output later.
*/
@Nullable
@Override
protected Runnable createRenewRequest(
CoverageSuitesBundle suites, CoverageDataManager dataManager) {
ProjectData data = suites.getCoverageData();
if (data == null) {
return null;
}
Runnable parentRunnable = super.createRenewRequest(suites, dataManager);
if (parentRunnable == null) {
return null;
}
return () -> {
coverageFilePaths.clear();
coverageFilePaths.addAll(collectRootPaths(suites));
parentRunnable.run();
ApplicationManager.getApplication().invokeLater(() -> rebuildUi(dataManager));
};
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:26,代码来源:BlazeCoverageAnnotator.java
示例5: testParseMultipleFiles
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Test
public void testParseMultipleFiles() throws IOException {
ProjectData data =
BlazeCoverageRunner.parseCoverage(
mockResolver,
inputStream(
"SF:path/to/file.txt",
"DA:4,0",
"DA:8,0",
"DA:9,1",
"DA:23,3",
"end_of_record",
"SF:path/to/another/file.txt",
"DA:1,1",
"DA:2,2",
"DA:5,0",
"DA:123,1",
"end_of_record"));
assertThat(data.getClasses()).hasSize(2);
assertThat(data.getClassData("/root/path/to/file.txt").getLines()).hasLength(24);
assertThat(data.getClassData("/root/path/to/another/file.txt").getLines()).hasLength(124);
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:23,代码来源:BlazeCoverageRunnerTest.java
示例6: testIgnoreUnrecognizedPrefixes
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Test
public void testIgnoreUnrecognizedPrefixes() throws IOException {
ProjectData data =
BlazeCoverageRunner.parseCoverage(
mockResolver,
inputStream(
"SF:path/to/file.txt",
"DA:4,0",
"DA:8,0",
"FS:0",
"unrecognized junk",
"DA:9,1",
"DA:23,3",
"end_of_record"));
assertThat(data.getClasses()).hasSize(1);
LineData[] lines = (LineData[]) data.getClassData("/root/path/to/file.txt").getLines();
assertThat(lines).hasLength(24);
assertEquals(lines[4], lineData(4, 0));
assertEquals(lines[9], lineData(9, 1));
assertEquals(lines[23], lineData(23, 3));
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:23,代码来源:BlazeCoverageRunnerTest.java
示例7: collectBaseFileCoverage
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@javax.annotation.Nullable
protected FileCoverageInfo collectBaseFileCoverage(@Nonnull final VirtualFile file,
@Nonnull final Annotator annotator,
@Nonnull final ProjectData projectData,
@Nonnull final Map<String, String> normalizedFiles2Files)
{
final String filePath = normalizeFilePath(file.getPath());
// process file
final FileCoverageInfo info;
final ClassData classData = getClassData(filePath, projectData, normalizedFiles2Files);
if (classData != null) {
// fill info from coverage data
info = fileInfoForCoveredFile(classData);
}
else {
// file wasn't mentioned in coverage information
info = fillInfoForUncoveredFile(VfsUtilCore.virtualToIoFile(file));
}
if (info != null) {
annotator.annotateFile(filePath, info);
}
return info;
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:SimpleCoverageAnnotator.java
示例8: annotate
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
public void annotate(@Nonnull final VirtualFile contentRoot,
@Nonnull final CoverageSuitesBundle suite,
final @Nonnull CoverageDataManager dataManager, @Nonnull final ProjectData data,
final Project project,
final Annotator annotator)
{
if (!contentRoot.isValid()) {
return;
}
// TODO: check name filter!!!!!
final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
@SuppressWarnings("unchecked") final Set<String> files = data.getClasses().keySet();
final Map<String, String> normalizedFiles2Files = ContainerUtil.newHashMap();
for (final String file : files) {
normalizedFiles2Files.put(normalizeFilePath(file), file);
}
collectFolderCoverage(contentRoot, dataManager, annotator, data,
suite.isTrackTestFolders(),
index,
suite.getCoverageEngine(),
ContainerUtil.<VirtualFile>newHashSet(),
Collections.unmodifiableMap(normalizedFiles2Files));
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:SimpleCoverageAnnotator.java
示例9: loadCoverageData
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Override
public ProjectData loadCoverageData(@NotNull File sessionDataFile, @Nullable CoverageSuite baseCoverageSuite)
{
final ProjectData data = new ProjectData();
try
{
final Project project = baseCoverageSuite instanceof BaseCoverageSuite ? ((BaseCoverageSuite) baseCoverageSuite).getProject() : null;
if(project != null)
{
loadExecutionData(sessionDataFile, data, project);
}
}
catch(Exception e)
{
return data;
}
return data;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:JaCoCoCoverageRunner.java
示例10: updateJavaParameters
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
public void updateJavaParameters(RunConfigurationBase configuration, JavaParameters params, RunnerSettings runnerSettings) {
if (runnerSettings != null || !isApplicableFor(configuration)) {
return;
}
StringBuilder argument = new StringBuilder("-javaagent:");
final String agentPath = PathUtil.getJarPathForClass(ProjectData.class);//todo spaces
argument.append(agentPath);
params.getVMParametersList().add(argument.toString());
params.getClassPath().add(agentPath);
params.getVMParametersList().addProperty(ProjectData.TRACE_DIR, getTracesDirectory(configuration));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:TestDiscoveryExtension.java
示例11: annotateFilteredClass
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
public void annotateFilteredClass(PsiClass psiClass, CoverageSuitesBundle bundle, Annotator annotator) {
final ProjectData data = bundle.getCoverageData();
if (data == null) return;
final Module module = ModuleUtil.findModuleForPsiElement(psiClass);
if (module != null) {
final boolean isInTests = ProjectRootManager.getInstance(module.getProject()).getFileIndex()
.isInTestSourceContent(psiClass.getContainingFile().getVirtualFile());
final CompilerModuleExtension moduleExtension = CompilerModuleExtension.getInstance(module);
final VirtualFile outputPath = isInTests ? moduleExtension.getCompilerOutputPathForTests() : moduleExtension.getCompilerOutputPath();
if (outputPath != null) {
final String qualifiedName = psiClass.getQualifiedName();
if (qualifiedName == null) return;
final String packageVMName = StringUtil.getPackageName(qualifiedName).replace('.', '/');
final File packageRoot = findRelativeFile(packageVMName, outputPath);
if (packageRoot != null && packageRoot.exists()) {
Map<String, ClassCoverageInfo> toplevelClassCoverage = new HashMap<String, ClassCoverageInfo>();
final File[] files = packageRoot.listFiles();
if (files != null) {
for (File child : files) {
if (isClassFile(child)) {
final String childName = getClassName(child);
final String classFqVMName = packageVMName.length() > 0 ? packageVMName + "/" + childName : childName;
final String toplevelClassSrcFQName = getSourceToplevelFQName(classFqVMName);
if (toplevelClassSrcFQName.equals(qualifiedName)) {
collectClassCoverageInformation(child, psiClass, new PackageCoverageInfo(), data, toplevelClassCoverage, classFqVMName.replace("/", "."), toplevelClassSrcFQName);
}
}
}
}
for (ClassCoverageInfo coverageInfo : toplevelClassCoverage.values()) {
annotator.annotateClass(qualifiedName, coverageInfo);
}
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:PackageAnnotator.java
示例12: loadCoverageData
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
public ProjectData loadCoverageData(@NotNull final File sessionDataFile, @Nullable final CoverageSuite coverageSuite) {
ProjectData projectData = ProjectDataLoader.load(sessionDataFile);
File sourceMapFile = new File(JavaCoverageEnabledConfiguration.getSourceMapPath(sessionDataFile.getPath()));
if (sourceMapFile.exists()) {
try {
loadSourceMap(projectData, sourceMapFile);
}
catch (IOException e) {
LOG.warn("Error reading source map associated with coverage data", e);
}
}
return projectData;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:IDEACoverageRunner.java
示例13: loadSourceMap
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
public void loadSourceMap(ProjectData projectData, File sourceMapFile) throws IOException {
Map map = SaveHook.loadSourceMapFromFile(new HashMap(), sourceMapFile);
for (Object o : map.entrySet()) {
@SuppressWarnings("unchecked") Map.Entry<String, String> entry = (Map.Entry<String, String>)o;
String className = entry.getKey();
String source = entry.getValue();
ClassData data = projectData.getClassData(className);
if (data != null) {
data.setSource(source);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:IDEACoverageRunner.java
示例14: appendCoverageArgument
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
public void appendCoverageArgument(final String sessionDataFilePath, final String[] patterns, final SimpleJavaParameters javaParameters,
final boolean collectLineInfo, final boolean isSampling, @Nullable String sourceMapPath) {
StringBuilder argument = new StringBuilder("-javaagent:");
final String agentPath = PathUtil.getJarPathForClass(ProjectData.class);
final String parentPath = handleSpacesInPath(agentPath);
argument.append(parentPath).append(File.separator).append(new File(agentPath).getName());
argument.append("=");
try {
final File tempFile = createTempFile();
tempFile.deleteOnExit();
write2file(tempFile, sessionDataFilePath);
write2file(tempFile, String.valueOf(collectLineInfo));
write2file(tempFile, Boolean.FALSE.toString()); //append unloaded
write2file(tempFile, Boolean.FALSE.toString());//merge with existing
write2file(tempFile, String.valueOf(isSampling));
if (sourceMapPath != null) {
write2file(tempFile, Boolean.TRUE.toString());
write2file(tempFile, sourceMapPath);
}
if (patterns != null) {
for (String coveragePattern : patterns) {
coveragePattern = coveragePattern.replace("$", "\\$").replace(".", "\\.").replaceAll("\\*", ".*");
if (!coveragePattern.endsWith(".*")) { //include inner classes
coveragePattern += "(\\$.*)*";
}
write2file(tempFile, coveragePattern);
}
}
argument.append(tempFile.getCanonicalPath());
}
catch (IOException e) {
LOG.info("Coverage was not enabled", e);
return;
}
javaParameters.getVMParametersList().add(argument.toString());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:IDEACoverageRunner.java
示例15: loadCoverageData
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Override
public ProjectData loadCoverageData(@NotNull File sessionDataFile, @Nullable CoverageSuite baseCoverageSuite) {
final ProjectData data = new ProjectData();
try {
final Project project = baseCoverageSuite instanceof BaseCoverageSuite ? ((BaseCoverageSuite)baseCoverageSuite).getProject() : null;
if (project != null) {
loadExecutionData(sessionDataFile, data, project);
}
}
catch (Exception e) {
return data;
}
return data;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JaCoCoCoverageRunner.java
示例16: getCoverageData
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Nullable
public ProjectData getCoverageData(final CoverageDataManager coverageDataManager) {
final ProjectData data = getCoverageData();
if (data != null) return data;
ProjectData map = loadProjectInfo();
if (mySuiteToMerge != null) {
JavaCoverageSuite toMerge = null;
final CoverageSuite[] suites = coverageDataManager.getSuites();
for (CoverageSuite suite : suites) {
if (Comparing.strEqual(suite.getPresentableName(), mySuiteToMerge)) {
if (!Comparing.strEqual(((JavaCoverageSuite)suite).getSuiteToMerge(), getPresentableName())) {
toMerge = (JavaCoverageSuite)suite;
}
break;
}
}
if (toMerge != null) {
final ProjectData projectInfo = toMerge.getCoverageData(coverageDataManager);
if (map != null) {
map.merge(projectInfo);
} else {
map = projectInfo;
}
}
}
setCoverageData(map);
return map;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:JavaCoverageSuite.java
示例17: getClassData
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
private static @Nullable ClassData getClassData(
final @NotNull String filePath,
final @NotNull ProjectData data,
final @NotNull Map<String, String> normalizedFiles2Files)
{
final String originalFileName = normalizedFiles2Files.get(filePath);
if (originalFileName == null) {
return null;
}
return data.getClassData(originalFileName);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SimpleCoverageAnnotator.java
示例18: getCoverageData
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Nullable
public ProjectData getCoverageData(final CoverageDataManager coverageDataManager) {
final ProjectData data = getCoverageData();
if (data != null) {
return data;
}
ProjectData map = loadProjectInfo();
setCoverageData(map);
return map;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:BaseCoverageSuite.java
示例19: loadProjectInfo
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
@Nullable
protected ProjectData loadProjectInfo() {
String sessionDataFileName = getCoverageDataFileName();
File sessionDataFile = new File(sessionDataFileName);
if (!sessionDataFile.exists()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Nonexistent file given +" + sessionDataFileName);
}
return null;
}
return myRunner.loadCoverageData(sessionDataFile, this);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:BaseCoverageSuite.java
示例20: classesArePresentInCoverageData
import com.intellij.rt.coverage.data.ProjectData; //导入依赖的package包/类
private static boolean classesArePresentInCoverageData(ProjectData data, Set<String> qualifiedNames) {
for (String qualifiedName : qualifiedNames) {
if (data.getClassData(qualifiedName) != null) {
return true;
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:SrcFileAnnotator.java
注:本文中的com.intellij.rt.coverage.data.ProjectData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论