Verified Commit 553a3e8d authored by Lukas Wiest's avatar Lukas Wiest 🚂
Browse files

refactor: more un-modocotting

parent 7ddc1e53
......@@ -7,12 +7,11 @@ ADD target/dtt-backend.jar app.jar
# Prepare environment.
# Create needed folders
RUN mkdir /dtt && \
mkdir /dtt/data && \
mkdir /dtt/config
RUN mkdir /data && \
mkdir /data/config
VOLUME /modocot/data
VOLUME /data
env SPRING_CONFIG_ADDITIONAL_LOCATION "file:/home/dtt/config/"
env SPRING_CONFIG_ADDITIONAL_LOCATION "file:/data/config/"
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
......@@ -41,7 +41,7 @@ public class TaskUpload {
this.executeTestUtil = executeTestUtil;
// set path of temporary directory on host and inside our container
this.testTmpPathModocot = Paths.get(env.getProperty("modocot.tests.tmp.dir"));
this.testTmpPathModocot = Paths.get(env.getProperty("tests.tmp.dir"));
}
@RequestMapping(method = RequestMethod.POST)
......
......@@ -27,8 +27,8 @@ import java.util.regex.Pattern;
public class UnitTestUpload {
private static final Logger LOG = LogManager.getLogger(UnitTestUpload.class);
public final static String modocotTestConfigRegex = "^dtt::(.*)::(.*|none)::(.*|none)::(.*)$";
public final static String modocotDueConfigRegex = "^dtt::(.*)::(.*|none)::(.*|none)$";
public final static String TESTCONFIGREGEX = "^dtt::(.*)::(.*|none)::(.*|none)::(.*)$";
public final static String SUBMISSIONCONFIGREGEX = "^dtt::(.*)::(.*|none)::(.*|none)$";
private final JGitUtil jGitUtil;
private final String assignmentBasePath;
......@@ -36,7 +36,7 @@ public class UnitTestUpload {
public UnitTestUpload(Environment env, JGitUtil jGitUtil) {
this.jGitUtil = jGitUtil;
Path p = Paths.get(env.getProperty("modocot.dir"), env.getProperty("modocot.dir.test.folder.name"));
Path p = Paths.get(env.getProperty("data.dir"), env.getProperty("data.dir.test.folder.name"));
this.assignmentBasePath = p.toAbsolutePath().toString();
}
......@@ -64,7 +64,7 @@ public class UnitTestUpload {
unitTestFileRef.transferTo(file);
LOG.debug(String.format("saved config file to: %s", file.getAbsolutePath()));
Pattern pattern = Pattern.compile(this.modocotTestConfigRegex);
Pattern pattern = Pattern.compile(this.TESTCONFIGREGEX);
Matcher config = null;
LOG.debug("reading test configuration file");
......
......@@ -35,13 +35,13 @@ public class ExecuteTestUtil {
// set base path for assignments to be stored
Path p = Paths.get(
env.getProperty("modocot.dir"),
env.getProperty("modocot.dir.test.folder.name"));
env.getProperty("data.dir"),
env.getProperty("data.dir.test.folder.name"));
this.assignmentBasePath = p.toAbsolutePath().toString();
// set path of temporary directory on host and inside our container
this.testTmpPathHost = Paths.get(env.getProperty("host.tests.tmp.dir"));
this.testTmpPathModocot = Paths.get(env.getProperty("modocot.tests.tmp.dir"));
this.testTmpPathModocot = Paths.get(env.getProperty("tests.tmp.dir"));
}
public ResultSummary runTests(String assignmentId, Path workDirectory) throws IOException, InterruptedException {
......@@ -99,9 +99,9 @@ public class ExecuteTestUtil {
// start test-container with professor given image and bind mounts for test, submission and result
dockerUtil.runContainer(
config.group(4),
new Bind(testPathHost.toAbsolutePath().toString(), new Volume("/modocot/test")),
new Bind(srcPathHost.toAbsolutePath().toString(), new Volume("/modocot/src")),
new Bind(resultPathHost.toAbsolutePath().toString(), new Volume("/modocot/result"))
new Bind(testPathHost.toAbsolutePath().toString(), new Volume("/data/test")),
new Bind(srcPathHost.toAbsolutePath().toString(), new Volume("/data/src")),
new Bind(resultPathHost.toAbsolutePath().toString(), new Volume("/data/result"))
);
// define expected result file
......
......@@ -32,11 +32,11 @@ public class RegexUtil {
Pattern pattern;
switch (configType) {
case PROFESSOR:
pattern = Pattern.compile(UnitTestUpload.modocotTestConfigRegex);
pattern = Pattern.compile(UnitTestUpload.TESTCONFIGREGEX);
break;
case STUDENT:
pattern = Pattern.compile(UnitTestUpload.modocotDueConfigRegex);
pattern = Pattern.compile(UnitTestUpload.SUBMISSIONCONFIGREGEX);
break;
default:
......
......@@ -7,7 +7,7 @@ spring.http.multipart.max-file-size=5Mb
###############################################
# Holds the uploaded Zip-Files
modocot.tests.tmp.dir=/tmp/modocot-tests
host.tests.tmp.dir=${modocot.tests.tmp.dir}
modocot.dir=/modocot/data
modocot.dir.test.folder.name=UnitTests
tests.tmp.dir=/tmp/dtt-tests
host.tests.tmp.dir=${tests.tmp.dir}
data.dir=/data
data.dir.test.folder.name=UnitTests
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment