Skip to content

Commit a6062df

Browse files
committed
Get it building again and course refresh and test run done via core
1 parent e1c1c9b commit a6062df

35 files changed

+155
-1910
lines changed

maven-wrapper/pom.xml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@
267267
<type>jar</type>
268268
<version>4.3.4</version>
269269
</dependency>
270-
271270
<dependency>
272271
<groupId>org.apache.commons</groupId>
273272
<artifactId>commons-lang3</artifactId>
@@ -288,27 +287,6 @@
288287
<artifactId>mockito-all</artifactId>
289288
<version>1.9.0</version>
290289
</dependency>
291-
<dependency>
292-
<groupId>junit</groupId>
293-
<artifactId>junit</artifactId>
294-
<version>4.11</version>
295-
</dependency>
296-
<dependency>
297-
<groupId>${project.groupId}</groupId>
298-
<artifactId>tmc-checkstyle-runner</artifactId>
299-
<version>1.0.2</version>
300-
<exclusions>
301-
<exclusion>
302-
<groupId>com.puppycrawl.tools</groupId>
303-
<artifactId>checkstyle</artifactId>
304-
</exclusion>
305-
</exclusions>
306-
</dependency>
307-
<dependency>
308-
<groupId>${project.groupId}</groupId>
309-
<artifactId>tmc-junit-runner</artifactId>
310-
<version>0.2.5</version>
311-
</dependency>
312290
<dependency>
313291
<groupId>org.cometd.java</groupId>
314292
<artifactId>cometd-java-client</artifactId>
@@ -345,6 +323,7 @@
345323
<publicPackage>org.apache.commons.*</publicPackage>
346324
<publicPackage>fi.helsinki.cs.tmc.core.*</publicPackage>
347325
<publicPackage>fi.helsinki.cs.tmc.langs.abstraction.*</publicPackage>
326+
<publicPackage>fi.helsinki.cs.tmc.langs.domain.*</publicPackage>
348327
<publicPackage>fi.helsinki.cs.tmc.langs.util.*</publicPackage>
349328
<publicPackage>fi.helsinki.cs.tmc.stylerunner.*</publicPackage>
350329
<publicPackage>fi.helsinki.cs.tmc.testrunner.*</publicPackage>

tmc-plugin/src/fi/helsinki/cs/tmc/actions/RunTestsLocallyAction.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
package fi.helsinki.cs.tmc.actions;
22

3+
import fi.helsinki.cs.tmc.core.TmcCore;
34
import fi.helsinki.cs.tmc.core.domain.Exercise;
5+
import fi.helsinki.cs.tmc.core.domain.ProgressObserver;
46
import fi.helsinki.cs.tmc.data.ResultCollector;
5-
import fi.helsinki.cs.tmc.events.TmcEvent;
6-
import fi.helsinki.cs.tmc.events.TmcEventBus;
77
import fi.helsinki.cs.tmc.model.CourseDb;
88
import fi.helsinki.cs.tmc.model.ProjectMediator;
9-
import fi.helsinki.cs.tmc.runners.CheckstyleRunHandler;
10-
import fi.helsinki.cs.tmc.runners.TestRunHandler;
119

1210
import java.util.logging.Logger;
1311
import org.netbeans.api.project.Project;
1412
import org.openide.nodes.Node;
13+
import org.openide.util.Exceptions;
1514
import org.openide.util.NbBundle.Messages;
1615
import org.openide.windows.WindowManager;
1716

@@ -22,15 +21,11 @@ public class RunTestsLocallyAction extends AbstractExerciseSensitiveAction imple
2221

2322
private CourseDb courseDb;
2423
private ProjectMediator projectMediator;
25-
private CheckstyleRunHandler checkstyleRunHandler;
26-
private TestRunHandler testRunHandler;
2724
private Project project;
2825

