@Test public void createFromAssetsSavesNodesWithComponents() { List<Component> components = asList( createComponent("componentName1", "componentGroup1", "componentVersion1", "componentId1"), createComponent("componentName2", "componentGroup2", "componentVersion2", "componentId2") ); List<Asset> assets = asList( createAsset("assetName1", "assetId1", MAVEN_2, EntityHelper.id(components.get(0))), createAsset("assetName2", "assetId2", MAVEN_2, EntityHelper.id(components.get(1))) ); for (int i = 0; i < assets.size(); i++) { Asset asset = assets.get(i); Component component = components.get(i); String name = asset.name(); when(maven2BrowseNodeGenerator.computeAssetPaths(asset, component)) .thenReturn(toBrowsePaths(asList(component.group(), component.name(), component.version(), name))); when(maven2BrowseNodeGenerator.computeComponentPaths(asset, component)) .thenReturn(toBrowsePaths(asList(component.group(), component.name(), component.version()))); } manager.createFromAssets(repository, assets); for (int i = 0; i < assets.size(); i++) { Asset asset = assets.get(i); Component component = components.get(i); verify(browseNodeStore).createComponentNode(REPOSITORY_NAME, MAVEN_2, toBrowsePaths(asList(component.group(), component.name(), component.version())), component); verify(browseNodeStore).createAssetNode(REPOSITORY_NAME, MAVEN_2, toBrowsePaths(asList(component.group(), component.name(), component.version(), asset.name())), asset); } verifyNoMoreInteractions(browseNodeStore); }
public void createFromAssets(final Repository repository, final Iterable<Asset> assets) { checkNotNull(repository); checkNotNull(assets); String repositoryName = repository.getName(); BrowseNodeGenerator generator = pathGenerators.getOrDefault(repository.getFormat().getValue(), defaultGenerator); assets.forEach(asset -> createBrowseNodes(repositoryName, repository.getFormat().getValue(), generator, asset)); }
OrientBrowseNodeManager extends ComponentSupport { public void createFromAssets(final Repository repository, final Iterable<Asset> assets) { checkNotNull(repository); checkNotNull(assets); String repositoryName = repository.getName(); BrowseNodeGenerator generator = pathGenerators.getOrDefault(repository.getFormat().getValue(), defaultGenerator); assets.forEach(asset -> createBrowseNodes(repositoryName, repository.getFormat().getValue(), generator, asset)); } }
OrientBrowseNodeManager extends ComponentSupport { public void createFromAssets(final Repository repository, final Iterable<Asset> assets) { checkNotNull(repository); checkNotNull(assets); String repositoryName = repository.getName(); BrowseNodeGenerator generator = pathGenerators.getOrDefault(repository.getFormat().getValue(), defaultGenerator); assets.forEach(asset -> createBrowseNodes(repositoryName, repository.getFormat().getValue(), generator, asset)); } @Inject  OrientBrowseNodeManager(
      final OrientBrowseNodeStore browseNodeStore,
      final ComponentStore componentStore,
      final Map<String, BrowseNodeGenerator> pathGenerators); }
OrientBrowseNodeManager extends ComponentSupport { public void createFromAssets(final Repository repository, final Iterable<Asset> assets) { checkNotNull(repository); checkNotNull(assets); String repositoryName = repository.getName(); BrowseNodeGenerator generator = pathGenerators.getOrDefault(repository.getFormat().getValue(), defaultGenerator); assets.forEach(asset -> createBrowseNodes(repositoryName, repository.getFormat().getValue(), generator, asset)); } @Inject  OrientBrowseNodeManager(
      final OrientBrowseNodeStore browseNodeStore,
      final ComponentStore componentStore,
      final Map<String, BrowseNodeGenerator> pathGenerators); void createFromAsset(final String repositoryName, final Asset asset); void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset); void createFromAssets(final Repository repository, final Iterable<Asset> assets); void deleteAssetNode(final Asset asset); void deleteComponentNode(final Component component); void deleteByRepository(final String repositoryName); }
OrientBrowseNodeManager extends ComponentSupport { public void createFromAssets(final Repository repository, final Iterable<Asset> assets) { checkNotNull(repository); checkNotNull(assets); String repositoryName = repository.getName(); BrowseNodeGenerator generator = pathGenerators.getOrDefault(repository.getFormat().getValue(), defaultGenerator); assets.forEach(asset -> createBrowseNodes(repositoryName, repository.getFormat().getValue(), generator, asset)); } @Inject  OrientBrowseNodeManager(
      final OrientBrowseNodeStore browseNodeStore,
      final ComponentStore componentStore,
      final Map<String, BrowseNodeGenerator> pathGenerators); void createFromAsset(final String repositoryName, final Asset asset); void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset); void createFromAssets(final Repository repository, final Iterable<Asset> assets); void deleteAssetNode(final Asset asset); void deleteComponentNode(final Component component); void deleteByRepository(final String repositoryName);  }