Skip to content
Permalink
Browse files

Merge branch 'JENKINS-25119-addendum' into JENKINS-28586

  • Loading branch information
jglick committed May 28, 2015
2 parents 6d46df1 + e7f8fa8 commit c5cb52160a7a6296e6f9aee660d547abb18bb67d
@@ -246,9 +246,14 @@ public void setProp2(String prop2) {
}
}

@Ignore("TODO not yet implemented")
@Issue("JENKINS-25119")
@Test public void defaultGroovyMethods() throws Exception {
assertEvaluate(new GenericWhitelist(), Arrays.asList(1, 4, 9), "([1, 2, 3] as int[]).collect({it * it})");
assertRejected(new ProxyWhitelist(), "staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods toInteger java.lang.String", "'123'.toInteger();");
assertEvaluate(new StaticWhitelist("staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods toInteger java.lang.String"), 123, "'123'.toInteger();");
assertEvaluate(new StaticWhitelist("staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods collect java.lang.Object groovy.lang.Closure"), Arrays.asList(1, 4, 9), "([1, 2, 3] as int[]).collect({x -> x * x})");
/* TODO No such property: it for class: Script1:
assertEvaluate(new StaticWhitelist("staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods collect java.lang.Object groovy.lang.Closure"), Arrays.asList(1, 4, 9), "([1, 2, 3] as int[]).collect({it * it})");
*/
}

@Test public void whitelistedIrrelevantInsideScript() throws Exception {

0 comments on commit c5cb521

Please sign in to comment.
You can’t perform that action at this time.