Last active
December 20, 2019 16:30
-
-
Save nblair/85b34948de59e5a5f458fb81fb014d00 to your computer and use it in GitHub Desktop.
3.19 vs 3.20 BlobStoreConfiguration use within Groovy API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/system-under-test/post-install-scenarios/01_blobstore.groovy b/system-under-test/post-install-scenarios/01_blobstore.groovy | |
index ea8db9d..9dbf852 100644 | |
--- a/system-under-test/post-install-scenarios/01_blobstore.groovy | |
+++ b/system-under-test/post-install-scenarios/01_blobstore.groovy | |
@@ -1,14 +1,15 @@ | |
-import org.sonatype.nexus.blobstore.api.BlobStoreConfiguration | |
import org.sonatype.nexus.blobstore.api.BlobStoreManager | |
import groovy.json.JsonSlurper | |
def object = new JsonSlurper().parseText(args) | |
def blobStoreManager = container.lookup(BlobStoreManager.class.name) | |
-blobStoreManager.create(new BlobStoreConfiguration(name: 'default', type: 'Google Cloud Storage', | |
- attributes: [ | |
- 'google cloud storage': [ | |
- bucket: "${object.name}".toString(), | |
- ] | |
- ])) | |
- | |
+def config = blobStoreManager.newConfiguration() | |
+config.name = 'default' | |
+config.type = 'Google Cloud Storage' | |
+config.setAttributes( | |
+ 'google cloud storage': [ | |
+ bucket: "${object.name}".toString(), | |
+ ] | |
+) | |
+blobStoreManager.create(config) |
Link back to 3.19 and prior version: https://gist.github.com/nblair/64e1e33b2b4bde0700c36fe73b264d3e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In 3.20 the
org.sonatype.nexus.blobstore.api.BlobStoreConfiguration
class changed from a concrete class to an interface. This patch represents the changes required to migrate a Groovy script that interacts with the internalBlobStoreManager
api instead of the supported Groovy API.