本文整理汇总了Java中org.jacoco.core.data.SessionInfoStore类的典型用法代码示例。如果您正苦于以下问题:Java SessionInfoStore类的具体用法?Java SessionInfoStore怎么用?Java SessionInfoStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionInfoStore类属于org.jacoco.core.data包,在下文中一共展示了SessionInfoStore类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testNewFile
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
@Test
public void testNewFile() throws Exception {
files.newFile(source());
final File[] execfiles = new File(folder.getRoot(), ".execdata")
.listFiles();
assertEquals(1, execfiles.length);
final File execfile = execfiles[0];
assertTrue(execfile.exists());
assertTrue(execfile.isFile());
final ExecutionDataReader reader = new ExecutionDataReader(
new FileInputStream(execfile));
final SessionInfoStore sessionInfoStore = new SessionInfoStore();
final ExecutionDataStore executionDataStore = new ExecutionDataStore();
reader.setSessionInfoVisitor(sessionInfoStore);
reader.setExecutionDataVisitor(executionDataStore);
reader.read();
assertEquals("id", sessionInfoStore.getInfos().get(0).getId());
assertEquals("MyClass", executionDataStore.get(123).getName());
}
开发者ID:eclipse,项目名称:eclemma,代码行数:23,代码来源:ExecutionDataFilesTest.java
示例2: execute
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
public void execute() throws IOException {
if (destfile == null) {
throw new RuntimeException("Destination file must be supplied");
}
final SessionInfoStore infoStore = new SessionInfoStore();
final ExecutionDataStore dataStore = new ExecutionDataStore();
loadSourceFiles(infoStore, dataStore);
OutputStream outputStream = null;
try {
outputStream = new BufferedOutputStream(new FileOutputStream(
destfile));
final ExecutionDataWriter dataWriter = new ExecutionDataWriter(
outputStream);
infoStore.accept(dataWriter);
dataStore.accept(dataWriter);
} finally {
if (outputStream != null) {
outputStream.close();
}
}
}
开发者ID:GITNE,项目名称:icedtea-web,代码行数:27,代码来源:MergeTask.java
示例3: loadSourceFiles
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
private void loadSourceFiles(final SessionInfoStore infoStore, final ExecutionDataStore dataStore) throws IOException {
if (files == null || files.isEmpty()) {
throw new RuntimeException("No input files");
}
final Iterator<?> resourceIterator = files.iterator();
while (resourceIterator.hasNext()) {
final File resource = (File) resourceIterator.next();
if (resource.isDirectory()) {
continue;
}
InputStream resourceStream = null;
try {
resourceStream = new FileInputStream(resource);
final ExecutionDataReader reader = new ExecutionDataReader(
resourceStream);
reader.setSessionInfoVisitor(infoStore);
reader.setExecutionDataVisitor(dataStore);
reader.read();
} finally {
if (resourceStream != null) {
resourceStream.close();
}
}
}
}
开发者ID:GITNE,项目名称:icedtea-web,代码行数:27,代码来源:MergeTask.java
示例4: loadExecutionData
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
private void loadExecutionData() throws IOException {
final FileInputStream fis = new FileInputStream(executionDataFile);
try {
final ExecutionDataReader executionDataReader = new ExecutionDataReader(
fis);
executionDataStore = new ExecutionDataStore();
sessionInfoStore = new SessionInfoStore();
executionDataReader.setExecutionDataVisitor(executionDataStore);
executionDataReader.setSessionInfoVisitor(sessionInfoStore);
while (executionDataReader.read()) {
}
} finally {
if (fis != null) {
fis.close();
}
}
}
开发者ID:GITNE,项目名称:icedtea-web,代码行数:20,代码来源:ReportGenerator.java
示例5: testAccept
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
@Test
public void testAccept() throws Exception {
SessionInfo info = new SessionInfo("id1", 1, 2);
source.visitSessionInfo(info);
source.visitClassExecution(new ExecutionData(123, "MyClass", new boolean[] {
true, false }));
SessionInfoStore sessionStore = new SessionInfoStore();
ExecutionDataStore execStore = new ExecutionDataStore();
source.accept(execStore, sessionStore);
assertEquals(Collections.singletonList(info), sessionStore.getInfos());
assertEquals("MyClass", execStore.get(123).getName());
}
开发者ID:eclipse,项目名称:eclemma,代码行数:15,代码来源:MemoryExecutionDataSourceTest.java
示例6: testReadFrom
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
@Test
public void testReadFrom() throws Exception {
ExecutionDataReader reader = new ExecutionDataReader(
new ByteArrayInputStream(createSessionData()));
source.readFrom(reader);
SessionInfoStore sessionStore = new SessionInfoStore();
ExecutionDataStore execStore = new ExecutionDataStore();
source.accept(execStore, sessionStore);
assertEquals(1, sessionStore.getInfos().size());
assertEquals("MyClass", execStore.get(123).getName());
}
开发者ID:eclipse,项目名称:eclemma,代码行数:14,代码来源:MemoryExecutionDataSourceTest.java
示例7: testReadExecutionData
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
@Test
public void testReadExecutionData() throws IOException, CoreException {
final CoverageSession session = new CoverageSession("Description",
Arrays.asList(root1), source(), configuration);
SessionInfoStore sessionStore = new SessionInfoStore();
ExecutionDataStore execStore = new ExecutionDataStore();
session.accept(execStore, sessionStore);
assertEquals(1, sessionStore.getInfos().size());
assertEquals("MyClass", execStore.get(123).getName());
}
开发者ID:eclipse,项目名称:eclemma,代码行数:13,代码来源:CoverageSessionTest.java
示例8: testAccept
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
@Test
public void testAccept() throws IOException, CoreException {
final IExecutionDataSource source = createValidSource();
SessionInfoStore sessionStore = new SessionInfoStore();
ExecutionDataStore execStore = new ExecutionDataStore();
source.accept(execStore, sessionStore);
assertEquals(1, sessionStore.getInfos().size());
assertEquals("MyClass", execStore.get(123).getName());
}
开发者ID:eclipse,项目名称:eclemma,代码行数:12,代码来源:URLExecutionDataSourceTest.java
示例9: testAcceptWithError
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
@Test
public void testAcceptWithError() throws IOException, CoreException {
exception.expect(CoreException.class);
exception.expectMessage("Error while reading execution data file");
final IExecutionDataSource source = creatInvalidSource();
SessionInfoStore sessionStore = new SessionInfoStore();
ExecutionDataStore execStore = new ExecutionDataStore();
source.accept(execStore, sessionStore);
}
开发者ID:eclipse,项目名称:eclemma,代码行数:12,代码来源:URLExecutionDataSourceTest.java
示例10: processSession
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
public IJavaModelCoverage processSession(ICoverageSession session,
IProgressMonitor monitor) throws CoreException {
PERFORMANCE.startTimer();
PERFORMANCE.startMemoryUsage();
modelcoverage = new JavaModelCoverage();
final Collection<IPackageFragmentRoot> roots = session.getScope();
monitor.beginTask(
NLS.bind(CoreMessages.AnalyzingCoverageSession_task,
session.getDescription()), 1 + roots.size());
executiondatastore = new ExecutionDataStore();
sessioninfostore = new SessionInfoStore();
session.accept(executiondatastore, sessioninfostore);
monitor.worked(1);
final PackageFragementRootAnalyzer analyzer = new PackageFragementRootAnalyzer(
executiondatastore);
for (final IPackageFragmentRoot root : roots) {
if (monitor.isCanceled()) {
break;
}
processPackageFragmentRoot(root, analyzer, new SubProgressMonitor(
monitor, 1));
}
monitor.done();
PERFORMANCE.stopTimer("loading " + session.getDescription()); //$NON-NLS-1$
PERFORMANCE.stopMemoryUsage("loading " + session.getDescription()); //$NON-NLS-1$
return modelcoverage;
}
开发者ID:eclipse,项目名称:eclemma,代码行数:30,代码来源:SessionAnalyzer.java
示例11: testStarted
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
@Override
public void testStarted(Description description) throws Exception {
this.executionData = new ExecutionDataStore();
this.sessionInfos = new SessionInfoStore();
data.setSessionId(description.getMethodName());
data.collect(executionData, sessionInfos, true);
}
开发者ID:STAMP-project,项目名称:dspot,代码行数:8,代码来源:JacocoListener.java
示例12: loadExecutionData
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
private void loadExecutionData() throws IOException {
final FileInputStream fis = new FileInputStream(executionDataFile);
final ExecutionDataReader executionDataReader = new ExecutionDataReader(
fis);
executionDataStore = new ExecutionDataStore();
sessionInfoStore = new SessionInfoStore();
executionDataReader.setExecutionDataVisitor(executionDataStore);
executionDataReader.setSessionInfoVisitor(sessionInfoStore);
while (executionDataReader.read()) {}
fis.close();
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:14,代码来源:CoverageReport.java
示例13: toHtmlReport
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
/**
* Load a JaCoCo binary report and convert it to HTML.
* <br/>See <a href="http://www.eclemma.org/jacoco/trunk/doc/examples/java/ReportGenerator.java">report generator example code</a>.
*
* @param jacocoexec the JaCoCo binary report.
* @param reportdir the folder to store HTML report.
* @param prjClassesDir the directory containing project's compiled classes.
* @param prjSourcesDir the directory containing project's Java source files.
* @param projectName the project's name.
* @return the absolute path of HTML report's {@code index.html} file.
* @throws FileNotFoundException if the JaCoCo binary report, compiled classes or Java sources files directory can't be found.
* @throws IOException if an I/O error occurs.
*/
public static String toHtmlReport(File jacocoexec, File reportdir, File prjClassesDir, File prjSourcesDir, String projectName)
throws FileNotFoundException,
IOException {
// Load the JaCoCo binary report.
FileInputStream fis = new FileInputStream(jacocoexec);
ExecutionDataStore executionDataStore = new ExecutionDataStore();
SessionInfoStore sessionInfoStore = new SessionInfoStore();
try {
ExecutionDataReader executionDataReader = new ExecutionDataReader(fis);
executionDataReader.setExecutionDataVisitor(executionDataStore);
executionDataReader.setSessionInfoVisitor(sessionInfoStore);
while (executionDataReader.read()) {
}
} finally {
fis.close();
}
// Convert the binary report to HTML.
CoverageBuilder coverageBuilder = new CoverageBuilder();
Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
analyzer.analyzeAll(prjClassesDir);
IBundleCoverage bundleCoverage = coverageBuilder.getBundle("JaCoCoverage analysis of project \"" + projectName
+ "\" (powered by JaCoCo from EclEmma)");
HTMLFormatter htmlformatter = new HTMLFormatter();
IReportVisitor visitor = htmlformatter.createVisitor(new FileMultiReportOutput(reportdir));
visitor.visitInfo(sessionInfoStore.getInfos(), executionDataStore.getContents());
visitor.visitBundle(bundleCoverage, new DirectorySourceFileLocator(prjSourcesDir, DEF_ENCODING, 4));
visitor.visitEnd();
return new File(reportdir, "index.html").getAbsolutePath();
}
开发者ID:jonathanlermitage,项目名称:tikione-jacocoverage,代码行数:44,代码来源:JaCoCoReportAnalyzer.java
示例14: toXmlReport
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
/**
* Load a JaCoCo binary report and convert it to XML.
* <br/>See <a href="http://www.eclemma.org/jacoco/trunk/doc/examples/java/ReportGenerator.java">report generator example code</a>.
*
* @param jacocoexec the JaCoCo binary report.
* @param xmlreport the XML file to generate.
* @param prjClassesDir the directory containing project's compiled classes.
* @param prjSourcesDir the directory containing project's Java source files.
* @throws FileNotFoundException if the JaCoCo binary report, compiled classes or Java sources files directory can't be found.
* @throws IOException if an I/O error occurs.
*/
public static void toXmlReport(File jacocoexec, File xmlreport, File prjClassesDir, File prjSourcesDir)
throws FileNotFoundException,
IOException {
// Load the JaCoCo binary report.
FileInputStream fis = new FileInputStream(jacocoexec);
ExecutionDataStore executionDataStore = new ExecutionDataStore();
SessionInfoStore sessionInfoStore = new SessionInfoStore();
try {
ExecutionDataReader executionDataReader = new ExecutionDataReader(fis);
executionDataReader.setExecutionDataVisitor(executionDataStore);
executionDataReader.setSessionInfoVisitor(sessionInfoStore);
while (executionDataReader.read()) {
}
} finally {
fis.close();
}
// Convert the binary report to XML.
CoverageBuilder coverageBuilder = new CoverageBuilder();
Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
analyzer.analyzeAll(prjClassesDir);
IBundleCoverage bundleCoverage = coverageBuilder.getBundle("JaCoCoverage analysis (powered by JaCoCo from EclEmma)");
XMLFormatter xmlformatter = new XMLFormatter();
xmlformatter.setOutputEncoding(DEF_ENCODING);
IReportVisitor visitor = xmlformatter.createVisitor(new FileOutputStream(xmlreport));
visitor.visitInfo(sessionInfoStore.getInfos(), executionDataStore.getContents());
visitor.visitBundle(bundleCoverage, new DirectorySourceFileLocator(prjSourcesDir, DEF_ENCODING, 4));
visitor.visitEnd();
}
开发者ID:jonathanlermitage,项目名称:tikione-jacocoverage,代码行数:41,代码来源:JaCoCoReportAnalyzer.java
示例15: clear
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
private void clear() {
executionData = new ExecutionDataStore();
sessionData = new SessionInfoStore();
}
开发者ID:eclipse,项目名称:eclemma,代码行数:5,代码来源:ExecutionDataContent.java
示例16: MemoryExecutionDataSource
import org.jacoco.core.data.SessionInfoStore; //导入依赖的package包/类
public MemoryExecutionDataSource() {
sessionInfoStore = new SessionInfoStore();
executionDataStore = new ExecutionDataStore();
}
开发者ID:eclipse,项目名称:eclemma,代码行数:5,代码来源:MemoryExecutionDataSource.java
注:本文中的org.jacoco.core.data.SessionInfoStore类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论