Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public class HystrixTest {
  2. // Hystrix commands have default command timeout execution of 1 second
  3. private HystrixObservableCommand<String> testCommand = new HystrixObservableCommand<String>(HystrixCommandGroupKey.Factory.asKey("test")) {
  4. @Override
  5. protected Observable<String> construct() {
  6. // This Promise will never complete
  7. return RxRatpack.observe(Promise.async(up -> {}));
  8. }
  9. };
  10.  
  11. private Promise<String> wrapped() {
  12. return RxRatpack.promiseSingle(testCommand.toObservable());
  13. }
  14.  
  15. @Test(timeout = 10000, expected = HystrixRuntimeException.class)
  16. public void test() throws Exception {
  17. try (ExecHarness execHarness = ExecHarness.harness()) {
  18. ExecResult<String> yield = execHarness.yield(execution -> wrapped());
  19. System.out.println(yield.getValueOrThrow());
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement