@@ -780,6 +780,7 @@ class StepContextSpec extends Specification {
780
780
scriptSourceNode. command. size() == 1
781
781
scriptSourceNode. command[0 ]. value() == " println 'Hello World!'"
782
782
1 * jobManagement. requirePlugin(' groovy' )
783
+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
783
784
784
785
when :
785
786
context. groovyCommand(' acme.Acme.doSomething()' , ' Groovy 2.0' ) {
@@ -817,6 +818,7 @@ class StepContextSpec extends Specification {
817
818
acmeScriptSourceNode. command. size() == 1
818
819
acmeScriptSourceNode. command[0 ]. value() == ' acme.Acme.doSomething()'
819
820
1 * jobManagement. requirePlugin(' groovy' )
821
+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
820
822
}
821
823
822
824
def ' call groovyScriptFile methods' () {
@@ -845,6 +847,7 @@ class StepContextSpec extends Specification {
845
847
scriptSourceNode. scriptFile. size() == 1
846
848
scriptSourceNode. scriptFile[0 ]. value() == ' scripts/hello.groovy'
847
849
1 * jobManagement. requirePlugin(' groovy' )
850
+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
848
851
849
852
when :
850
853
context. groovyScriptFile(' acme.groovy' , ' Groovy 2.0' ) {
@@ -894,6 +897,7 @@ class StepContextSpec extends Specification {
894
897
groovy21Node. groovyName. size() == 1
895
898
groovy21Node. groovyName[0 ]. value() == ' Groovy 2.1'
896
899
1 * jobManagement. requirePlugin(' groovy' )
900
+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
897
901
}
898
902
899
903
def ' call systemGroovyCommand methods' () {
@@ -914,6 +918,7 @@ class StepContextSpec extends Specification {
914
918
scriptSourceNode. command. size() == 1
915
919
scriptSourceNode. command[0 ]. value() == " println 'Hello World!'"
916
920
1 * jobManagement. requirePlugin(' groovy' )
921
+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
917
922
918
923
when :
919
924
context. systemGroovyCommand(' acme.Acme.doSomething()' ) {
@@ -937,6 +942,7 @@ class StepContextSpec extends Specification {
937
942
acmeScriptSourceNode. command. size() == 1
938
943
acmeScriptSourceNode. command[0 ]. value() == ' acme.Acme.doSomething()'
939
944
1 * jobManagement. requirePlugin(' groovy' )
945
+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
940
946
}
941
947
942
948
def ' call systemGroovyScriptFile methods' () {
@@ -957,6 +963,7 @@ class StepContextSpec extends Specification {
957
963
scriptSourceNode. scriptFile. size() == 1
958
964
scriptSourceNode. scriptFile[0 ]. value() == ' scripts/hello.groovy'
959
965
1 * jobManagement. requirePlugin(' groovy' )
966
+ 1 * jobManagement. logPluginDeprecationWarning(' groovy' , ' 2.0' )
960
967
961
968
when :
962
969
context. systemGroovyScriptFile(' acme.groovy' ) {
@@ -980,6 +987,127 @@ class StepContextSpec extends Specification {
980
987
acmeScriptSourceNode. scriptFile. size() == 1
981
988
acmeScriptSourceNode. scriptFile[0 ]. value() == ' acme.groovy'
982
989
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' )
983
1111
}
984
1112
985
1113
def ' call copyArtifacts selector variants' () {
0 commit comments