Search in sources :

Example 11 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders in project peass-ci-plugin by jenkinsci.

the class RTSLogFileTestUtil method initializeReader.

RTSLogFileReader initializeReader() {
    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, projectName));
    RTSLogFileReader reader = new RTSLogFileReader(visualizationFolders, peassDemoConfig);
    return reader;
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) RTSLogFileReader(de.dagere.peass.ci.logs.RTSLogFileReader) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PeassFolders(de.dagere.peass.folders.PeassFolders)

Example 12 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders 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 13 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders in project peass-ci-plugin by jenkinsci.

the class TestRCALogFileReaderMultimodule method init.

@BeforeEach
public void init() throws IOException {
    File source = new File("src/test/resources/demo-results-logs/demo-vis2-multimodule_peass");
    if (localFolder.exists()) {
        FileUtils.deleteDirectory(localFolder);
    }
    if (!localFolder.exists()) {
        localFolder.mkdirs();
    }
    FileUtils.copyDirectory(source, testFolder);
    ResultsFolders folders = new ResultsFolders(localFolder, "demo-vis2");
    File rcaLogFile = folders.getRCALogFile(RTSLogFileTestUtil.VERSION, RTSLogFileTestUtil.VERSION_OLD);
    FileUtils.write(rcaLogFile, "This is a rca log test", StandardCharsets.UTF_8);
}
Also used : ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 14 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders in project peass-ci-plugin by jenkinsci.

the class CleanMeasurementCallable method invoke.

@Override
public Boolean invoke(final File potentialSlaveWorkspace, final VirtualChannel channel) {
    try (final JenkinsLogRedirector redirector = new JenkinsLogRedirector(listener)) {
        String projectName = potentialSlaveWorkspace.getName();
        File folder = new File(potentialSlaveWorkspace.getParentFile(), projectName + "_fullPeass");
        ResultsFolders resultsFolders = new ResultsFolders(folder, projectName);
        deleteAllMeasurementData(projectName, folder, resultsFolders);
        return true;
    } catch (IOException e) {
        listener.getLogger().println("Exception thrown");
        e.printStackTrace(listener.getLogger());
        e.printStackTrace();
        return false;
    }
}
Also used : JenkinsLogRedirector(de.dagere.peass.ci.process.JenkinsLogRedirector) IOException(java.io.IOException) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File)

Example 15 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders in project peass-ci-plugin by jenkinsci.

the class CleanRCACallable method cleanFolder.

public static void cleanFolder(final String projectName, final File folder) throws IOException {
    System.out.println("Trying " + folder + " " + projectName);
    ResultsFolders resultsFolders = new ResultsFolders(folder, projectName);
    File visualizationFolder = new File(folder, VisualizationFolderManager.VISUALIZATION_FOLDER_NAME);
    if (visualizationFolder.exists()) {
        System.out.println("Deleting " + visualizationFolder);
        FileUtils.deleteDirectory(visualizationFolder);
    }
    deleteRCALogFolder(resultsFolders);
}
Also used : ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File)

Aggregations

ResultsFolders (de.dagere.peass.folders.ResultsFolders)36 File (java.io.File)30 Test (org.junit.jupiter.api.Test)14 PeassFolders (de.dagere.peass.folders.PeassFolders)13 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)9 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)8 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)7 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)7 VisualizationFolderManager (de.dagere.peass.ci.helper.VisualizationFolderManager)6 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)6 KiekerConfig (de.dagere.peass.config.KiekerConfig)5 TestSelectionConfig (de.dagere.peass.config.TestSelectionConfig)5 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)5 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)5 LogFileReader (de.dagere.peass.ci.logs.LogFileReader)4 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)4 IOException (java.io.IOException)4 List (java.util.List)4 PropertyReader (de.dagere.peass.analysis.properties.PropertyReader)3 VersionKeeper (de.dagere.peass.dependency.reader.VersionKeeper)3