Search in sources :

Example 1 with LogFiles

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++;
        }
    }
}
Also used : InternalLogAction(de.dagere.peass.ci.logs.InternalLogAction) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) LogFiles(de.dagere.peass.ci.logs.LogFiles) List(java.util.List) Map(java.util.Map)

Example 2 with LogFiles

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++;
    }
}
Also used : LogFiles(de.dagere.peass.ci.logs.LogFiles)

Example 3 with LogFiles

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);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) LogFiles(de.dagere.peass.ci.logs.LogFiles) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) PeassFolders(de.dagere.peass.folders.PeassFolders) 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) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 4 with LogFiles

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

Aggregations

LogFiles (de.dagere.peass.ci.logs.LogFiles)4 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)3 List (java.util.List)3 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)2 VisualizationFolderManager (de.dagere.peass.ci.helper.VisualizationFolderManager)2 LogFileReader (de.dagere.peass.ci.logs.LogFileReader)2 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)2 PeassFolders (de.dagere.peass.folders.PeassFolders)2 ResultsFolders (de.dagere.peass.folders.ResultsFolders)2 File (java.io.File)2 Test (org.junit.jupiter.api.Test)2 InternalLogAction (de.dagere.peass.ci.logs.InternalLogAction)1 Map (java.util.Map)1