Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

JENKINS-33925 Sample realization of the cps invoker interceptor #107

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*
* @author Kohsuke Kawaguchi
*/
public class DefaultInvoker implements Invoker {
public Object methodCall(Object receiver, String method, Object[] args) throws Throwable {
public class DefaultInvoker extends InvokerInterceptor {
public Object doMethodCall(Object receiver, String method, Object[] args) throws Throwable {
CallSite callSite = fakeCallSite(method);
Object v = callSite.call(receiver,args);
return v;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.cloudbees.groovy.cps.sandbox;

/**
* Allows to override one class to perform real-life tests of the CPS logic
*
* @author Sergei Parshev <[email protected]>
*/
public abstract class InvokerInterceptor implements Invoker {
public Object methodCall(Object receiver, String method, Object[] args) throws Throwable {
return doMethodCall(receiver, method, args);
}

abstract Object doMethodCall(Object receiver, String method, Object[] args) throws Throwable;

private static final long serialVersionUID = 1L;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*
* @author Kohsuke Kawaguchi
*/
public class SandboxInvoker implements Invoker {
public Object methodCall(Object receiver, String method, Object[] args) throws Throwable {
public class SandboxInvoker extends InvokerInterceptor {
public Object doMethodCall(Object receiver, String method, Object[] args) throws Throwable {
return Checker.checkedCall(receiver,false,false,method,args);
}

Expand Down