Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CoTA
cota-backend
Commits
257c0503
Commit
257c0503
authored
3 months ago
by
mamunozgil
Browse files
Options
Download
Email Patches
Plain Diff
Fix: correct property and rename variable names
parent
92f938c9
Pipeline
#10778
passed with stage
in 18 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/hftstuttgart/dtabackend/utils/ExecuteTestUtil.java
+15
-15
...ava/de/hftstuttgart/dtabackend/utils/ExecuteTestUtil.java
with
15 additions
and
15 deletions
+15
-15
src/main/java/de/hftstuttgart/dtabackend/utils/ExecuteTestUtil.java
+
15
-
15
View file @
257c0503
...
...
@@ -34,8 +34,8 @@ public class ExecuteTestUtil {
private
static
final
Logger
LOG
=
LogManager
.
getLogger
(
ExecuteTestUtil
.
class
);
private
final
DockerUtil
dockerUtil
;
private
final
String
basePath
;
private
final
String
containerBasePath
;
private
final
String
basePath
ProfessorUnitTests
;
private
final
String
basePathStudentsSubmissionCode
;
public
ExecuteTestUtil
(
Environment
env
,
DockerUtil
dockerUtil
)
{
this
.
dockerUtil
=
dockerUtil
;
...
...
@@ -44,16 +44,16 @@ public class ExecuteTestUtil {
Path
p
=
Paths
.
get
(
env
.
getProperty
(
"data.dir"
),
///data
env
.
getProperty
(
"data.dir.test.folder.name"
));
//UnitTests
this
.
basePath
=
p
.
toAbsolutePath
().
toString
();
this
.
containerBasePath
=
env
.
getProperty
(
"data.dir"
);
this
.
basePath
ProfessorUnitTests
=
p
.
toAbsolutePath
().
toString
();
this
.
basePathStudentsSubmissionCode
=
env
.
getProperty
(
"tests.tmp.dir"
);
// /dta-test-assignments
}
public
ResultSummary
runTests
(
String
assignmentId
,
Path
workDirectory
)
throws
IOException
,
InterruptedException
{
// Define paths for the submission-specific directories
String
containerTestDir
=
this
.
containerBasePath
+
workDirectory
.
getFileName
();
// /dta-test-assignments/dta-submissionID
Path
testPath
=
Paths
.
get
(
containerTestDir
,
"test"
);
Path
srcPath
=
Paths
.
get
(
containerTestDir
,
"src"
);
Path
resultPath
=
Paths
.
get
(
containerTestDir
,
"result"
);
String
submissionDirectory
=
this
.
basePathStudentsSubmissionCode
+
workDirectory
.
getFileName
();
// /dta-test-assignments/dta-submissionID
Path
testPath
=
Paths
.
get
(
submissionDirectory
,
"test"
);
Path
srcPath
=
Paths
.
get
(
submissionDirectory
,
"src"
);
Path
resultPath
=
Paths
.
get
(
submissionDirectory
,
"result"
);
// Ensure directories exist
Files
.
createDirectories
(
testPath
);
...
...
@@ -62,29 +62,29 @@ public class ExecuteTestUtil {
// Clone stored test to testPath
LOG
.
debug
(
"Copying pre-downloaded unit test repo"
);
FileUtil
.
copyFolder
(
Paths
.
get
(
basePath
,
assignmentId
),
testPath
);
FileUtil
.
copyFolder
(
Paths
.
get
(
basePath
ProfessorUnitTests
,
assignmentId
),
testPath
);
LOG
.
debug
(
"Copying exercise manifest"
);
Files
.
copy
(
Paths
.
get
(
basePath
,
assignmentId
+
"_checkout"
,
CompetencyAssessmentUtil
.
EXERCISE_COMPETENCY_MANIFEST_FILE_NAME
),
Paths
.
get
(
basePath
ProfessorUnitTests
,
assignmentId
+
"_checkout"
,
CompetencyAssessmentUtil
.
EXERCISE_COMPETENCY_MANIFEST_FILE_NAME
),
testPath
.
resolve
(
CompetencyAssessmentUtil
.
EXERCISE_COMPETENCY_MANIFEST_FILE_NAME
)
);
LOG
.
debug
(
"Copying test config"
);
Files
.
copy
(
Paths
.
get
(
basePath
,
assignmentId
+
".txt"
),
Paths
.
get
(
containerTestDir
,
"config.txt"
)
Paths
.
get
(
basePath
ProfessorUnitTests
,
assignmentId
+
".txt"
),
Paths
.
get
(
submissionDirectory
,
"config.txt"
)
);
LOG
.
info
(
"Reading test config"
);
Matcher
config
=
RegexUtil
.
extractConfig
(
new
FileInputStream
(
Paths
.
get
(
containerTestDir
,
"config.txt"
).
toFile
()),
new
FileInputStream
(
Paths
.
get
(
submissionDirectory
,
"config.txt"
).
toFile
()),
Pattern
.
compile
(
RegexUtil
.
DTA_TESTCONFIGREGEX
)
);
String
image
;
if
(
config
==
null
)
{
config
=
RegexUtil
.
extractConfig
(
new
FileInputStream
(
Paths
.
get
(
containerTestDir
,
"config.txt"
).
toFile
()),
new
FileInputStream
(
Paths
.
get
(
submissionDirectory
,
"config.txt"
).
toFile
()),
Pattern
.
compile
(
RegexUtil
.
TESTCONFIGREGEX
)
);
if
(
config
==
null
)
{
...
...
@@ -157,7 +157,7 @@ public class ExecuteTestUtil {
throws
FileNotFoundException
{
// fetch repo url from original test upload
Pattern
pattern
=
Pattern
.
compile
(
RegexUtil
.
DTA_TESTCONFIGREGEX
);
File
configFile
=
Paths
.
get
(
basePath
,
assignmentId
+
".txt"
).
toFile
();
File
configFile
=
Paths
.
get
(
basePath
ProfessorUnitTests
,
assignmentId
+
".txt"
).
toFile
();
Matcher
config
=
RegexUtil
.
extractConfig
(
new
FileInputStream
(
configFile
),
pattern
);
String
testRepoURL
=
config
.
group
(
1
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets