Skip to content

Commit ad540d8

Browse files
committed
Upgrade Azure Blobstore fromi legacy azure-sdk (11.0) to latest (12.27.0)
Add azure storage blob 12.27.1 dependencies and upgrade the azure blobstore. Run Azurite-based integration tests against the latest Docker image version, remove legacy. Migrate to `com.azure:blobstorage:12.x`. The upgrade tries to do a 1:1 migration to the new azure-sdk API (in its blocking falvor) as much as possible, so that the integration tests serve to avoid regressions. A couple remarks: * There's no way to close the HTTPClient so AzureClient does not implement Closeable anymore. * Fix a bug in DeleteManager that always reported 0 objects deleted Upgrade `com.microsoft.azure:azure-storage-blob` to `com.azure:azure-storage-blob`.
1 parent 6d10d9f commit ad540d8

15 files changed

+474
-905
lines changed

geowebcache/azureblob/pom.xml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@
1111
<groupId>org.geowebcache</groupId>
1212
<artifactId>gwc-azure-blob</artifactId>
1313

14+
<properties>
15+
<!-- Same sdk version as imageio-ext's cog-ragengereader-azure for GeoSever compatibility -->
16+
<azure.version>12.27.1</azure.version>
17+
</properties>
18+
19+
<dependencyManagement>
20+
<dependencies>
21+
<dependency>
22+
<!--
23+
Use the same netty version as imageio-ext's cog-ragengereader-s3 and cog-rangereader-azure
24+
See https://github.com/geosolutions-it/imageio-ext/pull/312
25+
-->
26+
<groupId>io.netty</groupId>
27+
<artifactId>netty-bom</artifactId>
28+
<version>4.1.113.Final</version>
29+
<type>pom</type>
30+
<scope>import</scope>
31+
</dependency>
32+
</dependencies>
33+
</dependencyManagement>
1434
<dependencies>
1535
<dependency>
1636
<groupId>org.geowebcache</groupId>
@@ -19,10 +39,9 @@
1939
</dependency>
2040

2141
<dependency>
22-
<groupId>com.microsoft.azure</groupId>
42+
<groupId>com.azure</groupId>
2343
<artifactId>azure-storage-blob</artifactId>
24-
<!-- at the time of writing 11.0.1 was available but pom on repoes was corrupted -->
25-
<version>11.0.0</version>
44+
<version>${azure.version}</version>
2645
</dependency>
2746

2847
<dependency>

geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStore.java

Lines changed: 99 additions & 114 deletions
Large diffs are not rendered by default.

geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreData.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class AzureBlobStoreData {
2929
private String accountName;
3030
private String accountKey;
3131
private Integer maxConnections;
32-
private Boolean useHTTPS;
32+
private boolean useHTTPS;
3333
private String proxyHost;
3434
private Integer proxyPort;
3535
private String proxyUsername;
@@ -113,11 +113,11 @@ public void setMaxConnections(Integer maxConnections) {
113113
this.maxConnections = maxConnections;
114114
}
115115

116-
public Boolean isUseHTTPS() {
116+
public boolean isUseHTTPS() {
117117
return useHTTPS;
118118
}
119119

120-
public void setUseHTTPS(Boolean useHTTPS) {
120+
public void setUseHTTPS(boolean useHTTPS) {
121121
this.useHTTPS = useHTTPS;
122122
}
123123

@@ -137,6 +137,7 @@ public void setProxyPort(Integer proxyPort) {
137137
this.proxyPort = proxyPort;
138138
}
139139

140+
/** unused */
140141
public String getProxyUsername() {
141142
return proxyUsername;
142143
}
@@ -145,6 +146,7 @@ public void setProxyUsername(String proxyUsername) {
145146
this.proxyUsername = proxyUsername;
146147
}
147148

149+
/** unused */
148150
public String getProxyPassword() {
149151
return proxyPassword;
150152
}

geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreInfo.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class AzureBlobStoreInfo extends BlobStoreInfo {
5252

5353
private String maxConnections;
5454

55-
private Boolean useHTTPS = true;
55+
private boolean useHTTPS = true;
5656

5757
private String proxyHost;
5858

@@ -139,7 +139,7 @@ public Boolean isUseHTTPS() {
139139
}
140140

141141
/** @param useHTTPS whether to use HTTPS (true) or HTTP (false) when talking to Azure */
142-
public void setUseHTTPS(Boolean useHTTPS) {
142+
public void setUseHTTPS(boolean useHTTPS) {
143143
this.useHTTPS = useHTTPS;
144144
}
145145

@@ -260,7 +260,7 @@ public int hashCode() {
260260
result = prime * result + ((proxyPort == null) ? 0 : proxyPort.hashCode());
261261
result = prime * result + ((proxyUsername == null) ? 0 : proxyUsername.hashCode());
262262
result = prime * result + ((serviceURL == null) ? 0 : serviceURL.hashCode());
263-
result = prime * result + ((useHTTPS == null) ? 0 : useHTTPS.hashCode());
263+
result = prime * result + (useHTTPS ? 1 : 0);
264264
return result;
265265
}
266266

@@ -300,9 +300,7 @@ public boolean equals(Object obj) {
300300
if (serviceURL == null) {
301301
if (other.serviceURL != null) return false;
302302
} else if (!serviceURL.equals(other.serviceURL)) return false;
303-
if (useHTTPS == null) {
304-
if (other.useHTTPS != null) return false;
305-
} else if (!useHTTPS.equals(other.useHTTPS)) return false;
303+
if (useHTTPS != other.useHTTPS) return false;
306304
return true;
307305
}
308306

0 commit comments

Comments
 (0)