@Test public void should_throw_metadataException_when_id_not_found() { assertThatThrownBy(() -> graphLoader.loadGraphInfo(newArrayList("1"))) .isInstanceOf(MetaDataException.class) .hasMessage("Cannot find parents: [1]"); }
public Map<String, UnitGraphModel> loadGraphInfo(Iterable<? extends String> ids) throws MetaDataNotFoundException { try { return unitLoadingCache.getAll(ids); } catch (CacheLoader.InvalidCacheLoadException e) { Matcher matcher = pattern.matcher(e.getMessage()); if (matcher.matches()) { String id = matcher.group(1); throw new MetaDataNotFoundException("Cannot find parents: [" + id + "]"); } throw new MetaDataNotFoundException(e); } catch (ExecutionException e) { throw new VitamRuntimeException(e); } }
GraphLoader implements AutoCloseable { public Map<String, UnitGraphModel> loadGraphInfo(Iterable<? extends String> ids) throws MetaDataNotFoundException { try { return unitLoadingCache.getAll(ids); } catch (CacheLoader.InvalidCacheLoadException e) { Matcher matcher = pattern.matcher(e.getMessage()); if (matcher.matches()) { String id = matcher.group(1); throw new MetaDataNotFoundException("Cannot find parents: [" + id + "]"); } throw new MetaDataNotFoundException(e); } catch (ExecutionException e) { throw new VitamRuntimeException(e); } } }
GraphLoader implements AutoCloseable { public Map<String, UnitGraphModel> loadGraphInfo(Iterable<? extends String> ids) throws MetaDataNotFoundException { try { return unitLoadingCache.getAll(ids); } catch (CacheLoader.InvalidCacheLoadException e) { Matcher matcher = pattern.matcher(e.getMessage()); if (matcher.matches()) { String id = matcher.group(1); throw new MetaDataNotFoundException("Cannot find parents: [" + id + "]"); } throw new MetaDataNotFoundException(e); } catch (ExecutionException e) { throw new VitamRuntimeException(e); } } GraphLoader(MongoDbMetadataRepository<Unit> mongoDbMetadataRepository); }
GraphLoader implements AutoCloseable { public Map<String, UnitGraphModel> loadGraphInfo(Iterable<? extends String> ids) throws MetaDataNotFoundException { try { return unitLoadingCache.getAll(ids); } catch (CacheLoader.InvalidCacheLoadException e) { Matcher matcher = pattern.matcher(e.getMessage()); if (matcher.matches()) { String id = matcher.group(1); throw new MetaDataNotFoundException("Cannot find parents: [" + id + "]"); } throw new MetaDataNotFoundException(e); } catch (ExecutionException e) { throw new VitamRuntimeException(e); } } GraphLoader(MongoDbMetadataRepository<Unit> mongoDbMetadataRepository); Map<String, UnitGraphModel> loadGraphInfo(Iterable<? extends String> ids); void cleanCache(); @Override void close(); }
GraphLoader implements AutoCloseable { public Map<String, UnitGraphModel> loadGraphInfo(Iterable<? extends String> ids) throws MetaDataNotFoundException { try { return unitLoadingCache.getAll(ids); } catch (CacheLoader.InvalidCacheLoadException e) { Matcher matcher = pattern.matcher(e.getMessage()); if (matcher.matches()) { String id = matcher.group(1); throw new MetaDataNotFoundException("Cannot find parents: [" + id + "]"); } throw new MetaDataNotFoundException(e); } catch (ExecutionException e) { throw new VitamRuntimeException(e); } } GraphLoader(MongoDbMetadataRepository<Unit> mongoDbMetadataRepository); Map<String, UnitGraphModel> loadGraphInfo(Iterable<? extends String> ids); void cleanCache(); @Override void close();  }