hudson.remoting.Channel.addLocalExecutionInterceptor()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中hudson.remoting.Channel.addLocalExecutionInterceptor()方法的一些代码示例,展示了Channel.addLocalExecutionInterceptor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.addLocalExecutionInterceptor()方法的具体详情如下:
包路径:hudson.remoting.Channel
类名称:Channel
方法名:addLocalExecutionInterceptor

Channel.addLocalExecutionInterceptor介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

public CliManagerImpl(Channel channel) {
  this.channel = channel;
  channel.addLocalExecutionInterceptor(authenticationFilter);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public CliManagerImpl(Channel channel) {
  this.channel = channel;
  channel.addLocalExecutionInterceptor(authenticationFilter);
}

代码示例来源:origin: jenkinsci/remoting

/**
 * @deprecated
 *      use {@link #addLocalExecutionInterceptor(CallableDecorator)}
 */
@Deprecated
public void addLocalExecutionInterceptor(CallableFilter filter) {
  addLocalExecutionInterceptor(new CallableDecoratorAdapter(filter));
}

代码示例来源:origin: jenkinsci/remoting

public void testFilter() throws Exception {
  channel.addLocalExecutionInterceptor(new CallableFilter() {
    public <V> V call(Callable<V> callable) throws Exception {
      Object old = STORE.get();
      STORE.set("x");
      try {
        return callable.call();
      } finally {
        STORE.set(old);
      }
    }
  });
  Callable<Object> t = new Callable<Object>() {
    public Object call() throws Exception {
      return STORE.get();
    }
  };
  final Callable c = channel.export(Callable.class, t);
  
  assertEquals("x", channel.call(new CallableCallable(c)));
}

代码示例来源:origin: jenkinsci/remoting

public void testBlacklisting() throws Exception {
    channel.addLocalExecutionInterceptor(new CallableDecorator() {
      @Override
      public <V, T extends Throwable> hudson.remoting.Callable<V, T> userRequest(hudson.remoting.Callable<V, T> op, hudson.remoting.Callable<V, T> stem) {
        if (op instanceof ShadyBusiness)
          throw new SecurityException("Rejecting "+op.getClass().getName());
        return stem;
      }
    });

    // this direction is unrestricted
    assertEquals("gun",channel.call(new GunImporter()));

    // the other direction should be rejected
    try {
      channel.call(new ReverseGunImporter());
      fail("should have failed");
    } catch (Exception e) {
      assertEquals("Rejecting "+GunImporter.class.getName(), findSecurityException(e).getMessage());
//            e.printStackTrace();
    }
  }
  private static SecurityException findSecurityException(Throwable x) {

相关文章