protected C GetCircuitOpenCommand(ExecutionIsolationStrategy isolationStrategy, FallbackResultTest fallbackResult)
        {
            TestCircuitBreaker openCircuit = new TestCircuitBreaker();

            openCircuit.SetForceShortCircuit(true);
            return(GetCommand(isolationStrategy, ExecutionResultTest.SUCCESS, 0, fallbackResult, 0, openCircuit, null, 500, CacheEnabledTest.NO, "foo", 10, 10, false));
        }
 public TestCommandBuilder SetCircuitBreaker(TestCircuitBreaker circuitBreaker)
 {
     this.circuitBreaker = circuitBreaker;
     if (circuitBreaker != null)
     {
         this.metrics = circuitBreaker.metrics;
     }
     return(this);
 }
Exemplo n.º 3
0
 public static TestCommandBuilder TestPropsBuilder(TestCircuitBreaker circuitBreaker)
 {
     return(new TestCommandBuilder(ExecutionIsolationStrategy.THREAD).SetCircuitBreaker(circuitBreaker));
 }
 protected C GetSharedCircuitBreakerCommand(IHystrixCommandKey commandKey, ExecutionIsolationStrategy isolationStrategy, FallbackResultTest fallbackResult, TestCircuitBreaker circuitBreaker)
 {
     return(GetCommand(commandKey, isolationStrategy, ExecutionResultTest.FAILURE, 0, fallbackResult, 0, circuitBreaker, null, 500, CacheEnabledTest.NO, "foo", 10, 10));
 }
 protected C GetLatentCommand(ExecutionIsolationStrategy isolationStrategy, ExecutionResultTest executionResult, int executionLatency, FallbackResultTest fallbackResult, TestCircuitBreaker circuitBreaker, IHystrixThreadPool threadPool, int timeout)
 {
     return(GetCommand(isolationStrategy, executionResult, executionLatency, fallbackResult, 0, circuitBreaker, threadPool, timeout, CacheEnabledTest.NO, "foo", 10, 10));
 }
 protected abstract C GetCommand(IHystrixCommandKey commandKey, ExecutionIsolationStrategy isolationStrategy, ExecutionResultTest executionResult, int executionLatency, FallbackResultTest fallbackResult, int fallbackLatency, TestCircuitBreaker circuitBreaker, IHystrixThreadPool threadPool, int timeout, CacheEnabledTest cacheEnabled, object value, SemaphoreSlim executionSemaphore, SemaphoreSlim fallbackSemaphore, bool circuitBreakerDisabled);
        protected C GetCommand(ExecutionIsolationStrategy isolationStrategy, ExecutionResultTest executionResult, int executionLatency, FallbackResultTest fallbackResult, int fallbackLatency, TestCircuitBreaker circuitBreaker, IHystrixThreadPool threadPool, int timeout, CacheEnabledTest cacheEnabled, object value, int executionSemaphoreCount, int fallbackSemaphoreCount, bool circuitBreakerDisabled)
        {
            SemaphoreSlim executionSemaphore = new SemaphoreSlim(executionSemaphoreCount);
            SemaphoreSlim fallbackSemaphore  = new SemaphoreSlim(fallbackSemaphoreCount);

            return(GetCommand(isolationStrategy, executionResult, executionLatency, fallbackResult, fallbackLatency, circuitBreaker, threadPool, timeout, cacheEnabled, value, executionSemaphore, fallbackSemaphore, circuitBreakerDisabled));
        }