Search in sources :

Example 26 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.

the class TestCreateMeasurementExecutionScript method buildExecutionDataWithTests.

private ExecutionData buildExecutionDataWithTests() {
    StaticTestSelection dependencies = TestExecutionData.buildExampleDependencies();
    VersionStaticSelection version2 = dependencies.getVersions().get("000002");
    version2.getChangedClazzes().put(new ChangedEntity("Test1#testMe"), new TestSet(new TestCase("Test1#testMe")));
    VersionStaticSelection version5 = dependencies.getVersions().get("000005");
    version5.getChangedClazzes().put(new ChangedEntity("Test5#testMe"), new TestSet(new TestCase("Test5#testMe")));
    ExecutionData executiondata = new ExecutionData(dependencies);
    return executiondata;
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) TestExecutionData(de.dagere.peass.dependency.persistence.TestExecutionData) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 27 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass-ci-plugin by jenkinsci.

the class RTSLogFileReader method isVersionRunSuccess.

private boolean isVersionRunSuccess(final VisualizationFolderManager visualizationFolders, final MeasurementConfig measurementConfig) {
    boolean success = false;
    File dependencyFile = visualizationFolders.getResultsFolders().getStaticTestSelectionFile();
    if (dependencyFile.exists()) {
        try {
            StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, StaticTestSelection.class);
            VersionStaticSelection version = dependencies.getVersions().get(measurementConfig.getExecutionConfig().getVersion());
            if (version != null) {
                LOG.debug("Version run success: {}", version.isRunning());
                success = version.isRunning();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else {
        LOG.debug("Dependencyfile {} not found, so run was n o success", dependencyFile);
    }
    return success;
}
Also used : VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) IOException(java.io.IOException) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 28 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass-ci-plugin by jenkinsci.

the class TestRTSVisualizationCreator method writeEmptyDependencies.

private void writeEmptyDependencies(final ResultsFolders localWorkspace) throws IOException, JsonGenerationException, JsonMappingException {
    StaticTestSelection emptyDependencies = new StaticTestSelection();
    emptyDependencies.getInitialversion().addDependency(new TestCase("Test#test"), new ChangedEntity("SomeCallee#method"));
    Constants.OBJECTMAPPER.writeValue(localWorkspace.getStaticTestSelectionFile(), emptyDependencies);
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 29 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.

the class GetChanges method call.

@Override
public Void call() throws Exception {
    SelectedTests selectedTests = VersionSorter.getSelectedTests(staticSelectionFile, executionFile);
    if (!out.exists()) {
        out.mkdirs();
    }
    LOG.info("Errors: 1: {} 2: {}", statisticConfigMixin.getType1error(), statisticConfigMixin.getType2error());
    ResultsFolders folders = new ResultsFolders(out, "out");
    final ChangeReader reader = createReader(folders, selectedTests);
    if (staticSelectionFile != null) {
        StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
        reader.setTests(dependencies.toExecutionData().getVersions());
    }
    if (executionFile != null) {
        ExecutionData executions = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
        reader.setTests(executions.getVersions());
    }
    for (final File dataFile : data) {
        reader.readFile(dataFile);
    }
    return null;
}
Also used : ChangeReader(de.dagere.peass.analysis.changes.ChangeReader) SelectedTests(de.dagere.peass.dependency.persistence.SelectedTests) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 30 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.

the class ContinuousDependencyReader method getDependencies.

StaticTestSelection getDependencies(final VersionIterator iterator, final String url) {
    try {
        StaticTestSelection dependencies;
        final VersionKeeper noChanges = new VersionKeeper(new File(resultsFolders.getStaticTestSelectionFile().getParentFile(), "nonChanges_" + folders.getProjectName() + ".json"));
        if (!resultsFolders.getStaticTestSelectionFile().exists()) {
            LOG.debug("Fully loading dependencies");
            dependencies = fullyLoadDependencies(url, iterator, noChanges);
        } else {
            LOG.debug("Partially loading dependencies");
            dependencies = Constants.OBJECTMAPPER.readValue(resultsFolders.getStaticTestSelectionFile(), StaticTestSelection.class);
            VersionComparator.setDependencies(dependencies);
            if (iterator != null) {
                executePartialRTS(dependencies, iterator);
            }
        }
        VersionComparator.setDependencies(dependencies);
        return dependencies;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : VersionKeeper(de.dagere.peass.dependency.reader.VersionKeeper) File(java.io.File) ViewNotFoundException(de.dagere.peass.dependencyprocessors.ViewNotFoundException) ParseException(com.github.javaparser.ParseException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Aggregations

StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)56 File (java.io.File)24 Test (org.junit.jupiter.api.Test)22 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)14 PeassFolders (de.dagere.peass.folders.PeassFolders)14 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)12 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)12 LinkedList (java.util.LinkedList)9 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)8 KiekerConfig (de.dagere.peass.config.KiekerConfig)7 InitialVersion (de.dagere.peass.dependency.persistence.InitialVersion)7 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)7 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)7 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)6 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)6 GitCommit (de.dagere.peass.vcs.GitCommit)6 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)5 ResultsFolders (de.dagere.peass.folders.ResultsFolders)5 GitUtils (de.dagere.peass.vcs.GitUtils)5 ChangeManager (de.dagere.peass.dependency.ChangeManager)4