Search in sources :

Example 6 with HystrixThreadPoolProperties

use of com.netflix.hystrix.HystrixThreadPoolProperties 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());
}
Also used : User(com.netflix.hystrix.contrib.javanica.test.common.domain.User) HystrixThreadPoolProperties(com.netflix.hystrix.HystrixThreadPoolProperties) BasicHystrixTest(com.netflix.hystrix.contrib.javanica.test.common.BasicHystrixTest) Test(org.junit.Test)

Example 7 with HystrixThreadPoolProperties

use of com.netflix.hystrix.HystrixThreadPoolProperties in project Hystrix by Netflix.

the class BasicFallbackDefaultPropertiesTest method testFallbackInheritsThreadPollProperties.

@Test
public void testFallbackInheritsThreadPollProperties() {
    service.commandWithFallbackInheritsDefaultProperties();
    com.netflix.hystrix.HystrixInvokableInfo fallbackCommand = getHystrixCommandByKey("fallbackInheritsDefaultProperties");
    HystrixThreadPoolProperties properties = getThreadPoolProperties(fallbackCommand);
    assertEquals(123, properties.maxQueueSize().get().intValue());
}
Also used : HystrixThreadPoolProperties(com.netflix.hystrix.HystrixThreadPoolProperties) Test(org.junit.Test) BasicHystrixTest(com.netflix.hystrix.contrib.javanica.test.common.BasicHystrixTest)

Example 8 with HystrixThreadPoolProperties

use of com.netflix.hystrix.HystrixThreadPoolProperties in project Hystrix by Netflix.

the class BasicFallbackDefaultPropertiesTest method testCommandOverridesDefaultPropertiesWithFallbackInheritsDefaultProperties.

@Test
public void testCommandOverridesDefaultPropertiesWithFallbackInheritsDefaultProperties() {
    service.commandOverridesDefaultPropertiesWithFallbackInheritsDefaultProperties();
    com.netflix.hystrix.HystrixInvokableInfo fallbackCommand = getHystrixCommandByKey("fallbackInheritsDefaultProperties");
    HystrixThreadPoolProperties properties = getThreadPoolProperties(fallbackCommand);
    assertEquals("DefaultGroupKey", fallbackCommand.getCommandGroup().name());
    assertEquals("DefaultThreadPoolKey", fallbackCommand.getThreadPoolKey().name());
    assertEquals(456, fallbackCommand.getProperties().executionTimeoutInMilliseconds().get().intValue());
    assertEquals(123, properties.maxQueueSize().get().intValue());
}
Also used : HystrixThreadPoolProperties(com.netflix.hystrix.HystrixThreadPoolProperties) Test(org.junit.Test) BasicHystrixTest(com.netflix.hystrix.contrib.javanica.test.common.BasicHystrixTest)

Aggregations

HystrixThreadPoolProperties (com.netflix.hystrix.HystrixThreadPoolProperties)8 BasicHystrixTest (com.netflix.hystrix.contrib.javanica.test.common.BasicHystrixTest)6 Test (org.junit.Test)6 HystrixThreadPool (com.netflix.hystrix.HystrixThreadPool)1 User (com.netflix.hystrix.contrib.javanica.test.common.domain.User)1 Field (java.lang.reflect.Field)1