use of de.dagere.peass.ci.logs.LogFiles in project peass-ci-plugin by jenkinsci.
the class MeasurementActionCreator method createLogActions.
private void createLogActions(final Run<?, ?> run, final Map<TestCase, List<LogFiles>> logFiles) throws IOException {
for (Map.Entry<TestCase, List<LogFiles>> entry : logFiles.entrySet()) {
LOG.debug("Creating {} log actions for {}", entry.getValue().size(), entry.getKey());
TestCase testcase = entry.getKey();
int vmId = 0;
for (LogFiles files : entry.getValue()) {
String logData = FileUtils.readFileToString(files.getCurrent(), StandardCharsets.UTF_8);
run.addAction(new LogAction(testcase, vmId, measurementConfig.getExecutionConfig().getVersion(), logData));
String logDataOld = FileUtils.readFileToString(files.getPredecessor(), StandardCharsets.UTF_8);
run.addAction(new LogAction(testcase, vmId, measurementConfig.getExecutionConfig().getVersionOld(), logDataOld));
vmId++;
}
}
}
use of de.dagere.peass.ci.logs.LogFiles in project peass-ci-plugin by jenkinsci.
the class RCAActionCreator method createLevelLogAction.
private void createLevelLogAction(final Map.Entry<TestCase, List<RCALevel>> testcase, final int levelId, final RCALevel level) throws IOException {
int vmId = 0;
for (LogFiles files : level.getLogFiles()) {
createVMLogActions(testcase, levelId, vmId, files);
vmId++;
}
}
use of de.dagere.peass.ci.logs.LogFiles in project peass-ci-plugin by jenkinsci.
the class TestLogFileReader method testReading.
@Test
public void testReading() throws JsonParseException, JsonMappingException, IOException {
MeasurementConfig peassDemoConfig = new MeasurementConfig(2, VERSION, VERSION_OLD);
VisualizationFolderManager visualizationFolders = Mockito.mock(VisualizationFolderManager.class);
Mockito.when(visualizationFolders.getPeassFolders()).thenReturn(new PeassFolders(testFolder));
Mockito.when(visualizationFolders.getResultsFolders()).thenReturn(new ResultsFolders(localFolder, "demo-vis2"));
LogFileReader reader = new LogFileReader(visualizationFolders, peassDemoConfig);
ProjectStatistics statistics = Constants.OBJECTMAPPER.readValue(new File("src/test/resources/demo-results-logs/statistics.json"), ProjectStatistics.class);
Map<TestCase, List<LogFiles>> testcases = reader.readAllTestcases(statistics.getStatistics().get(VERSION).keySet());
Assert.assertEquals(1, testcases.size());
TestCase test = new TestCase("de.test.CalleeTest#onlyCallMethod2");
List<LogFiles> logFiles = testcases.get(test);
Assert.assertEquals(2, logFiles.size());
String measureLog = reader.getMeasureLog();
Assert.assertEquals("This is a measurement log test", measureLog);
}
use of de.dagere.peass.ci.logs.LogFiles in project peass-ci-plugin by jenkinsci.
the class TestLogFileReader method testReadingIterationChanged.
@Test
public void testReadingIterationChanged() throws JsonParseException, JsonMappingException, IOException {
MeasurementConfig peassDemoConfig = new MeasurementConfig(2, VERSION, VERSION_OLD);
VisualizationFolderManager visualizationFolders = Mockito.mock(VisualizationFolderManager.class);
Mockito.when(visualizationFolders.getPeassFolders()).thenReturn(new PeassFolders(testFolder));
Mockito.when(visualizationFolders.getResultsFolders()).thenReturn(new ResultsFolders(localFolder, "demo-vis2"));
LogFileReader reader = new LogFileReader(visualizationFolders, peassDemoConfig);
ProjectStatistics statistics = Constants.OBJECTMAPPER.readValue(new File("src/test/resources/demo-results-logs/statistics.json"), ProjectStatistics.class);
Map<TestCase, List<LogFiles>> testcases = reader.readAllTestcases(statistics.getStatistics().get(VERSION).keySet());
Assert.assertEquals(1, testcases.size());
TestCase test = new TestCase("de.test.CalleeTest#onlyCallMethod2");
List<LogFiles> logFiles = testcases.get(test);
Assert.assertEquals(2, logFiles.size());
Assert.assertFalse(logFiles.get(0).isCurrentSuccess());
Assert.assertTrue(logFiles.get(0).isPredecessorSuccess());
Assert.assertTrue(logFiles.get(1).isCurrentSuccess());
Assert.assertTrue(logFiles.get(1).isPredecessorSuccess());
}
Aggregations