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