@Test public void testNestedRepository() { for (String file : componentLessFiles) { String path = SUBSITE + "/" + file; Asset asset = createAsset(path); List<String> paths = generator.computeAssetPaths(asset, null).stream().map(BrowsePaths::getDisplayName) .collect(Collectors.toList()); assertThat(paths, contains(SUBSITE, file)); } String assetName = COMPONENT_NAME.stream().collect(Collectors.joining(".")) + '_' + COMPONENT_VERSION; Component component = createComponent(String.join(".", COMPONENT_NAME), null, COMPONENT_VERSION); for (String directory : knownSubDirectories) { Asset asset = createAsset(SUBSITE + '/' + directory + '/' + assetName); List<String> paths = generator.computeAssetPaths(asset, component).stream().map(BrowsePaths::getDisplayName) .collect(Collectors.toList()); List<String> expectedPaths = new ArrayList<>(); expectedPaths.add(SUBSITE); expectedPaths.add(directory); expectedPaths.addAll(COMPONENT_NAME); expectedPaths.add(COMPONENT_VERSION); expectedPaths.add(assetName); assertThat(paths, contains(expectedPaths.toArray())); } }
@Override public List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component) { List<String> assetPaths = splitPath(asset.name()); List<BrowsePaths> browsePaths = computeComponentPath(assetPaths, component); browsePaths.addAll(BrowsePaths.fromPaths(Collections.singletonList(assetPaths.get(assetPaths.size() - 1)), false)); return browsePaths; }
P2BrowseNodeGenerator implements BrowseNodeGenerator { @Override public List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component) { List<String> assetPaths = splitPath(asset.name()); List<BrowsePaths> browsePaths = computeComponentPath(assetPaths, component); browsePaths.addAll(BrowsePaths.fromPaths(Collections.singletonList(assetPaths.get(assetPaths.size() - 1)), false)); return browsePaths; } }
P2BrowseNodeGenerator implements BrowseNodeGenerator { @Override public List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component) { List<String> assetPaths = splitPath(asset.name()); List<BrowsePaths> browsePaths = computeComponentPath(assetPaths, component); browsePaths.addAll(BrowsePaths.fromPaths(Collections.singletonList(assetPaths.get(assetPaths.size() - 1)), false)); return browsePaths; } @Inject  P2BrowseNodeGenerator(); }
P2BrowseNodeGenerator implements BrowseNodeGenerator { @Override public List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component) { List<String> assetPaths = splitPath(asset.name()); List<BrowsePaths> browsePaths = computeComponentPath(assetPaths, component); browsePaths.addAll(BrowsePaths.fromPaths(Collections.singletonList(assetPaths.get(assetPaths.size() - 1)), false)); return browsePaths; } @Inject  P2BrowseNodeGenerator(); @Override List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component); @Override List<BrowsePaths> computeComponentPaths(final Asset asset, @Nullable final Component component); }
P2BrowseNodeGenerator implements BrowseNodeGenerator { @Override public List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component) { List<String> assetPaths = splitPath(asset.name()); List<BrowsePaths> browsePaths = computeComponentPath(assetPaths, component); browsePaths.addAll(BrowsePaths.fromPaths(Collections.singletonList(assetPaths.get(assetPaths.size() - 1)), false)); return browsePaths; } @Inject  P2BrowseNodeGenerator(); @Override List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component); @Override List<BrowsePaths> computeComponentPaths(final Asset asset, @Nullable final Component component);  }