TimeoutStepExecution(TimeoutStep step, StepContext context) { super(context); this.step = step; this.activity = step.isActivity(); id = activity ? UUID.randomUUID().toString() : null; timeout = step.getUnit().toMillis(step.getTime()); }
@Test public void options() throws Exception { List<Describable> o = new ArrayList<>(); o.add(new BuildDiscarderProperty(new LogRotator("4", "", "", ""))); o.add(new SkipDefaultCheckout(true)); TimeoutStep timeout = new TimeoutStep(10); timeout.setUnit(TimeUnit.HOURS); o.add(timeout); OptionsDirective options = new OptionsDirective(o); assertGenerateDirective(options, "options {\n" + " buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '4', numToKeepStr: '')\n" + " skipDefaultCheckout true\n" + " timeout(time: 10, unit: 'HOURS')\n" + "}"); }
@Override public boolean start() throws Exception { StepContext context = getContext(); BodyInvoker bodyInvoker = context.newBodyInvoker() .withCallback(new Callback()); if (step.isActivity()) { bodyInvoker = bodyInvoker.withContext( BodyInvoker.mergeConsoleLogFilters( context.get(ConsoleLogFilter.class), new ConsoleLogFilterImpl2(id, timeout) ) ); } body = bodyInvoker.start(); resetTimer(); return false; // execution is asynchronous }