OrientPyPiFacetImpl extends FacetSupport implements PyPiFacet { @Override public Asset putIndex(final String path, final AssetBlob assetBlob) { final StorageTx tx = UnitOfWork.currentTx(); final Bucket bucket = tx.findBucket(getRepository()); Asset asset = findAsset(tx, bucket, path); if (asset == null) { asset = tx.createAsset(bucket, getRepository().getFormat()); asset.name(path); saveAsset(tx, asset, assetBlob, AssetKind.INDEX); } return asset; } @Inject  OrientPyPiFacetImpl(final AssetEntityAdapter assetEntityAdapter); @Override boolean assetExists(final String name); @Override @Nullable Asset put(final String path, final AssetBlob assetBlob); @Override Asset putPackage(final String path, final AssetBlob assetBlob); @Override Asset putIndex(final String path, final AssetBlob assetBlob);  }
@Test public void testPutIndex() throws Exception { when(assetBlob.getBlob()).thenReturn(blob); when(tx.findBucket(repository)).thenReturn(bucket); when(repository.getFormat()).thenReturn(format); when(tx.createAsset(bucket, format)).thenReturn(asset); when(asset.formatAttributes()).thenReturn(assetFormatAttributes); when(blob.getMetrics()).thenReturn(blobMetrics); when(blobMetrics.getCreationTime()).thenReturn(createdDateTime); underTest.put(INDEX_PATH, assetBlob); verify(asset).name(INDEX_PATH); verify(assetFormatAttributes).set(P_ASSET_KIND, AssetKind.INDEX); verify(tx).attachBlob(asset, assetBlob); verify(asset).blobCreated(createdDateTime); verify(tx).saveAsset(asset); }