@Test public void testPutRepositoryRoot() throws Exception { underTest.putRepositoryRoot(assetBlob, null); verifyAssetCreated(REPOSITORY_ROOT_ASSET); verify(eventManager).post(any(NpmSearchIndexInvalidatedEvent.class)); }
@Nullable @Override public Asset putRepositoryRoot(final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes) throws IOException { final Repository repository = getRepository(); final StorageTx tx = UnitOfWork.currentTx(); final Bucket bucket = tx.findBucket(repository); Asset asset = NpmFacetUtils.findRepositoryRootAsset(tx, bucket); if (asset == null) { asset = tx.createAsset(bucket, repository.getFormat()).name(REPOSITORY_ROOT_ASSET); getEventManager().post(new NpmSearchIndexInvalidatedEvent(repository)); saveAsset(tx, asset, assetBlob, REPOSITORY_ROOT, contentAttributes); } return asset; }
NpmFacetImpl extends FacetSupport implements NpmFacet { @Nullable @Override public Asset putRepositoryRoot(final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes) throws IOException { final Repository repository = getRepository(); final StorageTx tx = UnitOfWork.currentTx(); final Bucket bucket = tx.findBucket(repository); Asset asset = NpmFacetUtils.findRepositoryRootAsset(tx, bucket); if (asset == null) { asset = tx.createAsset(bucket, repository.getFormat()).name(REPOSITORY_ROOT_ASSET); getEventManager().post(new NpmSearchIndexInvalidatedEvent(repository)); saveAsset(tx, asset, assetBlob, REPOSITORY_ROOT, contentAttributes); } return asset; } }
NpmFacetImpl extends FacetSupport implements NpmFacet { @Nullable @Override public Asset putRepositoryRoot(final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes) throws IOException { final Repository repository = getRepository(); final StorageTx tx = UnitOfWork.currentTx(); final Bucket bucket = tx.findBucket(repository); Asset asset = NpmFacetUtils.findRepositoryRootAsset(tx, bucket); if (asset == null) { asset = tx.createAsset(bucket, repository.getFormat()).name(REPOSITORY_ROOT_ASSET); getEventManager().post(new NpmSearchIndexInvalidatedEvent(repository)); saveAsset(tx, asset, assetBlob, REPOSITORY_ROOT, contentAttributes); } return asset; } @Inject  NpmFacetImpl(final NpmPackageParser npmPackageParser); }
NpmFacetImpl extends FacetSupport implements NpmFacet { @Nullable @Override public Asset putRepositoryRoot(final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes) throws IOException { final Repository repository = getRepository(); final StorageTx tx = UnitOfWork.currentTx(); final Bucket bucket = tx.findBucket(repository); Asset asset = NpmFacetUtils.findRepositoryRootAsset(tx, bucket); if (asset == null) { asset = tx.createAsset(bucket, repository.getFormat()).name(REPOSITORY_ROOT_ASSET); getEventManager().post(new NpmSearchIndexInvalidatedEvent(repository)); saveAsset(tx, asset, assetBlob, REPOSITORY_ROOT, contentAttributes); } return asset; } @Inject  NpmFacetImpl(final NpmPackageParser npmPackageParser); @Nullable @Override Asset findRepositoryRootAsset(); @Nullable @Override Asset putRepositoryRoot(final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes); @Nullable @Override Asset findPackageRootAsset(final String packageId); @Nullable @Override Asset putPackageRoot(final String packageId,
                              final AssetBlob assetBlob,
                              @Nullable final AttributesMap contentAttributes); @Nullable @Override Asset findTarballAsset(final String packageId,
                                final String tarballName); @Nullable @Override Asset putTarball(final String packageId,
                          final String tarballName,
                          final AssetBlob assetBlob,
                          @Nullable final AttributesMap contentAttributes); }
NpmFacetImpl extends FacetSupport implements NpmFacet { @Nullable @Override public Asset putRepositoryRoot(final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes) throws IOException { final Repository repository = getRepository(); final StorageTx tx = UnitOfWork.currentTx(); final Bucket bucket = tx.findBucket(repository); Asset asset = NpmFacetUtils.findRepositoryRootAsset(tx, bucket); if (asset == null) { asset = tx.createAsset(bucket, repository.getFormat()).name(REPOSITORY_ROOT_ASSET); getEventManager().post(new NpmSearchIndexInvalidatedEvent(repository)); saveAsset(tx, asset, assetBlob, REPOSITORY_ROOT, contentAttributes); } return asset; } @Inject  NpmFacetImpl(final NpmPackageParser npmPackageParser); @Nullable @Override Asset findRepositoryRootAsset(); @Nullable @Override Asset putRepositoryRoot(final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes); @Nullable @Override Asset findPackageRootAsset(final String packageId); @Nullable @Override Asset putPackageRoot(final String packageId,
                              final AssetBlob assetBlob,
                              @Nullable final AttributesMap contentAttributes); @Nullable @Override Asset findTarballAsset(final String packageId,
                                final String tarballName); @Nullable @Override Asset putTarball(final String packageId,
                          final String tarballName,
                          final AssetBlob assetBlob,
                          @Nullable final AttributesMap contentAttributes);  }