use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.
the class ReadProperties method call.
@Override
public Void call() throws Exception {
final RepoFolders folders = new RepoFolders();
final String projectName = projectFolder.getName();
SelectedTests selectedTests = VersionSorter.getSelectedTests(staticSelectionFile, executionFile, folders.getDependencyFile(projectName));
if (!projectFolder.exists()) {
GitUtils.downloadProject(selectedTests.getUrl(), projectFolder);
}
System.out.println("Read all: " + ReadAllProperties.readAll);
if (ReadAllProperties.readAll) {
final ExecutionData changedTests = executionFile != null ? Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class) : folders.getExecutionData(projectName);
final File resultFile = new File("results" + File.separator + projectName + File.separator + "properties_alltests.json");
out = resultFile;
ResultsFolders resultsFolders = new ResultsFolders(out, projectName);
final PropertyReader reader = new PropertyReader(resultsFolders, projectFolder, changedTests, new ExecutionConfig());
reader.readAllTestsProperties();
} else {
final File changefile;
if (this.changefile != null) {
changefile = this.changefile;
} else {
changefile = folders.getChangeFile(projectName);
}
if (out == null) {
out = folders.getProjectPropertyFile(projectName);
if (!out.getParentFile().exists()) {
out.getParentFile().mkdirs();
}
}
if (!changefile.exists()) {
LOG.error("Changefile {} needs to exist.", changefile);
System.exit(1);
}
if (!viewfolder.exists()) {
LOG.error("ViewFolder {} needs to exist.", viewfolder);
System.exit(1);
}
StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
readChangeProperties(changefile, projectFolder, viewfolder, new ExecutionData(dependencies));
}
return null;
}
use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.
the class GetAllChanges method main.
public static void main(final String[] args) throws JAXBException, JsonParseException, JsonMappingException, IOException {
final RepoFolders folders = new RepoFolders();
// "commons-imaging", "commons-io", "commons-numbers", "commons-pool", "commons-text" }) {
for (final String project : new String[] { "commons-fileupload" }) {
final File dependencyFile = new File(folders.getDependencyFolder(), ResultsFolders.STATIC_SELECTION_PREFIX + project + ".json");
if (dependencyFile.exists()) {
final StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, StaticTestSelection.class);
getChangesForProject(folders, project, dependencies);
// ProjectChanges.reset();
} else {
System.out.println("Dependencyfile does not exist: " + dependencyFile);
}
}
}
use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.
the class ContinuousDependencyReader method getTests.
public RTSResult getTests(final VersionIterator iterator, final String url, final String version, final MeasurementConfig measurementConfig) {
final StaticTestSelection dependencies = getDependencies(iterator, url);
RTSResult result;
final Set<TestCase> tests;
if (dependencies.getVersions().size() > 0) {
VersionStaticSelection versionInfo = dependencies.getVersions().get(version);
LOG.debug("Versioninfo for version {}, running was: {}", version, versionInfo != null ? versionInfo.isRunning() : "null");
if (dependencyConfig.isGenerateTraces()) {
tests = selectResults(version);
result = new RTSResult(tests, versionInfo.isRunning());
} else {
tests = versionInfo.getTests().getTests();
result = new RTSResult(tests, versionInfo.isRunning());
}
// final Set<TestCase> tests = selectIncludedTests(dependencies);
NonIncludedTestRemover.removeNotIncluded(tests, measurementConfig.getExecutionConfig());
} else {
tests = new HashSet<>();
result = new RTSResult(tests, true);
LOG.info("No test executed - version did not contain changed tests.");
}
return result;
}
use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.
the class ContinuousDependencyReader method doFullyLoadDependencies.
private StaticTestSelection doFullyLoadDependencies(final String url, final VersionIterator iterator, final VersionKeeper nonChanges) throws IOException, InterruptedException, XmlPullParserException, JsonParseException, JsonMappingException, ParseException, ViewNotFoundException {
final DependencyReader reader = new DependencyReader(dependencyConfig, folders, resultsFolders, url, iterator, nonChanges, executionConfig, kiekerConfig, env);
iterator.goToPreviousCommit();
if (!reader.readInitialVersion()) {
LOG.error("Analyzing first version was not possible");
} else {
reader.readDependencies();
}
StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(resultsFolders.getStaticTestSelectionFile(), StaticTestSelection.class);
return dependencies;
}
use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.
the class FindLowestPossibleIterations method call.
@Override
public Void call() throws InterruptedException, StreamReadException, DatabindException, IOException {
final StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, StaticTestSelection.class);
VersionComparator.setDependencies(dependencies);
for (File fullDataFolder : data) {
LOG.info("Loading: {}", fullDataFolder);
if (!fullDataFolder.exists()) {
LOG.error("Ordner existiert nicht!");
System.exit(1);
}
final LinkedBlockingQueue<TestData> measurements = new LinkedBlockingQueue<>();
DataReader.startReadVersionDataMap(fullDataFolder, measurements);
TestData measurementEntry = measurements.take();
while (measurementEntry != DataReader.POISON_PILL) {
processTestdata(measurementEntry);
measurementEntry = measurements.take();
}
}
LOG.debug("Final minimal VM executions for same result: " + vmDeterminer.getMinNeccessaryValue() + " Average: " + ((double) vmDeterminer.getSum() / vmDeterminer.getCount()));
LOG.debug(vmDeterminer.getValues());
return null;
// LOG.debug("Final minimal measurement executions for same result: " + exDeterminer.minNeccessaryValue + " Average: " + ((double) exDeterminer.sum / exDeterminer.count));
// LOG.debug(exDeterminer.values);
}
Aggregations