@Override public Number getValue() { return properties.executionTimeoutInMilliseconds().get(); } });
@Override public Number getValue() { return properties.executionTimeoutInMilliseconds().get(); } });
@Override public int getIntervalTimeInMilliseconds() { return originalCommand.properties.executionTimeoutInMilliseconds().get(); } };
@Test public void testCommandOverridesDefaultCommandProperties() { service.commandOverridesDefaultCommandProperties(); HystrixInvokableInfo<?> command = HystrixRequestLog.getCurrentRequest() .getAllExecutedCommands().iterator().next(); assertEquals(654, command.getProperties().executionTimeoutInMilliseconds().get().intValue()); }
@Test public void testCommandInheritsDefaultCommandProperties() { service.commandInheritsDefaultProperties(); HystrixInvokableInfo<?> command = HystrixRequestLog.getCurrentRequest() .getAllExecutedCommands().iterator().next(); assertEquals(456, command.getProperties().executionTimeoutInMilliseconds().get().intValue()); }
@Test public void testFallbackInheritsDefaultCommandProperties() { service.commandWithFallbackInheritsDefaultProperties(); com.netflix.hystrix.HystrixInvokableInfo fallbackCommand = getHystrixCommandByKey("fallbackInheritsDefaultProperties"); assertEquals(456, fallbackCommand.getProperties().executionTimeoutInMilliseconds().get().intValue()); }
@Test public void testFallbackOverridesDefaultCommandProperties() { service.commandWithFallbackOverridesDefaultProperties(); com.netflix.hystrix.HystrixInvokableInfo fallbackCommand = getHystrixCommandByKey("fallbackOverridesDefaultProperties"); assertEquals(654, fallbackCommand.getProperties().executionTimeoutInMilliseconds().get().intValue()); }
@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()); }
@Test public void testResetCommandProperties() { HystrixCommand<Boolean> cmd1 = new ResettableCommand(100, 1, 10); assertEquals(100L, (long) cmd1.getProperties().executionTimeoutInMilliseconds().get()); assertEquals(1L, (long) cmd1.getProperties().executionIsolationSemaphoreMaxConcurrentRequests().get()); //assertEquals(10L, (long) cmd1.threadPool.getExecutor()..getCorePoolSize()); Hystrix.reset(); HystrixCommand<Boolean> cmd2 = new ResettableCommand(700, 2, 40); assertEquals(700L, (long) cmd2.getProperties().executionTimeoutInMilliseconds().get()); assertEquals(2L, (long) cmd2.getProperties().executionIsolationSemaphoreMaxConcurrentRequests().get()); //assertEquals(40L, (long) cmd2.threadPool.getExecutor().getCorePoolSize()); }
assertEquals(500, command.getProperties().executionTimeoutInMilliseconds().get().intValue()); assertEquals(true, command.getProperties().executionTimeoutEnabled().get().booleanValue()); assertEquals(false, command.getProperties().executionIsolationThreadInterruptOnTimeout().get().booleanValue());
@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(35, (int) properties.maximumSize().get()); assertEquals(true, properties.getAllowMaximumSizeToDivergeFromCoreSize().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()); }
commandProperties.executionIsolationThreadPoolKeyOverride().get(), commandProperties.executionTimeoutEnabled().get(), commandProperties.executionTimeoutInMilliseconds().get(), commandProperties.fallbackEnabled().get(), commandProperties.fallbackIsolationSemaphoreMaxConcurrentRequests().get(),
@Override public Number getValue() { return properties.executionTimeoutInMilliseconds().get(); } });
@Override public Number getValue() { return properties.executionTimeoutInMilliseconds().get(); } });
@Override public Number value() { return properties.executionTimeoutInMilliseconds().get(); } });
@Override public int getIntervalTimeInMilliseconds() { return originalCommand.properties.executionTimeoutInMilliseconds().get(); } };
@Override public Number call() { return properties.executionTimeoutInMilliseconds().get(); } });
@Override public Number getValue() { return properties.executionTimeoutInMilliseconds().get(); } });
protected void setTimeoutWithTenacity(Invocation.Builder builder) { builder.property(ClientProperties.READ_TIMEOUT, Ints.checkedCast(TenacityCommand .getCommandProperties(tenacityPropertyKey) .executionTimeoutInMilliseconds() .get() + timeoutPadding.toMilliseconds())); }
protected void setTimeoutWithTenacity(Invocation.Builder builder) { builder.property(ClientProperties.READ_TIMEOUT, Ints.checkedCast(TenacityCommand .getCommandProperties(tenacityPropertyKey) .executionTimeoutInMilliseconds() .get() + timeoutPadding.toMilliseconds())); }