ExposedServiceUriAnalyzer implements Updateable { @Override public void update() { final Map<String, Extension> exts = extensions.list().stream() .map(extensions::getExtension) .filter(Extension::isExposing) .filter(e -> e.exposed().scope() != Scope.EXTERNAL) .collect(Collectors.toMap(e -> e.exposed().exposedAt().getPath(), e -> e, (e1, e2) -> { LOG.warn("Expose path '{}' defined by two extensions: <{}> and <{}>; " + "Arbitrarily ignoring one of them", e1.exposed().exposedAt().getPath(), e1.uri(), e2.uri()); return e1.uri().compareTo(e2.uri()) <= 0 ? e1 : e2; })); endpoints.putAll(exts); endpoints.keySet().removeIf(k -> !exts.containsKey(k)); }  void setExtensionRegistry(final ExtensionRegistry registry); void setFcrepoBaseURI(final URI baseURI); void setExposePath(final String path); void setRouting(final RoutingFactory routing); void setInitializer(final Initializer initializer); void init(); void shutdown(); @Override void update(); @Override void update(final URI inResponseTo); ServiceExposingBinding match(final URI requestURI);  }
@Test public void updateTest() { when(extensisons.getExtension(extension2URI)).thenReturn(extension2); when(extension2.isExposing()).thenReturn(true); when(extension2.exposed()).thenReturn(extension2Spec); when(extension2Spec.exposedAt()).thenReturn(extension2ExposedAt); when(extension2Spec.scope()).thenReturn(Scope.RESOURCE); extensionURIs.add(extension2URI); toTest.update(); final String path = "some/path/"; final ServiceExposingBinding binding = toTest.match(exposureURI(path, extension2ExposedAt)); assertNotNull(binding); assertEquals(extension2, binding.extension); }