Skip to content

Instantly share code, notes, and snippets.

@nblair
Last active December 20, 2019 16:30
Show Gist options
  • Save nblair/85b34948de59e5a5f458fb81fb014d00 to your computer and use it in GitHub Desktop.
Save nblair/85b34948de59e5a5f458fb81fb014d00 to your computer and use it in GitHub Desktop.
3.19 vs 3.20 BlobStoreConfiguration use within Groovy API
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)
@nblair
Copy link
Author

nblair commented Dec 20, 2019

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 internal BlobStoreManager api instead of the supported Groovy API.

@nblair
Copy link
Author

nblair commented Dec 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment