@Test public void testHandle_blocked() throws Exception { when(routingRuleHelper.isAllowed(any(Repository.class), eq(SOME_PATH))).thenReturn(false); Response response = underTest.handle(context); assertNotNull(response); assertThat(response.getStatus().getCode(), is(403)); verify(context, times(0)).proceed(); }
@Override public Response handle(final Context context) throws Exception { if (routingRuleHelper.isAllowed(context.getRepository(), path(context.getRequest()))) { return context.proceed(); } return HttpResponses.forbidden(PATH_IS_BLOCKED); }
RoutingRuleHandler extends ComponentSupport implements Handler, org.sonatype.nexus.repository.routing.RoutingRuleHandler { @Override public Response handle(final Context context) throws Exception { if (routingRuleHelper.isAllowed(context.getRepository(), path(context.getRequest()))) { return context.proceed(); } return HttpResponses.forbidden(PATH_IS_BLOCKED); } }
RoutingRuleHandler extends ComponentSupport implements Handler, org.sonatype.nexus.repository.routing.RoutingRuleHandler { @Override public Response handle(final Context context) throws Exception { if (routingRuleHelper.isAllowed(context.getRepository(), path(context.getRequest()))) { return context.proceed(); } return HttpResponses.forbidden(PATH_IS_BLOCKED); } @Inject  RoutingRuleHandler(final RoutingRuleHelper routingRuleHelper); }
RoutingRuleHandler extends ComponentSupport implements Handler, org.sonatype.nexus.repository.routing.RoutingRuleHandler { @Override public Response handle(final Context context) throws Exception { if (routingRuleHelper.isAllowed(context.getRepository(), path(context.getRequest()))) { return context.proceed(); } return HttpResponses.forbidden(PATH_IS_BLOCKED); } @Inject  RoutingRuleHandler(final RoutingRuleHelper routingRuleHelper); @Override Response handle(final Context context); }
RoutingRuleHandler extends ComponentSupport implements Handler, org.sonatype.nexus.repository.routing.RoutingRuleHandler { @Override public Response handle(final Context context) throws Exception { if (routingRuleHelper.isAllowed(context.getRepository(), path(context.getRequest()))) { return context.proceed(); } return HttpResponses.forbidden(PATH_IS_BLOCKED); } @Inject  RoutingRuleHandler(final RoutingRuleHelper routingRuleHelper); @Override Response handle(final Context context);  }