2926
public RunTestsLocallyAction() {
3027
this.courseDb = CourseDb.getInstance();
3128
this.projectMediator = ProjectMediator.getInstance();
32-
this.checkstyleRunHandler = new CheckstyleRunHandler();
33-
this.testRunHandler = new TestRunHandler();
3429

3530
putValue("noIconInMenu", Boolean.TRUE);
3631
}
@@ -76,9 +71,13 @@ protected boolean enabledFor(Exercise exercise) {
7671
public void run() {
7772
Exercise exercise = exerciseForProject(project);
7873
if (exercise != null) {
79-
ResultCollector resultCollector = new ResultCollector(exercise);
80-
this.checkstyleRunHandler.performAction(resultCollector, project);
81-
this.testRunHandler.performAction(resultCollector, project);
74+
try {
75+
ResultCollector resultCollector = new ResultCollector(exercise);
76+
resultCollector.setLocalTestResults(TmcCore.get().runTests(ProgressObserver.NULL_OBSERVER, exercise).call());
77+
resultCollector.setValidationResult(TmcCore.get().runCheckStyle(ProgressObserver.NULL_OBSERVER, exercise).call());
78+
} catch (Exception ex) {
79+
Exceptions.printStackTrace(ex);
80+
}
8281
}
8382
}
8483
}

tmc-plugin/src/fi/helsinki/cs/tmc/actions/SubmitExerciseAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package fi.helsinki.cs.tmc.actions;
22

3+
import fi.helsinki.cs.tmc.core.TmcCore;
4+
import fi.helsinki.cs.tmc.core.domain.ProgressObserver;
35
import fi.helsinki.cs.tmc.exerciseSubmitter.ExerciseSubmitter;
46
import fi.helsinki.cs.tmc.model.CourseDb;
57
import fi.helsinki.cs.tmc.model.ProjectMediator;

tmc-plugin/src/fi/helsinki/cs/tmc/data/FeedbackAnswer.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

tmc-plugin/src/fi/helsinki/cs/tmc/data/FeedbackQuestion.java

Lines changed: 0 additions & 75 deletions
This file was deleted.

tmc-plugin/src/fi/helsinki/cs/tmc/data/ResultCollector.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import fi.helsinki.cs.tmc.core.domain.Exercise;
44
import fi.helsinki.cs.tmc.langs.abstraction.Strategy;
55
import fi.helsinki.cs.tmc.langs.abstraction.ValidationResult;
6+
import fi.helsinki.cs.tmc.langs.domain.RunResult;
7+
import fi.helsinki.cs.tmc.langs.domain.TestResult;
68
import fi.helsinki.cs.tmc.ui.TestResultWindow;
79

8-
import java.util.List;
10+
import com.google.common.collect.ImmutableList;
911

1012
/**
1113
* Waits for test and validation results and shows the result view only when
@@ -14,7 +16,7 @@
1416
public final class ResultCollector {
1517

1618
private final Exercise exercise;
17-
private List<TestCaseResult> testCaseResults;
19+
private ImmutableList<TestResult> testCaseResults;
1820
private ValidationResult validationResults;
1921

2022
private boolean testCaseResultsSet = false;
@@ -35,14 +37,18 @@ public void setValidationResult(final ValidationResult result) {
3537
showResultsIfReady();
3638
}
3739

38-
public void setTestCaseResults(final List<TestCaseResult> results) {
40+
public void setTestCaseResults(final ImmutableList<TestResult> results) {
3941

4042
this.testCaseResults = results;
4143
this.testCaseResultsSet = true;
4244

4345
showResultsIfReady();
4446
}
4547

48+
public void setLocalTestResults(RunResult runResult) {
49+
setTestCaseResults(runResult.testResults);
50+
}
51+
4652
private void showResultsIfReady() {
4753

4854
boolean ready = testCaseResultsSet && validationResultsSet;
@@ -63,9 +69,8 @@ public void setReturnable(final boolean returnable) {
6369

6470
private boolean isSubmittable() {
6571

66-
for (TestCaseResult result : testCaseResults) {
67-
68-
if (!result.isSuccessful()) {
72+
for (TestResult result : testCaseResults) {
73+
if (!result.passed) {
6974
return false;
7075
}
7176
}
@@ -80,4 +85,6 @@ private boolean isSubmittable() {
8085

8186
return isReturnable;
8287
}
88+
89+
8390
}

0 commit comments

Comments
 (0)