use of de.dagere.peass.ci.logs.rca.RCALevel in project peass-ci-plugin by jenkinsci.
the class TestRCALogFileReaderMultimodule method testReading.
@Test
public void testReading() throws JsonParseException, JsonMappingException, IOException {
MeasurementConfig peassDemoConfig = new MeasurementConfig(2, RTSLogFileTestUtil.VERSION, RTSLogFileTestUtil.VERSION_OLD);
VisualizationFolderManager visualizationFolders = Mockito.mock(VisualizationFolderManager.class);
Mockito.when(visualizationFolders.getPeassFolders()).thenReturn(new PeassFolders(testFolder));
Mockito.when(visualizationFolders.getPeassRCAFolders()).thenReturn(new CauseSearchFolders(testFolder));
Mockito.when(visualizationFolders.getResultsFolders()).thenReturn(new ResultsFolders(localFolder, "demo-vis2"));
LogFileReader reader = new LogFileReader(visualizationFolders, peassDemoConfig);
Map<TestCase, List<RCALevel>> rcaTestcases = reader.getRCATestcases();
List<RCALevel> levels = rcaTestcases.get(test);
Assert.assertEquals(1, levels.size());
MatcherAssert.assertThat(levels.get(0).getLogFiles(), Matchers.hasSize(3));
String rtsLog = reader.getRCALog();
Assert.assertEquals("This is a rca log test", rtsLog);
}
use of de.dagere.peass.ci.logs.rca.RCALevel in project peass-ci-plugin by jenkinsci.
the class LogFileReader method readRCATestcase.
private void readRCATestcase(final CauseSearchFolders causeFolders, final Map<TestCase, List<RCALevel>> testcases, final File jsonFileName) throws IOException, JsonParseException, JsonMappingException {
CauseSearchData data = Constants.OBJECTMAPPER.readValue(jsonFileName, CauseSearchData.class);
TestCase test = data.getCauseConfig().getTestCase();
boolean lastHadLogs = true;
int levelId = 0;
List<RCALevel> levels = new LinkedList<>();
while (lastHadLogs) {
File logFolder = causeFolders.getExistingRCALogFolder(measurementConfig.getExecutionConfig().getVersion(), test, levelId);
List<LogFiles> currentFiles = tryLocalLogFolderVMIds(test, logFolder, causeFolders);
if (currentFiles.size() > 0) {
RCALevel level = new RCALevel(currentFiles);
levels.add(level);
levelId++;
} else {
lastHadLogs = false;
}
}
testcases.put(test, levels);
}
use of de.dagere.peass.ci.logs.rca.RCALevel in project peass-ci-plugin by jenkinsci.
the class TestRCALogFileReader method testReading.
@Test
public void testReading() throws JsonParseException, JsonMappingException, IOException {
MeasurementConfig peassDemoConfig = new MeasurementConfig(2, RTSLogFileTestUtil.VERSION, RTSLogFileTestUtil.VERSION_OLD);
VisualizationFolderManager visualizationFolders = Mockito.mock(VisualizationFolderManager.class);
Mockito.when(visualizationFolders.getPeassFolders()).thenReturn(new PeassFolders(testFolder));
Mockito.when(visualizationFolders.getPeassRCAFolders()).thenReturn(new CauseSearchFolders(testFolder));
Mockito.when(visualizationFolders.getResultsFolders()).thenReturn(new ResultsFolders(localFolder, "demo-vis2"));
LogFileReader reader = new LogFileReader(visualizationFolders, peassDemoConfig);
TestCase test = new TestCase("de.test.CalleeTest#onlyCallMethod2");
Map<TestCase, List<RCALevel>> rcaTestcases = reader.getRCATestcases();
List<RCALevel> levels = rcaTestcases.get(test);
Assert.assertEquals(1, levels.size());
MatcherAssert.assertThat(levels.get(0).getLogFiles(), Matchers.hasSize(3));
String rtsLog = reader.getRCALog();
Assert.assertEquals("This is a rca log test", rtsLog);
}
Aggregations