Search in sources :

Example 1 with RTSLogFileReader

use of de.dagere.peass.ci.logs.RTSLogFileReader 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 2 with RTSLogFileReader

use of de.dagere.peass.ci.logs.RTSLogFileReader in project peass-ci-plugin by jenkinsci.

the class TestRTSLogFileReader method testReading.

@Test
public void testReading() throws JsonParseException, JsonMappingException, IOException {
    RTSLogFileReader reader = util.initializeReader();
    Map<String, File> testcases = reader.findProcessSuccessRuns();
    Assert.assertEquals(1, testcases.size());
    File testRunningFile = testcases.get("a23e385264c31def8dcda86c3cf64faa698c62d8");
    Assert.assertTrue(testRunningFile.exists());
    Assert.assertTrue(reader.isLogsExisting());
    Map<TestCase, RTSLogData> rtsVmRuns = reader.getRtsVmRuns("a23e385264c31def8dcda86c3cf64faa698c62d8");
    Assert.assertEquals(2, rtsVmRuns.size());
    checkFirstTest(rtsVmRuns);
    checkSecondTest(reader);
    String rtsLog = reader.getRTSLog();
    Assert.assertEquals("This is a rts log test", rtsLog);
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) RTSLogData(de.dagere.peass.ci.logs.rts.RTSLogData) RTSLogFileReader(de.dagere.peass.ci.logs.RTSLogFileReader) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 3 with RTSLogFileReader

use of de.dagere.peass.ci.logs.RTSLogFileReader in project peass-ci-plugin by jenkinsci.

the class TestRTSLogFileReaderMultimodule method testReading.

@Test
public void testReading() throws JsonParseException, JsonMappingException, IOException {
    RTSLogFileReader reader = util.initializeReader();
    Map<String, File> testcases = reader.findProcessSuccessRuns();
    Assert.assertEquals(1, testcases.size());
    File testRunningFile = testcases.get(RTSLogFileTestUtil.VERSION);
    Assert.assertTrue(testRunningFile.exists());
    Assert.assertTrue(reader.isLogsExisting());
    Map<TestCase, RTSLogData> rtsVmRuns = reader.getRtsVmRuns(RTSLogFileTestUtil.VERSION);
    Assert.assertEquals(2, rtsVmRuns.size());
    File dataFile1 = rtsVmRuns.get(TestRTSLogFileReader.TEST1).getMethodFile();
    Assert.assertTrue(dataFile1.exists());
    RTSLogData logDataTest2 = rtsVmRuns.get(TestRTSLogFileReader.TEST2);
    File dataFile2 = logDataTest2.getMethodFile();
    Assert.assertTrue(dataFile2.exists());
    Assert.assertFalse(logDataTest2.isSuccess());
    Map<TestCase, RTSLogData> rtsVmRunsPredecessor = reader.getRtsVmRuns(RTSLogFileTestUtil.VERSION_OLD);
    Assert.assertEquals(2, rtsVmRunsPredecessor.size());
    RTSLogData rtsLogData = rtsVmRunsPredecessor.get(TestRTSLogFileReader.TEST1);
    Assert.assertEquals(RTSLogFileTestUtil.VERSION_OLD, rtsLogData.getVersion());
    Assert.assertTrue(rtsLogData.isSuccess());
    String rtsLog = reader.getRTSLog();
    Assert.assertEquals("This is a rts log test", rtsLog);
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) RTSLogData(de.dagere.peass.ci.logs.rts.RTSLogData) RTSLogFileReader(de.dagere.peass.ci.logs.RTSLogFileReader) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 4 with RTSLogFileReader

use of de.dagere.peass.ci.logs.RTSLogFileReader in project peass-ci-plugin by jenkinsci.

the class TestRTSLogFileReaderParameterized method testParameterizedReading.

@Test
public void testParameterizedReading() {
    VisualizationFolderManager visualizationFoldersMock = Mockito.mock(VisualizationFolderManager.class);
    Mockito.when(visualizationFoldersMock.getResultsFolders()).thenReturn(new ResultsFolders(currentDir, "parameterized-demo"));
    Mockito.when(visualizationFoldersMock.getPeassFolders()).thenReturn(new PeassFolders(new File(currentDir, "parameterized-demo_peass")));
    MeasurementConfig measurementConfig = Mockito.mock(MeasurementConfig.class);
    ExecutionConfig executionConfig = new ExecutionConfig();
    executionConfig.setVersion(VERSION);
    executionConfig.setVersionOld(VERSION_OLD);
    Mockito.when(measurementConfig.getExecutionConfig()).thenReturn(executionConfig);
    RTSLogFileReader reader = new RTSLogFileReader(visualizationFoldersMock, measurementConfig);
    Map<TestCase, RTSLogData> rtsVmRuns = reader.getRtsVmRuns(VERSION);
    RTSLogData data = rtsVmRuns.get(new TestCase("de.dagere.peass.ExampleTest", "test", "", "JUNIT_PARAMETERIZED-1"));
    Assert.assertNotNull(data);
    Assert.assertFalse(data.isParameterizedWithoutIndex());
    Assert.assertTrue(data.isSuccess());
    Map<TestCase, RTSLogData> rtsVmRunsPredecessor = reader.getRtsVmRuns(VERSION_OLD);
    RTSLogData dataImplicitParameterized = rtsVmRunsPredecessor.get(new TestCase("de.dagere.peass.ExampleTest", "test", ""));
    Assert.assertNotNull(dataImplicitParameterized);
    Assert.assertTrue(dataImplicitParameterized.isParameterizedWithoutIndex());
    Assert.assertFalse(dataImplicitParameterized.isSuccess());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) RTSLogData(de.dagere.peass.ci.logs.rts.RTSLogData) RTSLogFileReader(de.dagere.peass.ci.logs.RTSLogFileReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) 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)

Example 5 with RTSLogFileReader

use of de.dagere.peass.ci.logs.RTSLogFileReader in project peass-ci-plugin by jenkinsci.

the class TestRTSLogFileReader method testReadingOnlyOverviewExists.

@Test
public void testReadingOnlyOverviewExists() throws IOException {
    FileUtils.deleteDirectory(RTSLogFileTestUtil.testFolder);
    RTSLogFileReader reader = util.initializeReader();
    Assert.assertTrue(reader.isLogsExisting());
}
Also used : RTSLogFileReader(de.dagere.peass.ci.logs.RTSLogFileReader) Test(org.junit.jupiter.api.Test)

Aggregations

RTSLogFileReader (de.dagere.peass.ci.logs.RTSLogFileReader)5 Test (org.junit.jupiter.api.Test)4 RTSLogData (de.dagere.peass.ci.logs.rts.RTSLogData)3 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)3 File (java.io.File)3 VisualizationFolderManager (de.dagere.peass.ci.helper.VisualizationFolderManager)2 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)2 PeassFolders (de.dagere.peass.folders.PeassFolders)2 ResultsFolders (de.dagere.peass.folders.ResultsFolders)2 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)1