use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.
the class ContinuousDependencyReaderIT method testAnotherVersion.
@Order(2)
@Test
public void testAnotherVersion() throws Exception {
final String prevTag = builder.getTags().get(builder.getTags().size() - 1);
GitUtils.goToTag(prevTag, TestConstants.CURRENT_FOLDER);
String newVersion = builder.addVersion(new File("../dependency/src/test/resources/dependencyIT/basic_state"), "test 2");
VersionIteratorGit iterator = new VersionIteratorGit(TestConstants.CURRENT_FOLDER);
ExecutionConfig executionConfig = new ExecutionConfig();
executionConfig.setVersion(newVersion);
executionConfig.setVersionOld(iterator.getPrevious().getTag());
final ContinuousDependencyReader spiedReader = new ContinuousDependencyReader(DependencyTestConstants.DEFAULT_CONFIG_WITH_VIEWS, executionConfig, new KiekerConfig(true), new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, new EnvironmentVariables());
StaticTestSelection dependencies = spiedReader.getDependencies(iterator, "");
final String lastTag = builder.getTags().get(builder.getTags().size() - 1);
checkVersion(dependencies, lastTag, 2);
ExecutionData executions = Constants.OBJECTMAPPER.readValue(resultsFolders.getTraceTestSelectionFile(), ExecutionData.class);
Assert.assertEquals(3, executions.getVersions().size());
}
use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.
the class CreateMeasurementExecutionScript method call.
@Override
public Void call() throws Exception {
if (dependencyFile != null) {
dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, StaticTestSelection.class);
}
if (executionfile != null) {
executionData = Constants.OBJECTMAPPER.readValue(executionfile, ExecutionData.class);
dependencies = new StaticTestSelection(executionData);
}
if (executionData == null && dependencies == null) {
throw new RuntimeException("Dependencyfile and executionfile not readable - one needs to be defined!");
}
PrintStream destination = System.out;
RunCommandWriter writer;
if (useSlurm) {
destination.println("timestamp=$(date +%s)");
writer = new RunCommandWriterSlurm(System.out, experimentId, dependencies);
} else {
writer = new RunCommandWriter(destination, experimentId, dependencies);
}
generateExecuteCommands(dependencies, executionData, experimentId, writer);
return null;
}
use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.
the class DivideAllVersions method main.
public static void main(final String[] args) throws JAXBException, JsonParseException, JsonMappingException, IOException {
String repoName = System.getenv(Constants.PEASS_REPOS);
File repos = new File(repoName);
if (!repos.exists()) {
LOG.error("Repofolder " + repos.getAbsolutePath() + " not found!");
}
final File resultFolder = new File("results");
if (!resultFolder.exists()) {
resultFolder.mkdirs();
}
File dependencyFolder = new File(repos, "dependencies-final");
for (String project : Constants.defaultUrls.keySet()) {
File dependencyFile = new File(dependencyFolder, ResultsFolders.STATIC_SELECTION_PREFIX + project + ".json");
File executionFile = new File(dependencyFolder, ResultsFolders.TRACE_SELECTION_PREFIX + project + ".json");
if (dependencyFile.exists() && executionFile.exists()) {
LOG.debug("Loading: " + project);
final File executeCommandsFile = new File(resultFolder, "execute-" + project + ".sh");
final StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, StaticTestSelection.class);
final ExecutionData changedTests = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
CreateMeasurementExecutionScript.generateExecuteCommands(dependencies, changedTests, "validation", new PrintStream(new FileOutputStream(executeCommandsFile)));
} else {
LOG.error("File not existing: " + project + " " + Constants.defaultUrls.get(project) + " " + dependencyFile.getAbsolutePath());
}
}
}
use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.
the class DependencyViewGeneratorTest method testTwoVersions.
@Test
public void testTwoVersions() throws Exception {
try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
FakeGitUtil.prepareGitUtils(gitUtilsMock);
DependencyDetectorTestUtil.init(TraceGettingIT.BASIC);
ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
FakeFileIterator iteratorspied = mockIterator();
DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iteratorspied, new VersionKeeper(new File("/dev/null")), new ExecutionConfig(), new KiekerConfig(true), new EnvironmentVariables());
reader.readInitialVersion();
try {
reader.readDependencies();
} catch (Throwable t) {
System.out.println();
for (StackTraceElement te : t.getStackTrace()) {
System.out.println(te);
}
System.out.println();
throw t;
}
File expectedDiff = new File(resultsFolders.getVersionDiffFolder("000002"), "TestMe#test.txt");
System.out.println(expectedDiff.getAbsolutePath());
Assert.assertTrue(expectedDiff.exists());
// TODO Test, that instrumentation sources are not added to the view
final ExecutionData tests = Constants.OBJECTMAPPER.readValue(resultsFolders.getTraceTestSelectionFile(), ExecutionData.class);
//
Assert.assertEquals(2, tests.getVersions().size());
Assert.assertEquals(1, tests.getVersions().get("000002").getTests().size());
}
}
use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.
the class TestChangedTraceTestSerialisation method testVersionContent.
@Test
public void testVersionContent() throws IOException {
final ExecutionData tests = new ExecutionData();
tests.addEmptyVersion("v1", "v0");
tests.addCall("v1", new TestCase("Test1#test"));
tests.addEmptyVersion("v2", "v1");
tests.addCall("v2", new TestCase("Test1#test"));
final ObjectMapper mapper = Constants.OBJECTMAPPER;
final String json = mapper.writeValueAsString(tests);
Assert.assertNotNull(json);
System.out.println(json);
final ExecutionData deserialize = mapper.readValue(json, ExecutionData.class);
Assert.assertNotNull(deserialize);
Map<TestCase, Set<String>> regularV1 = tests.getVersions().get("v1").getTestcases();
Map<TestCase, Set<String>> deserializedV1 = deserialize.getVersions().get("v1").getTestcases();
Assert.assertEquals(regularV1, deserializedV1);
}
Aggregations