File tree Expand file tree Collapse file tree 3 files changed +43
-115
lines changed
groovy/org/jenkinsci/plugins/workflow/cps
java/org/jenkinsci/plugins/workflow/cps Expand file tree Collapse file tree 3 files changed +43
-115
lines changed Original file line number Diff line number Diff line change 289289 </resource >
290290 </resources >
291291 <plugins >
292- <!-- gmaven is inherited from the parent-pom. Set it to never run. -->
293- <plugin >
294- <groupId >org.codehaus.gmaven</groupId >
295- <artifactId >gmaven-plugin</artifactId >
296- <executions >
297- <execution >
298- <phase >none</phase >
299- </execution >
300- <execution >
301- <id >test-in-groovy</id >
302- <phase >none</phase >
303- </execution >
304- </executions >
305- </plugin >
306- <plugin >
307- <groupId >org.codehaus.gmavenplus</groupId >
308- <artifactId >gmavenplus-plugin</artifactId >
309- <version >1.7.1</version >
310- <executions >
311- <execution >
312- <goals >
313- <goal >generateTestStubs</goal >
314- <goal >compileTests</goal >
315- </goals >
316- </execution >
317- </executions >
318- <configuration >
319- <testStubsOutputDirectory >${project.build.directory} /generated-test-sources/groovy-stubs</testStubsOutputDirectory >
320- </configuration >
321- </plugin >
322292 <plugin >
323293 <groupId >org.jenkins-ci.tools</groupId >
324294 <artifactId >maven-hpi-plugin</artifactId >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ package org .jenkinsci .plugins .workflow .cps ;
2+
3+ import org .junit .Test ;
4+
5+ /**
6+ * @author Kohsuke Kawaguchi
7+ */
8+ public class CpsFlowDefinitionTest extends AbstractCpsFlowTest {
9+ /**
10+ * CpsFlowDefinition's simplest possible test.
11+ */
12+ @ Test
13+ public void simplestPossibleTest () throws Exception {
14+ CpsFlowDefinition flow = new CpsFlowDefinition (
15+ "def sqrt(int x) { return Math.sqrt(x); }\n for (int i=0; i<10; i++)\n sqrt(i);" ,
16+ false );
17+
18+ createExecution (flow );
19+ exec .start ();
20+ exec .waitForSuspension ();
21+
22+ assert exec .isComplete ();
23+ }
24+
25+ @ Test
26+ public void exceptionInWorkflowShouldBreakFlowExecution () throws Exception {
27+ CpsFlowDefinition flow = new CpsFlowDefinition (
28+ "throw new Throwable('This is a fire drill, not a real fire');" ,
29+ false );
30+
31+ // get this going...
32+ createExecution (flow );
33+ exec .start ();
34+
35+ // it should stop at watch and suspend.
36+ exec .waitForSuspension ();
37+ assert exec .isComplete ();
38+ Throwable t = exec .getCauseOfFailure ();
39+ assert t .getClass ().equals (Throwable .class );
40+ assert t .getMessage ().equals ("This is a fire drill, not a real fire" );
41+ }
42+
43+ }
You can’t perform that action at this time.
0 commit comments