Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] Bump Groovy version to 3 that works with Java 17. #24477

Merged
merged 4 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/versioning/external_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ org.junit.vintage:junit-vintage-engine;5.7.2
org.openjdk.jmh:jmh-core;1.22
org.openjdk.jmh:jmh-generator-annprocess;1.22
org.spockframework:spock-core;2.0-M4-groovy-2.5
groovy3_org.spockframework:spock-core;2.0-groovy-3.0
org.testng:testng;7.3.0
uk.org.lidalia:slf4j-test;1.2.0

Expand Down
22 changes: 16 additions & 6 deletions sdk/storage/azure-storage-blob-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@
<version>1.6.5</version> <!-- {x-version-update;com.microsoft.azure:adal4j;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-M4-groovy-2.5</version> <!-- {x-version-update;org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
Expand Down Expand Up @@ -177,6 +171,14 @@
<activation>
<jdk>[1.8,9)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-M4-groovy-2.5</version> <!-- {x-version-update;org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -219,6 +221,14 @@
<activation>
<jdk>[9,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-groovy-3.0</version> <!-- {x-version-update;groovy3_org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ class APISpec extends StorageSpec {
BlobServiceClient versionedBlobServiceClient

def setup() {
primaryBlobServiceClient = getServiceClient(env.primaryAccount)
primaryBlobServiceAsyncClient = getServiceAsyncClient(env.primaryAccount)
versionedBlobServiceClient = getServiceClient(env.versionedAccount)
primaryBlobServiceClient = getServiceClient(environment.primaryAccount)
primaryBlobServiceAsyncClient = getServiceAsyncClient(environment.primaryAccount)
versionedBlobServiceClient = getServiceClient(environment.versionedAccount)
}

def getOAuthServiceClient() {
BlobServiceClientBuilder builder = new BlobServiceClientBuilder()
.endpoint(env.primaryAccount.blobEndpoint)
.endpoint(environment.primaryAccount.blobEndpoint)

instrument(builder)

if (env.testMode != TestMode.PLAYBACK) {
if (environment.testMode != TestMode.PLAYBACK) {
// AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET
return builder.credential(new EnvironmentCredentialBuilder().build()).buildClient()
} else {
// Running in playback, we don't have access to the AAD environment variables, just use SharedKeyCredential.
return builder.credential(env.primaryAccount.credential).buildClient()
return builder.credential(environment.primaryAccount.credential).buildClient()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class BatchAPITest extends APISpec {
thrown(BlobBatchStorageException)

// In PLAYBACK check responses in an order invariant fashion.
if (env.testMode == TestMode.PLAYBACK) {
if (environment.testMode == TestMode.PLAYBACK) {
assert (assertExpectedOrException(response1, 200) + assertExpectedOrException(response2, 200)) == 1
} else {
assert response1.getStatusCode() == 200
Expand Down Expand Up @@ -280,7 +280,7 @@ class BatchAPITest extends APISpec {
.verify(Duration.ofSeconds(30))

// In PLAYBACK check responses in an order invariant fashion.
if (env.testMode == TestMode.PLAYBACK) {
if (environment.testMode == TestMode.PLAYBACK) {
assert (assertExpectedOrException(response1, 200) + assertExpectedOrException(response2, 200)) == 1
} else {
assert response1.getStatusCode() == 200
Expand Down Expand Up @@ -313,7 +313,7 @@ class BatchAPITest extends APISpec {
notThrown(BlobBatchStorageException)

// In PLAYBACK check responses in an order invariant fashion.
if (env.testMode == TestMode.PLAYBACK) {
if (environment.testMode == TestMode.PLAYBACK) {
assert (assertExpectedOrException(response1, 200) + assertExpectedOrException(response2, 200)) == 1
} else {
assert response1.getStatusCode() == 200
Expand Down Expand Up @@ -435,7 +435,7 @@ class BatchAPITest extends APISpec {
thrown(BlobBatchStorageException)

// In PLAYBACK check responses in an order invariant fashion.
if (env.testMode == TestMode.PLAYBACK) {
if (environment.testMode == TestMode.PLAYBACK) {
assert (assertExpectedOrException(response1, 202) + assertExpectedOrException(response2, 202)) == 1
} else {
assert response1.getStatusCode() == 202
Expand Down Expand Up @@ -468,7 +468,7 @@ class BatchAPITest extends APISpec {
notThrown(BlobStorageException)

// In PLAYBACK check responses in an order invariant fashion.
if (env.testMode == TestMode.PLAYBACK) {
if (environment.testMode == TestMode.PLAYBACK) {
assert (assertExpectedOrException(response1, 202) + assertExpectedOrException(response2, 202)) == 1
} else {
assert response1.getStatusCode() == 202
Expand Down
22 changes: 16 additions & 6 deletions sdk/storage/azure-storage-blob-changefeed/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,6 @@
<version>1.6.5</version> <!-- {x-version-update;com.microsoft.azure:adal4j;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-M4-groovy-2.5</version> <!-- {x-version-update;org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
Expand Down Expand Up @@ -189,6 +183,14 @@
<activation>
<jdk>[1.8,9)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-M4-groovy-2.5</version> <!-- {x-version-update;org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -231,6 +233,14 @@
<activation>
<jdk>[9,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-groovy-3.0</version> <!-- {x-version-update;groovy3_org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ class APISpec extends StorageSpec {
}

def setup() {
primaryBlobServiceClient = getServiceClient(env.primaryAccount)
primaryBlobServiceAsyncClient = getServiceAsyncClient(env.primaryAccount)
primaryBlobServiceClient = getServiceClient(environment.primaryAccount)
primaryBlobServiceAsyncClient = getServiceAsyncClient(environment.primaryAccount)

containerName = generateContainerName()
}

def cleanup() {
if (env.testMode != TestMode.PLAYBACK) {
if (environment.testMode != TestMode.PLAYBACK) {
def cleanupClient = new BlobServiceClientBuilder()
.httpClient(getHttpClient())
.credential(env.primaryAccount.credential)
.endpoint(env.primaryAccount.blobEndpoint)
.credential(environment.primaryAccount.credential)
.endpoint(environment.primaryAccount.blobEndpoint)
.buildClient()
def options = new ListBlobContainersOptions().setPrefix(namer.getResourcePrefix())
for (BlobContainerItem container : cleanupClient.listBlobContainers(options, Duration.ofSeconds(120))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.azure.storage.blob.changefeed.models.BlobChangefeedEvent
import com.azure.storage.common.test.shared.extensions.PlaybackOnly
import spock.lang.Ignore
import reactor.test.StepVerifier
import spock.lang.Requires

import java.time.OffsetDateTime
import java.time.ZoneOffset
Expand Down Expand Up @@ -92,7 +91,7 @@ class ChangefeedNetworkTest extends APISpec {
/* Update and uncomment after recording. */
OffsetDateTime startTime = OffsetDateTime.of(2020, 8, 11, 23, 3, 10, 987532200, ZoneOffset.UTC)

Long pollInterval = env.testMode == TestMode.PLAYBACK ? 0 : 1000 * 60 * 3
Long pollInterval = environment.testMode == TestMode.PLAYBACK ? 0 : 1000 * 60 * 3

Set<String> eventIds1 = new HashSet<>()
Set<String> eventIds2 = new HashSet<>()
Expand Down
23 changes: 16 additions & 7 deletions sdk/storage/azure-storage-blob-cryptography/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@
<version>1.7.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.spockframework/spock-core -->
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-M4-groovy-2.5</version> <!-- {x-version-update;org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<!-- The following two dependencies are to test for
cross platform compatibility within SDKs -->
Expand Down Expand Up @@ -168,6 +161,14 @@
<activation>
<jdk>[1.8,9)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-M4-groovy-2.5</version> <!-- {x-version-update;org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -210,6 +211,14 @@
<activation>
<jdk>[9,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-groovy-3.0</version> <!-- {x-version-update;groovy3_org.spockframework:spock-core;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class APISpec extends StorageSpec {
* real key this way.
*/
static def getRandomKey(long seed = new Random().nextLong()) {
if (getEnv().getTestMode() == TestMode.LIVE) {
if (getEnvironment().getTestMode() == TestMode.LIVE) {
def key = new byte[32] // 256 bit key
new Random(seed).nextBytes(key)
return key
Expand All @@ -417,7 +417,7 @@ class APISpec extends StorageSpec {
* and RECORD testing modes only.
*/
static def mockAesKey(EncryptedBlobAsyncClient encryptedClient) {
if (getEnv().getTestMode() != TestMode.LIVE) {
if (getEnvironment().getTestMode() != TestMode.LIVE) {
def mockAesKey = new SecretKey() {
@Override
String getAlgorithm() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class BlobCryptographyBuilderTest extends APISpec {
def setup() {
keyId = "keyId"

fakeKey = new FakeKey(keyId, (getEnv().getTestMode() == TestMode.LIVE) ? getRandomByteArray(256) : mockRandomData)
fakeKey = new FakeKey(keyId, (getEnvironment().getTestMode() == TestMode.LIVE) ? getRandomByteArray(256) : mockRandomData)
fakeKeyResolver = new FakeKeyResolver(fakeKey)

def sc = getServiceClientBuilder(env.primaryAccount)
def sc = getServiceClientBuilder(environment.primaryAccount)
.buildClient()
def containerName = generateContainerName()
def blobName = generateBlobName()
Expand Down Expand Up @@ -66,7 +66,7 @@ class BlobCryptographyBuilderTest extends APISpec {
def "Http pipeline"() {
when:
def regularClient = cc.getBlobClient(generateBlobName())
def encryptedClient = new EncryptedBlobClient(mockAesKey(getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential, cc.getBlobContainerUrl())
def encryptedClient = new EncryptedBlobClient(mockAesKey(getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential, cc.getBlobContainerUrl())
.pipeline(regularClient.getHttpPipeline())
.blobName(regularClient.getBlobName())
.buildEncryptedBlobAsyncClient()))
Expand All @@ -82,7 +82,7 @@ class BlobCryptographyBuilderTest extends APISpec {
setup:
cc.create()
CustomerProvidedKey key = new CustomerProvidedKey(getRandomKey())
def builder = getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential, cc.getBlobContainerUrl())
def builder = getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential, cc.getBlobContainerUrl())
.customerProvidedKey(key)
.blobName(generateBlobName())
def encryptedAsyncClient = mockAesKey(builder.buildEncryptedBlobAsyncClient())
Expand All @@ -106,12 +106,12 @@ class BlobCryptographyBuilderTest extends APISpec {
setup:
cc.create()
CustomerProvidedKey key = new CustomerProvidedKey(getRandomKey())
def encryptedClientWithCpk = mockAesKey(getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential, cc.getBlobContainerUrl())
def encryptedClientWithCpk = mockAesKey(getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential, cc.getBlobContainerUrl())
.customerProvidedKey(key)
.blobName(generateBlobName())
.buildEncryptedBlobAsyncClient())

def encryptedClientNoCpk = new EncryptedBlobClient(mockAesKey(getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential, encryptedClientWithCpk.getBlobUrl())
def encryptedClientNoCpk = new EncryptedBlobClient(mockAesKey(getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential, encryptedClientWithCpk.getBlobUrl())
.buildEncryptedBlobAsyncClient()))

when:
Expand All @@ -129,7 +129,7 @@ class BlobCryptographyBuilderTest extends APISpec {
setup:
def scope = "testscope1"
cc.create()
def builder = getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential, cc.getBlobContainerUrl())
def builder = getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential, cc.getBlobContainerUrl())
.encryptionScope(scope)
.blobName(generateBlobName())
def encryptedAsyncClient = mockAesKey(builder.buildEncryptedBlobAsyncClient())
Expand Down Expand Up @@ -174,7 +174,7 @@ class BlobCryptographyBuilderTest extends APISpec {
def "getCustomerProvidedKeyClient"() {
setup:
CustomerProvidedKey originalKey = new CustomerProvidedKey(getRandomKey())
def client = getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential, cc.getBlobContainerUrl())
def client = getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential, cc.getBlobContainerUrl())
.customerProvidedKey(originalKey)
.blobName(generateBlobName())
.buildEncryptedBlobClient()
Expand All @@ -191,7 +191,7 @@ class BlobCryptographyBuilderTest extends APISpec {
def "getEncryptionScopeClient"() {
setup:
def originalScope = "testscope1"
def client = getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential, cc.getBlobContainerUrl())
def client = getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential, cc.getBlobContainerUrl())
.encryptionScope(originalScope)
.blobName(generateBlobName())
.buildEncryptedBlobClient()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ class EncryptedBlobOutputStreamTest extends APISpec {
fakeKey = new FakeKey(keyId, getRandomByteArray(256))
fakeKeyResolver = new FakeKeyResolver(fakeKey)

cc = getServiceClientBuilder(env.primaryAccount)
cc = getServiceClientBuilder(environment.primaryAccount)
.buildClient()
.getBlobContainerClient(generateContainerName())
cc.create()

def blobName = generateBlobName()

beac = getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential,
beac = getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential,
cc.getBlobContainerUrl())
.blobName(blobName)
.buildEncryptedBlobAsyncClient()

bec = getEncryptedClientBuilder(fakeKey, null, env.primaryAccount.credential,
bec = getEncryptedClientBuilder(fakeKey, null, environment.primaryAccount.credential,
cc.getBlobContainerUrl().toString())
.blobName(blobName)
.buildEncryptedBlobClient()
Expand Down
Loading