Search in sources :

Example 1 with RCALevel

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);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) LogFileReader(de.dagere.peass.ci.logs.LogFileReader) List(java.util.List) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PeassFolders(de.dagere.peass.folders.PeassFolders) RCALevel(de.dagere.peass.ci.logs.rca.RCALevel) Test(org.junit.jupiter.api.Test)

Example 2 with RCALevel

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);
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) CauseSearchData(de.dagere.peass.measurement.rca.data.CauseSearchData) File(java.io.File) LinkedList(java.util.LinkedList) RCALevel(de.dagere.peass.ci.logs.rca.RCALevel)

Example 3 with RCALevel

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);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) LogFileReader(de.dagere.peass.ci.logs.LogFileReader) List(java.util.List) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PeassFolders(de.dagere.peass.folders.PeassFolders) RCALevel(de.dagere.peass.ci.logs.rca.RCALevel) Test(org.junit.jupiter.api.Test)

Aggregations

RCALevel (de.dagere.peass.ci.logs.rca.RCALevel)3 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)3 VisualizationFolderManager (de.dagere.peass.ci.helper.VisualizationFolderManager)2 LogFileReader (de.dagere.peass.ci.logs.LogFileReader)2 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)2 CauseSearchFolders (de.dagere.peass.folders.CauseSearchFolders)2 PeassFolders (de.dagere.peass.folders.PeassFolders)2 ResultsFolders (de.dagere.peass.folders.ResultsFolders)2 List (java.util.List)2 Test (org.junit.jupiter.api.Test)2 CauseSearchData (de.dagere.peass.measurement.rca.data.CauseSearchData)1 File (java.io.File)1 LinkedList (java.util.LinkedList)1