Skip to content

Commit

Permalink
Refactoring: Move TLR, ID & LiSSA to projects in ArDoCo.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuchss committed Feb 14, 2024
1 parent 1d5f882 commit 755a3e9
Show file tree
Hide file tree
Showing 656 changed files with 294 additions and 377,871 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/dependency-update.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/maven-manual-release.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/maven-release.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2022 ArDoCo
Copyright (c) 2020-2024 ArDoCo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.io.*;
import java.lang.reflect.ParameterizedType;

import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -65,7 +64,7 @@ protected void write(T content) {
}

@Override
protected @Nullable T read() throws CacheException {
protected T read() throws CacheException {
try (ObjectInputStream in = new ObjectInputStream(new FileInputStream(getFile()))) {
logger.info("Reading {} file", getIdentifier());
var dObj = in.readObject();
Expand Down
93 changes: 93 additions & 0 deletions pipeline-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.ardoco.core</groupId>
<artifactId>parent</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>pipeline-core</artifactId>

<dependencies>
<dependency>
<groupId>io.github.ardoco.core</groupId>
<artifactId>common</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-testCompile</id>
<goals>
<goal>testCompile</goal>
</goals>
<phase>test-compile</phase>
<configuration combine.self="override">
<!-- Enforce compilation of test classes -->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-test-jar</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>install</phase>
<configuration>
<file>${project.build.directory}/${project.build.finalName}-tests.jar</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private ConfigurationHelper() throws IllegalAccessException {
public static SortedMap<String, String> loadAdditionalConfigs(File additionalConfigsFile) {
SortedMap<String, String> additionalConfigs = new TreeMap<>();
if (additionalConfigsFile != null && (!additionalConfigsFile.exists() || !additionalConfigsFile.isFile())) {
throw new IllegalArgumentException("File " + additionalConfigsFile + " is not a valid configuration file!");
throw new IllegalArgumentException("File " + additionalConfigsFile.getAbsolutePath() + " is not a valid configuration file!");
}
if (additionalConfigsFile == null) {
return additionalConfigs;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Licensed under MIT 2022-2023. */
/* Licensed under MIT 2022-2024. */
package edu.kit.kastel.mcse.ardoco.core.execution;

import edu.kit.kastel.mcse.ardoco.core.data.ProjectPipelineData;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* Licensed under MIT 2023-2024. */
package edu.kit.kastel.mcse.ardoco.core.execution;

import java.io.File;
import java.nio.file.Files;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import edu.kit.kastel.mcse.ardoco.core.common.RepositoryHandler;

public class CodeRunnerBaseTest extends RunnerBaseTest {

private static final Logger logger = LoggerFactory.getLogger(CodeRunnerBaseTest.class);
protected static final String inputCodeRepository = "https://github.com/ArDoCo/TeaStore.git";

protected String inputCodeModel = null;
protected static String commitHash = "bdc49020a55cfa97eaabbb25744fefbc2697defa";

@BeforeEach
void setupCodeDirectories() throws Exception {
if (inputCodeModel != null) {
logger.debug("Already initialized");
return;
}

var inputCodeModelDirectory = new File(directory.toFile(), "code");
inputCodeModelDirectory.mkdir();
var inputCodeModel = new File(inputCodeModelDirectory, "codeModel.acm");
this.getClass().getResourceAsStream("/code/teastore/codeModel.acm").transferTo(Files.newOutputStream(inputCodeModel.toPath()));
this.inputCodeModel = inputCodeModelDirectory.getAbsolutePath();

if (System.getenv("testCodeFull") != null) {
var inputCodeModelDirectoryFull = new File(directory.toFile(), "code-full");
inputCodeModelDirectoryFull.mkdir();
this.inputCodeModel = inputCodeModelDirectoryFull.getAbsolutePath();
var successfulClone = RepositoryHandler.shallowCloneRepository(inputCodeRepository, this.inputCodeModel, commitHash);
if (!successfulClone) {
Assertions.fail("Could not clone repository.");
}
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Licensed under MIT 2022-2023. */
/* Licensed under MIT 2022-2024. */
package edu.kit.kastel.mcse.ardoco.core.execution;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/* Licensed under MIT 2023-2024. */
package edu.kit.kastel.mcse.ardoco.core.execution;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import edu.kit.kastel.mcse.ardoco.core.execution.runner.ArDoCoRunner;

public class RunnerBaseTest {
private static final Logger logger = LoggerFactory.getLogger(RunnerBaseTest.class);

protected String outputDir = "../target/testout-" + this.getClass().getSimpleName();
protected String inputText = null;
protected String inputModelArchitecture = null;
protected String inputModelArchitectureUml = null;
protected String additionalConfigs = null;
protected String projectName = "teastore";
protected Path directory;

@BeforeEach
void setupDirectories() throws Exception {
new File(outputDir).mkdirs();

if (inputText != null) {
logger.debug("Already initialized");
return;
}

this.directory = Files.createTempDirectory("RunnerTest" + this.getClass().getName());
var inputText = new File(directory.toFile(), "inputText.txt");
var inputModelArchitecture = new File(directory.toFile(), "inputModelArchitecture.repository");
var inputModelArchitectureUml = new File(directory.toFile(), "inputModelArchitecture.uml");
var inputDiagram = new File(directory.toFile(), "teastore-paper.png");

var additionalConfigs = new File(directory.toFile(), "additionalConfigs.txt");

this.getClass().getResourceAsStream("/teastore.txt").transferTo(Files.newOutputStream(inputText.toPath()));
this.getClass().getResourceAsStream("/teastore.repository").transferTo(Files.newOutputStream(inputModelArchitecture.toPath()));
this.getClass().getResourceAsStream("/teastore.uml").transferTo(Files.newOutputStream(inputModelArchitectureUml.toPath()));
this.getClass().getResourceAsStream("/additionalConfig.txt").transferTo(Files.newOutputStream(additionalConfigs.toPath()));
this.getClass().getResourceAsStream("/teastore-paper.png").transferTo(Files.newOutputStream(inputDiagram.toPath()));

this.inputText = inputText.getAbsolutePath();
this.inputModelArchitecture = inputModelArchitecture.getAbsolutePath();
this.inputModelArchitectureUml = inputModelArchitectureUml.getAbsolutePath();
this.additionalConfigs = additionalConfigs.getAbsolutePath();

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
// Recursively delete files from directory
Files.walk(directory).sorted((a, b) -> -a.compareTo(b)).forEach(p -> {
try {
Files.delete(p);
} catch (IOException e) {
logger.warn("Error when cleaning up!", e);
}
});
} catch (IOException e) {
logger.warn("Error when cleaning up!", e);
}
}));
}

@AfterEach
void cleanUp() {
for (File file : Objects.requireNonNull(new File(outputDir).listFiles())) {
if (!file.getName().equals(".gitkeep")) {
try {
Files.delete(file.toPath());
} catch (IOException e) {
logger.warn("Error when cleaning up!", e);
}
}
}
}

@SuppressWarnings("java:S5960")
@Test
@DisplayName("Test SetUp")
void testInput() {
File inputTextFile = new File(inputText);
File inputModelArchitectureFile = new File(inputModelArchitecture);
File inputModelArchitectureUmlFile = new File(inputModelArchitectureUml);
File outputDirFile = new File(outputDir);
File additionalConfigsFile = new File(additionalConfigs);

Assertions.assertAll(//
() -> Assertions.assertTrue(inputTextFile.exists()),//
() -> Assertions.assertTrue(inputModelArchitectureFile.exists()),//
() -> Assertions.assertTrue(inputModelArchitectureUmlFile.exists()),//
() -> Assertions.assertTrue(outputDirFile.exists()),//
() -> Assertions.assertTrue(additionalConfigsFile.exists())//
);
}

protected void testRunnerAssertions(ArDoCoRunner runner) {
Assertions.assertAll(//
() -> Assertions.assertNotNull(runner),//
() -> Assertions.assertTrue(runner.isSetUp())//
);
}
}
12 changes: 0 additions & 12 deletions pipeline/pipeline-core/pom.xml

This file was deleted.

Loading

0 comments on commit 755a3e9

Please sign in to comment.