public TestCommandWithoutCircuitBreaker() : base(new TestCommandBuilder() { CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithCircuitBreakerEnabled(false) }) { }
public IHystrixCommandProperties GetCommandProperties(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { if (setter == null) { setter = UnitTestSetterFactory.GetCommandPropertiesSetter(); } return(new MockingHystrixCommandProperties(setter)); }
public IHystrixThreadPoolProperties GetThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolPropertiesSetter setter) { if (setter == null) { setter = UnitTestSetterFactory.GetThreadPoolPropertiesSetter(); } return(new MockingHystrixThreadPoolProperties(setter)); }
public BadRequestCommand(TestCircuitBreaker circuitBreaker, ExecutionIsolationStrategy isolationType) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithExecutionIsolationStrategy(isolationType), }) { }
public TestCommandWithTimeout(TimeSpan timeout, int fallbackBehavior) : base(new TestCommandBuilder() { CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithExecutionIsolationThreadTimeout(timeout) }) { this.timeout = timeout; this.fallbackBehavior = fallbackBehavior; }
public CommandWithCheckedException(TestCircuitBreaker circuitBreaker) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithExecutionIsolationThreadTimeout(Timeout.InfiniteTimeSpan), }) { }
public KnownFailureTestCommandWithFallback(TestCircuitBreaker circuitBreaker, bool fallbackEnabled) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithFallbackEnabled(fallbackEnabled) }) { }
public TestSemaphoreCommandWithSlowFallback(TestCircuitBreaker circuitBreaker, int fallbackSemaphoreExecutionCount, TimeSpan fallbackSleep) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithFallbackIsolationSemaphoreMaxConcurrentRequests(fallbackSemaphoreExecutionCount) }) { this.fallbackSleep = fallbackSleep; }
public RequestCacheNullPointerExceptionCase(TestCircuitBreaker circuitBreaker) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithExecutionIsolationThreadTimeoutInMilliseconds(200), }) { // we want it to timeout }
public SuccessfulCacheableCommandViaSemaphore(TestCircuitBreaker circuitBreaker, bool cacheEnabled, string value) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Semaphore), }) { this.value = value; this.cacheEnabled = cacheEnabled; }
public TestSemaphoreCommand(TestCircuitBreaker circuitBreaker, TryableSemaphore semaphore, TimeSpan executionSleep) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter() .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Semaphore), ExecutionSemaphore = semaphore, }) { this.executionSleep = executionSleep; }
public TestSemaphoreCommand(TestCircuitBreaker circuitBreaker, int executionSemaphoreCount, TimeSpan executionSleep) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter() .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Semaphore) .WithExecutionIsolationSemaphoreMaxConcurrentRequests(executionSemaphoreCount), }) { this.executionSleep = executionSleep; }
public TestCommandRejection(TestCircuitBreaker circuitBreaker, IHystrixThreadPool threadPool, TimeSpan sleepTime, TimeSpan timeout, int fallbackBehavior) : base(new TestCommandBuilder() { ThreadPool = threadPool, CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter().WithExecutionIsolationThreadTimeout(timeout) }) { this.fallbackBehavior = fallbackBehavior; this.sleepTime = sleepTime; }
/// <summary> /// /// </summary> /// <param name="circuitBreaker"></param> /// <param name="semaphore"></param> /// <param name="startLatch">this command calls {@link java.util.concurrent.CountDownLatch#countDown()} immediately upon running</param> /// <param name="waitLatch">this command calls {@link java.util.concurrent.CountDownLatch#await()} once it starts to run. The caller can use the latch to signal the command to finish</param> public LatchedSemaphoreCommand(TestCircuitBreaker circuitBreaker, TryableSemaphore semaphore, CountdownEvent startLatch, CountdownEvent waitLatch) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter() .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Semaphore), ExecutionSemaphore = semaphore, }) { this.startLatch = startLatch; this.waitLatch = waitLatch; }
public TestCommandBuilder() { TestCircuitBreaker cb = new TestCircuitBreaker(); Owner = CommandGroupForUnitTest.OwnerOne; DependencyKey = null; ThreadPoolKey = null; CircuitBreaker = cb; ThreadPool = null; CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter(); ThreadPoolPropertiesDefaults = UnitTestSetterFactory.GetThreadPoolPropertiesSetter(); Metrics = cb.Metrics; FallbackSemaphore = null; ExecutionSemaphore = null; ExecutionHook = new TestExecutionHook(); }
public TestCircuitBreaker() { this.metrics = HystrixCircuitBreakerTest.GetMetrics(UnitTestSetterFactory.GetCommandPropertiesSetter()); forceShortCircuit = false; }
public SuccessfulTestCommand() : this(UnitTestSetterFactory.GetCommandPropertiesSetter()) { }