IGNITE-15388 Fix azure-blob-storage dependency versions (#9365)
diff --git a/modules/azure/pom.xml b/modules/azure/pom.xml
index 850f4ed..206fef8 100644
--- a/modules/azure/pom.xml
+++ b/modules/azure/pom.xml
@@ -28,17 +28,17 @@
<version>2.12.0-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.azure</groupId>
- <artifactId>azure-sdk-bom</artifactId>
- <version>1.0.2</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
+<!-- <dependencyManagement>-->
+<!-- <dependencies>-->
+<!-- <dependency>-->
+<!-- <groupId>com.azure</groupId>-->
+<!-- <artifactId>azure-sdk-bom</artifactId>-->
+<!-- <version>1.0.2</version>-->
+<!-- <type>pom</type>-->
+<!-- <scope>import</scope>-->
+<!-- </dependency>-->
+<!-- </dependencies>-->
+<!-- </dependencyManagement>-->
<dependencies>
<dependency>
@@ -73,25 +73,38 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
- <version>1.0.0</version>
+ <version>1.10.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
- <version>1.0.0</version>
+ <version>1.17.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.azure</groupId>
+ <artifactId>azure-storage-internal-avro</artifactId>
+ <version>12.0.5</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
- <version>${azure.sdk.version}</version>
+ <version>12.13.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-common</artifactId>
- <version>${azure.sdk.version}</version>
+ <version>12.12.0</version>
+ </dependency>
+
+ <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
@@ -102,15 +115,6 @@
</dependency>
<dependency>
- <groupId>com.azure</groupId>
- <artifactId>azure-security-keyvault-secrets</artifactId>
- </dependency>
- <dependency>
- <groupId>com.azure</groupId>
- <artifactId>azure-identity</artifactId>
- </dependency>
-
- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
@@ -172,6 +176,13 @@
<version>${netty.version}</version>
</dependency>
+ <!-- https://mvnrepository.com/artifact/io.netty/netty-codec -->
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-codec-dns</artifactId>
+ <version>${netty.version}</version>
+ </dependency>
+
<!-- https://mvnrepository.com/artifact/io.netty/netty-codec-http2 -->
<dependency>
<groupId>io.netty</groupId>
@@ -221,6 +232,32 @@
<version>${netty.version}</version>
</dependency>
+ <!-- https://mvnrepository.com/artifact/io.netty/netty-resolver-dns -->
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-resolver-dns</artifactId>
+ <version>${netty.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-resolver-dns-native-macos</artifactId>
+ <version>${netty.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-tcnative-boringssl-static</artifactId>
+ <version>2.0.39.Final</version>
+ </dependency>
+
+ <!-- https://mvnrepository.com/artifact/io.netty/netty-codec-dns -->
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-codec-dns</artifactId>
+ <version>${netty.version}</version>
+ </dependency>
+
<!-- https://mvnrepository.com/artifact/io.netty/netty-transport -->
<dependency>
<groupId>io.netty</groupId>
@@ -249,6 +286,13 @@
<version>${netty.version}</version>
</dependency>
+ <!-- https://mvnrepository.com/artifact/io.netty/netty-tcnative -->
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-tcnative</artifactId>
+ <version>2.0.40.Final</version>
+ </dependency>
+
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -265,14 +309,27 @@
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
- <version>3.3.0.RELEASE</version>
+ <version>3.4.6</version>
</dependency>
- <!-- https://mvnrepository.com/artifact/io.projectreactor.netty/reactor-netty -->
+ <!-- https://mvnrepository.com/artifact/io.projectreactor.netty/reactor-netty-core -->
<dependency>
<groupId>io.projectreactor.netty</groupId>
- <artifactId>reactor-netty</artifactId>
- <version>0.9.0.RELEASE</version>
+ <artifactId>reactor-netty-core</artifactId>
+ <version>1.0.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.projectreactor.netty</groupId>
+ <artifactId>reactor-netty-http</artifactId>
+ <version>1.0.7</version>
+ </dependency>
+
+ <!-- https://mvnrepository.com/artifact/com.fasterxml.woodstox/woodstox-core -->
+ <dependency>
+ <groupId>com.fasterxml.woodstox</groupId>
+ <artifactId>woodstox-core</artifactId>
+ <version>6.2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.woodstox/stax2-api -->
@@ -282,13 +339,6 @@
<version>4.2.1</version>
</dependency>
- <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
-
<!-- https://mvnrepository.com/artifact/org.reflections/reflections -->
<dependency>
<groupId>org.reflections</groupId>
diff --git a/modules/azure/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/azure/TcpDiscoveryAzureBlobStoreIpFinder.java b/modules/azure/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/azure/TcpDiscoveryAzureBlobStoreIpFinder.java
index 031554b..6540909 100644
--- a/modules/azure/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/azure/TcpDiscoveryAzureBlobStoreIpFinder.java
+++ b/modules/azure/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/azure/TcpDiscoveryAzureBlobStoreIpFinder.java
@@ -16,11 +16,10 @@
* limitations under the License.
*/
import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -32,6 +31,7 @@
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.BlobServiceClient;
import com.azure.storage.blob.BlobServiceClientBuilder;
+import com.azure.storage.blob.models.BlobErrorCode;
import com.azure.storage.blob.models.BlobItem;
import com.azure.storage.blob.models.BlobStorageException;
import com.azure.storage.blob.specialized.BlockBlobClient;
@@ -46,8 +46,6 @@
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter;
-import static com.nimbusds.oauth2.sdk.util.URLUtils.CHARSET;
-
/**
* Azure Blob Storage based IP Finder
* <p>
@@ -154,33 +152,19 @@
init();
for (InetSocketAddress addr : addrs) {
- String key = keyFromAddr(addr);
try {
- key = URLEncoder.encode(key, CHARSET);
- } catch (UnsupportedEncodingException e) {
- throw new IgniteSpiException("Unable to encode URL due to error "
- + e.getMessage());
+ String key = URLEncoder.encode(keyFromAddr(addr), StandardCharsets.UTF_8.name());
+ BlockBlobClient blobClient = blobContainerClient.getBlobClient(key).getBlockBlobClient();
+
+ blobClient.upload(new ByteArrayInputStream(OBJECT_CONTENT), OBJECT_CONTENT.length);
}
-
- BlockBlobClient blobClient = blobContainerClient.getBlobClient(key).getBlockBlobClient();
- InputStream dataStream = new ByteArrayInputStream(OBJECT_CONTENT);
-
- try {
- blobClient.upload(dataStream, OBJECT_CONTENT.length);
+ catch (UnsupportedEncodingException e) {
+ throw new IgniteSpiException("Unable to encode URL due to error " + e.getMessage(), e);
}
catch (BlobStorageException e) {
// If the blob already exists, ignore
- if (!(e.getStatusCode() == 409)) {
- throw new IgniteSpiException("Failed to upload blob with exception " +
- e.getMessage());
- }
- }
-
- try {
- dataStream.close();
- }
- catch (IOException e) {
- throw new IgniteSpiException(e.getMessage());
+ if (e.getStatusCode() != 409)
+ throw new IgniteSpiException("Failed to upload blob with exception " + e.getMessage(), e);
}
}
}
@@ -199,9 +183,9 @@
} catch (Exception e) {
// https://github.com/Azure/azure-sdk-for-java/issues/20551
if ((!(e.getMessage().contains("InterruptedException"))) || (e instanceof BlobStorageException
- && (!((BlobStorageException) e).getErrorCode().equals(404)))) {
+ && (((BlobStorageException)e).getErrorCode() != BlobErrorCode.BLOB_NOT_FOUND))) {
throw new IgniteSpiException("Failed to delete entry [containerName=" + containerName +
- ", entry=" + key + ']', e);
+ ", entry=" + key + ']', e);
}
}
}
@@ -352,22 +336,6 @@
return addr.getAddress().getHostAddress() + "#" + addr.getPort();
}
- /**
- * Used by TEST SUITES only. Called through reflection.
- *
- * @param containerName Container to delete
- */
- private void removeContainer(String containerName) {
- init();
-
- try {
- blobServiceClient.getBlobContainerClient(containerName).delete();
- }
- catch (Exception e) {
- throw new IgniteSpiException("Failed to remove the container: " + containerName, e);
- }
- }
-
/** {@inheritDoc} */
@Override public TcpDiscoveryAzureBlobStoreIpFinder setShared(boolean shared) {
super.setShared(shared);
diff --git a/modules/azure/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/azure/TcpDiscoveryAzureBlobStoreIpFinderSelfTest.java b/modules/azure/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/azure/TcpDiscoveryAzureBlobStoreIpFinderSelfTest.java
index d9f87bb..9e8ac18 100644
--- a/modules/azure/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/azure/TcpDiscoveryAzureBlobStoreIpFinderSelfTest.java
+++ b/modules/azure/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/azure/TcpDiscoveryAzureBlobStoreIpFinderSelfTest.java
@@ -15,11 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import java.lang.reflect.Method;
+
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.Collection;
+import com.azure.storage.blob.BlobContainerClient;
+import com.azure.storage.blob.BlobServiceClientBuilder;
+import com.azure.storage.common.StorageSharedKeyCredential;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAbstractSelfTest;
import org.apache.ignite.testsuites.IgniteAzureTestSuite;
@@ -47,13 +50,17 @@
}
/** {@inheritDoc} */
- @Override protected void afterTestsStopped() {
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
try {
- Method method = TcpDiscoveryAzureBlobStoreIpFinder.class.getDeclaredMethod("removeContainer", String.class);
+ BlobContainerClient container =
+ new BlobServiceClientBuilder().endpoint(IgniteAzureTestSuite.getEndpoint()).credential(
+ new StorageSharedKeyCredential(IgniteAzureTestSuite.getAccountName(),
+ IgniteAzureTestSuite.getAccountKey())).buildClient().getBlobContainerClient(containerName);
- method.setAccessible(true);
-
- method.invoke(finder, containerName);
+ if (container.exists())
+ container.delete();
}
catch (Exception e) {
log.warning("Failed to remove bucket on Azure [containerName=" + containerName + ", mes=" + e.getMessage() + ']');
diff --git a/parent/pom.xml b/parent/pom.xml
index 8e2c3f7..5018f0f 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -54,7 +54,6 @@
<aspectj.version>1.8.13</aspectj.version>
<aws.sdk.bundle.version>1.10.12_1</aws.sdk.bundle.version>
<aws.sdk.version>1.11.75</aws.sdk.version>
- <azure.sdk.version>12.0.0</azure.sdk.version>
<netty.version>4.1.66.Final</netty.version>
<camel.version>2.22.0</camel.version>
<aws.encryption.sdk.version>1.3.2</aws.encryption.sdk.version>