Package org.sonatype.nexus.component.model

Examples of org.sonatype.nexus.component.model.Asset


    assetDocument.field(EntityAdapter.P_ID, assetId.asUniqueString());
    assetDocument.field(P_FIRST_CREATED, blob.getMetrics().getCreationTime().toDate());
    assetDocument.field(P_COMPONENT, componentDocumentRid);
    Map<String, String> blobRefs = ImmutableMap.of(localBlobStoreId, blob.getId().asUniqueString());
    assetDocument.field(P_BLOB_REFS, blobRefs);
    Asset asset = (Asset) sourceAsset;
    assetDocument.field(P_CONTENT_TYPE, asset.getContentType());
    assetDocument.field(P_PATH, asset.getPath());

    // store and return asset document
    return assetDocument.save();
  }
View Full Code Here


    assertThat(encode(AssetHashers.SHA512.hash(mockAsset())), is(equalTo(SHA512_HASH)));
    assertThat(encode(injectHasher("SHA512").hash(mockAsset())), is(equalTo(SHA512_HASH)));
  }

  private static Asset mockAsset() throws Exception {
    Asset asset = mock(Asset.class);
    when(asset.openStream()).thenReturn(new ByteArrayInputStream(DATA.getBytes(Charsets.UTF_8)));
    return asset;
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.component.model.Asset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.