Search in sources :

Example 1 with PluginException

use of org.zalando.nakadi.plugin.api.PluginException in project nakadi by zalando.

the class AuthorizationValidatorTest method whenPluginExceptionInIsAuthorizationAttributeValidThenServiceUnavailableException.

@Test(expected = ServiceTemporarilyUnavailableException.class)
public void whenPluginExceptionInIsAuthorizationAttributeValidThenServiceUnavailableException() throws Exception {
    final ResourceAuthorization auth = new ResourceAuthorization(ImmutableList.of(attr1), ImmutableList.of(attr2), ImmutableList.of(attr3));
    when(authorizationService.isAuthorizationAttributeValid(any())).thenThrow(new PluginException("blah"));
    validator.validateAuthorization(auth);
}
Also used : ResourceAuthorization(org.zalando.nakadi.domain.ResourceAuthorization) PluginException(org.zalando.nakadi.plugin.api.PluginException) Test(org.junit.Test)

Example 2 with PluginException

use of org.zalando.nakadi.plugin.api.PluginException in project nakadi by zalando.

the class AuthorizationValidatorTest method whenPluginExceptionInAuthorizeEventTypeUpdateThenServiceTemporaryUnavailableException.

@Test(expected = ServiceTemporarilyUnavailableException.class)
public void whenPluginExceptionInAuthorizeEventTypeUpdateThenServiceTemporaryUnavailableException() throws Exception {
    when(authorizationService.isAuthorized(any(), any())).thenThrow(new PluginException("blah"));
    validator.authorizeEventTypeAdmin(EventTypeTestBuilder.builder().authorization(new ResourceAuthorization(null, null, null)).build());
}
Also used : ResourceAuthorization(org.zalando.nakadi.domain.ResourceAuthorization) PluginException(org.zalando.nakadi.plugin.api.PluginException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ResourceAuthorization (org.zalando.nakadi.domain.ResourceAuthorization)2 PluginException (org.zalando.nakadi.plugin.api.PluginException)2