@@ -780,6 +780,7 @@ class StepContextSpec extends Specification {
780780 scriptSourceNode. command. size() == 1
781781 scriptSourceNode. command[0 ]. value() == " println 'Hello World!'"
782782 1 * jobManagement. requirePlugin(' groovy' )
783+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
783784
784785 when :
785786 context. groovyCommand(' acme.Acme.doSomething()' , ' Groovy 2.0' ) {
@@ -817,6 +818,7 @@ class StepContextSpec extends Specification {
817818 acmeScriptSourceNode. command. size() == 1
818819 acmeScriptSourceNode. command[0 ]. value() == ' acme.Acme.doSomething()'
819820 1 * jobManagement. requirePlugin(' groovy' )
821+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
820822 }
821823
822824 def ' call groovyScriptFile methods' () {
@@ -845,6 +847,7 @@ class StepContextSpec extends Specification {
845847 scriptSourceNode. scriptFile. size() == 1
846848 scriptSourceNode. scriptFile[0 ]. value() == ' scripts/hello.groovy'
847849 1 * jobManagement. requirePlugin(' groovy' )
850+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
848851
849852 when :
850853 context. groovyScriptFile(' acme.groovy' , ' Groovy 2.0' ) {
@@ -894,6 +897,7 @@ class StepContextSpec extends Specification {
894897 groovy21Node. groovyName. size() == 1
895898 groovy21Node. groovyName[0 ]. value() == ' Groovy 2.1'
896899 1 * jobManagement. requirePlugin(' groovy' )
900+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
897901 }
898902
899903 def ' call systemGroovyCommand methods' () {
@@ -914,6 +918,7 @@ class StepContextSpec extends Specification {
914918 scriptSourceNode. command. size() == 1
915919 scriptSourceNode. command[0 ]. value() == " println 'Hello World!'"
916920 1 * jobManagement. requirePlugin(' groovy' )
921+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
917922
918923 when :
919924 context. systemGroovyCommand(' acme.Acme.doSomething()' ) {
@@ -937,6 +942,7 @@ class StepContextSpec extends Specification {
937942 acmeScriptSourceNode. command. size() == 1
938943 acmeScriptSourceNode. command[0 ]. value() == ' acme.Acme.doSomething()'
939944 1 * jobManagement. requirePlugin(' groovy' )
945+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
940946 }
941947
942948 def ' call systemGroovyScriptFile methods' () {
@@ -957,6 +963,7 @@ class StepContextSpec extends Specification {
957963 scriptSourceNode. scriptFile. size() == 1
958964 scriptSourceNode. scriptFile[0 ]. value() == ' scripts/hello.groovy'
959965 1 * jobManagement. requirePlugin(' groovy' )
966+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
960967
961968 when :
962969 context. systemGroovyScriptFile(' acme.groovy' ) {
@@ -980,6 +987,127 @@ class StepContextSpec extends Specification {
980987 acmeScriptSourceNode. scriptFile. size() == 1
981988 acmeScriptSourceNode. scriptFile[0 ]. value() == ' acme.groovy'
982989 1 * jobManagement. requirePlugin(' groovy' )
990+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
991+ }
992+
993+ def ' call systemGroovyCommand methods with plugin version 2.0' () {
994+ setup :
995+ jobManagement. isMinimumPluginVersionInstalled(' groovy' , ' 2.0' ) >> true
996+
997+ when :
998+ context. systemGroovyCommand(" println 'Hello World!'" )
999+
1000+ then :
1001+ context. stepNodes. size() == 1
1002+ with(context. stepNodes[0 ]) {
1003+ name() == ' hudson.plugins.groovy.SystemGroovy'
1004+ children(). size() == 2
1005+ bindings[0 ]. value() == ' '
1006+ source. size() == 1
1007+ with(source[0 ]) {
1008+ attribute(' class' ) == ' hudson.plugins.groovy.StringSystemScriptSource'
1009+ children(). size() == 1
1010+ script[0 ]. children(). size() == 3
1011+ script[0 ]. script[0 ]. value() == " println 'Hello World!'"
1012+ script[0 ]. sandbox[0 ]. value() == false
1013+ script[0 ]. classpath[0 ]. children(). size() == 0
1014+ }
1015+ }
1016+ 1 * jobManagement. requirePlugin(' groovy' )
1017+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
1018+
1019+ when :
1020+ context. systemGroovyCommand(' acme.Acme.doSomething()' ) {
1021+ binding(' foo' , ' bar' )
1022+ binding(' test' , ' 0815' )
1023+ classpath(' file:/foo/acme.jar' )
1024+ classpath(' file:/foo/test.jar' )
1025+ sandbox()
1026+ }
1027+
1028+ then :
1029+ context. stepNodes. size() == 2
1030+ with (context. stepNodes[1 ]) {
1031+ name() == ' hudson.plugins.groovy.SystemGroovy'
1032+ children(). size() == 2
1033+ bindings[0 ]. value() == ' foo=bar\n test=0815'
1034+ with(source[0 ]) {
1035+ attribute(' class' ) == ' hudson.plugins.groovy.StringSystemScriptSource'
1036+ children(). size() == 1
1037+ script[0 ]. children(). size() == 3
1038+ script[0 ]. script[0 ]. value() == ' acme.Acme.doSomething()'
1039+ script[0 ]. sandbox[0 ]. value() == true
1040+ script[0 ]. classpath[0 ]. children(). size() == 2
1041+ script[0 ]. classpath[0 ]. entry[0 ]. children(). size() == 1
1042+ script[0 ]. classpath[0 ]. entry[0 ]. url[0 ]. value() == ' file:/foo/acme.jar'
1043+ script[0 ]. classpath[0 ]. entry[1 ]. children(). size() == 1
1044+ script[0 ]. classpath[0 ]. entry[1 ]. url[0 ]. value() == ' file:/foo/test.jar'
1045+ }
1046+ }
1047+ 1 * jobManagement. requirePlugin(' groovy' )
1048+ 1 * jobManagement. requireMinimumPluginVersion(' groovy' , ' 2.0' )
1049+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
1050+ }
1051+
1052+ def ' call systemGroovyCommand with invalid classpath and plugin version 2.0' () {
1053+ setup :
1054+ jobManagement. isMinimumPluginVersionInstalled(' groovy' , ' 2.0' ) >> true
1055+
1056+ when :
1057+ context. systemGroovyCommand(' acme.Acme.doSomething()' ) {
1058+ classpath(' /foo/acme.jar' )
1059+ }
1060+
1061+ then :
1062+ thrown(DslScriptException )
1063+ }
1064+
1065+ def ' call systemGroovyScriptFile methods with plugin version 2.0' () {
1066+ setup :
1067+ jobManagement. isMinimumPluginVersionInstalled(' groovy' , ' 2.0' ) >> true
1068+
1069+ when :
1070+ context. systemGroovyScriptFile(' scripts/hello.groovy' )
1071+
1072+ then :
1073+ context. stepNodes. size() == 1
1074+ with(context. stepNodes[0 ]) {
1075+ name() == ' hudson.plugins.groovy.SystemGroovy'
1076+ bindings. size() == 1
1077+ bindings[0 ]. value() == ' '
1078+ source. size() == 1
1079+ with(source[0 ]) {
1080+ attribute(' class' ) == ' hudson.plugins.groovy.FileSystemScriptSource'
1081+ scriptFile. size() == 1
1082+ scriptFile[0 ]. value() == ' scripts/hello.groovy'
1083+ }
1084+ }
1085+ 1 * jobManagement. requirePlugin(' groovy' )
1086+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
1087+
1088+ when :
1089+ context. systemGroovyScriptFile(' acme.groovy' ) {
1090+ binding(' foo' , ' bar' )
1091+ binding(' test' , ' 0815' )
1092+ classpath(' /foo/acme.jar' )
1093+ classpath(' /foo/test.jar' )
1094+ }
1095+
1096+ then :
1097+ context. stepNodes. size() == 2
1098+ with(context. stepNodes[1 ]) {
1099+ name() == ' hudson.plugins.groovy.SystemGroovy'
1100+ bindings. size() == 1
1101+ bindings[0 ]. value() == ' foo=bar\n test=0815'
1102+ source. size() == 1
1103+ with(source[0 ]) {
1104+ attribute(' class' ) == ' hudson.plugins.groovy.FileSystemScriptSource'
1105+ scriptFile. size() == 1
1106+ scriptFile[0 ]. value() == ' acme.groovy'
1107+ }
1108+ }
1109+ 1 * jobManagement. requirePlugin(' groovy' )
1110+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
9831111 }
9841112
9851113 def ' call copyArtifacts selector variants' () {
0 commit comments