Search in sources :

Example 21 with KiekerConfig

use of de.dagere.peass.config.KiekerConfig in project peass by DaGeRe.

the class DependencyDetectorMultimoduleIT method testNormalChange.

// This test is disabled since it takes too long and nearly tests the same as testTwoChanges; however, since it enables easier debugging, it is left in the code
@Disabled
@Test
public void testNormalChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException {
    final File secondVersion = new File(VERSIONS_FOLDER, "normal_change");
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(secondVersion));
    final Map<ChangedEntity, ClazzChangeData> changes = DependencyDetectorTestUtil.buildChanges("base-module", "de.dagere.base.BaseChangeable", "doSomething");
    ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    final DependencyReader reader = new DependencyReader(DependencyTestConstants.DEFAULT_CONFIG_NO_VIEWS, new PeassFolders(DependencyTestConstants.CURRENT), DependencyTestConstants.NULL_RESULTS_FOLDERS, null, fakeIterator, changeManager, new ExecutionConfig(5), new KiekerConfig(true), new EnvironmentVariables());
    final boolean success = reader.readInitialVersion();
    Assert.assertTrue(success);
    StaticTestSelection dependencies = reader.getDependencies();
    checkInitialVersion(dependencies);
    fakeIterator.goToNextCommit();
    reader.analyseVersion(changeManager);
    testFirstChange(dependencies);
}
Also used : FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) PeassFolders(de.dagere.peass.folders.PeassFolders) ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) VersionIterator(de.dagere.peass.vcs.VersionIterator) File(java.io.File) KiekerConfig(de.dagere.peass.config.KiekerConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 22 with KiekerConfig

use of de.dagere.peass.config.KiekerConfig in project peass by DaGeRe.

the class DependencyDetectorOneCallWriterIT method readTwoVersions.

public static DependencyReader readTwoVersions(final ChangeManager changeManager, final VersionIterator fakeIterator, final ExecutionConfig config, final TestSelectionConfig dependencyConfig, final ResultsFolders resultsFolders) {
    try {
        KiekerConfig kiekerConfig = new KiekerConfig(true);
        kiekerConfig.setOnlyOneCallRecording(true);
        kiekerConfig.setUseSourceInstrumentation(false);
        final DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(DependencyTestConstants.CURRENT), resultsFolders, null, fakeIterator, changeManager, config, kiekerConfig, new EnvironmentVariables());
        boolean success = reader.readInitialVersion();
        Assert.assertTrue(success);
        fakeIterator.goToNextCommit();
        reader.analyseVersion(changeManager);
        return reader;
    } catch (IOException | InterruptedException | XmlPullParserException | ParseException | ViewNotFoundException e) {
        throw new RuntimeException(e);
    }
}
Also used : EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) IOException(java.io.IOException) ParseException(com.github.javaparser.ParseException) KiekerConfig(de.dagere.peass.config.KiekerConfig) ViewNotFoundException(de.dagere.peass.dependencyprocessors.ViewNotFoundException) PeassFolders(de.dagere.peass.folders.PeassFolders)

Example 23 with KiekerConfig

use of de.dagere.peass.config.KiekerConfig in project peass by DaGeRe.

the class TraceGeneratorStarter method writeTestcase.

private void writeTestcase(final String newestVersion, final PeassFolders folders, final KiekerResultManager resultsManager, final TestCase testcase) throws FileNotFoundException, IOException, XmlPullParserException, ViewNotFoundException {
    final File moduleResultFolder = KiekerFolderUtil.getModuleResultFolder(folders, testcase);
    final File kiekerResultFolder = KiekerFolderUtil.getClazzMethodFolder(testcase, moduleResultFolder)[0];
    final long size = FileUtils.sizeOfDirectory(kiekerResultFolder);
    final long sizeInMB = size / (1024 * 1024);
    if (sizeInMB < 100) {
        LOG.debug("Writing " + testcase);
        final List<TraceElement> shortTrace = new CalledMethodLoader(kiekerResultFolder, mapping, new KiekerConfig()).getShortTrace("");
        writeTrace(newestVersion, testcase, shortTrace);
    } else {
        LOG.info("Not writing " + testcase + " since size is " + sizeInMB + " mb");
    }
}
Also used : TraceElement(de.dagere.peass.dependency.analysis.data.TraceElement) File(java.io.File) KiekerConfig(de.dagere.peass.config.KiekerConfig) CalledMethodLoader(de.dagere.peass.dependency.analysis.CalledMethodLoader)

Example 24 with KiekerConfig

use of de.dagere.peass.config.KiekerConfig in project peass by DaGeRe.

the class TraceGeneratorStarter method runTests.

private KiekerResultManager runTests(final String newestVersion, final TestSet tests, final PeassFolders folders, final ExecutionConfig executionConfig) throws IOException, XmlPullParserException, InterruptedException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    KiekerResultManager resultsManager = new KiekerResultManager(folders, executionConfig, new KiekerConfig(true), new EnvironmentVariables());
    resultsManager.executeKoPeMeKiekerRun(tests, newestVersion, folders.getDependencyLogFolder());
    return resultsManager;
}
Also used : EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) KiekerResultManager(de.dagere.peass.dependency.KiekerResultManager) KiekerConfig(de.dagere.peass.config.KiekerConfig)

Example 25 with KiekerConfig

use of de.dagere.peass.config.KiekerConfig in project peass by DaGeRe.

the class DependencyDetectorTestUtil method readTwoVersions.

public static DependencyReader readTwoVersions(final ChangeManager changeManager, final VersionIterator fakeIterator, final ExecutionConfig config, final TestSelectionConfig dependencyConfig, final ResultsFolders resultsFolders) {
    try {
        final DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(DependencyTestConstants.CURRENT), resultsFolders, null, fakeIterator, changeManager, config, new KiekerConfig(true), new EnvironmentVariables());
        boolean success = reader.readInitialVersion();
        Assert.assertTrue(success);
        fakeIterator.goToNextCommit();
        reader.analyseVersion(changeManager);
        return reader;
    } catch (IOException | InterruptedException | XmlPullParserException | ParseException | ViewNotFoundException e) {
        throw new RuntimeException(e);
    }
}
Also used : EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) IOException(java.io.IOException) ParseException(com.github.javaparser.ParseException) KiekerConfig(de.dagere.peass.config.KiekerConfig) ViewNotFoundException(de.dagere.peass.dependencyprocessors.ViewNotFoundException) PeassFolders(de.dagere.peass.folders.PeassFolders)

Aggregations

KiekerConfig (de.dagere.peass.config.KiekerConfig)34 PeassFolders (de.dagere.peass.folders.PeassFolders)22 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)21 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)21 File (java.io.File)21 Test (org.junit.jupiter.api.Test)18 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)9 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)7 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)7 ChangeManager (de.dagere.peass.dependency.ChangeManager)5 CalledMethodLoader (de.dagere.peass.dependency.analysis.CalledMethodLoader)5 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)5 TraceElement (de.dagere.peass.dependency.analysis.data.TraceElement)5 ResultsFolders (de.dagere.peass.folders.ResultsFolders)5 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)5 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)4 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)4 ClazzChangeData (de.dagere.peass.dependency.changesreading.ClazzChangeData)4 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)4 VersionIterator (de.dagere.peass.vcs.VersionIterator)4