-
Notifications
You must be signed in to change notification settings - Fork 5
Haskell Syntax Test and Haskell Runtime Test for Common Error Clustering #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
C8R15T14N
wants to merge
105
commits into
csware:commonerrors
Choose a base branch
from
C8R15T14N:hs-commonerrors
base: commonerrors
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
7e38df1
Add HaskellDynamicClusteringTestManager view and controller
C8R15T14N 051b48a
Add new HaskellRuntimeTest in testframework and in datamodel
C8R15T14N bab09b9
Rename HaskellDynamicClusteringTest to HaskellRuntimeTest
C8R15T14N 580aafc
User can now create haskell runtime tests
C8R15T14N b2d66ff
Implement view and controller for haskell runtime test
C8R15T14N f347855
Add basic groupHaskellRuntimeTestResults()
C8R15T14N 35d7c95
implement new Test for syntax tests and implement first regex clsutering
esat553 d8c08be
improve the new Haskell Syntax Test so it is like the Java Compile Test
esat553 92641b0
implement the clustering for the Java Syntax Test with a decent View
esat553 4a3f9b0
improve the clustering so that it is clustered based on pririty rathe…
esat553 4376465
add copyright declaration and remove debug console logs
esat553 6f8a20c
Place Haskell Runtime Test immediately below Haskell Syntax Test
C8R15T14N 6194b25
Show correct testtypes in overview "Funktionstest der Abgaben"
C8R15T14N 022f645
Change default title of haskell syntax/runtime test
C8R15T14N 762b853
Move haskell syntax classifier into own package
C8R15T14N 389035c
Small improvements: imports, formatting
C8R15T14N b9865a1
Forward requests from HaskellRuntimeTestManager to DockerTestManager
C8R15T14N bcc716a
Fix wrong html closing tags
C8R15T14N 3f47574
replace code duplicate with already defined function util function
esat553 a60dfe6
remove code duplicates
esat553 cdf93b3
reverse unnecessary code changes and focus on keeping DockerTest as i…
esat553 ee20e7b
remove unnecessary code fragments and modularizations
esat553 8e50e4d
fix bug where json is saved in a wrong format
esat553 76c7d6b
fix bug with closing div tag and reduce doubble declaration of variab…
esat553 442748f
Remove manual testcase definition from HaskellRuntimeTest
C8R15T14N 8716465
Add new line at end of each file
C8R15T14N 402f094
Add action "generateNewTestSteps" to haskell runtime test
C8R15T14N cded4cf
Formatting
C8R15T14N 63825f7
Make the Haskell RegEx Testing static
esat553 97596a4
implement stricter privacy settings for Methods and variables
esat553 474b947
delete methode for logging
esat553 677b2d4
fix formatting
esat553 5bf8441
Formatting
C8R15T14N 0ef83d9
Reformat using Eclipse formatter settings defined in ".settings"
C8R15T14N bc44843
Formatting
C8R15T14N aab38fc
Formatting
C8R15T14N cb66082
Formatting
C8R15T14N fc6d40e
Edit test using HaskellRuntimeTestManager instead of DockerTestManager
C8R15T14N 9e9a815
Add function evaluateWithGhci() in HaskellRuntimeTestManager
C8R15T14N 7f37f75
Add hashable package to safe-docker Dockerfile
C8R15T14N 6eb0067
Disable form button and show "Bitte warten..." while ghci expressions…
C8R15T14N f1a7458
Load model solution in evaluateWithGhci(); show errors in view
C8R15T14N 9bc3210
Use URLEncoding to show error messages occuring in evaluateWithGhci()
C8R15T14N b22eb12
Add base implementation of haskell runtime testcase generator
C8R15T14N 235106c
Correctly escape arguments to ghci -e; minor fixes
C8R15T14N fa8799c
Change datamodel: store haskell identifiers of each haskell runtime test
C8R15T14N a73f8eb
Browse haskell file, list all haskell identifiers and generate testca…
C8R15T14N 21fc4c7
Fix warnings and stricter visibilities
C8R15T14N b750f35
Minor improvements in HaskellRuntimeTestManagerView
C8R15T14N 95db938
Delete haskell identifiers before (re-)browsing the file
C8R15T14N 085e422
Duplicate/delete a selection of testcases; group testcases by function
C8R15T14N 55f217e
Add master checkbox to select all testcases of a function at once
C8R15T14N 53a191f
Only show "Testschritte bearbeiten" if any test step exists
C8R15T14N 4e6106e
Wrap testcode in ghci -e '...'; testcases now runnable with model sol…
C8R15T14N 2aced1f
Handle non-terminating ghci expressions when generating haskell runti…
C8R15T14N 4078a68
Wrap haskell runtime testcode expression in catch and timeout to hand…
C8R15T14N bcaf82c
Implement basic haskell runtime clustering
C8R15T14N bf76a20
Add ShowHaskellRuntimeTestResult view fragment
C8R15T14N 179a56e
Re-use existing SAFE_DOCKER_SCRIPT constant defined in DockerTest
C8R15T14N cb73c2e
Throw IllegalArgumentException instead of IOException when haskell id…
C8R15T14N b929062
Fix XSS vulnerabilities and move CSS styling into <style> section
C8R15T14N 975a2a6
Move CSS styling into si.css
C8R15T14N 37ef4a1
remove unnecessary code from file
esat553 62d26e2
Differentiate between different exceptions by printing the exception …
C8R15T14N a8ade07
Bugfix: add import of Data.Hashable to DockerTestSteps (needed for te…
C8R15T14N 6a71005
Improve view fragment ShowHaskellRuntimeTestResult
C8R15T14N 4e5a006
Optimize tables in haskell runtime test manager for long content insi…
C8R15T14N 0d89dc9
Run testcases with modelsolution directly from HaskellRuntimeTestMana…
C8R15T14N 7cf187b
Continue running haskell runtime testcases, even if a previous case f…
C8R15T14N 2751db8
Don't hide member field testCode in DockerTestStepData constructor
C8R15T14N 063a0a4
Make all methods static in HaskellRuntimeTestManager if possible
C8R15T14N c00b5c4
Remove old LOG.info() calls
C8R15T14N 3b868a1
Bugfix: explicitly load .hs file using ":load"
C8R15T14N 663bd90
Show total number of test steps in HaskellRuntimeTestManagerView
C8R15T14N c2cc6c5
Increase (default) safe-docker timeout to 45s (when generating and wh…
C8R15T14N 6acde5e
Checkboxes to simplify or expand the testcode
C8R15T14N 6ba3589
Enter and leave edit mode for each testcase individually (saving the …
C8R15T14N 12da235
Add action "editSingleTestStep": run the user-entered testcode to com…
C8R15T14N 624b0ea
Create common error title in JSON format for haskell runtime tests
C8R15T14N a01d832
Add view fragment ShowHaskellRuntimeCommonErrorTitle to format common…
C8R15T14N f3f76c8
Fix ArrayIndexOutOfBoundsException caused by newer ghci version
C8R15T14N 4003f8e
Use debian:bookworm in Dockerfile, since debian:buster is an archived…
C8R15T14N 3cbeef4
Add experimental type defaulting; this uses "default (Int, Double, ()…
C8R15T14N 8e773be
Pretty print cyclic int mappers in ShowHaskellRuntimeCommonErrorTitle…
C8R15T14N 13ad123
Remove old TODO comment
C8R15T14N 5465d33
Remove line numbers from exceptions (should not be considered when cl…
C8R15T14N b1327e7
Cluster haskell runtime test results for each function individually
C8R15T14N 24704be
implement Version 2 of regex clustering
esat553 390106b
implement Unit Test for HaskellSyntaxTest
esat553 9f6d7f0
resolve warnings
esat553 6b84098
resolve warnings
esat553 e21228c
resolve warnings
esat553 1518302
adjust copyright
esat553 a21b614
fix minor bugs in regex pattern
esat553 153de00
fix a sematic error in the HaskellSyntaxTestTest.java
esat553 f708c7c
fix some clustering regex for downwards and upwards compatibility
esat553 e503f1d
resolve warnings and fix minor bug for compatibility
esat553 5c8bd61
Implement custom type defaulting for common type classes
C8R15T14N 315023e
Bugfix: set type of CyclicIntMap in parentheses, for example "CyclicI…
C8R15T14N 0662488
Remove default type signature from identifier table; disable generato…
C8R15T14N 0c44a58
Remove experimental type defaulting feature
C8R15T14N bcc1eff
Add form to manually add function identifiers
C8R15T14N 7036aa8
Remove resolved TODOs
C8R15T14N 60eada5
Allow generating test cases for constants
C8R15T14N 407fc6d
Stricter Exception normalization
C8R15T14N File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ain/java/de/tuclausthal/submissioninterface/persistence/datamodel/HaskellRuntimeTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * Copyright 2025 Sven Strickroth <[email protected]> | ||
| * Copyright 2025 Christian Wagner <[email protected]> | ||
| * | ||
| * This file is part of the GATE. | ||
| * | ||
| * GATE is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License version 3 as | ||
| * published by the Free Software Foundation. | ||
| * | ||
| * GATE is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with GATE. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package de.tuclausthal.submissioninterface.persistence.datamodel; | ||
|
|
||
| import de.tuclausthal.submissioninterface.testframework.tests.AbstractTest; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.Transient; | ||
|
|
||
|
|
||
| /** | ||
| * Haskell runtime test, extends the DockerTest by automatically generating haskell testcases and by clustering | ||
| * @author Christian Wagner | ||
| */ | ||
| @Entity | ||
| public class HaskellRuntimeTest extends DockerTest { | ||
| @Override | ||
| @Transient | ||
| public AbstractTest<DockerTest> getTestImpl() { | ||
| return new de.tuclausthal.submissioninterface.testframework.tests.impl.HaskellRuntimeTest(this); | ||
| } | ||
| } |
53 changes: 53 additions & 0 deletions
53
...main/java/de/tuclausthal/submissioninterface/persistence/datamodel/HaskellSyntaxTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Copyright 2025 Sven Strickroth <[email protected]> | ||
| * Copyright 2025 Esat Avci <[email protected]> | ||
| * | ||
| * This file is part of the GATE. | ||
| * | ||
| * GATE is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License version 3 as | ||
| * published by the Free Software Foundation. | ||
| * | ||
| * GATE is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with GATE. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
| package de.tuclausthal.submissioninterface.persistence.datamodel; | ||
|
|
||
| import java.lang.invoke.MethodHandles; | ||
|
|
||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.Transient; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||
|
|
||
| import de.tuclausthal.submissioninterface.testframework.tests.AbstractTest; | ||
|
|
||
| @Entity | ||
| public class HaskellSyntaxTest extends Test { | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| @Override | ||
| @Transient | ||
| @JsonIgnore | ||
| public AbstractTest<HaskellSyntaxTest> getTestImpl() { | ||
| return new de.tuclausthal.submissioninterface.testframework.tests.impl.HaskellSyntaxTest(this); | ||
| } | ||
|
|
||
| @Override | ||
| @Transient | ||
| public boolean TutorsCanRun() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return MethodHandles.lookup().lookupClass().getSimpleName() | ||
| + " (" + Integer.toHexString(hashCode()) + "): id:" + getId() | ||
| + "; testtitle:" + getTestTitle(); | ||
| } | ||
| } |
160 changes: 160 additions & 0 deletions
160
...ava/de/tuclausthal/submissioninterface/servlets/controller/HaskellRuntimeTestManager.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| /* | ||
| * Copyright 2025 Sven Strickroth <[email protected]> | ||
| * Copyright 2025 Christian Wagner <[email protected]> | ||
| * | ||
| * This file is part of the GATE. | ||
| * | ||
| * GATE is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License version 3 as | ||
| * published by the Free Software Foundation. | ||
| * | ||
| * GATE is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with GATE. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package de.tuclausthal.submissioninterface.servlets.controller; | ||
|
|
||
| import de.tuclausthal.submissioninterface.persistence.dao.DAOFactory; | ||
| import de.tuclausthal.submissioninterface.persistence.dao.ParticipationDAOIf; | ||
| import de.tuclausthal.submissioninterface.persistence.dao.TestDAOIf; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.Test; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.HaskellRuntimeTest; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.DockerTestStep; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.Participation; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.ParticipationRole; | ||
| import de.tuclausthal.submissioninterface.servlets.GATEController; | ||
| import de.tuclausthal.submissioninterface.servlets.RequestAdapter; | ||
| import de.tuclausthal.submissioninterface.servlets.view.HaskellRuntimeTestManagerView; | ||
| import de.tuclausthal.submissioninterface.servlets.view.MessageView; | ||
| import de.tuclausthal.submissioninterface.util.Util; | ||
| import jakarta.servlet.ServletException; | ||
| import jakarta.servlet.http.HttpServlet; | ||
| import jakarta.servlet.http.HttpServletRequest; | ||
| import jakarta.servlet.http.HttpServletResponse; | ||
| import org.hibernate.Session; | ||
| import org.hibernate.Transaction; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.Serial; | ||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Controller-Servlet for clustering haskell submissions based on common errors (dynamic/runtime analysis). | ||
| * This servlet allows advisors to manage (add, edit, remove) test steps. | ||
| * | ||
| * @author Christian Wagner | ||
| */ | ||
| @GATEController | ||
| public class HaskellRuntimeTestManager extends HttpServlet { | ||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| @Override | ||
| public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { | ||
| // similar code in DockerTestManager | ||
| Session session = RequestAdapter.getSession(request); | ||
|
|
||
| TestDAOIf testDAOIf = DAOFactory.TestDAOIf(session); | ||
| Test test = testDAOIf.getTest(Util.parseInteger(request.getParameter("testid"), 0)); | ||
| if (!(test instanceof HaskellRuntimeTest haskellRuntimeTest)) { | ||
| response.setStatus(HttpServletResponse.SC_NOT_FOUND); | ||
| request.setAttribute("title", "Test nicht gefunden"); | ||
| getServletContext().getNamedDispatcher(MessageView.class.getSimpleName()).forward(request, response); | ||
| return; | ||
| } | ||
|
|
||
| ParticipationDAOIf participationDAO = DAOFactory.ParticipationDAOIf(session); | ||
| Participation participation = participationDAO.getParticipation(RequestAdapter.getUser(request), haskellRuntimeTest.getTask().getTaskGroup().getLecture()); | ||
| if (participation == null || participation.getRoleType() != ParticipationRole.ADVISOR) { | ||
| response.sendError(HttpServletResponse.SC_FORBIDDEN, "insufficient rights"); | ||
| return; | ||
| } | ||
|
|
||
| request.setAttribute("test", haskellRuntimeTest); | ||
| getServletContext().getNamedDispatcher(HaskellRuntimeTestManagerView.class.getSimpleName()).forward(request, response); | ||
| } | ||
|
|
||
| @Override | ||
| public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { | ||
| // similar code in DockerTestManager | ||
| Session session = RequestAdapter.getSession(request); | ||
| TestDAOIf testDAOIf = DAOFactory.TestDAOIf(session); | ||
| Test test = testDAOIf.getTest(Util.parseInteger(request.getParameter("testid"), 0)); | ||
| if (!(test instanceof HaskellRuntimeTest haskellRuntimeTest)) { | ||
| response.setStatus(HttpServletResponse.SC_NOT_FOUND); | ||
| request.setAttribute("title", "Test nicht gefunden"); | ||
| getServletContext().getNamedDispatcher(MessageView.class.getSimpleName()).forward(request, response); | ||
| return; | ||
| } | ||
|
|
||
| ParticipationDAOIf participationDAO = DAOFactory.ParticipationDAOIf(session); | ||
| Participation participation = participationDAO.getParticipation(RequestAdapter.getUser(request), haskellRuntimeTest.getTask().getTaskGroup().getLecture()); | ||
| if (participation == null || participation.getRoleType() != ParticipationRole.ADVISOR) { | ||
| response.sendError(HttpServletResponse.SC_FORBIDDEN, "insufficient rights"); | ||
| return; | ||
| } | ||
|
|
||
| if ("edittest".equals(request.getParameter("action"))) { | ||
| Transaction tx = session.beginTransaction(); | ||
| haskellRuntimeTest.setTestTitle(request.getParameter("title")); | ||
| haskellRuntimeTest.setForTutors(request.getParameter("tutortest") != null); | ||
| haskellRuntimeTest.setTimesRunnableByStudents(Util.parseInteger(request.getParameter("timesRunnableByStudents"), 0)); | ||
| haskellRuntimeTest.setGiveDetailsToStudents(request.getParameter("giveDetailsToStudents") != null); | ||
| haskellRuntimeTest.setPreparationShellCode(request.getParameter("preparationcode").replaceAll("\r\n", "\n")); // TODO@CHW: can getParameter("preparationcode") be null? | ||
| tx.commit(); | ||
| response.sendRedirect(Util.generateRedirectURL(HaskellRuntimeTestManager.class.getSimpleName() + "?testid=" + haskellRuntimeTest.getId(), response)); | ||
| return; | ||
| } else if ("addNewStep".equals(request.getParameter("action"))) { | ||
| String title = request.getParameter("title"); | ||
| String testCode = request.getParameter("testcode").replaceAll("\r\n", "\n"); | ||
| String expect = request.getParameter("expect").replaceAll("\r\n", "\n"); | ||
| DockerTestStep newStep = new DockerTestStep(haskellRuntimeTest, title, testCode, expect); | ||
| Transaction tx = session.beginTransaction(); | ||
| session.persist(newStep); | ||
| tx.commit(); | ||
| response.sendRedirect(Util.generateRedirectURL(HaskellRuntimeTestManager.class.getSimpleName() + "?testid=" + haskellRuntimeTest.getId(), response)); | ||
| return; | ||
| } else if ("updateStep".equals(request.getParameter("action"))) { | ||
| DockerTestStep step = null; | ||
| for (DockerTestStep istep : haskellRuntimeTest.getTestSteps()) { | ||
| if (istep.getTeststepid() == Util.parseInteger(request.getParameter("teststepid"), -1)) { | ||
| step = istep; | ||
| break; | ||
| } | ||
| } | ||
| if (step != null) { | ||
| Transaction tx = session.beginTransaction(); | ||
| String title = request.getParameter("title"); | ||
| String testCode = request.getParameter("testcode").replaceAll("\r\n", "\n"); | ||
| step.setTitle(title); | ||
| step.setTestcode(testCode); | ||
| step.setExpect(Objects.toString(request.getParameter("expect"), "").replaceAll("\r\n", "\n")); | ||
| tx.commit(); | ||
| } | ||
| response.sendRedirect(Util.generateRedirectURL(HaskellRuntimeTestManager.class.getSimpleName() + "?testid=" + haskellRuntimeTest.getId(), response)); | ||
| return; | ||
| } else if ("deleteStep".equals(request.getParameter("action"))) { | ||
| DockerTestStep step = null; | ||
| for (DockerTestStep istep : haskellRuntimeTest.getTestSteps()) { | ||
| if (istep.getTeststepid() == Util.parseInteger(request.getParameter("teststepid"), -1)) { | ||
| step = istep; | ||
| break; | ||
| } | ||
| } | ||
| if (step != null) { | ||
| Transaction tx = session.beginTransaction(); | ||
| session.remove(step); | ||
| tx.commit(); | ||
| } | ||
| response.sendRedirect(Util.generateRedirectURL(HaskellRuntimeTestManager.class.getSimpleName() + "?testid=" + haskellRuntimeTest.getId(), response)); | ||
| return; | ||
| } | ||
|
|
||
| response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "invalid request"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,8 @@ | |
| import de.tuclausthal.submissioninterface.persistence.datamodel.CommentsMetricTest; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.CompileTest; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.DockerTest; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.HaskellSyntaxTest; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.HaskellRuntimeTest; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.JUnitTest; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.JavaAdvancedIOTest; | ||
| import de.tuclausthal.submissioninterface.persistence.datamodel.Participation; | ||
|
|
@@ -153,6 +155,28 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr | |
| test.setPreparationShellCode(preparationcode.replaceAll("\r\n", "\n")); | ||
| session.getTransaction().commit(); | ||
| response.sendRedirect(Util.generateRedirectURL(DockerTestManager.class.getSimpleName() + "?testid=" + test.getId(), response)); | ||
| } else if ("saveNewTest".equals(request.getParameter("action")) && "haskellsyntax".equals(request.getParameter("type"))) { | ||
| session.beginTransaction(); | ||
| TestDAOIf testDAO = DAOFactory.TestDAOIf(session); | ||
| HaskellSyntaxTest test = testDAO.createHaskellSyntaxTest(task); | ||
|
|
||
| int timesRunnableByStudents = Util.parseInteger(request.getParameter("timesRunnableByStudents"), 0); | ||
| boolean tutortest = request.getParameter("tutortest") != null; | ||
| String title = request.getParameter("title"); | ||
| String description = request.getParameter("description"); | ||
|
|
||
| test.setTimesRunnableByStudents(timesRunnableByStudents); | ||
| test.setForTutors(tutortest); | ||
| test.setTestTitle(title); | ||
| test.setTestDescription(description); | ||
| test.setGiveDetailsToStudents(request.getParameter("giveDetailsToStudents") != null); | ||
| test.setTimeout(15); // falls du es trotzdem festlegen willst | ||
| session.getTransaction().commit(); | ||
|
|
||
| // Zurück zur Aufgabenübersicht (wie bei CompileTest) | ||
| response.sendRedirect(Util.generateRedirectURL(TaskManager.class.getSimpleName() | ||
| + "?action=editTask&lecture=" + task.getTaskGroup().getLecture().getId() | ||
| + "&taskid=" + task.getTaskid(), response)); | ||
|
||
| } else if ("saveNewTest".equals(request.getParameter("action")) && "checklist".equals(request.getParameter("type"))) { | ||
| session.beginTransaction(); | ||
| TestDAOIf testDAO = DAOFactory.TestDAOIf(session); | ||
|
|
@@ -272,6 +296,27 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr | |
| test.setGiveDetailsToStudents(request.getParameter("giveDetailsToStudents") != null); | ||
| session.getTransaction().commit(); | ||
| response.sendRedirect(Util.generateRedirectURL(TaskManager.class.getSimpleName() + "?action=editTask&lecture=" + task.getTaskGroup().getLecture().getId() + "&taskid=" + task.getTaskid(), response)); | ||
| } else if ("saveNewTest".equals(request.getParameter("action")) && "haskellruntime".equals(request.getParameter("type"))) { | ||
| // TODO@CHW: make sure all parameters accessed by request.getParameter() are defined in HaskellRuntimeTestManagerView | ||
|
|
||
| session.beginTransaction(); | ||
| TestDAOIf testDAO = DAOFactory.TestDAOIf(session); | ||
|
|
||
| HaskellRuntimeTest test = testDAO.createHaskellRuntimeTest(task); | ||
| test.setTimesRunnableByStudents(Util.parseInteger(request.getParameter("timesRunnableByStudents"), 0)); | ||
| test.setForTutors(request.getParameter("tutortest") != null); | ||
| test.setTestTitle(request.getParameter("title")); | ||
| test.setTestDescription(request.getParameter("description")); | ||
| test.setTimeout(Util.parseInteger(request.getParameter("timeout"), 15)); | ||
| test.setGiveDetailsToStudents(request.getParameter("giveDetailsToStudents") != null); | ||
| String preparationCode = request.getParameter("preparationcode"); | ||
| if (preparationCode == null) preparationCode = ""; | ||
| test.setPreparationShellCode( | ||
| preparationCode.replaceAll("\r\n", "\n") | ||
| ); | ||
|
|
||
| session.getTransaction().commit(); | ||
| response.sendRedirect(Util.generateRedirectURL(HaskellRuntimeTestManager.class.getSimpleName() + "?testid=" + test.getId(), response)); | ||
| } else if ("deleteTest".equals(request.getParameter("action"))) { | ||
| TestDAOIf testDAO = DAOFactory.TestDAOIf(session); | ||
| session.beginTransaction(); | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.