@Test public void resolveSelfRelationship() { ComponentRelationships cable = ComponentRelationships.builder() .component(CABLE) .addConsumer(Consumer.by(CABLE)) .build(); ComponentRelationships cableResolved = ComponentRelationships.builder() .component(CABLE) .addConsumer(Consumer.by(CABLE)) .addDependency(Dependency.on(CABLE)) .build(); Snitch snitch1 = StaticSnitch.of(URI.create("fake: System actual = resolver.resolve(SYSTEM_NAME, StaticSnitchRegistry.of(snitch1)); System expected = System.of(SYSTEM_NAME, cableResolved); Assertions.assertThat(actual).isEqualTo(expected); }
@Override public System resolve(String systemName, SnitchRegistry snitchRegistry) { Set<SystemFragment> frags = new HashSet<>(); Set<ResolutionError> errors = new HashSet<>(); for (Snitch snitch : snitchRegistry.getAll()) { try { frags.add(snitch.snitch()); } catch (SnitchingException e) { LOGGER.error("Snitch error caught while resolving system at URI : " + e.getSnitchUri(), e); errors.add(ResolutionError.translate(e)); } catch (RuntimeException e) { LOGGER.error("Technical error caught while resolving system at URI : " + snitch.getUri(), e); errors.add(ResolutionError.of(snitch.getUri(), DEFAULT_ERROR_MESSAGE)); } } return resolveBuilder(systemName, frags).errors(errors).build(); }
SimpleSystemResolver implements SystemResolver { @Override public System resolve(String systemName, SnitchRegistry snitchRegistry) { Set<SystemFragment> frags = new HashSet<>(); Set<ResolutionError> errors = new HashSet<>(); for (Snitch snitch : snitchRegistry.getAll()) { try { frags.add(snitch.snitch()); } catch (SnitchingException e) { LOGGER.error("Snitch error caught while resolving system at URI : " + e.getSnitchUri(), e); errors.add(ResolutionError.translate(e)); } catch (RuntimeException e) { LOGGER.error("Technical error caught while resolving system at URI : " + snitch.getUri(), e); errors.add(ResolutionError.of(snitch.getUri(), DEFAULT_ERROR_MESSAGE)); } } return resolveBuilder(systemName, frags).errors(errors).build(); } }
SimpleSystemResolver implements SystemResolver { @Override public System resolve(String systemName, SnitchRegistry snitchRegistry) { Set<SystemFragment> frags = new HashSet<>(); Set<ResolutionError> errors = new HashSet<>(); for (Snitch snitch : snitchRegistry.getAll()) { try { frags.add(snitch.snitch()); } catch (SnitchingException e) { LOGGER.error("Snitch error caught while resolving system at URI : " + e.getSnitchUri(), e); errors.add(ResolutionError.translate(e)); } catch (RuntimeException e) { LOGGER.error("Technical error caught while resolving system at URI : " + snitch.getUri(), e); errors.add(ResolutionError.of(snitch.getUri(), DEFAULT_ERROR_MESSAGE)); } } return resolveBuilder(systemName, frags).errors(errors).build(); }  }
SimpleSystemResolver implements SystemResolver { @Override public System resolve(String systemName, SnitchRegistry snitchRegistry) { Set<SystemFragment> frags = new HashSet<>(); Set<ResolutionError> errors = new HashSet<>(); for (Snitch snitch : snitchRegistry.getAll()) { try { frags.add(snitch.snitch()); } catch (SnitchingException e) { LOGGER.error("Snitch error caught while resolving system at URI : " + e.getSnitchUri(), e); errors.add(ResolutionError.translate(e)); } catch (RuntimeException e) { LOGGER.error("Technical error caught while resolving system at URI : " + snitch.getUri(), e); errors.add(ResolutionError.of(snitch.getUri(), DEFAULT_ERROR_MESSAGE)); } } return resolveBuilder(systemName, frags).errors(errors).build(); }  @Override System resolve(String systemName, SnitchRegistry snitchRegistry); @Override System resolve(String systemName, Collection<SystemFragment> fragments); }
SimpleSystemResolver implements SystemResolver { @Override public System resolve(String systemName, SnitchRegistry snitchRegistry) { Set<SystemFragment> frags = new HashSet<>(); Set<ResolutionError> errors = new HashSet<>(); for (Snitch snitch : snitchRegistry.getAll()) { try { frags.add(snitch.snitch()); } catch (SnitchingException e) { LOGGER.error("Snitch error caught while resolving system at URI : " + e.getSnitchUri(), e); errors.add(ResolutionError.translate(e)); } catch (RuntimeException e) { LOGGER.error("Technical error caught while resolving system at URI : " + snitch.getUri(), e); errors.add(ResolutionError.of(snitch.getUri(), DEFAULT_ERROR_MESSAGE)); } } return resolveBuilder(systemName, frags).errors(errors).build(); }  @Override System resolve(String systemName, SnitchRegistry snitchRegistry); @Override System resolve(String systemName, Collection<SystemFragment> fragments);  }