@Test public void should_build_paths_for_asset_without_a_component() { AssetData asset = new AssetData(); asset.setPath("/com/sonatype/example/metadata.xml"); List<BrowsePath> browsePaths = underTest.computeAssetPaths(asset); assertThat(browsePaths.size(), is(4)); assertThat(browsePaths, containsInAnyOrder( new BrowsePath("com", "/com/"), new BrowsePath("sonatype", "/com/sonatype/"), new BrowsePath("example", "/com/sonatype/example/"), new BrowsePath("metadata.xml", asset.path()))); }
@Override public List<BrowsePath> computeAssetPaths(final Asset asset) { checkNotNull(asset); return asset.component().map(component -> { List<BrowsePath> assetPaths = computeComponentPaths(asset); appendPath(assetPaths, lastSegment(asset.path()), asset.path()); return assetPaths; }).orElseGet(() -> super.computeAssetPaths(asset)); }
Maven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator { @Override public List<BrowsePath> computeAssetPaths(final Asset asset) { checkNotNull(asset); return asset.component().map(component -> { List<BrowsePath> assetPaths = computeComponentPaths(asset); appendPath(assetPaths, lastSegment(asset.path()), asset.path()); return assetPaths; }).orElseGet(() -> super.computeAssetPaths(asset)); } }
Maven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator { @Override public List<BrowsePath> computeAssetPaths(final Asset asset) { checkNotNull(asset); return asset.component().map(component -> { List<BrowsePath> assetPaths = computeComponentPaths(asset); appendPath(assetPaths, lastSegment(asset.path()), asset.path()); return assetPaths; }).orElseGet(() -> super.computeAssetPaths(asset)); }  }
Maven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator { @Override public List<BrowsePath> computeAssetPaths(final Asset asset) { checkNotNull(asset); return asset.component().map(component -> { List<BrowsePath> assetPaths = computeComponentPaths(asset); appendPath(assetPaths, lastSegment(asset.path()), asset.path()); return assetPaths; }).orElseGet(() -> super.computeAssetPaths(asset)); }  @Override List<BrowsePath> computeAssetPaths(final Asset asset); @Override List<BrowsePath> computeComponentPaths(final Asset asset); }
Maven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator { @Override public List<BrowsePath> computeAssetPaths(final Asset asset) { checkNotNull(asset); return asset.component().map(component -> { List<BrowsePath> assetPaths = computeComponentPaths(asset); appendPath(assetPaths, lastSegment(asset.path()), asset.path()); return assetPaths; }).orElseGet(() -> super.computeAssetPaths(asset)); }  @Override List<BrowsePath> computeAssetPaths(final Asset asset); @Override List<BrowsePath> computeComponentPaths(final Asset asset);  }