RoutingRuleCache extends ComponentSupport implements EventAware { @Nullable public EntityId getRoutingRuleId(final Repository repository) { try { return repositoryAssignedCache.get(repository).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);  }
@Test public void testGetRoutingRuleId() throws Exception { Repository repository = createRepository("repo-a", "rule-a"); assertThat(routingRuleCache.getRoutingRuleId(repository), is(new DetachedEntityId("rule-a"))); verifyZeroInteractions(store); }