return Timeout.builder().withTimeout(waitLonger * defaultTimeoutSeconds(), TimeUnit.SECONDS) .withLookingForStuckThread(true).build();
/** * Creates a rule (chain) out of a gateway or other rule, adding extra rules as follows:<ol> * <li> a timeout rule * <li> a rule to print console messages at the start and end of each test method and print trace level * log messages on test failure. * </ol> * @param rule Rule to startup and stop gateway * @param timeout The maximum allowed time duration of each test (including the gateway rule) * @param timeUnit The unit for the timeout * @return A TestRule which should be the only public @Rule in our robot tests */ public static RuleChain createRuleChain(TestRule gateway, long timeout, TimeUnit timeUnit) { TestRule trace = new MethodExecutionTrace(); TestRule timeoutRule = new DisableOnDebug(Timeout.builder().withTimeout(timeout, timeUnit) .withLookingForStuckThread(true).build()); return RuleChain.outerRule(trace).around(timeoutRule).around(gateway); }
/** * Creates a rule (chain) out of a k3po rule and gateway rule, adding extra rules as follows:<ol> * <li> a timeout rule * <li> a rule to print console messages at the start and end of each test method and print trace level * log messages on test failure. * </ol> * @param gateway Rule to start up and shut down the gateway (or acceptor or etc) * @param robot Rule to startup and stop k3po * @param timeout The maximum allowed time duration of each test * @param timeUnit The unit for the timeout * @return A TestRule which should be the only public @Rule in our robot tests */ public static RuleChain createRuleChain(TestRule gateway, K3poRule robot, long timeout, TimeUnit timeUnit) { TestRule trace = new MethodExecutionTrace(); TestRule timeoutRule = new DisableOnDebug(Timeout.builder().withTimeout(timeout, timeUnit) .withLookingForStuckThread(true).build()); return RuleChain.outerRule(trace).around(gateway).around(robot).around(timeoutRule); }
public static TestRule getTimeoutRule(int timeout, TimeUnit unit) { return IS_DEBUG ? new TestName() : Timeout.builder().withTimeout(timeout, unit).build(); }
public static HBaseClassTestRule forClass(Class<?> clazz) { return new HBaseClassTestRule(clazz, Timeout.builder().withLookingForStuckThread(true) .withTimeout(getTimeoutInSeconds(clazz), TimeUnit.SECONDS).build()); }
public static TestRule timeoutRule(long timeout, TimeUnit timeUnit) { return new DisableOnDebug(Timeout.builder().withTimeout(timeout, timeUnit) .withLookingForStuckThread(true).build()); }
/** * Returns a new builder for building an instance. * * @since 4.12 */ public static Builder builder() { return new Builder(); }
/** * Create a {@code Timeout} instance initialized with values form * a builder. * * @since 4.12 */ protected Timeout(Builder builder) { timeout = builder.getTimeout(); timeUnit = builder.getTimeUnit(); lookForStuckThread = builder.getLookingForStuckThread(); }
/** * Create a {@code Timeout} instance initialized with values form * a builder. * * @since 4.12 */ protected Timeout(Builder builder) { timeout = builder.getTimeout(); timeUnit = builder.getTimeUnit(); lookForStuckThread = builder.getLookingForStuckThread(); }
public static HBaseClassTestRule forClass(Class<?> clazz) { return new HBaseClassTestRule(clazz, Timeout.builder().withLookingForStuckThread(true) .withTimeout(getTimeoutInSeconds(clazz), TimeUnit.SECONDS).build()); }
/** * Returns a new builder for building an instance. * * @since 4.12 */ public static Builder builder() { return new Builder(); }
@Override public Builder withTimeout(final long timeout, final TimeUnit unit) { super.withTimeout(timeout, unit); return this; }
@Override public Builder withLookingForStuckThread(final boolean enable) { super.withLookingForStuckThread(enable); return this; }
public static HBaseClassTestRule forClass(Class<?> clazz) { return new HBaseClassTestRule(clazz, Timeout.builder().withLookingForStuckThread(true) .withTimeout(getTimeoutInSeconds(clazz), TimeUnit.SECONDS).build()); }
/** * Returns a new builder for building an instance. * * @since 4.12 */ public static Builder builder() { return new Builder(); }
/** * Create a {@code Timeout} instance initialized with values from * a builder. * * @since 4.12 */ protected Timeout(Builder builder) { timeout = builder.getTimeout(); timeUnit = builder.getTimeUnit(); lookForStuckThread = builder.getLookingForStuckThread(); }