@Test public void testGetRoutingRule_notConfigured() throws Exception { Configuration configuration = mock(Configuration.class); when(configuration.getRepositoryName()).thenReturn("missing-config"); Repository repository = createRepository(configuration); assertNull(routingRuleCache.getRoutingRule(repository)); }
@Nullable public RoutingRule getRoutingRule(final Repository repository) { try { return repositoryAssignedCache.get(repository).map(this::getRoutingRule).orElse(null); } catch (ExecutionException e) { log.error("An error occurred retrieving the routing rule for repository: {}", repository.getName(), e); return null; } }
RoutingRuleCache extends ComponentSupport implements EventAware { @Nullable public RoutingRule getRoutingRule(final Repository repository) { try { return repositoryAssignedCache.get(repository).map(this::getRoutingRule).orElse(null); } catch (ExecutionException e) { log.error("An error occurred retrieving the routing rule for repository: {}", repository.getName(), e); return null; } } }
RoutingRuleCache extends ComponentSupport implements EventAware { @Nullable public RoutingRule getRoutingRule(final Repository repository) { try { return repositoryAssignedCache.get(repository).map(this::getRoutingRule).orElse(null); } catch (ExecutionException e) { log.error("An error occurred retrieving the routing rule for repository: {}", repository.getName(), e); return null; } } @Inject  RoutingRuleCache(final RoutingRuleStore routingRuleStore); }
RoutingRuleCache extends ComponentSupport implements EventAware { @Nullable public RoutingRule getRoutingRule(final Repository repository) { try { return repositoryAssignedCache.get(repository).map(this::getRoutingRule).orElse(null); } catch (ExecutionException e) { log.error("An error occurred retrieving the routing rule for repository: {}", repository.getName(), e); return null; } } @Inject  RoutingRuleCache(final RoutingRuleStore routingRuleStore); @Nullable RoutingRule getRoutingRule(final Repository repository); @Nullable EntityId getRoutingRuleId(final Repository repository); @AllowConcurrentEvents @Subscribe void handle(final RepositoryDeletedEvent event); @AllowConcurrentEvents @Subscribe void handle(final RepositoryUpdatedEvent event); @AllowConcurrentEvents @Subscribe void handle(final RoutingRuleInvalidatedEvent event); }
RoutingRuleCache extends ComponentSupport implements EventAware { @Nullable public RoutingRule getRoutingRule(final Repository repository) { try { return repositoryAssignedCache.get(repository).map(this::getRoutingRule).orElse(null); } catch (ExecutionException e) { log.error("An error occurred retrieving the routing rule for repository: {}", repository.getName(), e); return null; } } @Inject  RoutingRuleCache(final RoutingRuleStore routingRuleStore); @Nullable RoutingRule getRoutingRule(final Repository repository); @Nullable EntityId getRoutingRuleId(final Repository repository); @AllowConcurrentEvents @Subscribe void handle(final RepositoryDeletedEvent event); @AllowConcurrentEvents @Subscribe void handle(final RepositoryUpdatedEvent event); @AllowConcurrentEvents @Subscribe void handle(final RoutingRuleInvalidatedEvent event);  }