use of com.netflix.hystrix.contrib.javanica.test.common.domain.User in project Hystrix by Netflix.
the class BasicCommandPropertiesTest method testGetUserDefGroupKeyWithSpecificThreadPoolKey.
@Test
public void testGetUserDefGroupKeyWithSpecificThreadPoolKey() {
User u1 = userService.getUserDefGroupKeyWithSpecificThreadPoolKey("1", "name: ");
assertEquals("name: 1", u1.getName());
assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
HystrixInvokableInfo<?> command = HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().iterator().next();
assertEquals("getUserDefGroupKeyWithSpecificThreadPoolKey", command.getCommandKey().name());
assertEquals("UserService", command.getCommandGroup().name());
assertEquals("CustomThreadPool", command.getThreadPoolKey().name());
assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS));
}
use of com.netflix.hystrix.contrib.javanica.test.common.domain.User in project Hystrix by Netflix.
the class BasicCommandPropertiesTest method testHystrixCommandProperties.
@Test
public void testHystrixCommandProperties() {
User u1 = userService.getUsingAllCommandProperties("1", "name: ");
assertEquals("name: 1", u1.getName());
assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
HystrixInvokableInfo<?> command = HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().iterator().next();
assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS));
// assert properties
assertEquals(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE, command.getProperties().executionIsolationStrategy().get());
assertEquals(500, command.getProperties().executionTimeoutInMilliseconds().get().intValue());
assertEquals(true, command.getProperties().executionTimeoutEnabled().get().booleanValue());
assertEquals(false, command.getProperties().executionIsolationThreadInterruptOnTimeout().get().booleanValue());
assertEquals(10, command.getProperties().executionIsolationSemaphoreMaxConcurrentRequests().get().intValue());
assertEquals(15, command.getProperties().fallbackIsolationSemaphoreMaxConcurrentRequests().get().intValue());
assertEquals(false, command.getProperties().fallbackEnabled().get().booleanValue());
assertEquals(false, command.getProperties().circuitBreakerEnabled().get().booleanValue());
assertEquals(30, command.getProperties().circuitBreakerRequestVolumeThreshold().get().intValue());
assertEquals(250, command.getProperties().circuitBreakerSleepWindowInMilliseconds().get().intValue());
assertEquals(60, command.getProperties().circuitBreakerErrorThresholdPercentage().get().intValue());
assertEquals(false, command.getProperties().circuitBreakerForceOpen().get().booleanValue());
assertEquals(true, command.getProperties().circuitBreakerForceClosed().get().booleanValue());
assertEquals(false, command.getProperties().metricsRollingPercentileEnabled().get().booleanValue());
assertEquals(400, command.getProperties().metricsRollingPercentileWindowInMilliseconds().get().intValue());
assertEquals(5, command.getProperties().metricsRollingPercentileWindowBuckets().get().intValue());
assertEquals(6, command.getProperties().metricsRollingPercentileBucketSize().get().intValue());
assertEquals(10, command.getProperties().metricsRollingStatisticalWindowBuckets().get().intValue());
assertEquals(500, command.getProperties().metricsRollingStatisticalWindowInMilliseconds().get().intValue());
assertEquals(312, command.getProperties().metricsHealthSnapshotIntervalInMilliseconds().get().intValue());
assertEquals(false, command.getProperties().requestCacheEnabled().get().booleanValue());
assertEquals(true, command.getProperties().requestLogEnabled().get().booleanValue());
}
use of com.netflix.hystrix.contrib.javanica.test.common.domain.User in project Hystrix by Netflix.
the class BasicCommandPropertiesTest method testGetUserDefaultPropertiesValues.
@Test
public void testGetUserDefaultPropertiesValues() {
User u1 = userService.getUserDefProperties("1", "name: ");
assertEquals("name: 1", u1.getName());
assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
HystrixInvokableInfo<?> command = HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().iterator().next();
assertEquals("getUserDefProperties", command.getCommandKey().name());
assertEquals("UserService", command.getCommandGroup().name());
assertEquals("UserService", command.getThreadPoolKey().name());
assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS));
}
use of com.netflix.hystrix.contrib.javanica.test.common.domain.User in project Hystrix by Netflix.
the class BasicCommandPropertiesTest method testGetUser.
@Test
public void testGetUser() throws NoSuchFieldException, IllegalAccessException {
User u1 = userService.getUser("1", "name: ");
assertEquals("name: 1", u1.getName());
assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
HystrixInvokableInfo<?> command = HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().iterator().next();
assertEquals("GetUserCommand", command.getCommandKey().name());
assertEquals("UserGroupKey", command.getCommandGroup().name());
assertEquals("Test", command.getThreadPoolKey().name());
assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS));
// assert properties
assertEquals(110, command.getProperties().executionTimeoutInMilliseconds().get().intValue());
assertEquals(false, command.getProperties().executionIsolationThreadInterruptOnTimeout().get());
HystrixThreadPoolProperties properties = getThreadPoolProperties(command);
assertEquals(30, (int) properties.coreSize().get());
assertEquals(101, (int) properties.maxQueueSize().get());
assertEquals(2, (int) properties.keepAliveTimeMinutes().get());
assertEquals(15, (int) properties.queueSizeRejectionThreshold().get());
assertEquals(1440, (int) properties.metricsRollingStatisticalWindowInMilliseconds().get());
assertEquals(12, (int) properties.metricsRollingStatisticalWindowBuckets().get());
}
Aggregations