Package com.yammer.tenacity.core.logging

Examples of com.yammer.tenacity.core.logging.ExceptionLoggingCommandHook


                ));
    }

    @Test
    public void withExecutionMappers() throws Exception {
        final HystrixCommandExecutionHook hook = new ExceptionLoggingCommandHook();
        final TenacityConfiguredBundle bundle = TenacityBundleBuilder
                .newBuilder()
                .configurationFactory(configurationFactory)
                .commandExecutionHook(hook)
                .build();
View Full Code Here


    }

    @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
    @Test
    public void loggerLogsOnExpectedException() throws Exception {
        HystrixPlugins.getInstance().registerCommandExecutionHook(new ExceptionLoggingCommandHook(exceptionLogger));
        final HystrixCommand<String> failingCommand = new TenacityFailingCommand();

        failingCommand.execute();

        final List<RuntimeException> loggedExceptions = exceptionLogger.getLoggedExceptions();
View Full Code Here

        assertTrue(loggedExceptions.get(0).getClass().equals(RuntimeException.class));
    }

    @Test
    public void loggerDoesntLogIfItsNotExpected() throws Exception {
        HystrixPlugins.getInstance().registerCommandExecutionHook(new ExceptionLoggingCommandHook(exceptionLogger));
        final HystrixCommand<String> failingCommand = new TenacityFailingWithIOException();

        failingCommand.execute();

        final List<RuntimeException> loggedExceptions = exceptionLogger.getLoggedExceptions();
View Full Code Here

    }

    @Test
    public void shouldNotLogWhenShortCircuited() {
        final DefaultExceptionLogger defaultExceptionLogger = spy(new DefaultExceptionLogger());
        HystrixPlugins.getInstance().registerCommandExecutionHook(new ExceptionLoggingCommandHook(defaultExceptionLogger));

        try {
            new AlwaysShortCircuit().execute();
        } catch (HystrixRuntimeException err) {
            assertFalse(Iterables.isEmpty(
View Full Code Here

    private ExceptionLoggingCommandHook hook;

    @Before
    public void setUp() throws Exception {
        hook = new ExceptionLoggingCommandHook(
                ImmutableList.<ExceptionLogger<? extends Exception>>of(firstLogger, secondLogger, thirdLogger));
    }
View Full Code Here

    }

    @Test
    public void shouldLogWhenExceptionIsThrown() throws AuthenticationException {
        final DefaultExceptionLogger defaultExceptionLogger = spy(new DefaultExceptionLogger());
        HystrixPlugins.getInstance().registerCommandExecutionHook(new ExceptionLoggingCommandHook(defaultExceptionLogger));
        when(mockAuthenticator.authenticate(any(String.class))).thenThrow(new AuthenticationException("test"));
        doCallRealMethod().when(defaultExceptionLogger).log(any(Exception.class), any(HystrixCommand.class));

        try {
            tenacityAuthenticator.authenticate("foo");
View Full Code Here

TOP

Related Classes of com.yammer.tenacity.core.logging.ExceptionLoggingCommandHook

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.