diff --git a/src/main/java/land/oras/utils/Const.java b/src/main/java/land/oras/utils/Const.java index b3dd8843..e7bb690f 100644 --- a/src/main/java/land/oras/utils/Const.java +++ b/src/main/java/land/oras/utils/Const.java @@ -460,4 +460,24 @@ public static String currentTimestamp() { * Metric name for token refresh duration */ public static final String METRIC_TAG_REALM = "realm"; + + /** + * Flux CD config media type + */ + public static final String FLUX_CD_CONFIG_MEDIA_TYPE = "application/vnd.cncf.flux.config.v1+json"; + + /** + * Flux CD content media type + */ + public static final String FLUX_CD_CONTENT_MEDIA_TYPE = "application/vnd.cncf.flux.content.v1.tar+gzip"; + + /** + * Helm config media type + */ + public static final String HELM_CONFIG_MEDIA_TYPE = "application/vnd.cncf.helm.config.v1+json"; + + /** + * Helm content media type + */ + public static final String HELM_CONTENT_MEDIA_TYPE = "application/vnd.cncf.helm.chart.content.v1.tar+gzip"; } diff --git a/src/test/java/land/oras/FluxCDITCase.java b/src/test/java/land/oras/FluxCDITCase.java index 1c31fe39..1f02e035 100644 --- a/src/test/java/land/oras/FluxCDITCase.java +++ b/src/test/java/land/oras/FluxCDITCase.java @@ -49,8 +49,6 @@ void shouldAssembleArtifact() { // The compressed manifests Path archive = Paths.get("src/test/resources/archives").resolve("flux-manifests.tgz"); - String configMediaType = "application/vnd.cncf.flux.config.v1+json"; - String contentMediaType = "application/vnd.cncf.flux.content.v1.tar+gzip"; Map annotations = Map.of( Const.ANNOTATION_REVISION, "@sha1:6d63912ed9a9443dd01fbfd2991173a246050079", @@ -58,8 +56,8 @@ void shouldAssembleArtifact() { Const.ANNOTATION_CREATED, Const.currentTimestamp()); // Create objects - Config config = Config.empty().withMediaType(configMediaType); - Layer layer = Layer.fromFile(archive).withMediaType(contentMediaType); + Config config = Config.empty().withMediaType(Const.FLUX_CD_CONFIG_MEDIA_TYPE); + Layer layer = Layer.fromFile(archive).withMediaType(Const.FLUX_CD_CONTENT_MEDIA_TYPE); Manifest manifest = Manifest.empty().withConfig(config).withLayers(List.of(layer)).withAnnotations(annotations); diff --git a/src/test/java/land/oras/HelmITCase.java b/src/test/java/land/oras/HelmITCase.java index 631fda11..786642cb 100644 --- a/src/test/java/land/oras/HelmITCase.java +++ b/src/test/java/land/oras/HelmITCase.java @@ -49,8 +49,6 @@ void shouldAssembleArtifact() { // The compressed manifests Path archive = Paths.get("src/test/resources/archives").resolve("jenkins-chart.tgz"); - String configMediaType = "application/vnd.cncf.helm.config.v1+json"; - String contentMediaType = "application/vnd.cncf.helm.chart.content.v1.tar+gzip"; Map annotations = Map.of( Const.ANNOTATION_DESCRIPTION, "Test helm chart", @@ -58,8 +56,8 @@ void shouldAssembleArtifact() { Const.ANNOTATION_CREATED, Const.currentTimestamp()); // Create objects - Config config = Config.empty().withMediaType(configMediaType); - Layer layer = Layer.fromFile(archive).withMediaType(contentMediaType); + Config config = Config.empty().withMediaType(Const.HELM_CONFIG_MEDIA_TYPE); + Layer layer = Layer.fromFile(archive).withMediaType(Const.HELM_CONTENT_MEDIA_TYPE); Manifest manifest = Manifest.empty().withConfig(config).withLayers(List.of(layer)).withAnnotations(annotations);