use of com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler in project Hystrix by Netflix.
the class HystrixObservableCommandTest method testSuccessfulRequestContextWithSemaphoreIsolatedAsynchronousObservableAndCapturedContextScheduler.
/**
* Async Observable and semaphore isolation WITH functioning RequestContext
*
* Use HystrixContextScheduler to make the user provided scheduler capture context.
*/
@Test
public void testSuccessfulRequestContextWithSemaphoreIsolatedAsynchronousObservableAndCapturedContextScheduler() {
RequestContextTestResults results = testRequestContextOnSuccess(ExecutionIsolationStrategy.SEMAPHORE, new HystrixContextScheduler(Schedulers.newThread()));
// the user scheduler captures context
assertTrue(results.isContextInitialized.get());
// the user provided thread/scheduler
assertTrue(results.originThread.get().getName().startsWith("RxNewThread"));
// the user scheduler captures context
assertTrue(results.isContextInitializedObserveOn.get());
// the user provided thread/scheduler
assertTrue(results.observeOnThread.get().getName().startsWith("RxNewThread"));
// semaphore isolated
assertFalse(results.command.isExecutedInThread());
}
use of com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler in project Hystrix by Netflix.
the class HystrixObservableCommandTest method testFailureWithFallbackRequestContextWithSemaphoreIsolatedAsynchronousObservableAndCapturedContextScheduler.
/**
* Async Observable and semaphore isolation WITH functioning RequestContext
*
* Use HystrixContextScheduler to make the user provided scheduler capture context.
*/
@Test
public void testFailureWithFallbackRequestContextWithSemaphoreIsolatedAsynchronousObservableAndCapturedContextScheduler() {
RequestContextTestResults results = testRequestContextOnFailureWithFallback(ExecutionIsolationStrategy.SEMAPHORE, new HystrixContextScheduler(Schedulers.newThread()));
// the user scheduler captures context
assertTrue(results.isContextInitialized.get());
// the user provided thread/scheduler
assertTrue(results.originThread.get().getName().startsWith("RxNewThread"));
// the user scheduler captures context
assertTrue(results.isContextInitializedObserveOn.get());
// the user provided thread/scheduler
assertTrue(results.observeOnThread.get().getName().startsWith("RxNewThread"));
// semaphore isolated
assertFalse(results.command.isExecutedInThread());
}
use of com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler in project Hystrix by Netflix.
the class HystrixObservableCommandTest method testRejectionWithFallbackRequestContextWithThreadIsolatedAsynchronousObservableAndCapturedContextScheduler.
/**
* Async Observable and semaphore isolation WITH functioning RequestContext
*
* Use HystrixContextScheduler to make the user provided scheduler capture context.
*/
@Test
public void testRejectionWithFallbackRequestContextWithThreadIsolatedAsynchronousObservableAndCapturedContextScheduler() {
RequestContextTestResults results = testRequestContextOnRejectionWithFallback(ExecutionIsolationStrategy.THREAD, new HystrixContextScheduler(Schedulers.newThread()));
// the user scheduler captures context
assertTrue(results.isContextInitialized.get());
// the user provided thread/scheduler
assertTrue(results.originThread.get().getName().startsWith("RxNewThread"));
// the user scheduler captures context
assertTrue(results.isContextInitializedObserveOn.get());
// the user provided thread/scheduler for getFallback
assertTrue(results.observeOnThread.get().getName().startsWith("RxNewThread"));
// thread isolated, but rejected, so this is false
assertFalse(results.command.isExecutedInThread());
}
use of com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler in project Hystrix by Netflix.
the class HystrixObservableCommandTest method testTimeoutWithFallbackRequestContextWithSemaphoreIsolatedAsynchronousObservableAndCapturedContextScheduler.
/**
* Async Observable and semaphore isolation WITH functioning RequestContext
*
* Use HystrixContextScheduler to make the user provided scheduler capture context.
*/
@Test
public void testTimeoutWithFallbackRequestContextWithSemaphoreIsolatedAsynchronousObservableAndCapturedContextScheduler() {
RequestContextTestResults results = testRequestContextOnTimeoutWithFallback(ExecutionIsolationStrategy.SEMAPHORE, new HystrixContextScheduler(Schedulers.newThread()));
// the user scheduler captures context
assertTrue(results.isContextInitialized.get());
// the user provided thread/scheduler
assertTrue(results.originThread.get().getName().startsWith("RxNewThread"));
// the user scheduler captures context
assertTrue(results.isContextInitializedObserveOn.get());
// the user provided thread/scheduler
assertTrue(results.observeOnThread.get().getName().startsWith("RxNewThread"));
// semaphore isolated
assertFalse(results.command.isExecutedInThread());
HystrixCircuitBreaker.Factory.reset();
}
use of com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler in project Hystrix by Netflix.
the class HystrixObservableCommandTest method testGracefulFailureRequestContextWithThreadIsolatedAsynchronousObservableAndCapturedContextScheduler.
/**
* Async Observable and semaphore isolation WITH functioning RequestContext
*
* Use HystrixContextScheduler to make the user provided scheduler capture context.
*/
@Test
public void testGracefulFailureRequestContextWithThreadIsolatedAsynchronousObservableAndCapturedContextScheduler() {
RequestContextTestResults results = testRequestContextOnGracefulFailure(ExecutionIsolationStrategy.THREAD, new HystrixContextScheduler(Schedulers.newThread()));
// the user scheduler captures context
assertTrue(results.isContextInitialized.get());
// the user provided thread/scheduler
assertTrue(results.originThread.get().getName().startsWith("RxNewThread"));
// the user scheduler captures context
assertTrue(results.isContextInitializedObserveOn.get());
assertTrue(results.observeOnThread.get().getName().startsWith("RxNewThread"));
// thread isolated
assertTrue(results.command.isExecutedInThread());
}
Aggregations