@Test public void computeComponentPathNoGroup() { String baseVersion = "1.0.0"; NestedAttributesMap attributes = new NestedAttributesMap("attributes", singletonMap("maven2", singletonMap("baseVersion", baseVersion))); Asset asset = createAsset("name/1.0.0/name-1.0.0.jar"); Component component = new DefaultComponent(); component.name("name"); component.version("1.0.0"); component.attributes(attributes); List<BrowsePaths> paths = generator.computeComponentPaths(asset, component); assertPaths(asList(component.name(), component.version()), paths, true); }
@Override public List<BrowsePaths> computeComponentPaths(final Asset asset, final Component component) { List<String> pathParts = new ArrayList<>(); if (!Strings2.isBlank(component.group())) { pathParts.addAll(Splitter.on('.').omitEmptyStrings().splitToList(component.group())); } pathParts.add(component.name()); List<BrowsePaths> paths = BrowsePaths.fromPaths(pathParts, true); if (!Strings2.isBlank(component.version())) { String baseVersion = component.attributes().child("maven2").get("baseVersion", String.class); String requestPath = paths.get(paths.size() - 1).getRequestPath() + baseVersion + SLASH; if (!component.version().equals(baseVersion)) { BrowsePaths.appendPath(paths, baseVersion, requestPath); } BrowsePaths.appendPath(paths, component.version(), requestPath); } return paths; }
OrientMaven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator { @Override public List<BrowsePaths> computeComponentPaths(final Asset asset, final Component component) { List<String> pathParts = new ArrayList<>(); if (!Strings2.isBlank(component.group())) { pathParts.addAll(Splitter.on('.').omitEmptyStrings().splitToList(component.group())); } pathParts.add(component.name()); List<BrowsePaths> paths = BrowsePaths.fromPaths(pathParts, true); if (!Strings2.isBlank(component.version())) { String baseVersion = component.attributes().child("maven2").get("baseVersion", String.class); String requestPath = paths.get(paths.size() - 1).getRequestPath() + baseVersion + SLASH; if (!component.version().equals(baseVersion)) { BrowsePaths.appendPath(paths, baseVersion, requestPath); } BrowsePaths.appendPath(paths, component.version(), requestPath); } return paths; } }
OrientMaven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator { @Override public List<BrowsePaths> computeComponentPaths(final Asset asset, final Component component) { List<String> pathParts = new ArrayList<>(); if (!Strings2.isBlank(component.group())) { pathParts.addAll(Splitter.on('.').omitEmptyStrings().splitToList(component.group())); } pathParts.add(component.name()); List<BrowsePaths> paths = BrowsePaths.fromPaths(pathParts, true); if (!Strings2.isBlank(component.version())) { String baseVersion = component.attributes().child("maven2").get("baseVersion", String.class); String requestPath = paths.get(paths.size() - 1).getRequestPath() + baseVersion + SLASH; if (!component.version().equals(baseVersion)) { BrowsePaths.appendPath(paths, baseVersion, requestPath); } BrowsePaths.appendPath(paths, component.version(), requestPath); } return paths; }  }
OrientMaven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator { @Override public List<BrowsePaths> computeComponentPaths(final Asset asset, final Component component) { List<String> pathParts = new ArrayList<>(); if (!Strings2.isBlank(component.group())) { pathParts.addAll(Splitter.on('.').omitEmptyStrings().splitToList(component.group())); } pathParts.add(component.name()); List<BrowsePaths> paths = BrowsePaths.fromPaths(pathParts, true); if (!Strings2.isBlank(component.version())) { String baseVersion = component.attributes().child("maven2").get("baseVersion", String.class); String requestPath = paths.get(paths.size() - 1).getRequestPath() + baseVersion + SLASH; if (!component.version().equals(baseVersion)) { BrowsePaths.appendPath(paths, baseVersion, requestPath); } BrowsePaths.appendPath(paths, component.version(), requestPath); } return paths; }  @Override List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component); @Override List<BrowsePaths> computeComponentPaths(final Asset asset, final Component component); }
OrientMaven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator { @Override public List<BrowsePaths> computeComponentPaths(final Asset asset, final Component component) { List<String> pathParts = new ArrayList<>(); if (!Strings2.isBlank(component.group())) { pathParts.addAll(Splitter.on('.').omitEmptyStrings().splitToList(component.group())); } pathParts.add(component.name()); List<BrowsePaths> paths = BrowsePaths.fromPaths(pathParts, true); if (!Strings2.isBlank(component.version())) { String baseVersion = component.attributes().child("maven2").get("baseVersion", String.class); String requestPath = paths.get(paths.size() - 1).getRequestPath() + baseVersion + SLASH; if (!component.version().equals(baseVersion)) { BrowsePaths.appendPath(paths, baseVersion, requestPath); } BrowsePaths.appendPath(paths, component.version(), requestPath); } return paths; }  @Override List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component); @Override List<BrowsePaths> computeComponentPaths(final Asset asset, final Component component);  }