use of de.dagere.peass.dependency.reader.VersionKeeper in project peass by DaGeRe.
the class ContinuousDependencyReader method doPartialRCS.
private void doPartialRCS(final StaticTestSelection dependencies, final VersionIterator newIterator) {
DependencyReader reader = new DependencyReader(dependencyConfig, folders, resultsFolders, dependencies.getUrl(), newIterator, new VersionKeeper(new File(resultsFolders.getStaticTestSelectionFile().getParentFile(), "nochanges.json")), executionConfig, kiekerConfig, env);
newIterator.goTo0thCommit();
reader.readCompletedVersions(dependencies);
try {
ExecutionData executions = Constants.OBJECTMAPPER.readValue(resultsFolders.getTraceTestSelectionFile(), ExecutionData.class);
reader.setExecutionData(executions);
if (resultsFolders.getCoverageSelectionFile().exists()) {
ExecutionData coverageExecutions = Constants.OBJECTMAPPER.readValue(resultsFolders.getCoverageSelectionFile(), ExecutionData.class);
reader.setCoverageExecutions(coverageExecutions);
if (resultsFolders.getCoverageInfoFile().exists()) {
CoverageSelectionInfo coverageInfo = Constants.OBJECTMAPPER.readValue(resultsFolders.getCoverageInfoFile(), CoverageSelectionInfo.class);
reader.setCoverageInfo(coverageInfo);
}
}
reader.readDependencies();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of de.dagere.peass.dependency.reader.VersionKeeper in project peass by DaGeRe.
the class JmhDependencyReaderMultiParamTest method testVersionReading.
@Test
public void testVersionReading() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
FakeGitUtil.prepareGitUtils(gitUtilsMock);
FakeFileIterator iterator = mockIterator();
ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
ExecutionConfig jmhConfig = new ExecutionConfig();
jmhConfig.setTestTransformer("de.dagere.peass.dependency.jmh.JmhTestTransformer");
jmhConfig.setTestExecutor("de.dagere.peass.dependency.jmh.JmhTestExecutor");
DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, new VersionKeeper(new File("/dev/null")), jmhConfig, new KiekerConfig(true), new EnvironmentVariables());
reader.readInitialVersion();
checkInitialVersion(resultsFolders);
reader.readDependencies();
checkChangedVersion(resultsFolders);
}
}
use of de.dagere.peass.dependency.reader.VersionKeeper in project peass by DaGeRe.
the class JmhDependencyReaderTest method testVersionReading.
@ParameterizedTest
@ArgumentsSource(KiekerConfigurationProvider.class)
public void testVersionReading(final KiekerConfig kiekerConfig) throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
FakeGitUtil.prepareGitUtils(gitUtilsMock);
FakeFileIterator iterator = mockIterator();
ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
ExecutionConfig jmhConfig = new ExecutionConfig();
jmhConfig.setTestTransformer("de.dagere.peass.dependency.jmh.JmhTestTransformer");
jmhConfig.setTestExecutor("de.dagere.peass.dependency.jmh.JmhTestExecutor");
DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, new VersionKeeper(new File("/dev/null")), jmhConfig, kiekerConfig, new EnvironmentVariables());
reader.readInitialVersion();
checkInitialVersion(resultsFolders);
reader.readDependencies();
checkChangedVersion(resultsFolders);
}
}
use of de.dagere.peass.dependency.reader.VersionKeeper 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);
}
}
use of de.dagere.peass.dependency.reader.VersionKeeper in project peass by DaGeRe.
the class GetProjectSizes method main.
public static void main(final String[] args) throws JsonParseException, JsonMappingException, IOException {
File dependencyFolder;
if (System.getenv(Constants.PEASS_REPOS) != null) {
final String repofolder = System.getenv(Constants.PEASS_REPOS);
final File folder = new File(repofolder);
dependencyFolder = new File(folder, "dependencies-final");
} else {
throw new RuntimeException("Please define environment variable " + Constants.PEASS_REPOS);
}
System.out.println("Projekt & Versionen & Analysierbar & GeƤndert & Selektiert & Tests\\\\ \\hline");
for (final String project : allProjects) {
final File projectFolder = new File("../../projekte/" + project);
final int commits = GitUtils.getCommits(projectFolder, true).size();
final File executionFile = new File(dependencyFolder, ResultsFolders.TRACE_SELECTION_PREFIX + project + ".json");
int analyzable = 0;
int tests = 0;
int executionTests = 0;
if (executionFile.exists()) {
final ExecutionData executionData = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
executionTests = executionData.getVersions().size();
for (final TestSet test : executionData.getVersions().values()) {
tests += test.getTests().size();
}
}
final File nonRunning = new File(dependencyFolder, "nonRunning_" + project + ".json");
final File nonChanges = new File(dependencyFolder, "nonChanges_" + project + ".json");
int changes = 0;
if (nonRunning.exists()) {
final VersionKeeper vk = Constants.OBJECTMAPPER.readValue(nonRunning, VersionKeeper.class);
analyzable = commits - vk.getNonRunableReasons().size();
if (nonChanges.exists()) {
final VersionKeeper vk2 = Constants.OBJECTMAPPER.readValue(nonChanges, VersionKeeper.class);
changes = analyzable - vk2.getNonRunableReasons().size();
}
}
System.out.println(project + " & " + commits + " & " + analyzable + " & " + changes + " & " + executionTests + " & " + tests + "\\\\");
}
}
Aggregations