Java Code Examples for org.sonatype.nexus.repository.storage.Asset#contentType()
The following examples show how to use
org.sonatype.nexus.repository.storage.Asset#contentType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PurgeUnusedSnapshotsFacetImplTest.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
private Asset createMetadataAsset(String name, String cacheToken) { Asset asset = new Asset(); asset.contentType(TEXT_XML); asset.name(name); asset.format(Maven2Format.NAME); asset.attributes(new NestedAttributesMap(P_ATTRIBUTES, new HashMap<>())); asset.formatAttributes().set(P_ASSET_KIND, REPOSITORY_METADATA.name()); asset.attributes().child(CHECKSUM).set(HashType.SHA1.getExt(), HashAlgorithm.SHA1.function().hashString("foobar", StandardCharsets.UTF_8).toString()); asset.attributes().child(CHECKSUM).set(HashType.MD5.getExt(), HashAlgorithm.MD5.function().hashString("foobar", StandardCharsets.UTF_8).toString()); asset.attributes().child(CONTENT).set(P_LAST_MODIFIED, new Date()); asset.attributes().child(CONTENT).set(P_ETAG, "ETAG"); asset.attributes().child(CACHE).set(LAST_VERIFIED, new Date()); asset.attributes().child(CACHE).set(CACHE_TOKEN, cacheToken); asset.blobRef(new BlobRef("node", "store", "blobid")); return asset; }
Example 2
Source File: MavenFacetImplTest.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
private Asset createMetadataAsset(String name, String cacheToken) { Asset asset = new Asset(); asset.contentType(TEXT_XML); asset.name(name); asset.format(Maven2Format.NAME); asset.attributes(new NestedAttributesMap(P_ATTRIBUTES, new HashMap<>())); asset.formatAttributes().set(P_ASSET_KIND, REPOSITORY_METADATA.name()); asset.attributes().child(CHECKSUM).set(HashType.SHA1.getExt(), HashAlgorithm.SHA1.function().hashString("foobar", StandardCharsets.UTF_8).toString()); asset.attributes().child(CHECKSUM).set(HashType.MD5.getExt(), HashAlgorithm.MD5.function().hashString("foobar", StandardCharsets.UTF_8).toString()); asset.attributes().child(CONTENT).set(P_LAST_MODIFIED, new Date()); asset.attributes().child(CONTENT).set(P_ETAG, "ETAG"); asset.attributes().child(CACHE).set(LAST_VERIFIED, new Date()); asset.attributes().child(CACHE).set(CACHE_TOKEN, cacheToken); asset.blobRef(new BlobRef("node", "store", "blobid")); return asset; }
Example 3
Source File: MavenFacetImpl.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
private Content toContent(final Asset asset, final Blob blob) { final String contentType = asset.contentType(); final Content content = new Content(new BlobPayload(blob, contentType)); Content.extractFromAsset(asset, HashType.ALGORITHMS, content.getAttributes()); return content; }