@@ -49,7 +49,7 @@ public class WorkflowLibRepositoryTest {
49
49
public void globalLib () throws Exception {
50
50
story .addStep (new Statement () {
51
51
@ Override public void evaluate () throws Throwable {
52
- File dir = new File ( repo .workspace , "src/foo" );
52
+ File dir = repo .workspace . resolve ( "src/foo" ). toFile ( );
53
53
dir .mkdirs ();
54
54
55
55
FileUtils .write (new File (dir , "Foo.groovy" ),
@@ -106,7 +106,7 @@ public void globalLib() throws Exception {
106
106
public void userDefinedGlobalVariable () throws Exception {
107
107
story .addStep (new Statement () {
108
108
@ Override public void evaluate () throws Throwable {
109
- File vars = new File ( repo .workspace , UserDefinedGlobalVariableList .PREFIX );
109
+ File vars = repo .workspace . resolve ( UserDefinedGlobalVariableList .PREFIX ). toFile ( );
110
110
vars .mkdirs ();
111
111
FileUtils .writeStringToFile (new File (vars , "acmeVar.groovy" ), StringUtils .join (Arrays .asList (
112
112
"def hello(name) {echo \" Hello ${name}\" }" ,
@@ -159,7 +159,7 @@ public void userDefinedGlobalVariable() throws Exception {
159
159
@ Test public void restartGlobalVar () {
160
160
story .addStep (new Statement () {
161
161
@ Override public void evaluate () throws Throwable {
162
- File vars = new File ( repo .workspace , UserDefinedGlobalVariableList .PREFIX );
162
+ File vars = repo .workspace . resolve ( UserDefinedGlobalVariableList .PREFIX ). toFile ( );
163
163
vars .mkdirs ();
164
164
FileUtils .writeStringToFile (new File (vars , "block.groovy" ), "def call(body) {node {body()}}" );
165
165
uvl .rebuild ();
@@ -186,7 +186,7 @@ public void userDefinedGlobalVariable() throws Exception {
186
186
@ Override public void evaluate () throws Throwable {
187
187
File f = new File (jenkins .getRootDir (), "f" ); // marker file to write from Pipeline Script
188
188
189
- FileUtils .write (new File ( new File ( repo .workspace , "src/pkg" ), "Privileged.groovy" ),
189
+ FileUtils .write (repo .workspace . resolve ( "src/pkg" ). resolve ( "Privileged.groovy" ). toFile ( ),
190
190
"package pkg\n " +
191
191
"class Privileged implements Serializable {\n " +
192
192
" void write(String content) {\n " +
@@ -196,7 +196,7 @@ public void userDefinedGlobalVariable() throws Exception {
196
196
" body()\n " +
197
197
" }\n " +
198
198
"}" );
199
- FileUtils .write (new File ( new File ( repo .workspace , UserDefinedGlobalVariableList .PREFIX ), "record.groovy" ),
199
+ FileUtils .write (repo .workspace . resolve ( UserDefinedGlobalVariableList .PREFIX ). resolve ( "record.groovy" ). toFile ( ),
200
200
"def call() {new pkg.Privileged().write(jenkins.model.Jenkins.instance.systemMessage)}" );
201
201
WorkflowJob p = jenkins .createProject (WorkflowJob .class , "p" );
202
202
0 commit comments