use of org.jacoco.core.data.SessionInfoStore in project jacoco by jacoco.
the class TcpConnectionTest method readAndAssertData.
private void readAndAssertData() throws IOException {
final RemoteControlReader remoteReader = new RemoteControlReader(mockConnection.getSocketB().getInputStream());
final ExecutionDataStore execStore = new ExecutionDataStore();
remoteReader.setExecutionDataVisitor(execStore);
final SessionInfoStore infoStore = new SessionInfoStore();
remoteReader.setSessionInfoVisitor(infoStore);
assertTrue(remoteReader.read());
final List<SessionInfo> infos = infoStore.getInfos();
assertEquals(1, infos.size());
assertEquals("stubid", infos.get(0).getId());
assertEquals("Foo", execStore.get(0x12345678).getName());
}
use of org.jacoco.core.data.SessionInfoStore in project jacoco by jacoco.
the class TcpConnectionTest method testRemoteReset.
@Test
public void testRemoteReset() throws Exception {
data.getExecutionData(Long.valueOf(123), "Foo", 1).getProbes()[0] = true;
final RemoteControlWriter remoteWriter = new RemoteControlWriter(mockConnection.getSocketB().getOutputStream());
final TcpConnection con = new TcpConnection(mockConnection.getSocketA(), data);
con.init();
final Future<Void> f = executor.submit(new Callable<Void>() {
public Void call() throws Exception {
con.run();
return null;
}
});
assertBlocks(f);
remoteWriter.visitDumpCommand(false, true);
final RemoteControlReader remoteReader = new RemoteControlReader(mockConnection.getSocketB().getInputStream());
final ExecutionDataStore execStore = new ExecutionDataStore();
remoteReader.setExecutionDataVisitor(execStore);
final SessionInfoStore infoStore = new SessionInfoStore();
remoteReader.setSessionInfoVisitor(infoStore);
assertTrue(remoteReader.read());
assertTrue(infoStore.getInfos().isEmpty());
assertTrue(execStore.getContents().isEmpty());
assertFalse(data.getExecutionData(Long.valueOf(123), "Foo", 1).getProbes()[0]);
con.close();
f.get();
}
use of org.jacoco.core.data.SessionInfoStore in project jacoco by jacoco.
the class ExecFileLoaderTest method assertFileContents.
private void assertFileContents(File file, String... expected) throws IOException {
final InputStream in = new FileInputStream(file);
final ExecutionDataStore execStore = new ExecutionDataStore();
final SessionInfoStore sessionStore = new SessionInfoStore();
final ExecutionDataReader reader = new ExecutionDataReader(in);
reader.setExecutionDataVisitor(execStore);
reader.setSessionInfoVisitor(sessionStore);
reader.read();
assertContents(execStore, sessionStore, expected);
}
use of org.jacoco.core.data.SessionInfoStore in project jacoco by jacoco.
the class InstrumentingLoader method collect.
public ExecutionDataStore collect() {
final ExecutionDataStore store = new ExecutionDataStore();
data.collect(store, new SessionInfoStore(), false);
runtime.shutdown();
return store;
}
use of org.jacoco.core.data.SessionInfoStore in project jacoco by jacoco.
the class CyclomaticComplexityTest method analyze.
private ICounter analyze() throws IOException {
final CoverageBuilder builder = new CoverageBuilder();
final ExecutionDataStore store = new ExecutionDataStore();
data.collect(store, new SessionInfoStore(), false);
final Analyzer analyzer = new Analyzer(store, builder);
analyzer.analyzeClass(bytes, "TestTarget");
final Collection<IClassCoverage> classes = builder.getClasses();
assertEquals(1, classes.size(), 0.0);
final IClassCoverage classCoverage = classes.iterator().next();
for (final IMethodCoverage m : classCoverage.getMethods()) {
if (m.getName().equals("test")) {
return m.getComplexityCounter();
}
}
throw new AssertionError("No test() method.");
}
Aggregations