RFacetUtils { public static Content saveAsset(final StorageTx tx, final Asset asset, final Supplier<InputStream> contentSupplier, final Payload payload) throws IOException { AttributesMap contentAttributes = null; String contentType = null; if (payload instanceof Content) { contentAttributes = ((Content) payload).getAttributes(); contentType = payload.getContentType(); } return saveAsset(tx, asset, contentSupplier, contentType, contentAttributes); } private  RFacetUtils(); static Content toContent(final Asset asset, final Blob blob); @Nullable static Component findComponent(final StorageTx tx,
                                        final Repository repository,
                                        final String name,
                                        final String version,
                                        final String group); @Nullable static Asset findAsset(final StorageTx tx, final Bucket bucket, final String assetName); static Iterable<Asset> browseAllAssetsByKind(final StorageTx tx,
                                                      final Bucket bucket,
                                                      final AssetKind assetKind); static Content saveAsset(final StorageTx tx,
                                  final Asset asset,
                                  final Supplier<InputStream> contentSupplier,
                                  final Payload payload); static Content saveAsset(final StorageTx tx,
                                  final Asset asset,
                                  final Supplier<InputStream> contentSupplier,
                                  final String contentType,
                                  @Nullable final AttributesMap contentAttributes); static AssetKind extractAssetKind(final Asset asset); static final List<HashAlgorithm> HASH_ALGORITHMS; }
@Test public void returnContentOnSaveAsset() throws Exception { assertThat(saveAsset(tx, asset, supplier, payload), is(notNullValue())); }
@Test public void markAssetAsDownloadedOnSave() throws Exception { saveAsset(tx, asset, supplier, payload); verify(asset).markAsDownloaded(); }
@Test public void passAssetToTxOnSave() throws Exception { saveAsset(tx, asset, supplier, payload); verify(tx).saveAsset(asset); }
@Test public void applyContentToAssetOnSave() throws Exception { saveAsset(tx, asset, supplier, payload); verify(nestedAttributesMap).set(eq("last_modified"),any()); }
@Test public void extractContentTypeForContentPayloadOnSave() throws Exception { saveAsset(tx, asset, supplier, content); verify(content).getContentType(); verify(content).getAttributes(); }