Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HystrixTest {
- // Hystrix commands have default command timeout execution of 1 second
- private HystrixObservableCommand<String> testCommand = new HystrixObservableCommand<String>(HystrixCommandGroupKey.Factory.asKey("test")) {
- @Override
- protected Observable<String> construct() {
- // This Promise will never complete
- return RxRatpack.observe(Promise.async(up -> {}));
- }
- };
- private Promise<String> wrapped() {
- return RxRatpack.promiseSingle(testCommand.toObservable());
- }
- @Test(timeout = 10000, expected = HystrixRuntimeException.class)
- public void test() throws Exception {
- try (ExecHarness execHarness = ExecHarness.harness()) {
- ExecResult<String> yield = execHarness.yield(execution -> wrapped());
- System.out.println(yield.getValueOrThrow());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement