Skip to content
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
7e38df1
Add HaskellDynamicClusteringTestManager view and controller
C8R15T14N Apr 6, 2025
051b48a
Add new HaskellRuntimeTest in testframework and in datamodel
C8R15T14N Apr 13, 2025
bab09b9
Rename HaskellDynamicClusteringTest to HaskellRuntimeTest
C8R15T14N Apr 13, 2025
580aafc
User can now create haskell runtime tests
C8R15T14N Apr 13, 2025
b2d66ff
Implement view and controller for haskell runtime test
C8R15T14N Apr 14, 2025
f347855
Add basic groupHaskellRuntimeTestResults()
C8R15T14N Apr 14, 2025
35d7c95
implement new Test for syntax tests and implement first regex clsutering
esat553 Apr 12, 2025
d8c08be
improve the new Haskell Syntax Test so it is like the Java Compile Test
esat553 Apr 13, 2025
92641b0
implement the clustering for the Java Syntax Test with a decent View
esat553 Apr 14, 2025
4a3f9b0
improve the clustering so that it is clustered based on pririty rathe…
esat553 Apr 14, 2025
4376465
add copyright declaration and remove debug console logs
esat553 Apr 17, 2025
6f8a20c
Place Haskell Runtime Test immediately below Haskell Syntax Test
C8R15T14N Apr 17, 2025
6194b25
Show correct testtypes in overview "Funktionstest der Abgaben"
C8R15T14N Apr 17, 2025
022f645
Change default title of haskell syntax/runtime test
C8R15T14N Apr 17, 2025
762b853
Move haskell syntax classifier into own package
C8R15T14N Apr 21, 2025
389035c
Small improvements: imports, formatting
C8R15T14N Apr 21, 2025
b9865a1
Forward requests from HaskellRuntimeTestManager to DockerTestManager
C8R15T14N Apr 22, 2025
bcc716a
Fix wrong html closing tags
C8R15T14N Apr 22, 2025
3f47574
replace code duplicate with already defined function util function
esat553 Apr 22, 2025
a60dfe6
remove code duplicates
esat553 Apr 23, 2025
cdf93b3
reverse unnecessary code changes and focus on keeping DockerTest as i…
esat553 Apr 23, 2025
ee20e7b
remove unnecessary code fragments and modularizations
esat553 Apr 24, 2025
8e50e4d
fix bug where json is saved in a wrong format
esat553 Apr 24, 2025
76c7d6b
fix bug with closing div tag and reduce doubble declaration of variab…
esat553 Apr 24, 2025
442748f
Remove manual testcase definition from HaskellRuntimeTest
C8R15T14N Apr 25, 2025
8716465
Add new line at end of each file
C8R15T14N May 8, 2025
402f094
Add action "generateNewTestSteps" to haskell runtime test
C8R15T14N May 8, 2025
cded4cf
Formatting
C8R15T14N May 8, 2025
63825f7
Make the Haskell RegEx Testing static
esat553 May 9, 2025
97596a4
implement stricter privacy settings for Methods and variables
esat553 May 9, 2025
474b947
delete methode for logging
esat553 May 9, 2025
677b2d4
fix formatting
esat553 May 10, 2025
5bf8441
Formatting
C8R15T14N May 11, 2025
0ef83d9
Reformat using Eclipse formatter settings defined in ".settings"
C8R15T14N May 15, 2025
bc44843
Formatting
C8R15T14N May 15, 2025
aab38fc
Formatting
C8R15T14N May 18, 2025
cb66082
Formatting
C8R15T14N May 18, 2025
fc6d40e
Edit test using HaskellRuntimeTestManager instead of DockerTestManager
C8R15T14N Jun 12, 2025
9e9a815
Add function evaluateWithGhci() in HaskellRuntimeTestManager
C8R15T14N Jun 15, 2025
7f37f75
Add hashable package to safe-docker Dockerfile
C8R15T14N Jun 15, 2025
6eb0067
Disable form button and show "Bitte warten..." while ghci expressions…
C8R15T14N Jun 15, 2025
f1a7458
Load model solution in evaluateWithGhci(); show errors in view
C8R15T14N Jun 15, 2025
9bc3210
Use URLEncoding to show error messages occuring in evaluateWithGhci()
C8R15T14N Jun 15, 2025
b22eb12
Add base implementation of haskell runtime testcase generator
C8R15T14N Jun 27, 2025
235106c
Correctly escape arguments to ghci -e; minor fixes
C8R15T14N Jun 29, 2025
fa8799c
Change datamodel: store haskell identifiers of each haskell runtime test
C8R15T14N Jun 29, 2025
a73f8eb
Browse haskell file, list all haskell identifiers and generate testca…
C8R15T14N Jul 4, 2025
21fc4c7
Fix warnings and stricter visibilities
C8R15T14N Jul 4, 2025
b750f35
Minor improvements in HaskellRuntimeTestManagerView
C8R15T14N Jul 4, 2025
95db938
Delete haskell identifiers before (re-)browsing the file
C8R15T14N Jul 4, 2025
085e422
Duplicate/delete a selection of testcases; group testcases by function
C8R15T14N Jul 5, 2025
55f217e
Add master checkbox to select all testcases of a function at once
C8R15T14N Jul 5, 2025
53a191f
Only show "Testschritte bearbeiten" if any test step exists
C8R15T14N Jul 5, 2025
4e6106e
Wrap testcode in ghci -e '...'; testcases now runnable with model sol…
C8R15T14N Jul 6, 2025
2aced1f
Handle non-terminating ghci expressions when generating haskell runti…
C8R15T14N Jul 6, 2025
4078a68
Wrap haskell runtime testcode expression in catch and timeout to hand…
C8R15T14N Jul 6, 2025
bcaf82c
Implement basic haskell runtime clustering
C8R15T14N Jul 7, 2025
bf76a20
Add ShowHaskellRuntimeTestResult view fragment
C8R15T14N Jul 7, 2025
179a56e
Re-use existing SAFE_DOCKER_SCRIPT constant defined in DockerTest
C8R15T14N Jul 9, 2025
cb73c2e
Throw IllegalArgumentException instead of IOException when haskell id…
C8R15T14N Jul 9, 2025
b929062
Fix XSS vulnerabilities and move CSS styling into <style> section
C8R15T14N Jul 11, 2025
975a2a6
Move CSS styling into si.css
C8R15T14N Jul 11, 2025
37ef4a1
remove unnecessary code from file
esat553 Jul 11, 2025
62d26e2
Differentiate between different exceptions by printing the exception …
C8R15T14N Jul 12, 2025
a8ade07
Bugfix: add import of Data.Hashable to DockerTestSteps (needed for te…
C8R15T14N Jul 12, 2025
6a71005
Improve view fragment ShowHaskellRuntimeTestResult
C8R15T14N Jul 12, 2025
4e5a006
Optimize tables in haskell runtime test manager for long content insi…
C8R15T14N Jul 12, 2025
0d89dc9
Run testcases with modelsolution directly from HaskellRuntimeTestMana…
C8R15T14N Jul 12, 2025
7cf187b
Continue running haskell runtime testcases, even if a previous case f…
C8R15T14N Jul 13, 2025
2751db8
Don't hide member field testCode in DockerTestStepData constructor
C8R15T14N Jul 13, 2025
063a0a4
Make all methods static in HaskellRuntimeTestManager if possible
C8R15T14N Jul 13, 2025
c00b5c4
Remove old LOG.info() calls
C8R15T14N Jul 13, 2025
3b868a1
Bugfix: explicitly load .hs file using ":load"
C8R15T14N Jul 13, 2025
663bd90
Show total number of test steps in HaskellRuntimeTestManagerView
C8R15T14N Jul 13, 2025
c2cc6c5
Increase (default) safe-docker timeout to 45s (when generating and wh…
C8R15T14N Jul 13, 2025
6acde5e
Checkboxes to simplify or expand the testcode
C8R15T14N Jul 13, 2025
6ba3589
Enter and leave edit mode for each testcase individually (saving the …
C8R15T14N Jul 13, 2025
12da235
Add action "editSingleTestStep": run the user-entered testcode to com…
C8R15T14N Jul 13, 2025
624b0ea
Create common error title in JSON format for haskell runtime tests
C8R15T14N Jul 16, 2025
a01d832
Add view fragment ShowHaskellRuntimeCommonErrorTitle to format common…
C8R15T14N Jul 18, 2025
f3f76c8
Fix ArrayIndexOutOfBoundsException caused by newer ghci version
C8R15T14N Jul 19, 2025
4003f8e
Use debian:bookworm in Dockerfile, since debian:buster is an archived…
C8R15T14N Jul 19, 2025
3cbeef4
Add experimental type defaulting; this uses "default (Int, Double, ()…
C8R15T14N Jul 19, 2025
8e773be
Pretty print cyclic int mappers in ShowHaskellRuntimeCommonErrorTitle…
C8R15T14N Jul 19, 2025
13ad123
Remove old TODO comment
C8R15T14N Jul 19, 2025
5465d33
Remove line numbers from exceptions (should not be considered when cl…
C8R15T14N Jul 19, 2025
b1327e7
Cluster haskell runtime test results for each function individually
C8R15T14N Jul 19, 2025
24704be
implement Version 2 of regex clustering
esat553 Jul 22, 2025
390106b
implement Unit Test for HaskellSyntaxTest
esat553 Jul 22, 2025
9f6d7f0
resolve warnings
esat553 Jul 22, 2025
6b84098
resolve warnings
esat553 Jul 22, 2025
e21228c
resolve warnings
esat553 Jul 22, 2025
1518302
adjust copyright
esat553 Jul 27, 2025
a21b614
fix minor bugs in regex pattern
esat553 Jul 27, 2025
153de00
fix a sematic error in the HaskellSyntaxTestTest.java
esat553 Jul 27, 2025
f708c7c
fix some clustering regex for downwards and upwards compatibility
esat553 Jul 28, 2025
e503f1d
resolve warnings and fix minor bug for compatibility
esat553 Jul 28, 2025
5c8bd61
Implement custom type defaulting for common type classes
C8R15T14N Aug 23, 2025
315023e
Bugfix: set type of CyclicIntMap in parentheses, for example "CyclicI…
C8R15T14N Aug 23, 2025
0662488
Remove default type signature from identifier table; disable generato…
C8R15T14N Aug 23, 2025
0c44a58
Remove experimental type defaulting feature
C8R15T14N Aug 23, 2025
bcc1eff
Add form to manually add function identifiers
C8R15T14N Aug 23, 2025
7036aa8
Remove resolved TODOs
C8R15T14N Aug 23, 2025
60eada5
Allow generating test cases for constants
C8R15T14N Aug 25, 2025
407fc6d
Stricter Exception normalization
C8R15T14N Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,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.Task;
Expand Down Expand Up @@ -62,6 +64,10 @@ public interface TestDAOIf {

DockerTest createDockerTest(Task task);

HaskellSyntaxTest createHaskellSyntaxTest(Task task);

HaskellRuntimeTest createHaskellRuntimeTest(Task task);

ChecklistTest createChecklistTest(Task task);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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.Task;
Expand Down Expand Up @@ -162,6 +164,24 @@ public DockerTest createDockerTest(Task task) {
return test;
}

@Override
public HaskellSyntaxTest createHaskellSyntaxTest(Task task) {
Session session = getSession();
HaskellSyntaxTest test = new HaskellSyntaxTest();
test.setTask(task);
session.persist(test);
return test;
}

@Override
public HaskellRuntimeTest createHaskellRuntimeTest(Task task) {
Session session = getSession();
HaskellRuntimeTest test = new HaskellRuntimeTest();
test.setTask(task);
session.persist(test);
return test;
}

@Override
public ChecklistTest createChecklistTest(Task task) {
Session session = getSession();
Expand Down
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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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 jakarta.persistence.Entity;
import jakarta.persistence.Transient;


import de.tuclausthal.submissioninterface.testframework.tests.AbstractTest;

@Entity
public class HaskellSyntaxTest extends DockerTest {
@Override
@Transient
public AbstractTest<DockerTest> getTestImpl() {
return new de.tuclausthal.submissioninterface.testframework.tests.impl.HaskellSyntaxTest(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
import de.tuclausthal.submissioninterface.persistence.dao.ParticipationDAOIf;
import de.tuclausthal.submissioninterface.persistence.dao.TestDAOIf;
import de.tuclausthal.submissioninterface.persistence.datamodel.DockerTest;
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.persistence.datamodel.Test;
import de.tuclausthal.submissioninterface.servlets.GATEController;
import de.tuclausthal.submissioninterface.servlets.RequestAdapter;
import de.tuclausthal.submissioninterface.servlets.view.DockerTestManagerOverView;
import de.tuclausthal.submissioninterface.servlets.view.HaskellRuntimeTestManagerView;
import de.tuclausthal.submissioninterface.servlets.view.MessageView;
import de.tuclausthal.submissioninterface.util.Util;

Expand Down Expand Up @@ -71,7 +73,11 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
}

request.setAttribute("test", test);
getServletContext().getNamedDispatcher(DockerTestManagerOverView.class.getSimpleName()).forward(request, response);

String testManagerViewClassSimpleName = test instanceof HaskellRuntimeTest ?
HaskellRuntimeTestManagerView.class.getSimpleName() : DockerTestManagerOverView.class.getSimpleName();

getServletContext().getNamedDispatcher(testManagerViewClassSimpleName).forward(request, response);
}

@Override
Expand All @@ -93,6 +99,9 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
return;
}

String testManagerClassSimpleName = test instanceof HaskellRuntimeTest ?
HaskellRuntimeTestManager.class.getSimpleName() : DockerTestManager.class.getSimpleName();

if ("edittest".equals(request.getParameter("action"))) {
Transaction tx = session.beginTransaction();
test.setTestTitle(request.getParameter("title"));
Expand All @@ -101,7 +110,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
test.setGiveDetailsToStudents(request.getParameter("giveDetailsToStudents") != null);
test.setPreparationShellCode(request.getParameter("preparationcode").replaceAll("\r\n", "\n"));
tx.commit();
response.sendRedirect(Util.generateRedirectURL(DockerTestManager.class.getSimpleName() + "?testid=" + test.getId(), response));
response.sendRedirect(Util.generateRedirectURL(testManagerClassSimpleName + "?testid=" + test.getId(), response));
return;
} else if ("addNewStep".equals(request.getParameter("action"))) {
String title = request.getParameter("title");
Expand All @@ -111,7 +120,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
Transaction tx = session.beginTransaction();
session.persist(newStep);
tx.commit();
response.sendRedirect(Util.generateRedirectURL(DockerTestManager.class.getSimpleName() + "?testid=" + test.getId(), response));
response.sendRedirect(Util.generateRedirectURL(testManagerClassSimpleName + "?testid=" + test.getId(), response));
return;
} else if ("updateStep".equals(request.getParameter("action"))) {
DockerTestStep step = null;
Expand All @@ -130,7 +139,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
step.setExpect(Objects.toString(request.getParameter("expect"), "").replaceAll("\r\n", "\n"));
tx.commit();
}
response.sendRedirect(Util.generateRedirectURL(DockerTestManager.class.getSimpleName() + "?testid=" + test.getId(), response));
response.sendRedirect(Util.generateRedirectURL(testManagerClassSimpleName + "?testid=" + test.getId(), response));
return;
} else if ("deleteStep".equals(request.getParameter("action"))) {
DockerTestStep step = null;
Expand All @@ -145,7 +154,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
session.remove(step);
tx.commit();
}
response.sendRedirect(Util.generateRedirectURL(DockerTestManager.class.getSimpleName() + "?testid=" + test.getId(), response));
response.sendRedirect(Util.generateRedirectURL(testManagerClassSimpleName + "?testid=" + test.getId(), response));
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.servlets.GATEController;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.Serial;

/**
* 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 {
getServletContext().getNamedDispatcher(DockerTestManager.class.getSimpleName()).forward(request, response);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to be good style to just forward the calls to the DockerTestManager, i.e. this servlet is not necessary.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having different views for the HaskellTest is okay.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to be good style to just forward the calls to the DockerTestManager, i.e. this servlet is not necessary.

The HaskellRuntimeTestManager controller servlet requires some additional functionality that is not contained in the DockerTestManager controller servlet (this is still work in progress). My idea was to handle all actions that are specific to the haskell runtime test inside of the HaskellRuntimeTestManager, and forward all other calls to the DockerTestManager.

As an example, I just implemented a new "generateNewTestSteps" action inside the HaskellRuntimeTestManager, that automatically generates a certain number of haskell runtime testcases. All other actions are forwarded to the DockerTestManager (see new commit 402f094).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it should be added as soon as it is required.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it should be added as soon as it is required.

My choice of words may have been misleading - by saying "as an example", I didn’t mean that the "generateNewTestSteps" action is optional or merely illustrative for my idea. It is definitely required, since automatically generating haskell testcases is a major part of my bachelor thesis.

What I meant is that I expect to add more actions in the future that follow the same pattern - in that sense, "generateNewTestSteps" serves "as an example" for them.

}

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
getServletContext().getNamedDispatcher(DockerTestManager.class.getSimpleName()).forward(request, response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are lecture, taskid and testid necessary?

} else if ("saveNewTest".equals(request.getParameter("action")) && "checklist".equals(request.getParameter("type"))) {
session.beginTransaction();
TestDAOIf testDAO = DAOFactory.TestDAOIf(session);
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
out.println("<h2>Testschritte</h2>");

for (DockerTestStep step : test.getTestSteps()) {
out.println("<h3>" + Util.escapeHTML(step.getTitle()) + "</h2>");
out.println("<h3>" + Util.escapeHTML(step.getTitle()) + "</h3>");
out.println("<form action=\"" + Util.generateHTMLLink("?", response) + "\" method=post>");
out.println("<input type=hidden name=testid value=\"" + test.getId() + "\">");
out.println("<input type=hidden name=teststepid value=\"" + step.getTeststepid() + "\">");
Expand Down Expand Up @@ -125,7 +125,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro

out.println("<hr>");

out.println("<h3>Neuer Test-Schritt <a href=\"#\" onclick=\"toggleVisibility('teststephelp'); return false;\">(?)</a></h2>");
out.println("<h3>Neuer Test-Schritt <a href=\"#\" onclick=\"toggleVisibility('teststephelp'); return false;\">(?)</a></h3>");

out.println("<div style=\"display:none;\" id=teststephelp><b>Hilfe:</b><br>");
out.println("<p>Diese Art von Test erlaubt es beliebige einfache Ausgabe-Tests zu definieren. Mit dem Preparation-Code können vorbereitende Schritte als Bash-Skript programmiert werden. Ist dieser Schritt erfolgreich, werden die einzelnen Testschritte nacheinander aufgerufen, wobei für jeden Testschritt die Ausgabe auf STDOUT mit einem erwartetem Wert überprüft werden.</p>");
Expand Down
Loading