From 0269f52a1a944448c6160836a37756a4dc1e4596 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Fri, 22 Mar 2024 15:31:55 -0700 Subject: [PATCH 01/28] Adding changes for vectorIndex and vectorEmbeddingPolicy --- .../cosmos/implementation/Constants.java | 5 + .../implementation/DocumentCollection.java | 32 ++++++ .../azure/cosmos/models/CompositePath.java | 2 +- .../models/CosmosContainerProperties.java | 21 ++++ .../azure/cosmos/models/DistanceFunction.java | 43 ++++++++ .../com/azure/cosmos/models/Embedding.java | 101 ++++++++++++++++++ .../azure/cosmos/models/IndexingPolicy.java | 30 +++++- .../cosmos/models/ModelBridgeInternal.java | 4 + .../azure/cosmos/models/VectorDataType.java | 38 +++++++ .../cosmos/models/VectorEmbeddingPolicy.java | 90 ++++++++++++++++ .../azure/cosmos/models/VectorIndexSpec.java | 79 ++++++++++++++ .../azure/cosmos/models/VectorIndexType.java | 36 +++++++ 12 files changed, 479 insertions(+), 2 deletions(-) create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java index 8409d5b7ec23..a9fcdc9f0824 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java @@ -120,6 +120,11 @@ public static final class Properties { public static final String SPATIAL_INDEXES = "spatialIndexes"; public static final String TYPES = "types"; + // Vector Embedding Policy + public static final String VECTOR_EMBEDDING_POLICY = "vectorEmbeddingPolicy"; + public static final String VECTOR_INDEXES = "vectorIndexes"; + public static final String VECTOR_INDEX_TYPE = "type"; + // Unique index. public static final String UNIQUE_KEY_POLICY = "uniqueKeyPolicy"; public static final String UNIQUE_KEYS = "uniqueKeys"; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java index 7728781e0665..16f906c71827 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java @@ -13,6 +13,7 @@ import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.PartitionKeyDefinition; import com.azure.cosmos.models.UniqueKeyPolicy; +import com.azure.cosmos.models.VectorEmbeddingPolicy; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; @@ -41,6 +42,7 @@ public final class DocumentCollection extends Resource { private UniqueKeyPolicy uniqueKeyPolicy; private PartitionKeyDefinition partitionKeyDefinition; private ClientEncryptionPolicy clientEncryptionPolicyInternal; + private VectorEmbeddingPolicy vectorEmbeddingPolicy; /** * Constructor. @@ -411,6 +413,36 @@ public void setClientEncryptionPolicy(ClientEncryptionPolicy value) { setProperty(this, Constants.Properties.CLIENT_ENCRYPTION_POLICY, value); } + /** + * Gets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item + * used in performing vector search on the items in a collection in the Azure CosmosDB database service. + * + * @return the Vector Embedding Policy. + */ + public VectorEmbeddingPolicy getVectorEmbeddingPolicy() { + if (this.vectorEmbeddingPolicy == null) { + if (super.has(Constants.Properties.VECTOR_EMBEDDING_POLICY)) { + this.vectorEmbeddingPolicy = super.getObject(Constants.Properties.VECTOR_EMBEDDING_POLICY, + VectorEmbeddingPolicy.class); + } + } + return this.vectorEmbeddingPolicy; + } + + /** + * Sets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item + * used in performing vector search on the items in a collection in the Azure CosmosDB database service. + * + * @param value the Vector Embedding Policy. + */ + public void setVectorEmbeddingPolicy(VectorEmbeddingPolicy value) { + if (value == null) { + throw new IllegalArgumentException("VectorEmbeddingPolicy cannot be null."); + } + this.vectorEmbeddingPolicy = value; + setProperty(this, Constants.Properties.VECTOR_EMBEDDING_POLICY, value); + } + public void populatePropertyBag() { super.populatePropertyBag(); if (this.indexingPolicy == null) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CompositePath.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CompositePath.java index f90b12091d5a..8a20ac937038 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CompositePath.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CompositePath.java @@ -92,7 +92,7 @@ public CompositePathSortOrder getOrder() { } /** - * Gets the sort order for the composite path. + * Sets the sort order for the composite path. *

* For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", * then you need to make the order for "/age" "ascending" and the order for "/height" "descending". diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java index 4fae5a797a70..1e5ef80a6af6 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java @@ -347,6 +347,27 @@ public CosmosContainerProperties setClientEncryptionPolicy(ClientEncryptionPolic return this; } + /** + * Gets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item + * used in performing vector search on the items in a collection in the Azure CosmosDB database service. + * + * @return the Vector Embedding Policy. + */ + public VectorEmbeddingPolicy getVectorEmbeddingPolicy() { + return this.documentCollection.getVectorEmbeddingPolicy(); + } + + /** + * Sets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item + * used in performing vector search on the items in a collection in the Azure CosmosDB database service. + * + * @param value the Vector Embedding Policy. + */ + public CosmosContainerProperties setVectorEmbeddingPolicy(VectorEmbeddingPolicy value) { + this.documentCollection.setVectorEmbeddingPolicy(value); + return this; + } + Resource getResource() { return this.documentCollection; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java new file mode 100644 index 000000000000..de506e087d39 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +/** + * Distance Function for the embeddings in the Cosmos DB database service. + */ +public enum DistanceFunction { + /** + * Represents the euclidean distance function. + */ + EUCLIDEAN("EUCLIDEAN"), + + /** + * Represents the cosine distance function. + */ + COSINE("COSINE"), + + /** + * Represents the dot product distance function. + */ + DOT_PRODUCT("DOTPRODUCT"); + + private final String overWireValue; + + DistanceFunction(String overWireValue) { + this.overWireValue = overWireValue; + } + + @Override + public String toString() { + return this.overWireValue; + } + + public String getValue() { + return this.overWireValue; + } + + public boolean isEmpty() { + return this.overWireValue.isEmpty(); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java new file mode 100644 index 000000000000..ee917f3a133e --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Embedding settings within {@link VectorEmbeddingPolicy} + */ +public final class Embedding { + @JsonProperty("path") + private String path; + @JsonProperty("dataType") + private VectorDataType vectorDataType; + @JsonProperty("dimensions") + private Long dimensions; + @JsonProperty("distanceFunction") + private DistanceFunction distanceFunction; + + /** + * Gets the path for the embedding. + * + * @return path + */ + public String getPath() { + return path; + } + + /** + * Sets the path for the embedding. + * + * @param path + * @return Embedding + */ + public Embedding setPath(String path) { + this.path = path; + return this; + } + + + /** + * Gets the data type for the embedding. + * + * @return vectorDataType + */ + public VectorDataType getVectorDataType() { + return vectorDataType; + } + + /** + * Sets the data type for the embedding. + * + * @param vectorDataType + * @return Embedding + */ + public Embedding setVectorDataType(String vectorDataType) { + this.vectorDataType = VectorDataType.valueOf(vectorDataType); + return this; + } + + /** + * Gets the dimensions for the embedding. + * + * @return dimensions + */ + public Long getDimensions() { + return dimensions; + } + + /** + * Sets the dimensions for the embedding. + * + * @param dimensions + * @return Embedding + */ + public Embedding setDimensions(Long dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Gets the distanceFunction for the embedding. + * + * @return distanceFunction + */ + public DistanceFunction getDistanceFunction() { + return distanceFunction; + } + + /** + * Sets the distanceFunction for the embedding. + * + * @param distanceFunction + * @return Embedding + */ + public Embedding setDistanceFunction(String distanceFunction) { + this.distanceFunction = DistanceFunction.valueOf(distanceFunction); + return this; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index ea1247d2a2dc..7ab1077e231c 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -24,6 +24,7 @@ public final class IndexingPolicy { private List excludedPaths; private List> compositeIndexes; private List spatialIndexes; + private List vectorIndexes; private JsonSerializable jsonSerializable; @@ -234,7 +235,7 @@ public IndexingPolicy setCompositeIndexes(List> compositeInd } /** - * Sets the spatial indexes for additional indexes. + * Gets the spatial indexes for additional indexes. * * @return the spatial indexes. */ @@ -262,6 +263,33 @@ public IndexingPolicy setSpatialIndexes(List spatialIndexes) { return this; } + /** + * Gets the vector indexes. + * + * @return the vector indexes + */ + public List getVectorIndexes() { + if (this.vectorIndexes == null) { + this.vectorIndexes = this.jsonSerializable.getList(Constants.Properties.VECTOR_INDEXES, VectorIndexSpec.class); + + if (this.vectorIndexes == null) { + this.vectorIndexes = new ArrayList(); + } + } + + return this.vectorIndexes; + } + + /** + * Sets the vector indexes. + * + * @param vectorIndexes the vector indexes + */ + public IndexingPolicy setVectorIndexes(List vectorIndexes) { + this.vectorIndexes = vectorIndexes; + return this; + } + void populatePropertyBag() { this.jsonSerializable.populatePropertyBag(); // If indexing mode is not 'none' and not paths are set, set them to the defaults diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java index 8a589d7cd421..c78910f2e2df 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java @@ -598,6 +598,8 @@ public static void populatePropertyBag(T t) { ((PartitionKeyDefinition) t).populatePropertyBag(); } else if (t instanceof SpatialSpec) { ((SpatialSpec) t).populatePropertyBag(); + } else if (t instanceof VectorIndexSpec) { + ((VectorIndexSpec) t).populatePropertyBag(); } else if (t instanceof SqlParameter) { ((SqlParameter) t).populatePropertyBag(); } else if (t instanceof SqlQuerySpec) { @@ -631,6 +633,8 @@ public static JsonSerializable getJsonSerializable(T t) { return ((PartitionKeyDefinition) t).getJsonSerializable(); } else if (t instanceof SpatialSpec) { return ((SpatialSpec) t).getJsonSerializable(); + } else if (t instanceof VectorIndexSpec) { + return ((VectorIndexSpec) t).getJsonSerializable(); } else if (t instanceof SqlParameter) { return ((SqlParameter) t).getJsonSerializable(); } else if (t instanceof SqlQuerySpec) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java new file mode 100644 index 000000000000..2354fbd4fe2e --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +/** + * Data types for the embeddings in Cosmos DB database service. + */ +public enum VectorDataType { + /** + * Represents a byte data type. + */ + BYTE("Int8"), + + /** + * Represents a float data type. + */ + FLOAT("Float32"); + + private final String overWireValue; + + VectorDataType(String overWireValue) { + this.overWireValue = overWireValue; + } + + @Override + public String toString() { + return this.overWireValue; + } + + public String getValue() { + return this.overWireValue; + } + + public boolean isEmpty() { + return this.overWireValue.isEmpty(); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java new file mode 100644 index 000000000000..2602aee0bfda --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * Vector Embedding Policy + */ +public final class VectorEmbeddingPolicy { + + /** + * Paths for embeddings along with path-specific settings for the item. + */ + @JsonProperty("vectorEmbeddings") + private List embeddings; + + /** + * Constructor + * + * @param embeddings list of path for embeddings along with path-specific settings for the item. + */ + public VectorEmbeddingPolicy(List embeddings) { + validateEmbeddings(embeddings); + this.embeddings = embeddings; + } + + private static void validateEmbeddings(List embeddings) { + embeddings.forEach(embedding -> { + if (embedding == null) { + throw new IllegalArgumentException(""); + } + validateEmbeddingPath(embedding.getPath()); + validateEmbeddingDimensions(embedding.getDimensions()); + validateEmbeddingVectorDataType(embedding.getVectorDataType()); + validateEmbeddingDistanceFunction(embedding.getDistanceFunction()); + }); + } + + private static void validateEmbeddingPath(String path) { + if (StringUtils.isEmpty(path)) { + throw new IllegalArgumentException(""); + } + + if (path.charAt(0) != '/' || path.lastIndexOf('/') != 0) { + throw new IllegalArgumentException(""); + } + } + + private static void validateEmbeddingDimensions(Long dimensions) { + if (dimensions == null || dimensions < 1) { + throw new IllegalArgumentException(""); + } + } + + private static void validateEmbeddingVectorDataType(VectorDataType value) { + Optional.ofNullable(value) + .filter(vectorDataType -> !vectorDataType.isEmpty()) + .map(vectorDataType -> Arrays.stream(VectorDataType.values()) + .filter(dataType -> dataType.getValue().equals(vectorDataType.getValue())) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException(""))) + .orElseThrow(() -> new IllegalArgumentException("")); + } + + private static void validateEmbeddingDistanceFunction(DistanceFunction value) { + Optional.ofNullable(value) + .filter(distanceFunction -> !distanceFunction.isEmpty()) + .map(distanceFunction -> Arrays.stream(DistanceFunction.values()) + .filter(distFunction -> distFunction.getValue().equals(distanceFunction.getValue())) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException(""))) + .orElseThrow(() -> new IllegalArgumentException("")); + } + + /** + * Gets the paths for embeddings along with path-specific settings for the item. + * + * @return + */ + public List getEmbeddings() { + return this.embeddings; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java new file mode 100644 index 000000000000..669fc89b4f31 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.azure.cosmos.implementation.Constants; +import com.azure.cosmos.implementation.JsonSerializable; + +/** + * Vector Indexes spec for Azure CosmosDB service. + */ +public final class VectorIndexSpec { + + private final JsonSerializable jsonSerializable; + private VectorIndexType vectorIndexType; + + /** + * Constructor + */ + public VectorIndexSpec() { + this.jsonSerializable = new JsonSerializable(); + } + + /** + * Gets path. + * + * @return the path. + */ + public String getPath() { + return this.jsonSerializable.getString(Constants.Properties.PATH); + } + + /** + * Sets path. + * + * @param path the path. + * @return the SpatialSpec. + */ + public VectorIndexSpec setPath(String path) { + this.jsonSerializable.set(Constants.Properties.PATH, path); + return this; + } + + /** + * Gets the vector index type for the vector index + * + * @return the vector index type + */ + public VectorIndexType getVectorIndexType() { + if (this.vectorIndexType == null) { + this.vectorIndexType = VectorIndexType.valueOf(this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE)); + + if (this.vectorIndexType == null) { + throw new IllegalArgumentException("INVALID vectorIndexType of " + this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE)); + } + } + return this.vectorIndexType; + } + + /** + * Sets the vector index type for the vector index + * + * @param vectorIndexType the vector index type + * @return the VectorIndexSpec + */ + public VectorIndexSpec setVectorIndexType(VectorIndexType vectorIndexType) { + this.vectorIndexType = vectorIndexType; + this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, vectorIndexType.toString()); + return this; + } + + void populatePropertyBag() { + this.jsonSerializable.populatePropertyBag(); + } + + JsonSerializable getJsonSerializable() { + return this.jsonSerializable; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java new file mode 100644 index 000000000000..ea14e4a4a4d2 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +/** + * Defines the index type of vector index specification in the Azure Cosmos DB service. + */ +public enum VectorIndexType { + /** + * Represents a flat vector index type. + */ + FLAT("Flat"), + + /** + * Represents a quantized flat vector index type. + */ + QUANTIZED_FLAT("QuantizedFlat"), + + /** + * Represents a disk ANN vector index type. + */ + DISK_ANN("DiskANN"); + + + private final String overWireValue; + + VectorIndexType(String overWireValue) { + this.overWireValue = overWireValue; + } + + @Override + public String toString() { + return this.overWireValue; + } +} From 29ad3913e4071f1bd1bbe95276a1be8f5b0b82c5 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Wed, 27 Mar 2024 16:20:46 -0700 Subject: [PATCH 02/28] Adding some necessary comments --- .../cosmos/models/CosmosContainerProperties.java | 1 + .../com/azure/cosmos/models/DistanceFunction.java | 8 ++++++++ .../java/com/azure/cosmos/models/Embedding.java | 9 ++++----- .../com/azure/cosmos/models/IndexingPolicy.java | 1 + .../com/azure/cosmos/models/VectorDataType.java | 8 ++++++++ .../cosmos/models/VectorEmbeddingPolicy.java | 10 +++++----- .../com/azure/cosmos/models/VectorIndexSpec.java | 15 +++++++++++++++ 7 files changed, 42 insertions(+), 10 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java index 1e5ef80a6af6..c6d1188b5c6d 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java @@ -362,6 +362,7 @@ public VectorEmbeddingPolicy getVectorEmbeddingPolicy() { * used in performing vector search on the items in a collection in the Azure CosmosDB database service. * * @param value the Vector Embedding Policy. + * @return the CosmosContainerProperties. */ public CosmosContainerProperties setVectorEmbeddingPolicy(VectorEmbeddingPolicy value) { this.documentCollection.setVectorEmbeddingPolicy(value); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java index de506e087d39..cdeb0e065fe1 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java @@ -33,10 +33,18 @@ public String toString() { return this.overWireValue; } + /** + * + * @return value for the enum + */ public String getValue() { return this.overWireValue; } + /** + * + * @return if the value for the enum is empty or not. + */ public boolean isEmpty() { return this.overWireValue.isEmpty(); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java index ee917f3a133e..2fb2a9760f64 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java @@ -30,7 +30,7 @@ public String getPath() { /** * Sets the path for the embedding. * - * @param path + * @param path the path for the embedding * @return Embedding */ public Embedding setPath(String path) { @@ -38,7 +38,6 @@ public Embedding setPath(String path) { return this; } - /** * Gets the data type for the embedding. * @@ -51,7 +50,7 @@ public VectorDataType getVectorDataType() { /** * Sets the data type for the embedding. * - * @param vectorDataType + * @param vectorDataType the data type for the embedding * @return Embedding */ public Embedding setVectorDataType(String vectorDataType) { @@ -71,7 +70,7 @@ public Long getDimensions() { /** * Sets the dimensions for the embedding. * - * @param dimensions + * @param dimensions the dimensions for the embedding * @return Embedding */ public Embedding setDimensions(Long dimensions) { @@ -91,7 +90,7 @@ public DistanceFunction getDistanceFunction() { /** * Sets the distanceFunction for the embedding. * - * @param distanceFunction + * @param distanceFunction the distanceFunction for the embedding * @return Embedding */ public Embedding setDistanceFunction(String distanceFunction) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index 7ab1077e231c..361619507738 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -284,6 +284,7 @@ public List getVectorIndexes() { * Sets the vector indexes. * * @param vectorIndexes the vector indexes + * @return the Indexing Policy. */ public IndexingPolicy setVectorIndexes(List vectorIndexes) { this.vectorIndexes = vectorIndexes; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java index 2354fbd4fe2e..1d4be871a846 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java @@ -28,10 +28,18 @@ public String toString() { return this.overWireValue; } + /** + * + * @return value for the enum + */ public String getValue() { return this.overWireValue; } + /** + * + * @return if the value for the enum is empty or not. + */ public boolean isEmpty() { return this.overWireValue.isEmpty(); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java index 2602aee0bfda..3003e63a5e66 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java @@ -34,7 +34,7 @@ public VectorEmbeddingPolicy(List embeddings) { private static void validateEmbeddings(List embeddings) { embeddings.forEach(embedding -> { if (embedding == null) { - throw new IllegalArgumentException(""); + throw new IllegalArgumentException("Embedding cannot be empty."); } validateEmbeddingPath(embedding.getPath()); validateEmbeddingDimensions(embedding.getDimensions()); @@ -45,7 +45,7 @@ private static void validateEmbeddings(List embeddings) { private static void validateEmbeddingPath(String path) { if (StringUtils.isEmpty(path)) { - throw new IllegalArgumentException(""); + throw new IllegalArgumentException("embedding path is empty"); } if (path.charAt(0) != '/' || path.lastIndexOf('/') != 0) { @@ -54,8 +54,8 @@ private static void validateEmbeddingPath(String path) { } private static void validateEmbeddingDimensions(Long dimensions) { - if (dimensions == null || dimensions < 1) { - throw new IllegalArgumentException(""); + if (dimensions < 1) { + throw new IllegalArgumentException("dimensions for the embedding has to be a long value greater than 1"); } } @@ -82,7 +82,7 @@ private static void validateEmbeddingDistanceFunction(DistanceFunction value) { /** * Gets the paths for embeddings along with path-specific settings for the item. * - * @return + * @return the paths for embeddings along with path-specific settings for the item. */ public List getEmbeddings() { return this.embeddings; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java index 669fc89b4f31..cce1f68b6533 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java @@ -5,6 +5,7 @@ import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.JsonSerializable; +import com.fasterxml.jackson.databind.node.ObjectNode; /** * Vector Indexes spec for Azure CosmosDB service. @@ -21,6 +22,20 @@ public VectorIndexSpec() { this.jsonSerializable = new JsonSerializable(); } + /** + * Constructor. + * + * @param jsonString the json string that represents the included path. + */ + public VectorIndexSpec(String jsonString) { this.jsonSerializable = new JsonSerializable(jsonString); } + + /** + * Constructor. + * + * @param objectNode the object node that represents the included path. + */ + public VectorIndexSpec(ObjectNode objectNode) { this.jsonSerializable = new JsonSerializable(objectNode); } + /** * Gets path. * From cd4d8cfea05ca21fcffddfcad9d44155538ff042 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Thu, 28 Mar 2024 10:27:18 -0700 Subject: [PATCH 03/28] Adding test case --- .../implementation/VectorIndexTest.java | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java new file mode 100644 index 000000000000..2bc1841ba440 --- /dev/null +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java @@ -0,0 +1,136 @@ +package com.azure.cosmos.implementation; + +import com.azure.cosmos.BridgeInternal; +import com.azure.cosmos.ConsistencyLevel; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosAsyncContainer; +import com.azure.cosmos.CosmosAsyncDatabase; +import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.DirectConnectionConfig; +import com.azure.cosmos.implementation.guava25.collect.ImmutableList; +import com.azure.cosmos.models.CosmosContainerProperties; +import com.azure.cosmos.models.CosmosDatabaseProperties; +import com.azure.cosmos.models.Embedding; +import com.azure.cosmos.models.ExcludedPath; +import com.azure.cosmos.models.IncludedPath; +import com.azure.cosmos.models.IndexingMode; +import com.azure.cosmos.models.IndexingPolicy; +import com.azure.cosmos.models.PartitionKeyDefinition; +import com.azure.cosmos.models.VectorEmbeddingPolicy; +import com.azure.cosmos.models.VectorIndexSpec; +import com.azure.cosmos.models.VectorIndexType; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.UUID; + +public class VectorIndexTest { + protected static final int TIMEOUT = 3000000; + protected static final int SETUP_TIMEOUT = 2000000; + protected static final int SHUTDOWN_TIMEOUT = 2000000; + + protected static Logger logger = LoggerFactory.getLogger(VectorIndexTest.class.getSimpleName()); + private final String databaseId = "Vector_index_db"; + private CosmosAsyncClient client; + private CosmosAsyncDatabase database; + + private CosmosAsyncContainer collection; + + @Test(groups = { "long" }, timeOut = TIMEOUT) + public void insertWithVectorIndex() throws Exception { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + + VectorIndexSpec vectorIndexSpec = new VectorIndexSpec(); + vectorIndexSpec.setPath("/vector1"); + vectorIndexSpec.setVectorIndexType(VectorIndexType.FLAT); + indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); + + Embedding embedding = new Embedding(); + embedding.setPath("/vector1"); + embedding.setDistanceFunction("COSINE"); + embedding.setDimensions(3L); + embedding.setVectorDataType("FLOAT"); + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + + ObjectMapper om = new ObjectMapper(); + + JsonNode doc1 = om.readValue("{\"name\":\"Alexander Pushkin\",\"vector1\":[0.2, 0.5, 0.7],\"description\":\"poet\",\"id\": \""+ UUID.randomUUID().toString() +"\"}", JsonNode.class); + JsonNode doc2 = om.readValue("{\"name\":\"Alexander Pushkin\",\"vector1\":[0.6, 0.5, 0.7],\"description\":\"playwright\",\"id\": \"" + UUID.randomUUID().toString() + "\"}", JsonNode.class); + JsonNode doc3 = om.readValue("{\"name\":\"ABC DEF\",\"vector1\":[0.2, 0.9, 0.7],\"description\":\"poet\",\"id\": \"" + UUID.randomUUID().toString() + "\"}", JsonNode.class); + + database.createContainer(collectionDefinition).block(); + collection = database.getContainer(collectionDefinition.getId()); + + InternalObjectNode properties = BridgeInternal.getProperties(collection.createItem(doc1).block()); + } + + @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) + public void before_UniqueIndexTest() { + // set up the client + client = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .directMode(DirectConnectionConfig.getDefaultConfig()) + .consistencyLevel(ConsistencyLevel.SESSION) + .contentResponseOnWriteEnabled(true) + .buildAsyncClient(); + + database = createDatabase(client, databaseId); + } + + @AfterClass(groups = { "long" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + safeDeleteDatabase(database); + safeClose(client); + } + + static protected CosmosAsyncDatabase createDatabase(CosmosAsyncClient client, String databaseId) { + CosmosDatabaseProperties databaseSettings = new CosmosDatabaseProperties(databaseId); + client.createDatabase(databaseSettings).block(); + return client.getDatabase(databaseSettings.getId()); + } + + static protected void safeDeleteDatabase(CosmosAsyncDatabase database) { + if (database != null) { + try { + database.delete().block(); + } catch (Exception e) { + } + } + } + + static protected void safeClose(CosmosAsyncClient client) { + if (client != null) { + try { + client.close(); + } catch (Exception e) { + logger.error("failed to close client", e); + } + } + } +} From a2f6a83e113d9b515533b19241615189cc2258f1 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Thu, 28 Mar 2024 12:38:33 -0700 Subject: [PATCH 04/28] updating enum values --- .../implementation/VectorIndexTest.java | 2 +- .../cosmos/implementation/Constants.java | 4 +++ .../azure/cosmos/models/DistanceFunction.java | 6 ++--- .../com/azure/cosmos/models/Embedding.java | 17 ++++++------ .../azure/cosmos/models/IndexingPolicy.java | 27 ++++++++++++++----- .../azure/cosmos/models/VectorDataType.java | 18 ++++++++++--- .../cosmos/models/VectorEmbeddingPolicy.java | 3 ++- .../azure/cosmos/models/VectorIndexSpec.java | 12 +++------ .../azure/cosmos/models/VectorIndexType.java | 6 ++--- 9 files changed, 61 insertions(+), 34 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java index 2bc1841ba440..932eec9f52ca 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java @@ -62,7 +62,7 @@ public void insertWithVectorIndex() throws Exception { indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - VectorIndexSpec vectorIndexSpec = new VectorIndexSpec(); + VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); vectorIndexSpec.setPath("/vector1"); vectorIndexSpec.setVectorIndexType(VectorIndexType.FLAT); indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java index a9fcdc9f0824..f789963783ed 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java @@ -123,7 +123,11 @@ public static final class Properties { // Vector Embedding Policy public static final String VECTOR_EMBEDDING_POLICY = "vectorEmbeddingPolicy"; public static final String VECTOR_INDEXES = "vectorIndexes"; + public static final String VECTOR_EMBEDDINGS = "vectorEmbeddings"; public static final String VECTOR_INDEX_TYPE = "type"; + public static final String VECTOR_DATA_TYPE = "dataType"; + public static final String VECTOR_DIMENSIONS = "dimensions"; + public static final String DISTANCE_FUNCTION = "distanceFunction"; // Unique index. public static final String UNIQUE_KEY_POLICY = "uniqueKeyPolicy"; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java index cdeb0e065fe1..78c10f78e8c1 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java @@ -10,17 +10,17 @@ public enum DistanceFunction { /** * Represents the euclidean distance function. */ - EUCLIDEAN("EUCLIDEAN"), + EUCLIDEAN("euclidean"), /** * Represents the cosine distance function. */ - COSINE("COSINE"), + COSINE("cosine"), /** * Represents the dot product distance function. */ - DOT_PRODUCT("DOTPRODUCT"); + DOT_PRODUCT("dotproduct"); private final String overWireValue; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java index 2fb2a9760f64..52b9c00a1b2b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java @@ -3,19 +3,20 @@ package com.azure.cosmos.models; +import com.azure.cosmos.implementation.Constants; import com.fasterxml.jackson.annotation.JsonProperty; /** * Embedding settings within {@link VectorEmbeddingPolicy} */ public final class Embedding { - @JsonProperty("path") + @JsonProperty(Constants.Properties.PATH) private String path; - @JsonProperty("dataType") + @JsonProperty(Constants.Properties.VECTOR_DATA_TYPE) private VectorDataType vectorDataType; - @JsonProperty("dimensions") + @JsonProperty(Constants.Properties.VECTOR_DIMENSIONS) private Long dimensions; - @JsonProperty("distanceFunction") + @JsonProperty(Constants.Properties.DISTANCE_FUNCTION) private DistanceFunction distanceFunction; /** @@ -53,8 +54,8 @@ public VectorDataType getVectorDataType() { * @param vectorDataType the data type for the embedding * @return Embedding */ - public Embedding setVectorDataType(String vectorDataType) { - this.vectorDataType = VectorDataType.valueOf(vectorDataType); + public Embedding setVectorDataType(VectorDataType vectorDataType) { + this.vectorDataType = vectorDataType; return this; } @@ -93,8 +94,8 @@ public DistanceFunction getDistanceFunction() { * @param distanceFunction the distanceFunction for the embedding * @return Embedding */ - public Embedding setDistanceFunction(String distanceFunction) { - this.distanceFunction = DistanceFunction.valueOf(distanceFunction); + public Embedding setDistanceFunction(DistanceFunction distanceFunction) { + this.distanceFunction = distanceFunction; return this; } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index 361619507738..85959396fe0c 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -19,15 +19,13 @@ */ public final class IndexingPolicy { private static final String DEFAULT_PATH = "/*"; - + private final JsonSerializable jsonSerializable; private List includedPaths; private List excludedPaths; private List> compositeIndexes; private List spatialIndexes; private List vectorIndexes; - private JsonSerializable jsonSerializable; - /** * Constructor. */ @@ -54,7 +52,7 @@ public IndexingPolicy() { * * * @param defaultIndexOverrides comma separated set of indexes that serve as default index specifications for the - * root path. + * root path. * @throws IllegalArgumentException throws when defaultIndexOverrides is null */ IndexingPolicy(Index[] defaultIndexOverrides) { @@ -283,6 +281,21 @@ public List getVectorIndexes() { /** * Sets the vector indexes. * + * Example of the vectorIndexes: + * "vectorIndexes": [ + * { + * "path": "/vector1", + * "type": "DiskANN" + * }, + * { + * "path": "/vector1", + * "type": "Flat" + * }, + * { + * "path": "/vector2", + * "type": "QuantizedFlat" + * }] + * * @param vectorIndexes the vector indexes * @return the Indexing Policy. */ @@ -295,7 +308,7 @@ void populatePropertyBag() { this.jsonSerializable.populatePropertyBag(); // If indexing mode is not 'none' and not paths are set, set them to the defaults if (this.getIndexingMode() != IndexingMode.NONE && this.getIncludedPaths().size() == 0 - && this.getExcludedPaths().size() == 0) { + && this.getExcludedPaths().size() == 0) { IncludedPath includedPath = new IncludedPath(IndexingPolicy.DEFAULT_PATH); this.getIncludedPaths().add(includedPath); } @@ -315,5 +328,7 @@ void populatePropertyBag() { } } - JsonSerializable getJsonSerializable() { return this.jsonSerializable; } + JsonSerializable getJsonSerializable() { + return this.jsonSerializable; + } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java index 1d4be871a846..17fda76664b0 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java @@ -8,14 +8,24 @@ */ public enum VectorDataType { /** - * Represents a byte data type. + * Represents a int8 data type. */ - BYTE("Int8"), + Int8("int8"), /** - * Represents a float data type. + * Represents a uint8 data type. */ - FLOAT("Float32"); + Uint8("uint8"), + + /** + * Represents a float16 data type. + */ + Float16("float16"), + + /** + * Represents a float32 data type. + */ + Float32("float32"); private final String overWireValue; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java index 3003e63a5e66..7b247991bce1 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java @@ -3,6 +3,7 @@ package com.azure.cosmos.models; +import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.fasterxml.jackson.annotation.JsonProperty; @@ -18,7 +19,7 @@ public final class VectorEmbeddingPolicy { /** * Paths for embeddings along with path-specific settings for the item. */ - @JsonProperty("vectorEmbeddings") + @JsonProperty(Constants.Properties.VECTOR_EMBEDDINGS) private List embeddings; /** diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java index cce1f68b6533..23881383d0a1 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java @@ -17,18 +17,14 @@ public final class VectorIndexSpec { /** * Constructor + * + * @param path the path. */ - public VectorIndexSpec() { + public VectorIndexSpec(String path) { this.jsonSerializable = new JsonSerializable(); + this.setPath(path); } - /** - * Constructor. - * - * @param jsonString the json string that represents the included path. - */ - public VectorIndexSpec(String jsonString) { this.jsonSerializable = new JsonSerializable(jsonString); } - /** * Constructor. * diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java index ea14e4a4a4d2..8b8f7e031ac8 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java @@ -10,17 +10,17 @@ public enum VectorIndexType { /** * Represents a flat vector index type. */ - FLAT("Flat"), + FLAT("flat"), /** * Represents a quantized flat vector index type. */ - QUANTIZED_FLAT("QuantizedFlat"), + QUANTIZED_FLAT("quantizedFlat"), /** * Represents a disk ANN vector index type. */ - DISK_ANN("DiskANN"); + DISK_ANN("diskANN"); private final String overWireValue; From c4bc28383868ab00bf5254a9e513ced238e9a866 Mon Sep 17 00:00:00 2001 From: "Aayush Kataria (from Dev Box)" Date: Thu, 28 Mar 2024 12:50:35 -0700 Subject: [PATCH 05/28] Updating test case --- .../implementation/VectorIndexTest.java | 71 ++++++++++++------- .../azure/cosmos/models/VectorDataType.java | 8 +-- 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java index 932eec9f52ca..a0c39ecc64e3 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java @@ -8,17 +8,7 @@ import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.DirectConnectionConfig; import com.azure.cosmos.implementation.guava25.collect.ImmutableList; -import com.azure.cosmos.models.CosmosContainerProperties; -import com.azure.cosmos.models.CosmosDatabaseProperties; -import com.azure.cosmos.models.Embedding; -import com.azure.cosmos.models.ExcludedPath; -import com.azure.cosmos.models.IncludedPath; -import com.azure.cosmos.models.IndexingMode; -import com.azure.cosmos.models.IndexingPolicy; -import com.azure.cosmos.models.PartitionKeyDefinition; -import com.azure.cosmos.models.VectorEmbeddingPolicy; -import com.azure.cosmos.models.VectorIndexSpec; -import com.azure.cosmos.models.VectorIndexType; +import com.azure.cosmos.models.*; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; @@ -29,6 +19,7 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.List; import java.util.UUID; public class VectorIndexTest { @@ -61,32 +52,60 @@ public void insertWithVectorIndex() throws Exception { IncludedPath includedPath2 = new IncludedPath("/description/?"); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + // setting vectorIndexes + indexingPolicy.setVectorIndexes(getVectorIndexSpec()); - VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); - vectorIndexSpec.setPath("/vector1"); - vectorIndexSpec.setVectorIndexType(VectorIndexType.FLAT); - indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); - - Embedding embedding = new Embedding(); - embedding.setPath("/vector1"); - embedding.setDistanceFunction("COSINE"); - embedding.setDimensions(3L); - embedding.setVectorDataType("FLOAT"); - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); + // setting vector embedding policy + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(getEmbeddings()); collectionDefinition.setIndexingPolicy(indexingPolicy); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); ObjectMapper om = new ObjectMapper(); - JsonNode doc1 = om.readValue("{\"name\":\"Alexander Pushkin\",\"vector1\":[0.2, 0.5, 0.7],\"description\":\"poet\",\"id\": \""+ UUID.randomUUID().toString() +"\"}", JsonNode.class); - JsonNode doc2 = om.readValue("{\"name\":\"Alexander Pushkin\",\"vector1\":[0.6, 0.5, 0.7],\"description\":\"playwright\",\"id\": \"" + UUID.randomUUID().toString() + "\"}", JsonNode.class); - JsonNode doc3 = om.readValue("{\"name\":\"ABC DEF\",\"vector1\":[0.2, 0.9, 0.7],\"description\":\"poet\",\"id\": \"" + UUID.randomUUID().toString() + "\"}", JsonNode.class); +// JsonNode doc1 = om.readValue("{\"name\":\"Alexander Pushkin\",\"vector1\":[0.2, 0.5, 0.7],\"description\":\"poet\",\"id\": \""+ UUID.randomUUID().toString() +"\"}", JsonNode.class); +// JsonNode doc2 = om.readValue("{\"name\":\"Alexander Pushkin\",\"vector1\":[0.6, 0.5, 0.7],\"description\":\"playwright\",\"id\": \"" + UUID.randomUUID().toString() + "\"}", JsonNode.class); +// JsonNode doc3 = om.readValue("{\"name\":\"ABC DEF\",\"vector1\":[0.2, 0.9, 0.7],\"description\":\"poet\",\"id\": \"" + UUID.randomUUID().toString() + "\"}", JsonNode.class); database.createContainer(collectionDefinition).block(); collection = database.getContainer(collectionDefinition.getId()); - InternalObjectNode properties = BridgeInternal.getProperties(collection.createItem(doc1).block()); +// InternalObjectNode properties = BridgeInternal.getProperties(collection.createItem(doc1).block()); + } + + private List getVectorIndexSpec() { + VectorIndexSpec vectorIndexSpec1 = new VectorIndexSpec("/vector1"); + vectorIndexSpec1.setVectorIndexType(VectorIndexType.FLAT); + + VectorIndexSpec vectorIndexSpec2 = new VectorIndexSpec("/vector2"); + vectorIndexSpec2.setVectorIndexType(VectorIndexType.QUANTIZED_FLAT); + + VectorIndexSpec vectorIndexSpec3 = new VectorIndexSpec("/vector3"); + vectorIndexSpec3.setVectorIndexType(VectorIndexType.DISK_ANN); + + return ImmutableList.of(vectorIndexSpec1, vectorIndexSpec2, vectorIndexSpec3); + } + + private List getEmbeddings() { + Embedding embedding1 = new Embedding(); + embedding1.setPath("/vector1"); + embedding1.setDistanceFunction(DistanceFunction.COSINE); + embedding1.setDimensions(3L); + embedding1.setVectorDataType(VectorDataType.FLOAT32); + + Embedding embedding2 = new Embedding(); + embedding2.setPath("/vector2"); + embedding2.setDistanceFunction(DistanceFunction.DOT_PRODUCT); + embedding2.setDimensions(3L); + embedding2.setVectorDataType(VectorDataType.INT8); + + Embedding embedding3 = new Embedding(); + embedding3.setPath("/vector1"); + embedding3.setDistanceFunction(DistanceFunction.EUCLIDEAN); + embedding3.setDimensions(3L); + embedding3.setVectorDataType(VectorDataType.UINT8); + + return ImmutableList.of(embedding1, embedding2, embedding3); } @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java index 17fda76664b0..de176a5472b4 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java @@ -10,22 +10,22 @@ public enum VectorDataType { /** * Represents a int8 data type. */ - Int8("int8"), + INT8("int8"), /** * Represents a uint8 data type. */ - Uint8("uint8"), + UINT8("uint8"), /** * Represents a float16 data type. */ - Float16("float16"), + FLOAT16("float16"), /** * Represents a float32 data type. */ - Float32("float32"); + FLOAT32("float32"); private final String overWireValue; From af99d7b5cd96d26fdf12830a6e10fd7635d433df Mon Sep 17 00:00:00 2001 From: "Aayush Kataria (from Dev Box)" Date: Fri, 29 Mar 2024 09:35:18 -0700 Subject: [PATCH 06/28] Updating test case --- .../implementation/VectorIndexTest.java | 155 ------- .../com/azure/cosmos/rx/VectorIndexTest.java | 390 ++++++++++++++++++ .../com/azure/cosmos/models/Embedding.java | 12 +- .../azure/cosmos/models/IndexingPolicy.java | 7 +- .../cosmos/models/VectorEmbeddingPolicy.java | 26 +- .../azure/cosmos/models/VectorIndexSpec.java | 27 +- .../azure/cosmos/models/VectorIndexType.java | 8 + 7 files changed, 443 insertions(+), 182 deletions(-) delete mode 100644 sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java create mode 100644 sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java deleted file mode 100644 index a0c39ecc64e3..000000000000 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/VectorIndexTest.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.azure.cosmos.implementation; - -import com.azure.cosmos.BridgeInternal; -import com.azure.cosmos.ConsistencyLevel; -import com.azure.cosmos.CosmosAsyncClient; -import com.azure.cosmos.CosmosAsyncContainer; -import com.azure.cosmos.CosmosAsyncDatabase; -import com.azure.cosmos.CosmosClientBuilder; -import com.azure.cosmos.DirectConnectionConfig; -import com.azure.cosmos.implementation.guava25.collect.ImmutableList; -import com.azure.cosmos.models.*; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -public class VectorIndexTest { - protected static final int TIMEOUT = 3000000; - protected static final int SETUP_TIMEOUT = 2000000; - protected static final int SHUTDOWN_TIMEOUT = 2000000; - - protected static Logger logger = LoggerFactory.getLogger(VectorIndexTest.class.getSimpleName()); - private final String databaseId = "Vector_index_db"; - private CosmosAsyncClient client; - private CosmosAsyncDatabase database; - - private CosmosAsyncContainer collection; - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void insertWithVectorIndex() throws Exception { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath("/name/?"); - IncludedPath includedPath2 = new IncludedPath("/description/?"); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - // setting vectorIndexes - indexingPolicy.setVectorIndexes(getVectorIndexSpec()); - - // setting vector embedding policy - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(getEmbeddings()); - - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); - - ObjectMapper om = new ObjectMapper(); - -// JsonNode doc1 = om.readValue("{\"name\":\"Alexander Pushkin\",\"vector1\":[0.2, 0.5, 0.7],\"description\":\"poet\",\"id\": \""+ UUID.randomUUID().toString() +"\"}", JsonNode.class); -// JsonNode doc2 = om.readValue("{\"name\":\"Alexander Pushkin\",\"vector1\":[0.6, 0.5, 0.7],\"description\":\"playwright\",\"id\": \"" + UUID.randomUUID().toString() + "\"}", JsonNode.class); -// JsonNode doc3 = om.readValue("{\"name\":\"ABC DEF\",\"vector1\":[0.2, 0.9, 0.7],\"description\":\"poet\",\"id\": \"" + UUID.randomUUID().toString() + "\"}", JsonNode.class); - - database.createContainer(collectionDefinition).block(); - collection = database.getContainer(collectionDefinition.getId()); - -// InternalObjectNode properties = BridgeInternal.getProperties(collection.createItem(doc1).block()); - } - - private List getVectorIndexSpec() { - VectorIndexSpec vectorIndexSpec1 = new VectorIndexSpec("/vector1"); - vectorIndexSpec1.setVectorIndexType(VectorIndexType.FLAT); - - VectorIndexSpec vectorIndexSpec2 = new VectorIndexSpec("/vector2"); - vectorIndexSpec2.setVectorIndexType(VectorIndexType.QUANTIZED_FLAT); - - VectorIndexSpec vectorIndexSpec3 = new VectorIndexSpec("/vector3"); - vectorIndexSpec3.setVectorIndexType(VectorIndexType.DISK_ANN); - - return ImmutableList.of(vectorIndexSpec1, vectorIndexSpec2, vectorIndexSpec3); - } - - private List getEmbeddings() { - Embedding embedding1 = new Embedding(); - embedding1.setPath("/vector1"); - embedding1.setDistanceFunction(DistanceFunction.COSINE); - embedding1.setDimensions(3L); - embedding1.setVectorDataType(VectorDataType.FLOAT32); - - Embedding embedding2 = new Embedding(); - embedding2.setPath("/vector2"); - embedding2.setDistanceFunction(DistanceFunction.DOT_PRODUCT); - embedding2.setDimensions(3L); - embedding2.setVectorDataType(VectorDataType.INT8); - - Embedding embedding3 = new Embedding(); - embedding3.setPath("/vector1"); - embedding3.setDistanceFunction(DistanceFunction.EUCLIDEAN); - embedding3.setDimensions(3L); - embedding3.setVectorDataType(VectorDataType.UINT8); - - return ImmutableList.of(embedding1, embedding2, embedding3); - } - - @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) - public void before_UniqueIndexTest() { - // set up the client - client = new CosmosClientBuilder() - .endpoint(TestConfigurations.HOST) - .key(TestConfigurations.MASTER_KEY) - .directMode(DirectConnectionConfig.getDefaultConfig()) - .consistencyLevel(ConsistencyLevel.SESSION) - .contentResponseOnWriteEnabled(true) - .buildAsyncClient(); - - database = createDatabase(client, databaseId); - } - - @AfterClass(groups = { "long" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(database); - safeClose(client); - } - - static protected CosmosAsyncDatabase createDatabase(CosmosAsyncClient client, String databaseId) { - CosmosDatabaseProperties databaseSettings = new CosmosDatabaseProperties(databaseId); - client.createDatabase(databaseSettings).block(); - return client.getDatabase(databaseSettings.getId()); - } - - static protected void safeDeleteDatabase(CosmosAsyncDatabase database) { - if (database != null) { - try { - database.delete().block(); - } catch (Exception e) { - } - } - } - - static protected void safeClose(CosmosAsyncClient client) { - if (client != null) { - try { - client.close(); - } catch (Exception e) { - logger.error("failed to close client", e); - } - } - } -} diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java new file mode 100644 index 000000000000..a7bf55f21547 --- /dev/null +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -0,0 +1,390 @@ +package com.azure.cosmos.rx; + +import com.azure.cosmos.*; +import com.azure.cosmos.implementation.TestConfigurations; +import com.azure.cosmos.implementation.guava25.collect.ImmutableList; +import com.azure.cosmos.models.*; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Ignore; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +@Ignore("TODO: Ignore these test cases until the public emulator with vector indexes is released.") +public class VectorIndexTest extends TestSuiteBase{ + protected static final int TIMEOUT = 30000; + protected static final int SETUP_TIMEOUT = 20000; + protected static final int SHUTDOWN_TIMEOUT = 20000; + + protected static Logger logger = LoggerFactory.getLogger(VectorIndexTest.class.getSimpleName()); + private final String databaseId = CosmosDatabaseForTest.generateId(); + private CosmosAsyncClient client; + private CosmosAsyncDatabase database; + + @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) + public void before_UniqueIndexTest() { + // set up the client + client = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .directMode(DirectConnectionConfig.getDefaultConfig()) + .consistencyLevel(ConsistencyLevel.SESSION) + .contentResponseOnWriteEnabled(true) + .buildAsyncClient(); + + database = createDatabase(client, databaseId); + } + + @AfterClass(groups = { "long" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + safeDeleteDatabase(database); + safeClose(client); + } + + @Test(groups = { "long" }, timeOut = TIMEOUT) + public void shouldCreateVectorEmbeddingPolicy() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + indexingPolicy.setVectorIndexes(populateVectorIndexes()); + + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(populateEmbeddings()); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + + database.createContainer(collectionDefinition).block(); + CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); + CosmosContainerProperties collectionProperties = createdCollection.read().block().getProperties(); + validateCollectionProperties(collectionDefinition, collectionProperties); + } + + @Test(groups = { "long" }, timeOut = TIMEOUT) + public void shouldFailOnEmptyVectorEmbeddingPolicy() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); + vectorIndexSpec.setType(VectorIndexType.FLAT.getValue()); + indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + + try { + database.createContainer(collectionDefinition).block(); + fail("Container creation will fail as no vector embedding policy is being passed"); + } catch(CosmosException ex) { + assertThat(ex.getStatusCode()).isEqualTo(400); + assertThat(ex.getMessage()).contains("vector1 not matching in Embedding's path"); + } + } + + @Test(groups = { "long" }, timeOut = TIMEOUT) + public void shouldFailOnWrongVectorEmbeddingPolicy() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); + vectorIndexSpec.setType(VectorIndexType.FLAT.getValue()); + indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); + collectionDefinition.setIndexingPolicy(indexingPolicy); + + Embedding embedding = new Embedding(); + embedding.setPath("/vector1"); + embedding.setDistanceFunction(DistanceFunction.COSINE.getValue()); + embedding.setDimensions(3L); + embedding.setVectorDataType("String"); + + try { + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + fail("Vector Embedding policy creation will fail for wrong vector date type being passed"); + } catch(IllegalArgumentException ex) { + assertThat(ex.getMessage()).isEqualTo("Invalid vector data type for the vector embedding policy."); + } + + embedding.setVectorDataType(""); + try { + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + fail("Vector Embedding policy creation will fail for empty vector date type being passed"); + } catch(IllegalArgumentException ex) { + assertThat(ex.getMessage()).isEqualTo("Vector data type cannot be empty for the vector embedding policy."); + } + + embedding.setVectorDataType(VectorDataType.FLOAT32.getValue()); + embedding.setDistanceFunction("COS"); + try { + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + fail("Vector Embedding policy creation will fail for wrong distance function being passed"); + } catch(IllegalArgumentException ex) { + assertThat(ex.getMessage()).isEqualTo("Invalid distance function for the vector embedding policy."); + } + + embedding.setDistanceFunction(""); + try { + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + fail("Vector Embedding policy creation will fail for empty distance function being passed"); + } catch(IllegalArgumentException ex) { + assertThat(ex.getMessage()).isEqualTo("Distance function cannot be empty for the vector embedding policy."); + } + } + + @Test(groups = { "long" }, timeOut = TIMEOUT) + public void shouldFailOnWrongVectorIndex() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); + vectorIndexSpec.setType("NonFlat"); + indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); + collectionDefinition.setIndexingPolicy(indexingPolicy); + + Embedding embedding = new Embedding(); + embedding.setPath("/vector1"); + embedding.setDistanceFunction(DistanceFunction.COSINE.getValue()); + embedding.setDimensions(3L); + embedding.setVectorDataType(VectorDataType.INT8.getValue()); + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + + try { + database.createContainer(collectionDefinition).block(); + fail("Container creation will fail as wrong vector index type is being passed"); + } catch (CosmosException ex) { + assertThat(ex.getStatusCode()).isEqualTo(400); + assertThat(ex.getMessage()).contains("NonFlat is invalid, Valid types are 'flat' or 'quantizedFlat'"); + } + } + + @Test(groups = { "long" }, timeOut = TIMEOUT) + public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + List vectorIndexes = populateVectorIndexes(); + vectorIndexes.get(2).setPath("/vector2"); + indexingPolicy.setVectorIndexes(vectorIndexes); + + List embeddings = populateEmbeddings(); + embeddings.get(2).setPath("/vector2"); + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(embeddings); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + + database.createContainer(collectionDefinition).block(); + CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); + CosmosContainerProperties collectionProperties = createdCollection.read().block().getProperties(); + validateCollectionProperties(collectionDefinition, collectionProperties); + } + + @Test(groups = { "long" }, timeOut = TIMEOUT) + // TODO: This test case should fail, but is passing, confirm the implementation with Bala + public void shouldFailVectorIndexSimilarPathSimilarVectorType() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + List vectorIndexes = populateVectorIndexes(); + vectorIndexes.get(2).setPath("/vector2"); + vectorIndexes.get(2).setType(VectorIndexType.QUANTIZED_FLAT.getValue()); + indexingPolicy.setVectorIndexes(vectorIndexes); + + List embeddings = populateEmbeddings(); + embeddings.get(2).setPath("/vector2"); + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(embeddings); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + + try { + database.createContainer(collectionDefinition).block(); +// fail("Container creation will fail as vector index is being created with same path, " + +// "and same index type"); + } catch(Exception ex) { + System.out.println(ex.getMessage()); + } + } + + @Test(groups = { "long" }, timeOut = TIMEOUT) + public void shouldFailVectorEmbeddingOnReplaceContainer() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + indexingPolicy.setVectorIndexes(populateVectorIndexes()); + + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(populateEmbeddings()); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + + database.createContainer(collectionDefinition).block(); + CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); + + CosmosContainerProperties containerProperties = createdCollection.read().block().getProperties(); + containerProperties.getIndexingPolicy().getVectorIndexes().get(0).setType( + VectorIndexType.QUANTIZED_FLAT.getValue()); + try{ + collectionDefinition.setIndexingPolicy(indexingPolicy); + createdCollection.replace(containerProperties).block(); + } catch(CosmosException ex) { + System.out.println(ex.getMessage()); + } + } + + private void validateCollectionProperties(CosmosContainerProperties collectionDefinition, CosmosContainerProperties collectionProperties) { + assertThat(collectionProperties.getVectorEmbeddingPolicy()).isNotNull(); + assertThat(collectionProperties.getVectorEmbeddingPolicy().getEmbeddings()).isNotNull(); + List embeddings = collectionProperties.getVectorEmbeddingPolicy().getEmbeddings(); + assertThat(embeddings).hasSameSizeAs(collectionDefinition.getVectorEmbeddingPolicy().getEmbeddings()); + for (int i=0; i vectorIndexes = collectionProperties.getIndexingPolicy().getVectorIndexes(); + assertThat(vectorIndexes).hasSameSizeAs(collectionDefinition.getIndexingPolicy().getVectorIndexes()); + for (int i=0; i populateVectorIndexes() { + VectorIndexSpec vectorIndexSpec1 = new VectorIndexSpec("/vector1"); + vectorIndexSpec1.setType(VectorIndexType.FLAT.getValue()); + + VectorIndexSpec vectorIndexSpec2 = new VectorIndexSpec("/vector2"); + vectorIndexSpec2.setType(VectorIndexType.QUANTIZED_FLAT.getValue()); + + VectorIndexSpec vectorIndexSpec3 = new VectorIndexSpec("/vector3"); + vectorIndexSpec3.setType(VectorIndexType.DISK_ANN.getValue()); + + return List.of(vectorIndexSpec1, vectorIndexSpec2, vectorIndexSpec3); + } + + private List populateEmbeddings() { + Embedding embedding1 = new Embedding(); + embedding1.setPath("/vector1"); + embedding1.setDistanceFunction(DistanceFunction.COSINE.getValue()); + embedding1.setDimensions(3L); + embedding1.setVectorDataType(VectorDataType.FLOAT32.getValue()); + + Embedding embedding2 = new Embedding(); + embedding2.setPath("/vector2"); + embedding2.setDistanceFunction(DistanceFunction.DOT_PRODUCT.getValue()); + embedding2.setDimensions(3L); + embedding2.setVectorDataType(VectorDataType.INT8.getValue()); + + Embedding embedding3 = new Embedding(); + embedding3.setPath("/vector3"); + embedding3.setDistanceFunction(DistanceFunction.EUCLIDEAN.getValue()); + embedding3.setDimensions(3L); + embedding3.setVectorDataType(VectorDataType.UINT8.getValue()); + + return List.of(embedding1, embedding2, embedding3); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java index 52b9c00a1b2b..905701d56d52 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java @@ -13,11 +13,11 @@ public final class Embedding { @JsonProperty(Constants.Properties.PATH) private String path; @JsonProperty(Constants.Properties.VECTOR_DATA_TYPE) - private VectorDataType vectorDataType; + private String vectorDataType; @JsonProperty(Constants.Properties.VECTOR_DIMENSIONS) private Long dimensions; @JsonProperty(Constants.Properties.DISTANCE_FUNCTION) - private DistanceFunction distanceFunction; + private String distanceFunction; /** * Gets the path for the embedding. @@ -44,7 +44,7 @@ public Embedding setPath(String path) { * * @return vectorDataType */ - public VectorDataType getVectorDataType() { + public String getVectorDataType() { return vectorDataType; } @@ -54,7 +54,7 @@ public VectorDataType getVectorDataType() { * @param vectorDataType the data type for the embedding * @return Embedding */ - public Embedding setVectorDataType(VectorDataType vectorDataType) { + public Embedding setVectorDataType(String vectorDataType) { this.vectorDataType = vectorDataType; return this; } @@ -84,7 +84,7 @@ public Embedding setDimensions(Long dimensions) { * * @return distanceFunction */ - public DistanceFunction getDistanceFunction() { + public String getDistanceFunction() { return distanceFunction; } @@ -94,7 +94,7 @@ public DistanceFunction getDistanceFunction() { * @param distanceFunction the distanceFunction for the embedding * @return Embedding */ - public Embedding setDistanceFunction(DistanceFunction distanceFunction) { + public Embedding setDistanceFunction(String distanceFunction) { this.distanceFunction = distanceFunction; return this; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index 85959396fe0c..30f62f92de54 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -285,15 +285,15 @@ public List getVectorIndexes() { * "vectorIndexes": [ * { * "path": "/vector1", - * "type": "DiskANN" + * "type": "diskANN" * }, * { * "path": "/vector1", - * "type": "Flat" + * "type": "flat" * }, * { * "path": "/vector2", - * "type": "QuantizedFlat" + * "type": "quantizedFlat" * }] * * @param vectorIndexes the vector indexes @@ -301,6 +301,7 @@ public List getVectorIndexes() { */ public IndexingPolicy setVectorIndexes(List vectorIndexes) { this.vectorIndexes = vectorIndexes; + this.jsonSerializable.set(Constants.Properties.VECTOR_INDEXES,this.vectorIndexes); return this; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java index 7b247991bce1..2df3ad16a642 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java @@ -4,6 +4,7 @@ package com.azure.cosmos.models; import com.azure.cosmos.implementation.Constants; +import com.azure.cosmos.implementation.JsonSerializable; import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,6 +17,8 @@ */ public final class VectorEmbeddingPolicy { + private JsonSerializable jsonSerializable; + /** * Paths for embeddings along with path-specific settings for the item. */ @@ -32,6 +35,13 @@ public VectorEmbeddingPolicy(List embeddings) { this.embeddings = embeddings; } + /** + * Constructor. + */ + public VectorEmbeddingPolicy() { + this.jsonSerializable = new JsonSerializable(); + } + private static void validateEmbeddings(List embeddings) { embeddings.forEach(embedding -> { if (embedding == null) { @@ -60,24 +70,24 @@ private static void validateEmbeddingDimensions(Long dimensions) { } } - private static void validateEmbeddingVectorDataType(VectorDataType value) { + private static void validateEmbeddingVectorDataType(String value) { Optional.ofNullable(value) .filter(vectorDataType -> !vectorDataType.isEmpty()) .map(vectorDataType -> Arrays.stream(VectorDataType.values()) - .filter(dataType -> dataType.getValue().equals(vectorDataType.getValue())) + .filter(dataType -> dataType.getValue().equals(vectorDataType)) .findFirst() - .orElseThrow(() -> new IllegalArgumentException(""))) - .orElseThrow(() -> new IllegalArgumentException("")); + .orElseThrow(() -> new IllegalArgumentException("Invalid vector data type for the vector embedding policy."))) + .orElseThrow(() -> new IllegalArgumentException("Vector data type cannot be empty for the vector embedding policy.")); } - private static void validateEmbeddingDistanceFunction(DistanceFunction value) { + private static void validateEmbeddingDistanceFunction(String value) { Optional.ofNullable(value) .filter(distanceFunction -> !distanceFunction.isEmpty()) .map(distanceFunction -> Arrays.stream(DistanceFunction.values()) - .filter(distFunction -> distFunction.getValue().equals(distanceFunction.getValue())) + .filter(distFunction -> distFunction.getValue().equals(distanceFunction)) .findFirst() - .orElseThrow(() -> new IllegalArgumentException(""))) - .orElseThrow(() -> new IllegalArgumentException("")); + .orElseThrow(() -> new IllegalArgumentException("Invalid distance function for the vector embedding policy."))) + .orElseThrow(() -> new IllegalArgumentException("Distance function cannot be empty for the vector embedding policy.")); } /** diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java index 23881383d0a1..97d73453e3cf 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java @@ -13,7 +13,7 @@ public final class VectorIndexSpec { private final JsonSerializable jsonSerializable; - private VectorIndexType vectorIndexType; + private String type; /** * Constructor @@ -25,6 +25,13 @@ public VectorIndexSpec(String path) { this.setPath(path); } + /** + * Constructor. + */ + public VectorIndexSpec() { + this.jsonSerializable = new JsonSerializable(); + } + /** * Constructor. * @@ -57,26 +64,26 @@ public VectorIndexSpec setPath(String path) { * * @return the vector index type */ - public VectorIndexType getVectorIndexType() { - if (this.vectorIndexType == null) { - this.vectorIndexType = VectorIndexType.valueOf(this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE)); + public String getType() { + if (this.type == null) { + this.type = this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE); - if (this.vectorIndexType == null) { + if (this.type == null) { throw new IllegalArgumentException("INVALID vectorIndexType of " + this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE)); } } - return this.vectorIndexType; + return this.type; } /** * Sets the vector index type for the vector index * - * @param vectorIndexType the vector index type + * @param type the vector index type * @return the VectorIndexSpec */ - public VectorIndexSpec setVectorIndexType(VectorIndexType vectorIndexType) { - this.vectorIndexType = vectorIndexType; - this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, vectorIndexType.toString()); + public VectorIndexSpec setType(String type) { + this.type = type; + this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type); return this; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java index 8b8f7e031ac8..4a30dcc2f7d7 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java @@ -33,4 +33,12 @@ public enum VectorIndexType { public String toString() { return this.overWireValue; } + + /** + * + * @return value for the enum + */ + public String getValue() { + return this.overWireValue; + } } From 6d8fc9b7c6bff3c1f1cdefb903c5526c72455e04 Mon Sep 17 00:00:00 2001 From: "Aayush Kataria (from Dev Box)" Date: Fri, 29 Mar 2024 10:44:23 -0700 Subject: [PATCH 07/28] Updating test case --- .../com/azure/cosmos/rx/VectorIndexTest.java | 146 ++++++------------ .../cosmos/models/VectorEmbeddingPolicy.java | 2 +- 2 files changed, 48 insertions(+), 100 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index a7bf55f21547..09c11e091018 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -1,10 +1,29 @@ package com.azure.cosmos.rx; -import com.azure.cosmos.*; +import com.azure.cosmos.ConsistencyLevel; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosAsyncContainer; +import com.azure.cosmos.CosmosAsyncDatabase; +import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.CosmosDatabaseForTest; +import com.azure.cosmos.CosmosException; +import com.azure.cosmos.DirectConnectionConfig; import com.azure.cosmos.implementation.TestConfigurations; import com.azure.cosmos.implementation.guava25.collect.ImmutableList; -import com.azure.cosmos.models.*; -import com.fasterxml.jackson.databind.ObjectMapper; +import com.azure.cosmos.models.CosmosContainerProperties; +import com.azure.cosmos.models.DistanceFunction; +import com.azure.cosmos.models.Embedding; +import com.azure.cosmos.models.ExcludedPath; +import com.azure.cosmos.models.IncludedPath; +import com.azure.cosmos.models.IndexingMode; +import com.azure.cosmos.models.IndexingPolicy; +import com.azure.cosmos.models.PartitionKeyDefinition; +import com.azure.cosmos.models.VectorDataType; +import com.azure.cosmos.models.VectorEmbeddingPolicy; +import com.azure.cosmos.models.VectorIndexSpec; +import com.azure.cosmos.models.VectorIndexType; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterClass; @@ -17,11 +36,8 @@ import java.util.List; import java.util.UUID; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - @Ignore("TODO: Ignore these test cases until the public emulator with vector indexes is released.") -public class VectorIndexTest extends TestSuiteBase{ +public class VectorIndexTest extends TestSuiteBase { protected static final int TIMEOUT = 30000; protected static final int SETUP_TIMEOUT = 20000; protected static final int SHUTDOWN_TIMEOUT = 20000; @@ -31,7 +47,7 @@ public class VectorIndexTest extends TestSuiteBase{ private CosmosAsyncClient client; private CosmosAsyncDatabase database; - @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) + @BeforeClass(groups = {"long"}, timeOut = SETUP_TIMEOUT) public void before_UniqueIndexTest() { // set up the client client = new CosmosClientBuilder() @@ -45,13 +61,13 @@ public void before_UniqueIndexTest() { database = createDatabase(client, databaseId); } - @AfterClass(groups = { "long" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + @AfterClass(groups = {"long"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) public void afterClass() { safeDeleteDatabase(database); safeClose(client); } - @Test(groups = { "long" }, timeOut = TIMEOUT) + @Test(groups = {"long"}, timeOut = TIMEOUT) public void shouldCreateVectorEmbeddingPolicy() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -82,7 +98,7 @@ public void shouldCreateVectorEmbeddingPolicy() { validateCollectionProperties(collectionDefinition, collectionProperties); } - @Test(groups = { "long" }, timeOut = TIMEOUT) + @Test(groups = {"long"}, timeOut = TIMEOUT) public void shouldFailOnEmptyVectorEmbeddingPolicy() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -109,13 +125,13 @@ public void shouldFailOnEmptyVectorEmbeddingPolicy() { try { database.createContainer(collectionDefinition).block(); fail("Container creation will fail as no vector embedding policy is being passed"); - } catch(CosmosException ex) { + } catch (CosmosException ex) { assertThat(ex.getStatusCode()).isEqualTo(400); assertThat(ex.getMessage()).contains("vector1 not matching in Embedding's path"); } } - @Test(groups = { "long" }, timeOut = TIMEOUT) + @Test(groups = {"long"}, timeOut = TIMEOUT) public void shouldFailOnWrongVectorEmbeddingPolicy() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -148,7 +164,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); fail("Vector Embedding policy creation will fail for wrong vector date type being passed"); - } catch(IllegalArgumentException ex) { + } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()).isEqualTo("Invalid vector data type for the vector embedding policy."); } @@ -157,7 +173,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); fail("Vector Embedding policy creation will fail for empty vector date type being passed"); - } catch(IllegalArgumentException ex) { + } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()).isEqualTo("Vector data type cannot be empty for the vector embedding policy."); } @@ -167,7 +183,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); fail("Vector Embedding policy creation will fail for wrong distance function being passed"); - } catch(IllegalArgumentException ex) { + } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()).isEqualTo("Invalid distance function for the vector embedding policy."); } @@ -176,12 +192,22 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); fail("Vector Embedding policy creation will fail for empty distance function being passed"); - } catch(IllegalArgumentException ex) { + } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()).isEqualTo("Distance function cannot be empty for the vector embedding policy."); } + + embedding.setDistanceFunction(DistanceFunction.COSINE.getValue()); + embedding.setDimensions(-1L); + try { + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + fail("Vector Embedding policy creation will fail for negative dimensions being passed"); + } catch (IllegalArgumentException ex) { + assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding has to be a long value greater than 1 for the vector embedding policy"); + } } - @Test(groups = { "long" }, timeOut = TIMEOUT) + @Test(groups = {"long"}, timeOut = TIMEOUT) public void shouldFailOnWrongVectorIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -221,7 +247,7 @@ public void shouldFailOnWrongVectorIndex() { } } - @Test(groups = { "long" }, timeOut = TIMEOUT) + @Test(groups = {"long"}, timeOut = TIMEOUT) public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -256,90 +282,12 @@ public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { validateCollectionProperties(collectionDefinition, collectionProperties); } - @Test(groups = { "long" }, timeOut = TIMEOUT) - // TODO: This test case should fail, but is passing, confirm the implementation with Bala - public void shouldFailVectorIndexSimilarPathSimilarVectorType() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath("/name/?"); - IncludedPath includedPath2 = new IncludedPath("/description/?"); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - List vectorIndexes = populateVectorIndexes(); - vectorIndexes.get(2).setPath("/vector2"); - vectorIndexes.get(2).setType(VectorIndexType.QUANTIZED_FLAT.getValue()); - indexingPolicy.setVectorIndexes(vectorIndexes); - - List embeddings = populateEmbeddings(); - embeddings.get(2).setPath("/vector2"); - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(embeddings); - - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); - - try { - database.createContainer(collectionDefinition).block(); -// fail("Container creation will fail as vector index is being created with same path, " + -// "and same index type"); - } catch(Exception ex) { - System.out.println(ex.getMessage()); - } - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void shouldFailVectorEmbeddingOnReplaceContainer() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath("/name/?"); - IncludedPath includedPath2 = new IncludedPath("/description/?"); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - indexingPolicy.setVectorIndexes(populateVectorIndexes()); - - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(populateEmbeddings()); - - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); - - database.createContainer(collectionDefinition).block(); - CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); - - CosmosContainerProperties containerProperties = createdCollection.read().block().getProperties(); - containerProperties.getIndexingPolicy().getVectorIndexes().get(0).setType( - VectorIndexType.QUANTIZED_FLAT.getValue()); - try{ - collectionDefinition.setIndexingPolicy(indexingPolicy); - createdCollection.replace(containerProperties).block(); - } catch(CosmosException ex) { - System.out.println(ex.getMessage()); - } - } - private void validateCollectionProperties(CosmosContainerProperties collectionDefinition, CosmosContainerProperties collectionProperties) { assertThat(collectionProperties.getVectorEmbeddingPolicy()).isNotNull(); assertThat(collectionProperties.getVectorEmbeddingPolicy().getEmbeddings()).isNotNull(); List embeddings = collectionProperties.getVectorEmbeddingPolicy().getEmbeddings(); assertThat(embeddings).hasSameSizeAs(collectionDefinition.getVectorEmbeddingPolicy().getEmbeddings()); - for (int i=0; i vectorIndexes = collectionProperties.getIndexingPolicy().getVectorIndexes(); assertThat(vectorIndexes).hasSameSizeAs(collectionDefinition.getIndexingPolicy().getVectorIndexes()); - for (int i=0; i Date: Fri, 29 Mar 2024 10:49:44 -0700 Subject: [PATCH 08/28] updating changelog --- sdk/cosmos/azure-cosmos/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 6d3117630755..66037e596f60 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -4,6 +4,7 @@ #### Features Added * Added public APIs `setMaxMicroBatchSize` and `getMaxMicroBatchSize` in `CosmosBulkExecutionOptions` - See [PR 39335](https://github.com/Azure/azure-sdk-for-java/pull/39335) +* Added `vectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379) #### Breaking Changes From bb85dd35059b40751c57716820f24e0e9e612a23 Mon Sep 17 00:00:00 2001 From: "Aayush Kataria (from Dev Box)" Date: Fri, 29 Mar 2024 11:36:20 -0700 Subject: [PATCH 09/28] Updating test case --- .../src/test/java/com/azure/cosmos/rx/VectorIndexTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index 09c11e091018..0dcd2659f03d 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -32,6 +32,7 @@ import org.testng.annotations.Test; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.UUID; @@ -311,7 +312,7 @@ private List populateVectorIndexes() { VectorIndexSpec vectorIndexSpec3 = new VectorIndexSpec("/vector3"); vectorIndexSpec3.setType(VectorIndexType.DISK_ANN.getValue()); - return List.of(vectorIndexSpec1, vectorIndexSpec2, vectorIndexSpec3); + return Arrays.asList(vectorIndexSpec1, vectorIndexSpec2, vectorIndexSpec3); } private List populateEmbeddings() { @@ -332,7 +333,6 @@ private List populateEmbeddings() { embedding3.setDistanceFunction(DistanceFunction.EUCLIDEAN.getValue()); embedding3.setDimensions(3L); embedding3.setVectorDataType(VectorDataType.UINT8.getValue()); - - return List.of(embedding1, embedding2, embedding3); + return Arrays.asList(embedding1, embedding2, embedding3); } } From 72a4bcd0601bd5e36ae0e8593fefc7059dcb96f2 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Tue, 2 Apr 2024 12:15:29 -0700 Subject: [PATCH 10/28] Resolving comments --- .../com/azure/cosmos/rx/VectorIndexTest.java | 102 +++++++-------- sdk/cosmos/azure-cosmos/CHANGELOG.md | 1 - ...ataType.java => CosmosVectorDataType.java} | 20 +-- ...java => CosmosVectorDistanceFunction.java} | 20 +-- .../cosmos/models/CosmosVectorEmbedding.java | 116 ++++++++++++++++++ .../com/azure/cosmos/models/Embedding.java | 101 --------------- .../cosmos/models/VectorEmbeddingPolicy.java | 40 +++--- .../azure/cosmos/models/VectorIndexType.java | 8 -- 8 files changed, 192 insertions(+), 216 deletions(-) rename sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/{VectorDataType.java => CosmosVectorDataType.java} (65%) rename sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/{DistanceFunction.java => CosmosVectorDistanceFunction.java} (64%) create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index 0dcd2659f03d..7592a505ee47 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.cosmos.rx; import com.azure.cosmos.ConsistencyLevel; @@ -11,19 +14,17 @@ import com.azure.cosmos.implementation.TestConfigurations; import com.azure.cosmos.implementation.guava25.collect.ImmutableList; import com.azure.cosmos.models.CosmosContainerProperties; -import com.azure.cosmos.models.DistanceFunction; -import com.azure.cosmos.models.Embedding; +import com.azure.cosmos.models.CosmosVectorDataType; +import com.azure.cosmos.models.CosmosVectorDistanceFunction; +import com.azure.cosmos.models.CosmosVectorEmbedding; import com.azure.cosmos.models.ExcludedPath; import com.azure.cosmos.models.IncludedPath; import com.azure.cosmos.models.IndexingMode; import com.azure.cosmos.models.IndexingPolicy; import com.azure.cosmos.models.PartitionKeyDefinition; -import com.azure.cosmos.models.VectorDataType; import com.azure.cosmos.models.VectorEmbeddingPolicy; import com.azure.cosmos.models.VectorIndexSpec; import com.azure.cosmos.models.VectorIndexType; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterClass; @@ -37,6 +38,9 @@ import java.util.List; import java.util.UUID; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + @Ignore("TODO: Ignore these test cases until the public emulator with vector indexes is released.") public class VectorIndexTest extends TestSuiteBase { protected static final int TIMEOUT = 30000; @@ -48,7 +52,7 @@ public class VectorIndexTest extends TestSuiteBase { private CosmosAsyncClient client; private CosmosAsyncDatabase database; - @BeforeClass(groups = {"long"}, timeOut = SETUP_TIMEOUT) + @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) public void before_UniqueIndexTest() { // set up the client client = new CosmosClientBuilder() @@ -62,13 +66,13 @@ public void before_UniqueIndexTest() { database = createDatabase(client, databaseId); } - @AfterClass(groups = {"long"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + @AfterClass(groups = {"emulator"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) public void afterClass() { safeDeleteDatabase(database); safeClose(client); } - @Test(groups = {"long"}, timeOut = TIMEOUT) + @Test(groups = {"emulator"}, timeOut = TIMEOUT) public void shouldCreateVectorEmbeddingPolicy() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -99,7 +103,7 @@ public void shouldCreateVectorEmbeddingPolicy() { validateCollectionProperties(collectionDefinition, collectionProperties); } - @Test(groups = {"long"}, timeOut = TIMEOUT) + @Test(groups = {"emulator"}, timeOut = TIMEOUT) public void shouldFailOnEmptyVectorEmbeddingPolicy() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -118,7 +122,7 @@ public void shouldFailOnEmptyVectorEmbeddingPolicy() { indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); - vectorIndexSpec.setType(VectorIndexType.FLAT.getValue()); + vectorIndexSpec.setType(VectorIndexType.FLAT.toString()); indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); collectionDefinition.setIndexingPolicy(indexingPolicy); @@ -132,7 +136,7 @@ public void shouldFailOnEmptyVectorEmbeddingPolicy() { } } - @Test(groups = {"long"}, timeOut = TIMEOUT) + @Test(groups = {"emulator"}, timeOut = TIMEOUT) public void shouldFailOnWrongVectorEmbeddingPolicy() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -151,15 +155,15 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); - vectorIndexSpec.setType(VectorIndexType.FLAT.getValue()); + vectorIndexSpec.setType(VectorIndexType.FLAT.toString()); indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); collectionDefinition.setIndexingPolicy(indexingPolicy); - Embedding embedding = new Embedding(); - embedding.setPath("/vector1"); - embedding.setDistanceFunction(DistanceFunction.COSINE.getValue()); - embedding.setDimensions(3L); - embedding.setVectorDataType("String"); + CosmosVectorEmbedding embedding = new CosmosVectorEmbedding( + "/vector1", + CosmosVectorDistanceFunction.COSINE.toString(), + 3L, + "String"); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); @@ -178,7 +182,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { assertThat(ex.getMessage()).isEqualTo("Vector data type cannot be empty for the vector embedding policy."); } - embedding.setVectorDataType(VectorDataType.FLOAT32.getValue()); + embedding.setVectorDataType(CosmosVectorDataType.FLOAT32.toString()); embedding.setDistanceFunction("COS"); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); @@ -197,7 +201,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { assertThat(ex.getMessage()).isEqualTo("Distance function cannot be empty for the vector embedding policy."); } - embedding.setDistanceFunction(DistanceFunction.COSINE.getValue()); + embedding.setDistanceFunction(CosmosVectorDistanceFunction.COSINE.toString()); embedding.setDimensions(-1L); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); @@ -208,7 +212,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { } } - @Test(groups = {"long"}, timeOut = TIMEOUT) + @Test(groups = {"emulator"}, timeOut = TIMEOUT) public void shouldFailOnWrongVectorIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -231,11 +235,11 @@ public void shouldFailOnWrongVectorIndex() { indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); collectionDefinition.setIndexingPolicy(indexingPolicy); - Embedding embedding = new Embedding(); - embedding.setPath("/vector1"); - embedding.setDistanceFunction(DistanceFunction.COSINE.getValue()); - embedding.setDimensions(3L); - embedding.setVectorDataType(VectorDataType.INT8.getValue()); + CosmosVectorEmbedding embedding = new CosmosVectorEmbedding( + "/vector1", + CosmosVectorDistanceFunction.COSINE.toString(), + 3L, + CosmosVectorDataType.INT8.toString()); VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); @@ -248,7 +252,7 @@ public void shouldFailOnWrongVectorIndex() { } } - @Test(groups = {"long"}, timeOut = TIMEOUT) + @Test(groups = {"emulator"}, timeOut = TIMEOUT) public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -270,7 +274,7 @@ public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { vectorIndexes.get(2).setPath("/vector2"); indexingPolicy.setVectorIndexes(vectorIndexes); - List embeddings = populateEmbeddings(); + List embeddings = populateEmbeddings(); embeddings.get(2).setPath("/vector2"); VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(embeddings); @@ -286,7 +290,7 @@ public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { private void validateCollectionProperties(CosmosContainerProperties collectionDefinition, CosmosContainerProperties collectionProperties) { assertThat(collectionProperties.getVectorEmbeddingPolicy()).isNotNull(); assertThat(collectionProperties.getVectorEmbeddingPolicy().getEmbeddings()).isNotNull(); - List embeddings = collectionProperties.getVectorEmbeddingPolicy().getEmbeddings(); + List embeddings = collectionProperties.getVectorEmbeddingPolicy().getEmbeddings(); assertThat(embeddings).hasSameSizeAs(collectionDefinition.getVectorEmbeddingPolicy().getEmbeddings()); for (int i = 0; i < embeddings.size(); i++) { assertThat(embeddings.get(0).getPath()).isEqualTo( @@ -304,35 +308,35 @@ private void validateCollectionProperties(CosmosContainerProperties collectionDe private List populateVectorIndexes() { VectorIndexSpec vectorIndexSpec1 = new VectorIndexSpec("/vector1"); - vectorIndexSpec1.setType(VectorIndexType.FLAT.getValue()); + vectorIndexSpec1.setType(VectorIndexType.FLAT.toString()); VectorIndexSpec vectorIndexSpec2 = new VectorIndexSpec("/vector2"); - vectorIndexSpec2.setType(VectorIndexType.QUANTIZED_FLAT.getValue()); + vectorIndexSpec2.setType(VectorIndexType.QUANTIZED_FLAT.toString()); VectorIndexSpec vectorIndexSpec3 = new VectorIndexSpec("/vector3"); - vectorIndexSpec3.setType(VectorIndexType.DISK_ANN.getValue()); + vectorIndexSpec3.setType(VectorIndexType.DISK_ANN.toString()); return Arrays.asList(vectorIndexSpec1, vectorIndexSpec2, vectorIndexSpec3); } - private List populateEmbeddings() { - Embedding embedding1 = new Embedding(); - embedding1.setPath("/vector1"); - embedding1.setDistanceFunction(DistanceFunction.COSINE.getValue()); - embedding1.setDimensions(3L); - embedding1.setVectorDataType(VectorDataType.FLOAT32.getValue()); - - Embedding embedding2 = new Embedding(); - embedding2.setPath("/vector2"); - embedding2.setDistanceFunction(DistanceFunction.DOT_PRODUCT.getValue()); - embedding2.setDimensions(3L); - embedding2.setVectorDataType(VectorDataType.INT8.getValue()); - - Embedding embedding3 = new Embedding(); - embedding3.setPath("/vector3"); - embedding3.setDistanceFunction(DistanceFunction.EUCLIDEAN.getValue()); - embedding3.setDimensions(3L); - embedding3.setVectorDataType(VectorDataType.UINT8.getValue()); + private List populateEmbeddings() { + CosmosVectorEmbedding embedding1 = new CosmosVectorEmbedding( + "/vector1", + CosmosVectorDistanceFunction.COSINE.toString(), + 3L, + CosmosVectorDataType.FLOAT32.toString()); + + CosmosVectorEmbedding embedding2 = new CosmosVectorEmbedding( + "/vector2", + CosmosVectorDistanceFunction.DOT_PRODUCT.toString(), + 3L, + CosmosVectorDataType.INT8.toString()); + + CosmosVectorEmbedding embedding3 = new CosmosVectorEmbedding( + "/vector3", + CosmosVectorDistanceFunction.EUCLIDEAN.toString(), + 3L, + CosmosVectorDataType.UINT8.toString()); return Arrays.asList(embedding1, embedding2, embedding3); } } diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index fa8e6f4c6449..04b8f4d12a1f 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -3,7 +3,6 @@ ### 4.58.0-beta.1 (Unreleased) #### Features Added -* Added public APIs `setMaxMicroBatchSize` and `getMaxMicroBatchSize` in `CosmosBulkExecutionOptions` - See [PR 39335](https://github.com/Azure/azure-sdk-for-java/pull/39335) * Added `vectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379) #### Breaking Changes diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java similarity index 65% rename from sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java rename to sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java index de176a5472b4..4fd5bd465b73 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorDataType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java @@ -6,7 +6,7 @@ /** * Data types for the embeddings in Cosmos DB database service. */ -public enum VectorDataType { +public enum CosmosVectorDataType { /** * Represents a int8 data type. */ @@ -29,7 +29,7 @@ public enum VectorDataType { private final String overWireValue; - VectorDataType(String overWireValue) { + CosmosVectorDataType(String overWireValue) { this.overWireValue = overWireValue; } @@ -37,20 +37,4 @@ public enum VectorDataType { public String toString() { return this.overWireValue; } - - /** - * - * @return value for the enum - */ - public String getValue() { - return this.overWireValue; - } - - /** - * - * @return if the value for the enum is empty or not. - */ - public boolean isEmpty() { - return this.overWireValue.isEmpty(); - } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java similarity index 64% rename from sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java rename to sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java index 78c10f78e8c1..9b8d4cdac493 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/DistanceFunction.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java @@ -6,7 +6,7 @@ /** * Distance Function for the embeddings in the Cosmos DB database service. */ -public enum DistanceFunction { +public enum CosmosVectorDistanceFunction { /** * Represents the euclidean distance function. */ @@ -24,7 +24,7 @@ public enum DistanceFunction { private final String overWireValue; - DistanceFunction(String overWireValue) { + CosmosVectorDistanceFunction(String overWireValue) { this.overWireValue = overWireValue; } @@ -32,20 +32,4 @@ public enum DistanceFunction { public String toString() { return this.overWireValue; } - - /** - * - * @return value for the enum - */ - public String getValue() { - return this.overWireValue; - } - - /** - * - * @return if the value for the enum is empty or not. - */ - public boolean isEmpty() { - return this.overWireValue.isEmpty(); - } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java new file mode 100644 index 000000000000..1b520e6b5d2a --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.azure.cosmos.implementation.Constants; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Embedding settings within {@link VectorEmbeddingPolicy} + */ +public final class CosmosVectorEmbedding { + @JsonProperty(Constants.Properties.PATH) + private String path; + @JsonProperty(Constants.Properties.VECTOR_DATA_TYPE) + private String vectorDataType; + @JsonProperty(Constants.Properties.VECTOR_DIMENSIONS) + private Long dimensions; + @JsonProperty(Constants.Properties.DISTANCE_FUNCTION) + private String distanceFunction; + + /** + * Constructor + * + * @param path path for the cosmosVectorEmbedding + * @param vectorDataType data type for the embedding + * @param dimensions dimensions for the embedding + * @param distanceFunction distanceFunction for the embedding + */ + public CosmosVectorEmbedding(String path, String vectorDataType, Long dimensions, String distanceFunction) { + this.path = path; + this.vectorDataType = vectorDataType; + this.dimensions = dimensions; + this.distanceFunction = distanceFunction; + } + + /** + * Gets the path for the cosmosVectorEmbedding. + * + * @return path + */ + public String getPath() { + return path; + } + + /** + * Sets the path for the cosmosVectorEmbedding. + * + * @param path the path for the cosmosVectorEmbedding + * @return CosmosVectorEmbedding + */ + public CosmosVectorEmbedding setPath(String path) { + this.path = path; + return this; + } + + /** + * Gets the data type for the cosmosVectorEmbedding. + * + * @return vectorDataType + */ + public String getVectorDataType() { + return vectorDataType; + } + + /** + * Sets the data type for the cosmosVectorEmbedding. + * + * @param vectorDataType the data type for the cosmosVectorEmbedding + * @return CosmosVectorEmbedding + */ + public CosmosVectorEmbedding setVectorDataType(String vectorDataType) { + this.vectorDataType = vectorDataType; + return this; + } + + /** + * Gets the dimensions for the cosmosVectorEmbedding. + * + * @return dimensions + */ + public Long getDimensions() { + return dimensions; + } + + /** + * Sets the dimensions for the cosmosVectorEmbedding. + * + * @param dimensions the dimensions for the cosmosVectorEmbedding + * @return CosmosVectorEmbedding + */ + public CosmosVectorEmbedding setDimensions(Long dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Gets the distanceFunction for the cosmosVectorEmbedding. + * + * @return distanceFunction + */ + public String getDistanceFunction() { + return distanceFunction; + } + + /** + * Sets the distanceFunction for the cosmosVectorEmbedding. + * + * @param distanceFunction the distanceFunction for the cosmosVectorEmbedding + * @return CosmosVectorEmbedding + */ + public CosmosVectorEmbedding setDistanceFunction(String distanceFunction) { + this.distanceFunction = distanceFunction; + return this; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java deleted file mode 100644 index 905701d56d52..000000000000 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/Embedding.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.cosmos.models; - -import com.azure.cosmos.implementation.Constants; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Embedding settings within {@link VectorEmbeddingPolicy} - */ -public final class Embedding { - @JsonProperty(Constants.Properties.PATH) - private String path; - @JsonProperty(Constants.Properties.VECTOR_DATA_TYPE) - private String vectorDataType; - @JsonProperty(Constants.Properties.VECTOR_DIMENSIONS) - private Long dimensions; - @JsonProperty(Constants.Properties.DISTANCE_FUNCTION) - private String distanceFunction; - - /** - * Gets the path for the embedding. - * - * @return path - */ - public String getPath() { - return path; - } - - /** - * Sets the path for the embedding. - * - * @param path the path for the embedding - * @return Embedding - */ - public Embedding setPath(String path) { - this.path = path; - return this; - } - - /** - * Gets the data type for the embedding. - * - * @return vectorDataType - */ - public String getVectorDataType() { - return vectorDataType; - } - - /** - * Sets the data type for the embedding. - * - * @param vectorDataType the data type for the embedding - * @return Embedding - */ - public Embedding setVectorDataType(String vectorDataType) { - this.vectorDataType = vectorDataType; - return this; - } - - /** - * Gets the dimensions for the embedding. - * - * @return dimensions - */ - public Long getDimensions() { - return dimensions; - } - - /** - * Sets the dimensions for the embedding. - * - * @param dimensions the dimensions for the embedding - * @return Embedding - */ - public Embedding setDimensions(Long dimensions) { - this.dimensions = dimensions; - return this; - } - - /** - * Gets the distanceFunction for the embedding. - * - * @return distanceFunction - */ - public String getDistanceFunction() { - return distanceFunction; - } - - /** - * Sets the distanceFunction for the embedding. - * - * @param distanceFunction the distanceFunction for the embedding - * @return Embedding - */ - public Embedding setDistanceFunction(String distanceFunction) { - this.distanceFunction = distanceFunction; - return this; - } -} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java index 5de45010dee0..138c62b1997b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java @@ -10,7 +10,6 @@ import java.util.Arrays; import java.util.List; -import java.util.Optional; /** * Vector Embedding Policy @@ -23,14 +22,14 @@ public final class VectorEmbeddingPolicy { * Paths for embeddings along with path-specific settings for the item. */ @JsonProperty(Constants.Properties.VECTOR_EMBEDDINGS) - private List embeddings; + private List embeddings; /** * Constructor * * @param embeddings list of path for embeddings along with path-specific settings for the item. */ - public VectorEmbeddingPolicy(List embeddings) { + public VectorEmbeddingPolicy(List embeddings) { validateEmbeddings(embeddings); this.embeddings = embeddings; } @@ -42,10 +41,10 @@ public VectorEmbeddingPolicy() { this.jsonSerializable = new JsonSerializable(); } - private static void validateEmbeddings(List embeddings) { + private static void validateEmbeddings(List embeddings) { embeddings.forEach(embedding -> { if (embedding == null) { - throw new IllegalArgumentException("Embedding cannot be empty."); + throw new IllegalArgumentException("Embedding cannot be null."); } validateEmbeddingPath(embedding.getPath()); validateEmbeddingDimensions(embedding.getDimensions()); @@ -65,29 +64,28 @@ private static void validateEmbeddingPath(String path) { } private static void validateEmbeddingDimensions(Long dimensions) { + if (dimensions == null) { + throw new IllegalArgumentException("Dimensions for the embedding cannot be null " + + "for the vector embedding policy"); + } if (dimensions < 1) { - throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 1 for the vector embedding policy"); + throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 1 " + + "for the vector embedding policy"); } } private static void validateEmbeddingVectorDataType(String value) { - Optional.ofNullable(value) - .filter(vectorDataType -> !vectorDataType.isEmpty()) - .map(vectorDataType -> Arrays.stream(VectorDataType.values()) - .filter(dataType -> dataType.getValue().equals(vectorDataType)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Invalid vector data type for the vector embedding policy."))) - .orElseThrow(() -> new IllegalArgumentException("Vector data type cannot be empty for the vector embedding policy.")); + if (Arrays.stream(CosmosVectorDataType.values()).noneMatch(vectorDataType -> + vectorDataType.toString().equals(value))) { + throw new IllegalArgumentException("Invalid vector data type for the vector embedding policy."); + } } private static void validateEmbeddingDistanceFunction(String value) { - Optional.ofNullable(value) - .filter(distanceFunction -> !distanceFunction.isEmpty()) - .map(distanceFunction -> Arrays.stream(DistanceFunction.values()) - .filter(distFunction -> distFunction.getValue().equals(distanceFunction)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Invalid distance function for the vector embedding policy."))) - .orElseThrow(() -> new IllegalArgumentException("Distance function cannot be empty for the vector embedding policy.")); + if (Arrays.stream(CosmosVectorDistanceFunction.values()).noneMatch(distanceFunction -> + distanceFunction.toString().equals(value))) { + throw new IllegalArgumentException("Invalid distance function for the vector embedding policy."); + } } /** @@ -95,7 +93,7 @@ private static void validateEmbeddingDistanceFunction(String value) { * * @return the paths for embeddings along with path-specific settings for the item. */ - public List getEmbeddings() { + public List getEmbeddings() { return this.embeddings; } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java index 4a30dcc2f7d7..8b8f7e031ac8 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java @@ -33,12 +33,4 @@ public enum VectorIndexType { public String toString() { return this.overWireValue; } - - /** - * - * @return value for the enum - */ - public String getValue() { - return this.overWireValue; - } } From dfb3575042601b07bddda41fe7821fee2813aa78 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Tue, 2 Apr 2024 14:04:39 -0700 Subject: [PATCH 11/28] Resolving comments --- .../com/azure/cosmos/rx/VectorIndexTest.java | 89 +++++++++++++------ .../cosmos/models/CosmosVectorEmbedding.java | 41 +++++---- .../cosmos/models/VectorEmbeddingPolicy.java | 22 ++--- 3 files changed, 99 insertions(+), 53 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index 7592a505ee47..140dce7d58d7 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -12,6 +12,7 @@ import com.azure.cosmos.CosmosException; import com.azure.cosmos.DirectConnectionConfig; import com.azure.cosmos.implementation.TestConfigurations; +import com.azure.cosmos.implementation.Utils; import com.azure.cosmos.implementation.guava25.collect.ImmutableList; import com.azure.cosmos.models.CosmosContainerProperties; import com.azure.cosmos.models.CosmosVectorDataType; @@ -25,6 +26,8 @@ import com.azure.cosmos.models.VectorEmbeddingPolicy; import com.azure.cosmos.models.VectorIndexSpec; import com.azure.cosmos.models.VectorIndexType; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterClass; @@ -48,6 +51,7 @@ public class VectorIndexTest extends TestSuiteBase { protected static final int SHUTDOWN_TIMEOUT = 20000; protected static Logger logger = LoggerFactory.getLogger(VectorIndexTest.class.getSimpleName()); + private final ObjectMapper simpleObjectMapper = Utils.getSimpleObjectMapper(); private final String databaseId = CosmosDatabaseForTest.generateId(); private CosmosAsyncClient client; private CosmosAsyncDatabase database; @@ -161,9 +165,9 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { CosmosVectorEmbedding embedding = new CosmosVectorEmbedding( "/vector1", - CosmosVectorDistanceFunction.COSINE.toString(), + "String", 3L, - "String"); + CosmosVectorDistanceFunction.COSINE.toString()); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); @@ -173,7 +177,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { assertThat(ex.getMessage()).isEqualTo("Invalid vector data type for the vector embedding policy."); } - embedding.setVectorDataType(""); + embedding.setCosmosVectorDataType(""); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); @@ -182,8 +186,8 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { assertThat(ex.getMessage()).isEqualTo("Vector data type cannot be empty for the vector embedding policy."); } - embedding.setVectorDataType(CosmosVectorDataType.FLOAT32.toString()); - embedding.setDistanceFunction("COS"); + embedding.setCosmosVectorDataType(CosmosVectorDataType.FLOAT32.toString()); + embedding.setCosmosVectorDistanceFunction("COS"); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); @@ -192,7 +196,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { assertThat(ex.getMessage()).isEqualTo("Invalid distance function for the vector embedding policy."); } - embedding.setDistanceFunction(""); + embedding.setCosmosVectorDistanceFunction(""); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); @@ -201,7 +205,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { assertThat(ex.getMessage()).isEqualTo("Distance function cannot be empty for the vector embedding policy."); } - embedding.setDistanceFunction(CosmosVectorDistanceFunction.COSINE.toString()); + embedding.setCosmosVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE.toString()); embedding.setDimensions(-1L); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); @@ -239,7 +243,7 @@ public void shouldFailOnWrongVectorIndex() { "/vector1", CosmosVectorDistanceFunction.COSINE.toString(), 3L, - CosmosVectorDataType.INT8.toString()); + CosmosVectorDistanceFunction.COSINE.toString()); VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); @@ -287,22 +291,47 @@ public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { validateCollectionProperties(collectionDefinition, collectionProperties); } + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void shouldValidateVectorEmbeddingPolicySerializationAndDeserialization() throws JsonProcessingException { + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setVectorIndexes(populateVectorIndexes()); + + VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(populateEmbeddings()); + String vectorEmbeddingPolicyJson = getVectorEmbeddingPolicyAsString(); + String expectedVectorEmbeddingPolicyJson = simpleObjectMapper.writeValueAsString(vectorEmbeddingPolicy); + assertThat(vectorEmbeddingPolicyJson).isEqualTo(expectedVectorEmbeddingPolicyJson); + + VectorEmbeddingPolicy expectedVectorEmbeddingPolicy = simpleObjectMapper.readValue(expectedVectorEmbeddingPolicyJson, VectorEmbeddingPolicy.class); + validateVectorEmbeddingPolicy(vectorEmbeddingPolicy, expectedVectorEmbeddingPolicy); + } + private void validateCollectionProperties(CosmosContainerProperties collectionDefinition, CosmosContainerProperties collectionProperties) { assertThat(collectionProperties.getVectorEmbeddingPolicy()).isNotNull(); - assertThat(collectionProperties.getVectorEmbeddingPolicy().getEmbeddings()).isNotNull(); - List embeddings = collectionProperties.getVectorEmbeddingPolicy().getEmbeddings(); - assertThat(embeddings).hasSameSizeAs(collectionDefinition.getVectorEmbeddingPolicy().getEmbeddings()); - for (int i = 0; i < embeddings.size(); i++) { - assertThat(embeddings.get(0).getPath()).isEqualTo( - collectionDefinition.getVectorEmbeddingPolicy().getEmbeddings().get(0).getPath()); - } + assertThat(collectionProperties.getVectorEmbeddingPolicy().getCosmosVectorEmbeddings()).isNotNull(); + validateVectorEmbeddingPolicy(collectionProperties.getVectorEmbeddingPolicy(), + collectionDefinition.getVectorEmbeddingPolicy()); assertThat(collectionProperties.getIndexingPolicy().getVectorIndexes()).isNotNull(); - List vectorIndexes = collectionProperties.getIndexingPolicy().getVectorIndexes(); - assertThat(vectorIndexes).hasSameSizeAs(collectionDefinition.getIndexingPolicy().getVectorIndexes()); - for (int i = 0; i < vectorIndexes.size(); i++) { - assertThat(vectorIndexes.get(0).getPath()).isEqualTo( - collectionDefinition.getIndexingPolicy().getVectorIndexes().get(0).getPath()); + validateVectorIndexes(collectionDefinition.getIndexingPolicy().getVectorIndexes(), collectionProperties.getIndexingPolicy().getVectorIndexes()); + } + + private void validateVectorEmbeddingPolicy(VectorEmbeddingPolicy actual, VectorEmbeddingPolicy expected) { + List actualEmbeddings = actual.getCosmosVectorEmbeddings(); + List expectedEmbeddings = expected.getCosmosVectorEmbeddings(); + assertThat(expectedEmbeddings).hasSameSizeAs(actualEmbeddings); + for (int i = 0; i < expectedEmbeddings.size(); i++) { + assertThat(expectedEmbeddings.get(i).getPath()).isEqualTo(actualEmbeddings.get(i).getPath()); + assertThat(expectedEmbeddings.get(i).getCosmosVectorDataType()).isEqualTo(actualEmbeddings.get(i).getCosmosVectorDataType()); + assertThat(expectedEmbeddings.get(i).getDimensions()).isEqualTo(actualEmbeddings.get(i).getDimensions()); + assertThat(expectedEmbeddings.get(i).getCosmosVectorDistanceFunction()).isEqualTo(actualEmbeddings.get(i).getCosmosVectorDistanceFunction()); + } + } + + private void validateVectorIndexes(List actual, List expected) { + assertThat(expected).hasSameSizeAs(actual); + for (int i = 0; i < expected.size(); i++) { + assertThat(expected.get(i).getPath()).isEqualTo(actual.get(i).getPath()); + assertThat(expected.get(i).getType()).isEqualTo(actual.get(i).getType()); } } @@ -322,21 +351,29 @@ private List populateVectorIndexes() { private List populateEmbeddings() { CosmosVectorEmbedding embedding1 = new CosmosVectorEmbedding( "/vector1", - CosmosVectorDistanceFunction.COSINE.toString(), + CosmosVectorDataType.FLOAT32.toString(), 3L, - CosmosVectorDataType.FLOAT32.toString()); + CosmosVectorDistanceFunction.COSINE.toString()); CosmosVectorEmbedding embedding2 = new CosmosVectorEmbedding( "/vector2", - CosmosVectorDistanceFunction.DOT_PRODUCT.toString(), + CosmosVectorDataType.INT8.toString(), 3L, - CosmosVectorDataType.INT8.toString()); + CosmosVectorDistanceFunction.DOT_PRODUCT.toString()); CosmosVectorEmbedding embedding3 = new CosmosVectorEmbedding( "/vector3", - CosmosVectorDistanceFunction.EUCLIDEAN.toString(), + CosmosVectorDataType.UINT8.toString(), 3L, - CosmosVectorDataType.UINT8.toString()); + CosmosVectorDistanceFunction.EUCLIDEAN.toString()); return Arrays.asList(embedding1, embedding2, embedding3); } + + private String getVectorEmbeddingPolicyAsString() { + return "{\"vectorEmbeddings\":[" + + "{\"path\":\"/vector1\",\"dataType\":\"float32\",\"dimensions\":3,\"distanceFunction\":\"cosine\"}," + + "{\"path\":\"/vector2\",\"dataType\":\"int8\",\"dimensions\":3,\"distanceFunction\":\"dotproduct\"}," + + "{\"path\":\"/vector3\",\"dataType\":\"uint8\",\"dimensions\":3,\"distanceFunction\":\"euclidean\"}" + + "]}"; + } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java index 1b520e6b5d2a..f711fa962de8 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java @@ -4,6 +4,7 @@ package com.azure.cosmos.models; import com.azure.cosmos.implementation.Constants; +import com.azure.cosmos.implementation.JsonSerializable; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -13,11 +14,12 @@ public final class CosmosVectorEmbedding { @JsonProperty(Constants.Properties.PATH) private String path; @JsonProperty(Constants.Properties.VECTOR_DATA_TYPE) - private String vectorDataType; + private String cosmosVectorDataType; @JsonProperty(Constants.Properties.VECTOR_DIMENSIONS) private Long dimensions; @JsonProperty(Constants.Properties.DISTANCE_FUNCTION) - private String distanceFunction; + private String cosmosVectorDistanceFunction; + private JsonSerializable jsonSerializable; /** * Constructor @@ -29,9 +31,16 @@ public final class CosmosVectorEmbedding { */ public CosmosVectorEmbedding(String path, String vectorDataType, Long dimensions, String distanceFunction) { this.path = path; - this.vectorDataType = vectorDataType; + this.cosmosVectorDataType = vectorDataType; this.dimensions = dimensions; - this.distanceFunction = distanceFunction; + this.cosmosVectorDistanceFunction = distanceFunction; + } + + /** + * Constructor + */ + public CosmosVectorEmbedding() { + this.jsonSerializable = new JsonSerializable(); } /** @@ -57,20 +66,20 @@ public CosmosVectorEmbedding setPath(String path) { /** * Gets the data type for the cosmosVectorEmbedding. * - * @return vectorDataType + * @return cosmosVectorDataType */ - public String getVectorDataType() { - return vectorDataType; + public String getCosmosVectorDataType() { + return cosmosVectorDataType; } /** * Sets the data type for the cosmosVectorEmbedding. * - * @param vectorDataType the data type for the cosmosVectorEmbedding + * @param cosmosVectorDataType the data type for the cosmosVectorEmbedding * @return CosmosVectorEmbedding */ - public CosmosVectorEmbedding setVectorDataType(String vectorDataType) { - this.vectorDataType = vectorDataType; + public CosmosVectorEmbedding setCosmosVectorDataType(String cosmosVectorDataType) { + this.cosmosVectorDataType = cosmosVectorDataType; return this; } @@ -97,20 +106,20 @@ public CosmosVectorEmbedding setDimensions(Long dimensions) { /** * Gets the distanceFunction for the cosmosVectorEmbedding. * - * @return distanceFunction + * @return cosmosVectorDistanceFunction */ - public String getDistanceFunction() { - return distanceFunction; + public String getCosmosVectorDistanceFunction() { + return cosmosVectorDistanceFunction; } /** * Sets the distanceFunction for the cosmosVectorEmbedding. * - * @param distanceFunction the distanceFunction for the cosmosVectorEmbedding + * @param cosmosVectorDistanceFunction the distanceFunction for the cosmosVectorEmbedding * @return CosmosVectorEmbedding */ - public CosmosVectorEmbedding setDistanceFunction(String distanceFunction) { - this.distanceFunction = distanceFunction; + public CosmosVectorEmbedding setCosmosVectorDistanceFunction(String cosmosVectorDistanceFunction) { + this.cosmosVectorDistanceFunction = cosmosVectorDistanceFunction; return this; } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java index 138c62b1997b..d82e28e42f8b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java @@ -22,16 +22,16 @@ public final class VectorEmbeddingPolicy { * Paths for embeddings along with path-specific settings for the item. */ @JsonProperty(Constants.Properties.VECTOR_EMBEDDINGS) - private List embeddings; + private List cosmosVectorEmbeddings; /** * Constructor * - * @param embeddings list of path for embeddings along with path-specific settings for the item. + * @param cosmosVectorEmbeddings list of path for embeddings along with path-specific settings for the item. */ - public VectorEmbeddingPolicy(List embeddings) { - validateEmbeddings(embeddings); - this.embeddings = embeddings; + public VectorEmbeddingPolicy(List cosmosVectorEmbeddings) { + validateEmbeddings(cosmosVectorEmbeddings); + this.cosmosVectorEmbeddings = cosmosVectorEmbeddings; } /** @@ -41,15 +41,15 @@ public VectorEmbeddingPolicy() { this.jsonSerializable = new JsonSerializable(); } - private static void validateEmbeddings(List embeddings) { - embeddings.forEach(embedding -> { + private static void validateEmbeddings(List cosmosVectorEmbeddings) { + cosmosVectorEmbeddings.forEach(embedding -> { if (embedding == null) { throw new IllegalArgumentException("Embedding cannot be null."); } validateEmbeddingPath(embedding.getPath()); validateEmbeddingDimensions(embedding.getDimensions()); - validateEmbeddingVectorDataType(embedding.getVectorDataType()); - validateEmbeddingDistanceFunction(embedding.getDistanceFunction()); + validateEmbeddingVectorDataType(embedding.getCosmosVectorDataType()); + validateEmbeddingDistanceFunction(embedding.getCosmosVectorDistanceFunction()); }); } @@ -93,7 +93,7 @@ private static void validateEmbeddingDistanceFunction(String value) { * * @return the paths for embeddings along with path-specific settings for the item. */ - public List getEmbeddings() { - return this.embeddings; + public List getCosmosVectorEmbeddings() { + return this.cosmosVectorEmbeddings; } } From 67f51cb527e3d9eb5cfbd73f9ae4073153fee4c7 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Tue, 2 Apr 2024 14:10:38 -0700 Subject: [PATCH 12/28] Fixing test case --- .../java/com/azure/cosmos/rx/VectorIndexTest.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index 140dce7d58d7..54948767085c 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -177,15 +177,6 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { assertThat(ex.getMessage()).isEqualTo("Invalid vector data type for the vector embedding policy."); } - embedding.setCosmosVectorDataType(""); - try { - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); - fail("Vector Embedding policy creation will fail for empty vector date type being passed"); - } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage()).isEqualTo("Vector data type cannot be empty for the vector embedding policy."); - } - embedding.setCosmosVectorDataType(CosmosVectorDataType.FLOAT32.toString()); embedding.setCosmosVectorDistanceFunction("COS"); try { @@ -196,13 +187,14 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { assertThat(ex.getMessage()).isEqualTo("Invalid distance function for the vector embedding policy."); } - embedding.setCosmosVectorDistanceFunction(""); + embedding.setCosmosVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE.toString()); + embedding.setDimensions(null); try { VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); fail("Vector Embedding policy creation will fail for empty distance function being passed"); } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage()).isEqualTo("Distance function cannot be empty for the vector embedding policy."); + assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding cannot be null for the vector embedding policy"); } embedding.setCosmosVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE.toString()); From 730f8c2d8a13eb3f4efa0f3ed208c3eb9f26b33e Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Tue, 23 Apr 2024 11:33:49 -0700 Subject: [PATCH 13/28] Resolving comments --- .../com/azure/cosmos/rx/VectorIndexTest.java | 158 +++++++++--------- sdk/cosmos/azure-cosmos/CHANGELOG.md | 2 +- .../implementation/DocumentCollection.java | 20 +-- .../models/CosmosContainerProperties.java | 4 +- .../cosmos/models/CosmosVectorEmbedding.java | 33 +--- ....java => CosmosVectorEmbeddingPolicy.java} | 41 ++--- ...exSpec.java => CosmosVectorIndexSpec.java} | 17 +- ...exType.java => CosmosVectorIndexType.java} | 4 +- .../azure/cosmos/models/IndexingPolicy.java | 10 +- 9 files changed, 135 insertions(+), 154 deletions(-) rename sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/{VectorEmbeddingPolicy.java => CosmosVectorEmbeddingPolicy.java} (70%) rename sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/{VectorIndexSpec.java => CosmosVectorIndexSpec.java} (83%) rename sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/{VectorIndexType.java => CosmosVectorIndexType.java} (88%) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index 54948767085c..4c0357b67084 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -18,14 +18,14 @@ import com.azure.cosmos.models.CosmosVectorDataType; import com.azure.cosmos.models.CosmosVectorDistanceFunction; import com.azure.cosmos.models.CosmosVectorEmbedding; +import com.azure.cosmos.models.CosmosVectorEmbeddingPolicy; import com.azure.cosmos.models.ExcludedPath; import com.azure.cosmos.models.IncludedPath; import com.azure.cosmos.models.IndexingMode; import com.azure.cosmos.models.IndexingPolicy; import com.azure.cosmos.models.PartitionKeyDefinition; -import com.azure.cosmos.models.VectorEmbeddingPolicy; -import com.azure.cosmos.models.VectorIndexSpec; -import com.azure.cosmos.models.VectorIndexType; +import com.azure.cosmos.models.CosmosVectorIndexSpec; +import com.azure.cosmos.models.CosmosVectorIndexType; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; @@ -96,10 +96,10 @@ public void shouldCreateVectorEmbeddingPolicy() { indexingPolicy.setVectorIndexes(populateVectorIndexes()); - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(populateEmbeddings()); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(populateEmbeddings()); collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); database.createContainer(collectionDefinition).block(); CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); @@ -125,9 +125,9 @@ public void shouldFailOnEmptyVectorEmbeddingPolicy() { IncludedPath includedPath2 = new IncludedPath("/description/?"); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); - vectorIndexSpec.setType(VectorIndexType.FLAT.toString()); - indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); + CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec("/vector1"); + cosmosVectorIndexSpec.setType(CosmosVectorIndexType.FLAT.toString()); + indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); collectionDefinition.setIndexingPolicy(indexingPolicy); @@ -158,50 +158,50 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { IncludedPath includedPath2 = new IncludedPath("/description/?"); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); - vectorIndexSpec.setType(VectorIndexType.FLAT.toString()); - indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); + CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec("/vector1"); + cosmosVectorIndexSpec.setType(CosmosVectorIndexType.FLAT.toString()); + indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); collectionDefinition.setIndexingPolicy(indexingPolicy); - CosmosVectorEmbedding embedding = new CosmosVectorEmbedding( - "/vector1", - "String", - 3L, - CosmosVectorDistanceFunction.COSINE.toString()); + CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); + embedding.setPath("/vector1"); + embedding.setVectorDataType(null); + embedding.setDimensions(3L); + embedding.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); try { - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); - fail("Vector Embedding policy creation will fail for wrong vector date type being passed"); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); + fail("Vector Embedding policy creation will fail for wrong vector data type being passed"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()).isEqualTo("Invalid vector data type for the vector embedding policy."); } - embedding.setCosmosVectorDataType(CosmosVectorDataType.FLOAT32.toString()); - embedding.setCosmosVectorDistanceFunction("COS"); + embedding.setVectorDataType(CosmosVectorDataType.FLOAT32); + embedding.setVectorDistanceFunction(null); try { - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); fail("Vector Embedding policy creation will fail for wrong distance function being passed"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()).isEqualTo("Invalid distance function for the vector embedding policy."); } - embedding.setCosmosVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE.toString()); + embedding.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); embedding.setDimensions(null); try { - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); fail("Vector Embedding policy creation will fail for empty distance function being passed"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding cannot be null for the vector embedding policy"); } - embedding.setCosmosVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE.toString()); + embedding.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); embedding.setDimensions(-1L); try { - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); fail("Vector Embedding policy creation will fail for negative dimensions being passed"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding has to be a long value greater than 1 for the vector embedding policy"); @@ -226,18 +226,18 @@ public void shouldFailOnWrongVectorIndex() { IncludedPath includedPath2 = new IncludedPath("/description/?"); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - VectorIndexSpec vectorIndexSpec = new VectorIndexSpec("/vector1"); - vectorIndexSpec.setType("NonFlat"); - indexingPolicy.setVectorIndexes(ImmutableList.of(vectorIndexSpec)); + CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec("/vector1"); + cosmosVectorIndexSpec.setType("NonFlat"); + indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); collectionDefinition.setIndexingPolicy(indexingPolicy); - CosmosVectorEmbedding embedding = new CosmosVectorEmbedding( - "/vector1", - CosmosVectorDistanceFunction.COSINE.toString(), - 3L, - CosmosVectorDistanceFunction.COSINE.toString()); - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); + embedding.setPath("/vector1"); + embedding.setVectorDataType(CosmosVectorDataType.FLOAT32); + embedding.setDimensions(3L); + embedding.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); try { database.createContainer(collectionDefinition).block(); @@ -266,16 +266,16 @@ public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { IncludedPath includedPath2 = new IncludedPath("/description/?"); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - List vectorIndexes = populateVectorIndexes(); + List vectorIndexes = populateVectorIndexes(); vectorIndexes.get(2).setPath("/vector2"); indexingPolicy.setVectorIndexes(vectorIndexes); List embeddings = populateEmbeddings(); embeddings.get(2).setPath("/vector2"); - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(embeddings); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(embeddings); collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setVectorEmbeddingPolicy(vectorEmbeddingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); database.createContainer(collectionDefinition).block(); CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); @@ -283,23 +283,23 @@ public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { validateCollectionProperties(collectionDefinition, collectionProperties); } - @Test(groups = {"emulator"}, timeOut = TIMEOUT) + @Test(groups = {"unit"}, timeOut = TIMEOUT) public void shouldValidateVectorEmbeddingPolicySerializationAndDeserialization() throws JsonProcessingException { IndexingPolicy indexingPolicy = new IndexingPolicy(); indexingPolicy.setVectorIndexes(populateVectorIndexes()); - VectorEmbeddingPolicy vectorEmbeddingPolicy = new VectorEmbeddingPolicy(populateEmbeddings()); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(populateEmbeddings()); String vectorEmbeddingPolicyJson = getVectorEmbeddingPolicyAsString(); - String expectedVectorEmbeddingPolicyJson = simpleObjectMapper.writeValueAsString(vectorEmbeddingPolicy); + String expectedVectorEmbeddingPolicyJson = simpleObjectMapper.writeValueAsString(cosmosVectorEmbeddingPolicy); assertThat(vectorEmbeddingPolicyJson).isEqualTo(expectedVectorEmbeddingPolicyJson); - VectorEmbeddingPolicy expectedVectorEmbeddingPolicy = simpleObjectMapper.readValue(expectedVectorEmbeddingPolicyJson, VectorEmbeddingPolicy.class); - validateVectorEmbeddingPolicy(vectorEmbeddingPolicy, expectedVectorEmbeddingPolicy); + CosmosVectorEmbeddingPolicy expectedCosmosVectorEmbeddingPolicy = simpleObjectMapper.readValue(expectedVectorEmbeddingPolicyJson, CosmosVectorEmbeddingPolicy.class); + validateVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy, expectedCosmosVectorEmbeddingPolicy); } private void validateCollectionProperties(CosmosContainerProperties collectionDefinition, CosmosContainerProperties collectionProperties) { assertThat(collectionProperties.getVectorEmbeddingPolicy()).isNotNull(); - assertThat(collectionProperties.getVectorEmbeddingPolicy().getCosmosVectorEmbeddings()).isNotNull(); + assertThat(collectionProperties.getVectorEmbeddingPolicy().getVectorEmbeddings()).isNotNull(); validateVectorEmbeddingPolicy(collectionProperties.getVectorEmbeddingPolicy(), collectionDefinition.getVectorEmbeddingPolicy()); @@ -307,19 +307,19 @@ private void validateCollectionProperties(CosmosContainerProperties collectionDe validateVectorIndexes(collectionDefinition.getIndexingPolicy().getVectorIndexes(), collectionProperties.getIndexingPolicy().getVectorIndexes()); } - private void validateVectorEmbeddingPolicy(VectorEmbeddingPolicy actual, VectorEmbeddingPolicy expected) { - List actualEmbeddings = actual.getCosmosVectorEmbeddings(); - List expectedEmbeddings = expected.getCosmosVectorEmbeddings(); + private void validateVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy actual, CosmosVectorEmbeddingPolicy expected) { + List actualEmbeddings = actual.getVectorEmbeddings(); + List expectedEmbeddings = expected.getVectorEmbeddings(); assertThat(expectedEmbeddings).hasSameSizeAs(actualEmbeddings); for (int i = 0; i < expectedEmbeddings.size(); i++) { assertThat(expectedEmbeddings.get(i).getPath()).isEqualTo(actualEmbeddings.get(i).getPath()); - assertThat(expectedEmbeddings.get(i).getCosmosVectorDataType()).isEqualTo(actualEmbeddings.get(i).getCosmosVectorDataType()); + assertThat(expectedEmbeddings.get(i).getVectorDataType()).isEqualTo(actualEmbeddings.get(i).getVectorDataType()); assertThat(expectedEmbeddings.get(i).getDimensions()).isEqualTo(actualEmbeddings.get(i).getDimensions()); - assertThat(expectedEmbeddings.get(i).getCosmosVectorDistanceFunction()).isEqualTo(actualEmbeddings.get(i).getCosmosVectorDistanceFunction()); + assertThat(expectedEmbeddings.get(i).getVectorDistanceFunction()).isEqualTo(actualEmbeddings.get(i).getVectorDistanceFunction()); } } - private void validateVectorIndexes(List actual, List expected) { + private void validateVectorIndexes(List actual, List expected) { assertThat(expected).hasSameSizeAs(actual); for (int i = 0; i < expected.size(); i++) { assertThat(expected.get(i).getPath()).isEqualTo(actual.get(i).getPath()); @@ -327,37 +327,37 @@ private void validateVectorIndexes(List actual, List populateVectorIndexes() { - VectorIndexSpec vectorIndexSpec1 = new VectorIndexSpec("/vector1"); - vectorIndexSpec1.setType(VectorIndexType.FLAT.toString()); + private List populateVectorIndexes() { + CosmosVectorIndexSpec cosmosVectorIndexSpec1 = new CosmosVectorIndexSpec("/vector1"); + cosmosVectorIndexSpec1.setType(CosmosVectorIndexType.FLAT.toString()); - VectorIndexSpec vectorIndexSpec2 = new VectorIndexSpec("/vector2"); - vectorIndexSpec2.setType(VectorIndexType.QUANTIZED_FLAT.toString()); + CosmosVectorIndexSpec cosmosVectorIndexSpec2 = new CosmosVectorIndexSpec("/vector2"); + cosmosVectorIndexSpec2.setType(CosmosVectorIndexType.QUANTIZED_FLAT.toString()); - VectorIndexSpec vectorIndexSpec3 = new VectorIndexSpec("/vector3"); - vectorIndexSpec3.setType(VectorIndexType.DISK_ANN.toString()); + CosmosVectorIndexSpec cosmosVectorIndexSpec3 = new CosmosVectorIndexSpec("/vector3"); + cosmosVectorIndexSpec3.setType(CosmosVectorIndexType.DISK_ANN.toString()); - return Arrays.asList(vectorIndexSpec1, vectorIndexSpec2, vectorIndexSpec3); + return Arrays.asList(cosmosVectorIndexSpec1, cosmosVectorIndexSpec2, cosmosVectorIndexSpec3); } private List populateEmbeddings() { - CosmosVectorEmbedding embedding1 = new CosmosVectorEmbedding( - "/vector1", - CosmosVectorDataType.FLOAT32.toString(), - 3L, - CosmosVectorDistanceFunction.COSINE.toString()); - - CosmosVectorEmbedding embedding2 = new CosmosVectorEmbedding( - "/vector2", - CosmosVectorDataType.INT8.toString(), - 3L, - CosmosVectorDistanceFunction.DOT_PRODUCT.toString()); - - CosmosVectorEmbedding embedding3 = new CosmosVectorEmbedding( - "/vector3", - CosmosVectorDataType.UINT8.toString(), - 3L, - CosmosVectorDistanceFunction.EUCLIDEAN.toString()); + CosmosVectorEmbedding embedding1 = new CosmosVectorEmbedding(); + embedding1.setPath("/vector1"); + embedding1.setVectorDataType(CosmosVectorDataType.FLOAT32); + embedding1.setDimensions(3L); + embedding1.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); + + CosmosVectorEmbedding embedding2 = new CosmosVectorEmbedding(); + embedding2.setPath("/vector2"); + embedding2.setVectorDataType(CosmosVectorDataType.INT8); + embedding2.setDimensions(3L); + embedding2.setVectorDistanceFunction(CosmosVectorDistanceFunction.DOT_PRODUCT); + + CosmosVectorEmbedding embedding3 = new CosmosVectorEmbedding(); + embedding3.setPath("/vector3"); + embedding3.setVectorDataType(CosmosVectorDataType.UINT8); + embedding3.setDimensions(3L); + embedding3.setVectorDistanceFunction(CosmosVectorDistanceFunction.EUCLIDEAN); return Arrays.asList(embedding1, embedding2, embedding3); } diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 04b8f4d12a1f..56dba39cb3f3 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -3,7 +3,7 @@ ### 4.58.0-beta.1 (Unreleased) #### Features Added -* Added `vectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379) +* Added `cosmosVectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379) #### Breaking Changes diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java index 16f906c71827..c167522d6305 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java @@ -9,11 +9,11 @@ import com.azure.cosmos.models.ChangeFeedPolicy; import com.azure.cosmos.models.ComputedProperty; import com.azure.cosmos.models.ConflictResolutionPolicy; +import com.azure.cosmos.models.CosmosVectorEmbeddingPolicy; import com.azure.cosmos.models.IndexingPolicy; import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.PartitionKeyDefinition; import com.azure.cosmos.models.UniqueKeyPolicy; -import com.azure.cosmos.models.VectorEmbeddingPolicy; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; @@ -42,7 +42,7 @@ public final class DocumentCollection extends Resource { private UniqueKeyPolicy uniqueKeyPolicy; private PartitionKeyDefinition partitionKeyDefinition; private ClientEncryptionPolicy clientEncryptionPolicyInternal; - private VectorEmbeddingPolicy vectorEmbeddingPolicy; + private CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy; /** * Constructor. @@ -419,14 +419,14 @@ public void setClientEncryptionPolicy(ClientEncryptionPolicy value) { * * @return the Vector Embedding Policy. */ - public VectorEmbeddingPolicy getVectorEmbeddingPolicy() { - if (this.vectorEmbeddingPolicy == null) { + public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() { + if (this.cosmosVectorEmbeddingPolicy == null) { if (super.has(Constants.Properties.VECTOR_EMBEDDING_POLICY)) { - this.vectorEmbeddingPolicy = super.getObject(Constants.Properties.VECTOR_EMBEDDING_POLICY, - VectorEmbeddingPolicy.class); + this.cosmosVectorEmbeddingPolicy = super.getObject(Constants.Properties.VECTOR_EMBEDDING_POLICY, + CosmosVectorEmbeddingPolicy.class); } } - return this.vectorEmbeddingPolicy; + return this.cosmosVectorEmbeddingPolicy; } /** @@ -435,11 +435,11 @@ public VectorEmbeddingPolicy getVectorEmbeddingPolicy() { * * @param value the Vector Embedding Policy. */ - public void setVectorEmbeddingPolicy(VectorEmbeddingPolicy value) { + public void setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) { if (value == null) { - throw new IllegalArgumentException("VectorEmbeddingPolicy cannot be null."); + throw new NullPointerException("VectorEmbeddingPolicy cannot be null."); } - this.vectorEmbeddingPolicy = value; + this.cosmosVectorEmbeddingPolicy = value; setProperty(this, Constants.Properties.VECTOR_EMBEDDING_POLICY, value); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java index c6d1188b5c6d..0d357da0cc37 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java @@ -353,7 +353,7 @@ public CosmosContainerProperties setClientEncryptionPolicy(ClientEncryptionPolic * * @return the Vector Embedding Policy. */ - public VectorEmbeddingPolicy getVectorEmbeddingPolicy() { + public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() { return this.documentCollection.getVectorEmbeddingPolicy(); } @@ -364,7 +364,7 @@ public VectorEmbeddingPolicy getVectorEmbeddingPolicy() { * @param value the Vector Embedding Policy. * @return the CosmosContainerProperties. */ - public CosmosContainerProperties setVectorEmbeddingPolicy(VectorEmbeddingPolicy value) { + public CosmosContainerProperties setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) { this.documentCollection.setVectorEmbeddingPolicy(value); return this; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java index f711fa962de8..95917a23e0f5 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Embedding settings within {@link VectorEmbeddingPolicy} + * Embedding settings within {@link CosmosVectorEmbeddingPolicy} */ public final class CosmosVectorEmbedding { @JsonProperty(Constants.Properties.PATH) @@ -21,21 +21,6 @@ public final class CosmosVectorEmbedding { private String cosmosVectorDistanceFunction; private JsonSerializable jsonSerializable; - /** - * Constructor - * - * @param path path for the cosmosVectorEmbedding - * @param vectorDataType data type for the embedding - * @param dimensions dimensions for the embedding - * @param distanceFunction distanceFunction for the embedding - */ - public CosmosVectorEmbedding(String path, String vectorDataType, Long dimensions, String distanceFunction) { - this.path = path; - this.cosmosVectorDataType = vectorDataType; - this.dimensions = dimensions; - this.cosmosVectorDistanceFunction = distanceFunction; - } - /** * Constructor */ @@ -68,8 +53,8 @@ public CosmosVectorEmbedding setPath(String path) { * * @return cosmosVectorDataType */ - public String getCosmosVectorDataType() { - return cosmosVectorDataType; + public CosmosVectorDataType getVectorDataType() { + return CosmosVectorDataType.valueOf(cosmosVectorDataType); } /** @@ -78,8 +63,8 @@ public String getCosmosVectorDataType() { * @param cosmosVectorDataType the data type for the cosmosVectorEmbedding * @return CosmosVectorEmbedding */ - public CosmosVectorEmbedding setCosmosVectorDataType(String cosmosVectorDataType) { - this.cosmosVectorDataType = cosmosVectorDataType; + public CosmosVectorEmbedding setVectorDataType(CosmosVectorDataType cosmosVectorDataType) { + this.cosmosVectorDataType = cosmosVectorDataType.toString(); return this; } @@ -108,8 +93,8 @@ public CosmosVectorEmbedding setDimensions(Long dimensions) { * * @return cosmosVectorDistanceFunction */ - public String getCosmosVectorDistanceFunction() { - return cosmosVectorDistanceFunction; + public CosmosVectorDistanceFunction getVectorDistanceFunction() { + return CosmosVectorDistanceFunction.valueOf(cosmosVectorDistanceFunction); } /** @@ -118,8 +103,8 @@ public String getCosmosVectorDistanceFunction() { * @param cosmosVectorDistanceFunction the distanceFunction for the cosmosVectorEmbedding * @return CosmosVectorEmbedding */ - public CosmosVectorEmbedding setCosmosVectorDistanceFunction(String cosmosVectorDistanceFunction) { - this.cosmosVectorDistanceFunction = cosmosVectorDistanceFunction; + public CosmosVectorEmbedding setVectorDistanceFunction(CosmosVectorDistanceFunction cosmosVectorDistanceFunction) { + this.cosmosVectorDistanceFunction = cosmosVectorDistanceFunction.toString(); return this; } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java similarity index 70% rename from sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java rename to sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java index d82e28e42f8b..57cfb82dd915 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java @@ -14,10 +14,9 @@ /** * Vector Embedding Policy */ -public final class VectorEmbeddingPolicy { +public final class CosmosVectorEmbeddingPolicy { private JsonSerializable jsonSerializable; - /** * Paths for embeddings along with path-specific settings for the item. */ @@ -29,16 +28,10 @@ public final class VectorEmbeddingPolicy { * * @param cosmosVectorEmbeddings list of path for embeddings along with path-specific settings for the item. */ - public VectorEmbeddingPolicy(List cosmosVectorEmbeddings) { + public CosmosVectorEmbeddingPolicy(List cosmosVectorEmbeddings) { validateEmbeddings(cosmosVectorEmbeddings); - this.cosmosVectorEmbeddings = cosmosVectorEmbeddings; - } - - /** - * Constructor. - */ - public VectorEmbeddingPolicy() { this.jsonSerializable = new JsonSerializable(); + this.setCosmosVectorEmbeddings(cosmosVectorEmbeddings); } private static void validateEmbeddings(List cosmosVectorEmbeddings) { @@ -48,14 +41,14 @@ private static void validateEmbeddings(List cosmosVectorE } validateEmbeddingPath(embedding.getPath()); validateEmbeddingDimensions(embedding.getDimensions()); - validateEmbeddingVectorDataType(embedding.getCosmosVectorDataType()); - validateEmbeddingDistanceFunction(embedding.getCosmosVectorDistanceFunction()); + validateEmbeddingVectorDataType(embedding.getVectorDataType()); + validateEmbeddingDistanceFunction(embedding.getVectorDistanceFunction()); }); } private static void validateEmbeddingPath(String path) { if (StringUtils.isEmpty(path)) { - throw new IllegalArgumentException("embedding path is empty"); + throw new NullPointerException("embedding path is empty"); } if (path.charAt(0) != '/' || path.lastIndexOf('/') != 0) { @@ -65,7 +58,7 @@ private static void validateEmbeddingPath(String path) { private static void validateEmbeddingDimensions(Long dimensions) { if (dimensions == null) { - throw new IllegalArgumentException("Dimensions for the embedding cannot be null " + + throw new NullPointerException("Dimensions for the embedding cannot be null " + "for the vector embedding policy"); } if (dimensions < 1) { @@ -74,16 +67,16 @@ private static void validateEmbeddingDimensions(Long dimensions) { } } - private static void validateEmbeddingVectorDataType(String value) { + private static void validateEmbeddingVectorDataType(CosmosVectorDataType value) { if (Arrays.stream(CosmosVectorDataType.values()).noneMatch(vectorDataType -> - vectorDataType.toString().equals(value))) { + vectorDataType.equals(value))) { throw new IllegalArgumentException("Invalid vector data type for the vector embedding policy."); } } - private static void validateEmbeddingDistanceFunction(String value) { + private static void validateEmbeddingDistanceFunction(CosmosVectorDistanceFunction value) { if (Arrays.stream(CosmosVectorDistanceFunction.values()).noneMatch(distanceFunction -> - distanceFunction.toString().equals(value))) { + distanceFunction.equals(value))) { throw new IllegalArgumentException("Invalid distance function for the vector embedding policy."); } } @@ -93,7 +86,17 @@ private static void validateEmbeddingDistanceFunction(String value) { * * @return the paths for embeddings along with path-specific settings for the item. */ - public List getCosmosVectorEmbeddings() { + public List getVectorEmbeddings() { return this.cosmosVectorEmbeddings; } + + /** + * Sets the paths for embeddings along with path-specific settings for the item. + * + * @param cosmosVectorEmbeddings paths for embeddings along with path-specific settings for the item. + */ + public void setCosmosVectorEmbeddings(List cosmosVectorEmbeddings) { + this.cosmosVectorEmbeddings = cosmosVectorEmbeddings; + } + } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java similarity index 83% rename from sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java rename to sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java index 97d73453e3cf..ae1299394bdd 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexSpec.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java @@ -10,7 +10,7 @@ /** * Vector Indexes spec for Azure CosmosDB service. */ -public final class VectorIndexSpec { +public final class CosmosVectorIndexSpec { private final JsonSerializable jsonSerializable; private String type; @@ -20,24 +20,17 @@ public final class VectorIndexSpec { * * @param path the path. */ - public VectorIndexSpec(String path) { + public CosmosVectorIndexSpec(String path) { this.jsonSerializable = new JsonSerializable(); this.setPath(path); } - /** - * Constructor. - */ - public VectorIndexSpec() { - this.jsonSerializable = new JsonSerializable(); - } - /** * Constructor. * * @param objectNode the object node that represents the included path. */ - public VectorIndexSpec(ObjectNode objectNode) { this.jsonSerializable = new JsonSerializable(objectNode); } + private CosmosVectorIndexSpec(ObjectNode objectNode) { this.jsonSerializable = new JsonSerializable(objectNode); } /** * Gets path. @@ -54,7 +47,7 @@ public String getPath() { * @param path the path. * @return the SpatialSpec. */ - public VectorIndexSpec setPath(String path) { + public CosmosVectorIndexSpec setPath(String path) { this.jsonSerializable.set(Constants.Properties.PATH, path); return this; } @@ -81,7 +74,7 @@ public String getType() { * @param type the vector index type * @return the VectorIndexSpec */ - public VectorIndexSpec setType(String type) { + public CosmosVectorIndexSpec setType(String type) { this.type = type; this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type); return this; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java similarity index 88% rename from sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java rename to sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java index 8b8f7e031ac8..679ea1f991c0 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/VectorIndexType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java @@ -6,7 +6,7 @@ /** * Defines the index type of vector index specification in the Azure Cosmos DB service. */ -public enum VectorIndexType { +public enum CosmosVectorIndexType { /** * Represents a flat vector index type. */ @@ -25,7 +25,7 @@ public enum VectorIndexType { private final String overWireValue; - VectorIndexType(String overWireValue) { + CosmosVectorIndexType(String overWireValue) { this.overWireValue = overWireValue; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index 30f62f92de54..29e01a18814f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -24,7 +24,7 @@ public final class IndexingPolicy { private List excludedPaths; private List> compositeIndexes; private List spatialIndexes; - private List vectorIndexes; + private List vectorIndexes; /** * Constructor. @@ -266,12 +266,12 @@ public IndexingPolicy setSpatialIndexes(List spatialIndexes) { * * @return the vector indexes */ - public List getVectorIndexes() { + public List getVectorIndexes() { if (this.vectorIndexes == null) { - this.vectorIndexes = this.jsonSerializable.getList(Constants.Properties.VECTOR_INDEXES, VectorIndexSpec.class); + this.vectorIndexes = this.jsonSerializable.getList(Constants.Properties.VECTOR_INDEXES, CosmosVectorIndexSpec.class); if (this.vectorIndexes == null) { - this.vectorIndexes = new ArrayList(); + this.vectorIndexes = new ArrayList(); } } @@ -299,7 +299,7 @@ public List getVectorIndexes() { * @param vectorIndexes the vector indexes * @return the Indexing Policy. */ - public IndexingPolicy setVectorIndexes(List vectorIndexes) { + public IndexingPolicy setVectorIndexes(List vectorIndexes) { this.vectorIndexes = vectorIndexes; this.jsonSerializable.set(Constants.Properties.VECTOR_INDEXES,this.vectorIndexes); return this; From ad3ac894d840f3a6f8f7f20927a207d6541df3c6 Mon Sep 17 00:00:00 2001 From: "Aayush Kataria (from Dev Box)" Date: Sat, 27 Apr 2024 00:35:56 -0700 Subject: [PATCH 14/28] Resolving Comments --- .../com/azure/cosmos/rx/VectorIndexTest.java | 158 ++++++++---------- .../implementation/DocumentCollection.java | 5 +- .../cosmos/models/CosmosVectorDataType.java | 15 ++ .../models/CosmosVectorDistanceFunction.java | 15 ++ .../cosmos/models/CosmosVectorEmbedding.java | 46 +++-- .../models/CosmosVectorEmbeddingPolicy.java | 61 +------ .../cosmos/models/CosmosVectorIndexSpec.java | 17 +- .../cosmos/models/ModelBridgeInternal.java | 8 +- 8 files changed, 143 insertions(+), 182 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index 4c0357b67084..cd7bfc6e5dae 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -57,7 +57,7 @@ public class VectorIndexTest extends TestSuiteBase { private CosmosAsyncDatabase database; @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) - public void before_UniqueIndexTest() { + public void before_VectorIndexTest() { // set up the client client = new CosmosClientBuilder() .endpoint(TestConfigurations.HOST) @@ -76,7 +76,7 @@ public void afterClass() { safeClose(client); } - @Test(groups = {"emulator"}, timeOut = TIMEOUT) + @Test(groups = {"emulator"}, timeOut = TIMEOUT*10000) public void shouldCreateVectorEmbeddingPolicy() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList(); @@ -96,7 +96,8 @@ public void shouldCreateVectorEmbeddingPolicy() { indexingPolicy.setVectorIndexes(populateVectorIndexes()); - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(populateEmbeddings()); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); + cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(populateEmbeddings()); collectionDefinition.setIndexingPolicy(indexingPolicy); collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); @@ -125,7 +126,8 @@ public void shouldFailOnEmptyVectorEmbeddingPolicy() { IncludedPath includedPath2 = new IncludedPath("/description/?"); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec("/vector1"); + CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec.setPath("/vector1"); cosmosVectorIndexSpec.setType(CosmosVectorIndexType.FLAT.toString()); indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); @@ -140,74 +142,6 @@ public void shouldFailOnEmptyVectorEmbeddingPolicy() { } } - @Test(groups = {"emulator"}, timeOut = TIMEOUT) - public void shouldFailOnWrongVectorEmbeddingPolicy() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath("/name/?"); - IncludedPath includedPath2 = new IncludedPath("/description/?"); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec("/vector1"); - cosmosVectorIndexSpec.setType(CosmosVectorIndexType.FLAT.toString()); - indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); - embedding.setPath("/vector1"); - embedding.setVectorDataType(null); - embedding.setDimensions(3L); - embedding.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); - - try { - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); - fail("Vector Embedding policy creation will fail for wrong vector data type being passed"); - } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage()).isEqualTo("Invalid vector data type for the vector embedding policy."); - } - - embedding.setVectorDataType(CosmosVectorDataType.FLOAT32); - embedding.setVectorDistanceFunction(null); - try { - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); - fail("Vector Embedding policy creation will fail for wrong distance function being passed"); - } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage()).isEqualTo("Invalid distance function for the vector embedding policy."); - } - - embedding.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); - embedding.setDimensions(null); - try { - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); - fail("Vector Embedding policy creation will fail for empty distance function being passed"); - } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding cannot be null for the vector embedding policy"); - } - - embedding.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); - embedding.setDimensions(-1L); - try { - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); - fail("Vector Embedding policy creation will fail for negative dimensions being passed"); - } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding has to be a long value greater than 1 for the vector embedding policy"); - } - } - @Test(groups = {"emulator"}, timeOut = TIMEOUT) public void shouldFailOnWrongVectorIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); @@ -226,17 +160,19 @@ public void shouldFailOnWrongVectorIndex() { IncludedPath includedPath2 = new IncludedPath("/description/?"); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec("/vector1"); + CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec.setPath("/vector1"); cosmosVectorIndexSpec.setType("NonFlat"); indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); collectionDefinition.setIndexingPolicy(indexingPolicy); CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); embedding.setPath("/vector1"); - embedding.setVectorDataType(CosmosVectorDataType.FLOAT32); + embedding.setDataType(CosmosVectorDataType.FLOAT32); embedding.setDimensions(3L); - embedding.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(ImmutableList.of(embedding)); + embedding.setDistanceFunction(CosmosVectorDistanceFunction.COSINE); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); + cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(ImmutableList.of(embedding)); collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); try { @@ -272,7 +208,8 @@ public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { List embeddings = populateEmbeddings(); embeddings.get(2).setPath("/vector2"); - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(embeddings); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); + cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(embeddings); collectionDefinition.setIndexingPolicy(indexingPolicy); collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); @@ -283,12 +220,46 @@ public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { validateCollectionProperties(collectionDefinition, collectionProperties); } + @Test(groups = {"unit"}, timeOut = TIMEOUT) + public void shouldFailOnWrongVectorEmbeddingPolicy() { + CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); + try { + + embedding.setDataType(null); + fail("Embedding creation failed because cosmosVectorDataType argument is empty"); + } catch (NullPointerException ex) { + assertThat(ex.getMessage()).isEqualTo("cosmosVectorDataType cannot be empty"); + } + + try { + embedding.setDistanceFunction(null); + fail("Embedding creation failed because cosmosVectorDistanceFunction argument is empty"); + } catch (NullPointerException ex) { + assertThat(ex.getMessage()).isEqualTo("cosmosVectorDistanceFunction cannot be empty"); + } + + try { + embedding.setDimensions(null); + fail("Embedding creation failed because dimensions argument is empty"); + } catch (NullPointerException ex) { + assertThat(ex.getMessage()).isEqualTo("dimensions cannot be empty"); + } + + try { + embedding.setDimensions(-1L); + fail("Vector Embedding policy creation will fail for negative dimensions being passed"); + } catch (IllegalArgumentException ex) { + assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding has to be a long value greater than 1 for the vector embedding policy"); + } + } + @Test(groups = {"unit"}, timeOut = TIMEOUT) public void shouldValidateVectorEmbeddingPolicySerializationAndDeserialization() throws JsonProcessingException { IndexingPolicy indexingPolicy = new IndexingPolicy(); indexingPolicy.setVectorIndexes(populateVectorIndexes()); - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(populateEmbeddings()); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); + cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(populateEmbeddings()); String vectorEmbeddingPolicyJson = getVectorEmbeddingPolicyAsString(); String expectedVectorEmbeddingPolicyJson = simpleObjectMapper.writeValueAsString(cosmosVectorEmbeddingPolicy); assertThat(vectorEmbeddingPolicyJson).isEqualTo(expectedVectorEmbeddingPolicyJson); @@ -313,9 +284,9 @@ private void validateVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy actual, C assertThat(expectedEmbeddings).hasSameSizeAs(actualEmbeddings); for (int i = 0; i < expectedEmbeddings.size(); i++) { assertThat(expectedEmbeddings.get(i).getPath()).isEqualTo(actualEmbeddings.get(i).getPath()); - assertThat(expectedEmbeddings.get(i).getVectorDataType()).isEqualTo(actualEmbeddings.get(i).getVectorDataType()); + assertThat(expectedEmbeddings.get(i).getDataType()).isEqualTo(actualEmbeddings.get(i).getDataType()); assertThat(expectedEmbeddings.get(i).getDimensions()).isEqualTo(actualEmbeddings.get(i).getDimensions()); - assertThat(expectedEmbeddings.get(i).getVectorDistanceFunction()).isEqualTo(actualEmbeddings.get(i).getVectorDistanceFunction()); + assertThat(expectedEmbeddings.get(i).getDistanceFunction()).isEqualTo(actualEmbeddings.get(i).getDistanceFunction()); } } @@ -328,13 +299,16 @@ private void validateVectorIndexes(List actual, List populateVectorIndexes() { - CosmosVectorIndexSpec cosmosVectorIndexSpec1 = new CosmosVectorIndexSpec("/vector1"); + CosmosVectorIndexSpec cosmosVectorIndexSpec1 = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec1.setPath("/vector1"); cosmosVectorIndexSpec1.setType(CosmosVectorIndexType.FLAT.toString()); - CosmosVectorIndexSpec cosmosVectorIndexSpec2 = new CosmosVectorIndexSpec("/vector2"); + CosmosVectorIndexSpec cosmosVectorIndexSpec2 = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec2.setPath("/vector2"); cosmosVectorIndexSpec2.setType(CosmosVectorIndexType.QUANTIZED_FLAT.toString()); - CosmosVectorIndexSpec cosmosVectorIndexSpec3 = new CosmosVectorIndexSpec("/vector3"); + CosmosVectorIndexSpec cosmosVectorIndexSpec3 = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec3.setPath("/vector3"); cosmosVectorIndexSpec3.setType(CosmosVectorIndexType.DISK_ANN.toString()); return Arrays.asList(cosmosVectorIndexSpec1, cosmosVectorIndexSpec2, cosmosVectorIndexSpec3); @@ -343,29 +317,29 @@ private List populateVectorIndexes() { private List populateEmbeddings() { CosmosVectorEmbedding embedding1 = new CosmosVectorEmbedding(); embedding1.setPath("/vector1"); - embedding1.setVectorDataType(CosmosVectorDataType.FLOAT32); + embedding1.setDataType(CosmosVectorDataType.FLOAT32); embedding1.setDimensions(3L); - embedding1.setVectorDistanceFunction(CosmosVectorDistanceFunction.COSINE); + embedding1.setDistanceFunction(CosmosVectorDistanceFunction.COSINE); CosmosVectorEmbedding embedding2 = new CosmosVectorEmbedding(); embedding2.setPath("/vector2"); - embedding2.setVectorDataType(CosmosVectorDataType.INT8); + embedding2.setDataType(CosmosVectorDataType.INT8); embedding2.setDimensions(3L); - embedding2.setVectorDistanceFunction(CosmosVectorDistanceFunction.DOT_PRODUCT); + embedding2.setDistanceFunction(CosmosVectorDistanceFunction.DOT_PRODUCT); CosmosVectorEmbedding embedding3 = new CosmosVectorEmbedding(); embedding3.setPath("/vector3"); - embedding3.setVectorDataType(CosmosVectorDataType.UINT8); + embedding3.setDataType(CosmosVectorDataType.UINT8); embedding3.setDimensions(3L); - embedding3.setVectorDistanceFunction(CosmosVectorDistanceFunction.EUCLIDEAN); + embedding3.setDistanceFunction(CosmosVectorDistanceFunction.EUCLIDEAN); return Arrays.asList(embedding1, embedding2, embedding3); } private String getVectorEmbeddingPolicyAsString() { return "{\"vectorEmbeddings\":[" + - "{\"path\":\"/vector1\",\"dataType\":\"float32\",\"dimensions\":3,\"distanceFunction\":\"cosine\"}," + - "{\"path\":\"/vector2\",\"dataType\":\"int8\",\"dimensions\":3,\"distanceFunction\":\"dotproduct\"}," + - "{\"path\":\"/vector3\",\"dataType\":\"uint8\",\"dimensions\":3,\"distanceFunction\":\"euclidean\"}" + + "{\"path\":\"/vector1\",\"dataType\":\"FLOAT32\",\"dimensions\":3,\"distanceFunction\":\"COSINE\"}," + + "{\"path\":\"/vector2\",\"dataType\":\"INT8\",\"dimensions\":3,\"distanceFunction\":\"DOT_PRODUCT\"}," + + "{\"path\":\"/vector3\",\"dataType\":\"UINT8\",\"dimensions\":3,\"distanceFunction\":\"EUCLIDEAN\"}" + "]}"; } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java index c167522d6305..6ac8da95e941 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java @@ -25,6 +25,7 @@ import java.util.Collections; import static com.azure.cosmos.BridgeInternal.setProperty; +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; /** * Represents a document collection in the Azure Cosmos DB database service. A collection is a named logical container @@ -436,9 +437,7 @@ public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() { * @param value the Vector Embedding Policy. */ public void setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) { - if (value == null) { - throw new NullPointerException("VectorEmbeddingPolicy cannot be null."); - } + checkNotNull(value, "cosmosVectorEmbeddingPolicy cannot be null"); this.cosmosVectorEmbeddingPolicy = value; setProperty(this, Constants.Properties.VECTOR_EMBEDDING_POLICY, value); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java index 4fd5bd465b73..3d99a04a4633 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java @@ -3,6 +3,8 @@ package com.azure.cosmos.models; +import java.util.Arrays; + /** * Data types for the embeddings in Cosmos DB database service. */ @@ -37,4 +39,17 @@ public enum CosmosVectorDataType { public String toString() { return this.overWireValue; } + + /** + * Method to retrieve the enum constant by its overWireValue. + * @param value the overWire value of the enum constant + * @return the matching CosmosVectorDataType + * @throws IllegalArgumentException if no matching enum constant is found + */ + public static CosmosVectorDataType fromString(String value) { + return Arrays.stream(CosmosVectorDataType.values()) + .filter(vectorDataType -> vectorDataType.toString().equalsIgnoreCase(value)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("Invalid vector data type for the vector embedding policy.")); + } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java index 9b8d4cdac493..54d2ad5b0853 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java @@ -3,6 +3,8 @@ package com.azure.cosmos.models; +import java.util.Arrays; + /** * Distance Function for the embeddings in the Cosmos DB database service. */ @@ -32,4 +34,17 @@ public enum CosmosVectorDistanceFunction { public String toString() { return this.overWireValue; } + + /** + * Method to retrieve the enum constant by its overWireValue. + * @param value the overWire value of the enum constant + * @return the matching CosmosVectorDataType + * @throws IllegalArgumentException if no matching enum constant is found + */ + public static CosmosVectorDistanceFunction fromString(String value) { + return Arrays.stream(CosmosVectorDistanceFunction.values()) + .filter(vectorDistanceFunction -> vectorDistanceFunction.toString().equalsIgnoreCase(value)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("Invalid distance function for the vector embedding policy.")); + } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java index 95917a23e0f5..9bc267ea6006 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java @@ -5,7 +5,9 @@ import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.JsonSerializable; +import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.fasterxml.jackson.annotation.JsonProperty; +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; /** * Embedding settings within {@link CosmosVectorEmbeddingPolicy} @@ -14,11 +16,11 @@ public final class CosmosVectorEmbedding { @JsonProperty(Constants.Properties.PATH) private String path; @JsonProperty(Constants.Properties.VECTOR_DATA_TYPE) - private String cosmosVectorDataType; + private String dataType; @JsonProperty(Constants.Properties.VECTOR_DIMENSIONS) private Long dimensions; @JsonProperty(Constants.Properties.DISTANCE_FUNCTION) - private String cosmosVectorDistanceFunction; + private String distanceFunction; private JsonSerializable jsonSerializable; /** @@ -44,6 +46,14 @@ public String getPath() { * @return CosmosVectorEmbedding */ public CosmosVectorEmbedding setPath(String path) { + if (StringUtils.isEmpty(path)) { + throw new NullPointerException("embedding path is empty"); + } + + if (path.charAt(0) != '/' || path.lastIndexOf('/') != 0) { + throw new IllegalArgumentException(""); + } + this.path = path; return this; } @@ -51,20 +61,21 @@ public CosmosVectorEmbedding setPath(String path) { /** * Gets the data type for the cosmosVectorEmbedding. * - * @return cosmosVectorDataType + * @return dataType */ - public CosmosVectorDataType getVectorDataType() { - return CosmosVectorDataType.valueOf(cosmosVectorDataType); + public CosmosVectorDataType getDataType() { + return CosmosVectorDataType.fromString(dataType); } /** * Sets the data type for the cosmosVectorEmbedding. * - * @param cosmosVectorDataType the data type for the cosmosVectorEmbedding + * @param dataType the data type for the cosmosVectorEmbedding * @return CosmosVectorEmbedding */ - public CosmosVectorEmbedding setVectorDataType(CosmosVectorDataType cosmosVectorDataType) { - this.cosmosVectorDataType = cosmosVectorDataType.toString(); + public CosmosVectorEmbedding setDataType(CosmosVectorDataType dataType) { + checkNotNull(dataType, "cosmosVectorDataType cannot be empty"); + this.dataType = dataType.toString(); return this; } @@ -84,6 +95,12 @@ public Long getDimensions() { * @return CosmosVectorEmbedding */ public CosmosVectorEmbedding setDimensions(Long dimensions) { + checkNotNull(dimensions, "dimensions cannot be empty"); + if (dimensions < 1) { + throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 1 " + + "for the vector embedding policy"); + } + this.dimensions = dimensions; return this; } @@ -91,20 +108,21 @@ public CosmosVectorEmbedding setDimensions(Long dimensions) { /** * Gets the distanceFunction for the cosmosVectorEmbedding. * - * @return cosmosVectorDistanceFunction + * @return distanceFunction */ - public CosmosVectorDistanceFunction getVectorDistanceFunction() { - return CosmosVectorDistanceFunction.valueOf(cosmosVectorDistanceFunction); + public CosmosVectorDistanceFunction getDistanceFunction() { + return CosmosVectorDistanceFunction.fromString(distanceFunction); } /** * Sets the distanceFunction for the cosmosVectorEmbedding. * - * @param cosmosVectorDistanceFunction the distanceFunction for the cosmosVectorEmbedding + * @param distanceFunction the distanceFunction for the cosmosVectorEmbedding * @return CosmosVectorEmbedding */ - public CosmosVectorEmbedding setVectorDistanceFunction(CosmosVectorDistanceFunction cosmosVectorDistanceFunction) { - this.cosmosVectorDistanceFunction = cosmosVectorDistanceFunction.toString(); + public CosmosVectorEmbedding setDistanceFunction(CosmosVectorDistanceFunction distanceFunction) { + checkNotNull(distanceFunction, "cosmosVectorDistanceFunction cannot be empty"); + this.distanceFunction = distanceFunction.toString(); return this; } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java index 57cfb82dd915..c54c843ebd96 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java @@ -5,10 +5,8 @@ import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.JsonSerializable; -import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Arrays; import java.util.List; /** @@ -25,60 +23,9 @@ public final class CosmosVectorEmbeddingPolicy { /** * Constructor - * - * @param cosmosVectorEmbeddings list of path for embeddings along with path-specific settings for the item. */ - public CosmosVectorEmbeddingPolicy(List cosmosVectorEmbeddings) { - validateEmbeddings(cosmosVectorEmbeddings); + public CosmosVectorEmbeddingPolicy() { this.jsonSerializable = new JsonSerializable(); - this.setCosmosVectorEmbeddings(cosmosVectorEmbeddings); - } - - private static void validateEmbeddings(List cosmosVectorEmbeddings) { - cosmosVectorEmbeddings.forEach(embedding -> { - if (embedding == null) { - throw new IllegalArgumentException("Embedding cannot be null."); - } - validateEmbeddingPath(embedding.getPath()); - validateEmbeddingDimensions(embedding.getDimensions()); - validateEmbeddingVectorDataType(embedding.getVectorDataType()); - validateEmbeddingDistanceFunction(embedding.getVectorDistanceFunction()); - }); - } - - private static void validateEmbeddingPath(String path) { - if (StringUtils.isEmpty(path)) { - throw new NullPointerException("embedding path is empty"); - } - - if (path.charAt(0) != '/' || path.lastIndexOf('/') != 0) { - throw new IllegalArgumentException(""); - } - } - - private static void validateEmbeddingDimensions(Long dimensions) { - if (dimensions == null) { - throw new NullPointerException("Dimensions for the embedding cannot be null " + - "for the vector embedding policy"); - } - if (dimensions < 1) { - throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 1 " + - "for the vector embedding policy"); - } - } - - private static void validateEmbeddingVectorDataType(CosmosVectorDataType value) { - if (Arrays.stream(CosmosVectorDataType.values()).noneMatch(vectorDataType -> - vectorDataType.equals(value))) { - throw new IllegalArgumentException("Invalid vector data type for the vector embedding policy."); - } - } - - private static void validateEmbeddingDistanceFunction(CosmosVectorDistanceFunction value) { - if (Arrays.stream(CosmosVectorDistanceFunction.values()).noneMatch(distanceFunction -> - distanceFunction.equals(value))) { - throw new IllegalArgumentException("Invalid distance function for the vector embedding policy."); - } } /** @@ -96,7 +43,13 @@ public List getVectorEmbeddings() { * @param cosmosVectorEmbeddings paths for embeddings along with path-specific settings for the item. */ public void setCosmosVectorEmbeddings(List cosmosVectorEmbeddings) { + cosmosVectorEmbeddings.forEach(embedding -> { + if (embedding == null) { + throw new NullPointerException("Embedding cannot be null."); + } + }); this.cosmosVectorEmbeddings = cosmosVectorEmbeddings; +// this.jsonSerializable.set(Constants.Properties.VECTOR_EMBEDDINGS, cosmosVectorEmbeddings); } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java index ae1299394bdd..47dee3ab88e2 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java @@ -5,32 +5,19 @@ import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.JsonSerializable; -import com.fasterxml.jackson.databind.node.ObjectNode; /** * Vector Indexes spec for Azure CosmosDB service. */ public final class CosmosVectorIndexSpec { - private final JsonSerializable jsonSerializable; + private JsonSerializable jsonSerializable; private String type; /** * Constructor - * - * @param path the path. - */ - public CosmosVectorIndexSpec(String path) { - this.jsonSerializable = new JsonSerializable(); - this.setPath(path); - } - - /** - * Constructor. - * - * @param objectNode the object node that represents the included path. */ - private CosmosVectorIndexSpec(ObjectNode objectNode) { this.jsonSerializable = new JsonSerializable(objectNode); } + public CosmosVectorIndexSpec() { this.jsonSerializable = new JsonSerializable(); } /** * Gets path. diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java index c78910f2e2df..d2a7abdff8c7 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java @@ -598,8 +598,8 @@ public static void populatePropertyBag(T t) { ((PartitionKeyDefinition) t).populatePropertyBag(); } else if (t instanceof SpatialSpec) { ((SpatialSpec) t).populatePropertyBag(); - } else if (t instanceof VectorIndexSpec) { - ((VectorIndexSpec) t).populatePropertyBag(); + } else if (t instanceof CosmosVectorIndexSpec) { + ((CosmosVectorIndexSpec) t).populatePropertyBag(); } else if (t instanceof SqlParameter) { ((SqlParameter) t).populatePropertyBag(); } else if (t instanceof SqlQuerySpec) { @@ -633,8 +633,8 @@ public static JsonSerializable getJsonSerializable(T t) { return ((PartitionKeyDefinition) t).getJsonSerializable(); } else if (t instanceof SpatialSpec) { return ((SpatialSpec) t).getJsonSerializable(); - } else if (t instanceof VectorIndexSpec) { - return ((VectorIndexSpec) t).getJsonSerializable(); + } else if (t instanceof CosmosVectorIndexSpec) { + return ((CosmosVectorIndexSpec) t).getJsonSerializable(); } else if (t instanceof SqlParameter) { return ((SqlParameter) t).getJsonSerializable(); } else if (t instanceof SqlQuerySpec) { From 3eb77ead823d910c6d60d2dd78cc8980fc8601c9 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Sat, 27 Apr 2024 09:37:14 -0700 Subject: [PATCH 15/28] Fixing build issues --- .../com/azure/cosmos/implementation/DocumentCollection.java | 6 ++---- .../java/com/azure/cosmos/models/CosmosVectorIndexSpec.java | 5 +++-- .../main/java/com/azure/cosmos/models/IndexingPolicy.java | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java index 1668d8791d57..1930f2275a61 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java @@ -6,8 +6,8 @@ import com.azure.cosmos.CosmosItemSerializer; import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.azure.cosmos.implementation.caches.SerializableWrapper; -import com.azure.cosmos.models.ClientEncryptionPolicy; import com.azure.cosmos.models.ChangeFeedPolicy; +import com.azure.cosmos.models.ClientEncryptionPolicy; import com.azure.cosmos.models.ComputedProperty; import com.azure.cosmos.models.ConflictResolutionPolicy; import com.azure.cosmos.models.CosmosVectorEmbeddingPolicy; @@ -25,7 +25,6 @@ import java.util.Collection; import java.util.Collections; -import static com.azure.cosmos.BridgeInternal.setProperty; import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; /** @@ -439,8 +438,7 @@ public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() { */ public void setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) { checkNotNull(value, "cosmosVectorEmbeddingPolicy cannot be null"); - this.cosmosVectorEmbeddingPolicy = value; - setProperty(this, Constants.Properties.VECTOR_EMBEDDING_POLICY, value); + this.set(Constants.Properties.VECTOR_EMBEDDING_POLICY, value, CosmosItemSerializer.DEFAULT_SERIALIZER); } public void populatePropertyBag() { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java index 47dee3ab88e2..3133123313fb 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java @@ -3,6 +3,7 @@ package com.azure.cosmos.models; +import com.azure.cosmos.CosmosItemSerializer; import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.JsonSerializable; @@ -35,7 +36,7 @@ public String getPath() { * @return the SpatialSpec. */ public CosmosVectorIndexSpec setPath(String path) { - this.jsonSerializable.set(Constants.Properties.PATH, path); + this.jsonSerializable.set(Constants.Properties.PATH, path, CosmosItemSerializer.DEFAULT_SERIALIZER); return this; } @@ -63,7 +64,7 @@ public String getType() { */ public CosmosVectorIndexSpec setType(String type) { this.type = type; - this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type); + this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type, CosmosItemSerializer.DEFAULT_SERIALIZER); return this; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index d8b6cf5e6ae9..678cea56fcc4 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -305,7 +305,7 @@ public List getVectorIndexes() { */ public IndexingPolicy setVectorIndexes(List vectorIndexes) { this.vectorIndexes = vectorIndexes; - this.jsonSerializable.set(Constants.Properties.VECTOR_INDEXES,this.vectorIndexes); + this.jsonSerializable.set(Constants.Properties.VECTOR_INDEXES,this.vectorIndexes, CosmosItemSerializer.DEFAULT_SERIALIZER); return this; } From 460f68114f76b51a63617c7091c19e09024a82ea Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Tue, 30 Apr 2024 10:21:58 -0700 Subject: [PATCH 16/28] Resolving comments --- .../com/azure/cosmos/models/CosmosVectorEmbedding.java | 6 +++--- .../com/azure/cosmos/models/CosmosVectorIndexSpec.java | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java index 9bc267ea6006..94a519ef9d38 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java @@ -74,7 +74,7 @@ public CosmosVectorDataType getDataType() { * @return CosmosVectorEmbedding */ public CosmosVectorEmbedding setDataType(CosmosVectorDataType dataType) { - checkNotNull(dataType, "cosmosVectorDataType cannot be empty"); + checkNotNull(dataType, "cosmosVectorDataType cannot be null"); this.dataType = dataType.toString(); return this; } @@ -95,9 +95,9 @@ public Long getDimensions() { * @return CosmosVectorEmbedding */ public CosmosVectorEmbedding setDimensions(Long dimensions) { - checkNotNull(dimensions, "dimensions cannot be empty"); + checkNotNull(dimensions, "dimensions cannot be null"); if (dimensions < 1) { - throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 1 " + + throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 0 " + "for the vector embedding policy"); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java index 3133123313fb..13b1559810ca 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java @@ -7,6 +7,8 @@ import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.JsonSerializable; +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + /** * Vector Indexes spec for Azure CosmosDB service. */ @@ -48,10 +50,6 @@ public CosmosVectorIndexSpec setPath(String path) { public String getType() { if (this.type == null) { this.type = this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE); - - if (this.type == null) { - throw new IllegalArgumentException("INVALID vectorIndexType of " + this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE)); - } } return this.type; } @@ -63,6 +61,7 @@ public String getType() { * @return the VectorIndexSpec */ public CosmosVectorIndexSpec setType(String type) { + checkNotNull(type, "cosmosVectorIndexType cannot be null"); this.type = type; this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type, CosmosItemSerializer.DEFAULT_SERIALIZER); return this; From 5579dd1da71261b82640db4a14f2ad200298f2e0 Mon Sep 17 00:00:00 2001 From: "Aayush Kataria (from Dev Box)" Date: Wed, 1 May 2024 09:15:25 -0700 Subject: [PATCH 17/28] Resolving Comments --- .../test/java/com/azure/cosmos/rx/VectorIndexTest.java | 10 +++++----- .../com/azure/cosmos/models/CosmosVectorDataType.java | 3 +++ .../cosmos/models/CosmosVectorDistanceFunction.java | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index cd7bfc6e5dae..74f13be9d4f4 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -317,13 +317,13 @@ private List populateVectorIndexes() { private List populateEmbeddings() { CosmosVectorEmbedding embedding1 = new CosmosVectorEmbedding(); embedding1.setPath("/vector1"); - embedding1.setDataType(CosmosVectorDataType.FLOAT32); + embedding1.setDataType(CosmosVectorDataType.INT8); embedding1.setDimensions(3L); embedding1.setDistanceFunction(CosmosVectorDistanceFunction.COSINE); CosmosVectorEmbedding embedding2 = new CosmosVectorEmbedding(); embedding2.setPath("/vector2"); - embedding2.setDataType(CosmosVectorDataType.INT8); + embedding2.setDataType(CosmosVectorDataType.FLOAT32); embedding2.setDimensions(3L); embedding2.setDistanceFunction(CosmosVectorDistanceFunction.DOT_PRODUCT); @@ -337,9 +337,9 @@ private List populateEmbeddings() { private String getVectorEmbeddingPolicyAsString() { return "{\"vectorEmbeddings\":[" + - "{\"path\":\"/vector1\",\"dataType\":\"FLOAT32\",\"dimensions\":3,\"distanceFunction\":\"COSINE\"}," + - "{\"path\":\"/vector2\",\"dataType\":\"INT8\",\"dimensions\":3,\"distanceFunction\":\"DOT_PRODUCT\"}," + - "{\"path\":\"/vector3\",\"dataType\":\"UINT8\",\"dimensions\":3,\"distanceFunction\":\"EUCLIDEAN\"}" + + "{\"path\":\"/vector1\",\"dataType\":\"int8\",\"dimensions\":3,\"distanceFunction\":\"cosine\"}," + + "{\"path\":\"/vector2\",\"dataType\":\"float32\",\"dimensions\":3,\"distanceFunction\":\"dotproduct\"}," + + "{\"path\":\"/vector3\",\"dataType\":\"uint8\",\"dimensions\":3,\"distanceFunction\":\"euclidean\"}" + "]}"; } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java index 3d99a04a4633..1a0d42af17a4 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java @@ -3,6 +3,8 @@ package com.azure.cosmos.models; +import com.fasterxml.jackson.annotation.JsonValue; + import java.util.Arrays; /** @@ -35,6 +37,7 @@ public enum CosmosVectorDataType { this.overWireValue = overWireValue; } + @JsonValue @Override public String toString() { return this.overWireValue; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java index 54d2ad5b0853..60efd432ad7f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java @@ -3,6 +3,8 @@ package com.azure.cosmos.models; +import com.fasterxml.jackson.annotation.JsonValue; + import java.util.Arrays; /** @@ -30,6 +32,7 @@ public enum CosmosVectorDistanceFunction { this.overWireValue = overWireValue; } + @JsonValue @Override public String toString() { return this.overWireValue; From 528a0ebd7ddd39a6883931adc10d27a56f14daa3 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Thu, 2 May 2024 08:18:18 -0700 Subject: [PATCH 18/28] [Cosmos][VectorIndex]Adding changes for vectorIndex and vectorEmbeddingPolicy (#40004) * Adding changes for vectorIndex and vectorEmbeddingPolicy * Adding some necessary comments * Adding test case * updating enum values * Updating test case * Updating test case * Updating test case * updating changelog * Updating test case * Resolving comments * Resolving comments * Fixing test case * Resolving comments * Resolving Comments * Fixing build issues * Resolving comments * Resolving Comments --- .../com/azure/cosmos/rx/VectorIndexTest.java | 345 ++++++++++++++++++ sdk/cosmos/azure-cosmos/CHANGELOG.md | 3 +- .../cosmos/implementation/Constants.java | 9 + .../implementation/DocumentCollection.java | 33 +- .../azure/cosmos/models/CompositePath.java | 2 +- .../models/CosmosContainerProperties.java | 22 ++ .../cosmos/models/CosmosVectorDataType.java | 58 +++ .../models/CosmosVectorDistanceFunction.java | 53 +++ .../cosmos/models/CosmosVectorEmbedding.java | 128 +++++++ .../models/CosmosVectorEmbeddingPolicy.java | 55 +++ .../cosmos/models/CosmosVectorIndexSpec.java | 77 ++++ .../cosmos/models/CosmosVectorIndexType.java | 36 ++ .../azure/cosmos/models/IndexingPolicy.java | 59 ++- .../cosmos/models/ModelBridgeInternal.java | 4 + 14 files changed, 874 insertions(+), 10 deletions(-) create mode 100644 sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java new file mode 100644 index 000000000000..74f13be9d4f4 --- /dev/null +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.rx; + +import com.azure.cosmos.ConsistencyLevel; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosAsyncContainer; +import com.azure.cosmos.CosmosAsyncDatabase; +import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.CosmosDatabaseForTest; +import com.azure.cosmos.CosmosException; +import com.azure.cosmos.DirectConnectionConfig; +import com.azure.cosmos.implementation.TestConfigurations; +import com.azure.cosmos.implementation.Utils; +import com.azure.cosmos.implementation.guava25.collect.ImmutableList; +import com.azure.cosmos.models.CosmosContainerProperties; +import com.azure.cosmos.models.CosmosVectorDataType; +import com.azure.cosmos.models.CosmosVectorDistanceFunction; +import com.azure.cosmos.models.CosmosVectorEmbedding; +import com.azure.cosmos.models.CosmosVectorEmbeddingPolicy; +import com.azure.cosmos.models.ExcludedPath; +import com.azure.cosmos.models.IncludedPath; +import com.azure.cosmos.models.IndexingMode; +import com.azure.cosmos.models.IndexingPolicy; +import com.azure.cosmos.models.PartitionKeyDefinition; +import com.azure.cosmos.models.CosmosVectorIndexSpec; +import com.azure.cosmos.models.CosmosVectorIndexType; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Ignore; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +@Ignore("TODO: Ignore these test cases until the public emulator with vector indexes is released.") +public class VectorIndexTest extends TestSuiteBase { + protected static final int TIMEOUT = 30000; + protected static final int SETUP_TIMEOUT = 20000; + protected static final int SHUTDOWN_TIMEOUT = 20000; + + protected static Logger logger = LoggerFactory.getLogger(VectorIndexTest.class.getSimpleName()); + private final ObjectMapper simpleObjectMapper = Utils.getSimpleObjectMapper(); + private final String databaseId = CosmosDatabaseForTest.generateId(); + private CosmosAsyncClient client; + private CosmosAsyncDatabase database; + + @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) + public void before_VectorIndexTest() { + // set up the client + client = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .directMode(DirectConnectionConfig.getDefaultConfig()) + .consistencyLevel(ConsistencyLevel.SESSION) + .contentResponseOnWriteEnabled(true) + .buildAsyncClient(); + + database = createDatabase(client, databaseId); + } + + @AfterClass(groups = {"emulator"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + safeDeleteDatabase(database); + safeClose(client); + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT*10000) + public void shouldCreateVectorEmbeddingPolicy() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + indexingPolicy.setVectorIndexes(populateVectorIndexes()); + + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); + cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(populateEmbeddings()); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); + + database.createContainer(collectionDefinition).block(); + CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); + CosmosContainerProperties collectionProperties = createdCollection.read().block().getProperties(); + validateCollectionProperties(collectionDefinition, collectionProperties); + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void shouldFailOnEmptyVectorEmbeddingPolicy() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec.setPath("/vector1"); + cosmosVectorIndexSpec.setType(CosmosVectorIndexType.FLAT.toString()); + indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + + try { + database.createContainer(collectionDefinition).block(); + fail("Container creation will fail as no vector embedding policy is being passed"); + } catch (CosmosException ex) { + assertThat(ex.getStatusCode()).isEqualTo(400); + assertThat(ex.getMessage()).contains("vector1 not matching in Embedding's path"); + } + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void shouldFailOnWrongVectorIndex() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec.setPath("/vector1"); + cosmosVectorIndexSpec.setType("NonFlat"); + indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); + collectionDefinition.setIndexingPolicy(indexingPolicy); + + CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); + embedding.setPath("/vector1"); + embedding.setDataType(CosmosVectorDataType.FLOAT32); + embedding.setDimensions(3L); + embedding.setDistanceFunction(CosmosVectorDistanceFunction.COSINE); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); + cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(ImmutableList.of(embedding)); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); + + try { + database.createContainer(collectionDefinition).block(); + fail("Container creation will fail as wrong vector index type is being passed"); + } catch (CosmosException ex) { + assertThat(ex.getStatusCode()).isEqualTo(400); + assertThat(ex.getMessage()).contains("NonFlat is invalid, Valid types are 'flat' or 'quantizedFlat'"); + } + } + + @Test(groups = {"emulator"}, timeOut = TIMEOUT) + public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList(); + paths.add("/mypk"); + partitionKeyDef.setPaths(paths); + + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); + + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); + ExcludedPath excludedPath = new ExcludedPath("/*"); + indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); + + IncludedPath includedPath1 = new IncludedPath("/name/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); + indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); + + List vectorIndexes = populateVectorIndexes(); + vectorIndexes.get(2).setPath("/vector2"); + indexingPolicy.setVectorIndexes(vectorIndexes); + + List embeddings = populateEmbeddings(); + embeddings.get(2).setPath("/vector2"); + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); + cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(embeddings); + + collectionDefinition.setIndexingPolicy(indexingPolicy); + collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); + + database.createContainer(collectionDefinition).block(); + CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); + CosmosContainerProperties collectionProperties = createdCollection.read().block().getProperties(); + validateCollectionProperties(collectionDefinition, collectionProperties); + } + + @Test(groups = {"unit"}, timeOut = TIMEOUT) + public void shouldFailOnWrongVectorEmbeddingPolicy() { + CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); + try { + + embedding.setDataType(null); + fail("Embedding creation failed because cosmosVectorDataType argument is empty"); + } catch (NullPointerException ex) { + assertThat(ex.getMessage()).isEqualTo("cosmosVectorDataType cannot be empty"); + } + + try { + embedding.setDistanceFunction(null); + fail("Embedding creation failed because cosmosVectorDistanceFunction argument is empty"); + } catch (NullPointerException ex) { + assertThat(ex.getMessage()).isEqualTo("cosmosVectorDistanceFunction cannot be empty"); + } + + try { + embedding.setDimensions(null); + fail("Embedding creation failed because dimensions argument is empty"); + } catch (NullPointerException ex) { + assertThat(ex.getMessage()).isEqualTo("dimensions cannot be empty"); + } + + try { + embedding.setDimensions(-1L); + fail("Vector Embedding policy creation will fail for negative dimensions being passed"); + } catch (IllegalArgumentException ex) { + assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding has to be a long value greater than 1 for the vector embedding policy"); + } + } + + @Test(groups = {"unit"}, timeOut = TIMEOUT) + public void shouldValidateVectorEmbeddingPolicySerializationAndDeserialization() throws JsonProcessingException { + IndexingPolicy indexingPolicy = new IndexingPolicy(); + indexingPolicy.setVectorIndexes(populateVectorIndexes()); + + CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); + cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(populateEmbeddings()); + String vectorEmbeddingPolicyJson = getVectorEmbeddingPolicyAsString(); + String expectedVectorEmbeddingPolicyJson = simpleObjectMapper.writeValueAsString(cosmosVectorEmbeddingPolicy); + assertThat(vectorEmbeddingPolicyJson).isEqualTo(expectedVectorEmbeddingPolicyJson); + + CosmosVectorEmbeddingPolicy expectedCosmosVectorEmbeddingPolicy = simpleObjectMapper.readValue(expectedVectorEmbeddingPolicyJson, CosmosVectorEmbeddingPolicy.class); + validateVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy, expectedCosmosVectorEmbeddingPolicy); + } + + private void validateCollectionProperties(CosmosContainerProperties collectionDefinition, CosmosContainerProperties collectionProperties) { + assertThat(collectionProperties.getVectorEmbeddingPolicy()).isNotNull(); + assertThat(collectionProperties.getVectorEmbeddingPolicy().getVectorEmbeddings()).isNotNull(); + validateVectorEmbeddingPolicy(collectionProperties.getVectorEmbeddingPolicy(), + collectionDefinition.getVectorEmbeddingPolicy()); + + assertThat(collectionProperties.getIndexingPolicy().getVectorIndexes()).isNotNull(); + validateVectorIndexes(collectionDefinition.getIndexingPolicy().getVectorIndexes(), collectionProperties.getIndexingPolicy().getVectorIndexes()); + } + + private void validateVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy actual, CosmosVectorEmbeddingPolicy expected) { + List actualEmbeddings = actual.getVectorEmbeddings(); + List expectedEmbeddings = expected.getVectorEmbeddings(); + assertThat(expectedEmbeddings).hasSameSizeAs(actualEmbeddings); + for (int i = 0; i < expectedEmbeddings.size(); i++) { + assertThat(expectedEmbeddings.get(i).getPath()).isEqualTo(actualEmbeddings.get(i).getPath()); + assertThat(expectedEmbeddings.get(i).getDataType()).isEqualTo(actualEmbeddings.get(i).getDataType()); + assertThat(expectedEmbeddings.get(i).getDimensions()).isEqualTo(actualEmbeddings.get(i).getDimensions()); + assertThat(expectedEmbeddings.get(i).getDistanceFunction()).isEqualTo(actualEmbeddings.get(i).getDistanceFunction()); + } + } + + private void validateVectorIndexes(List actual, List expected) { + assertThat(expected).hasSameSizeAs(actual); + for (int i = 0; i < expected.size(); i++) { + assertThat(expected.get(i).getPath()).isEqualTo(actual.get(i).getPath()); + assertThat(expected.get(i).getType()).isEqualTo(actual.get(i).getType()); + } + } + + private List populateVectorIndexes() { + CosmosVectorIndexSpec cosmosVectorIndexSpec1 = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec1.setPath("/vector1"); + cosmosVectorIndexSpec1.setType(CosmosVectorIndexType.FLAT.toString()); + + CosmosVectorIndexSpec cosmosVectorIndexSpec2 = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec2.setPath("/vector2"); + cosmosVectorIndexSpec2.setType(CosmosVectorIndexType.QUANTIZED_FLAT.toString()); + + CosmosVectorIndexSpec cosmosVectorIndexSpec3 = new CosmosVectorIndexSpec(); + cosmosVectorIndexSpec3.setPath("/vector3"); + cosmosVectorIndexSpec3.setType(CosmosVectorIndexType.DISK_ANN.toString()); + + return Arrays.asList(cosmosVectorIndexSpec1, cosmosVectorIndexSpec2, cosmosVectorIndexSpec3); + } + + private List populateEmbeddings() { + CosmosVectorEmbedding embedding1 = new CosmosVectorEmbedding(); + embedding1.setPath("/vector1"); + embedding1.setDataType(CosmosVectorDataType.INT8); + embedding1.setDimensions(3L); + embedding1.setDistanceFunction(CosmosVectorDistanceFunction.COSINE); + + CosmosVectorEmbedding embedding2 = new CosmosVectorEmbedding(); + embedding2.setPath("/vector2"); + embedding2.setDataType(CosmosVectorDataType.FLOAT32); + embedding2.setDimensions(3L); + embedding2.setDistanceFunction(CosmosVectorDistanceFunction.DOT_PRODUCT); + + CosmosVectorEmbedding embedding3 = new CosmosVectorEmbedding(); + embedding3.setPath("/vector3"); + embedding3.setDataType(CosmosVectorDataType.UINT8); + embedding3.setDimensions(3L); + embedding3.setDistanceFunction(CosmosVectorDistanceFunction.EUCLIDEAN); + return Arrays.asList(embedding1, embedding2, embedding3); + } + + private String getVectorEmbeddingPolicyAsString() { + return "{\"vectorEmbeddings\":[" + + "{\"path\":\"/vector1\",\"dataType\":\"int8\",\"dimensions\":3,\"distanceFunction\":\"cosine\"}," + + "{\"path\":\"/vector2\",\"dataType\":\"float32\",\"dimensions\":3,\"distanceFunction\":\"dotproduct\"}," + + "{\"path\":\"/vector3\",\"dataType\":\"uint8\",\"dimensions\":3,\"distanceFunction\":\"euclidean\"}" + + "]}"; + } +} diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 4ea8a84052bd..28c11dc76f12 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -13,8 +13,9 @@ ### 4.59.0 (2024-04-27) #### Features Added +* Added `cosmosVectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379) * Added public APIs `getCustomItemSerializer` and `setCustomItemSerializer` to allow customers to specify custom payload transformations or serialization settings. - See [PR 38997](https://github.com/Azure/azure-sdk-for-java/pull/38997) and [PR 39933](https://github.com/Azure/azure-sdk-for-java/pull/39933) - + #### Other Changes * Load Blackbird or Afterburner into the ObjectMapper depending upon Java version and presence of modules in classpath. Make Afterburner and Blackbird optional maven dependencies. See - [PR 39689](https://github.com/Azure/azure-sdk-for-java/pull/39689) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java index 8409d5b7ec23..f789963783ed 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java @@ -120,6 +120,15 @@ public static final class Properties { public static final String SPATIAL_INDEXES = "spatialIndexes"; public static final String TYPES = "types"; + // Vector Embedding Policy + public static final String VECTOR_EMBEDDING_POLICY = "vectorEmbeddingPolicy"; + public static final String VECTOR_INDEXES = "vectorIndexes"; + public static final String VECTOR_EMBEDDINGS = "vectorEmbeddings"; + public static final String VECTOR_INDEX_TYPE = "type"; + public static final String VECTOR_DATA_TYPE = "dataType"; + public static final String VECTOR_DIMENSIONS = "dimensions"; + public static final String DISTANCE_FUNCTION = "distanceFunction"; + // Unique index. public static final String UNIQUE_KEY_POLICY = "uniqueKeyPolicy"; public static final String UNIQUE_KEYS = "uniqueKeys"; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java index 678bdb90378c..1930f2275a61 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java @@ -6,10 +6,11 @@ import com.azure.cosmos.CosmosItemSerializer; import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.azure.cosmos.implementation.caches.SerializableWrapper; -import com.azure.cosmos.models.ClientEncryptionPolicy; import com.azure.cosmos.models.ChangeFeedPolicy; +import com.azure.cosmos.models.ClientEncryptionPolicy; import com.azure.cosmos.models.ComputedProperty; import com.azure.cosmos.models.ConflictResolutionPolicy; +import com.azure.cosmos.models.CosmosVectorEmbeddingPolicy; import com.azure.cosmos.models.IndexingPolicy; import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.PartitionKeyDefinition; @@ -24,6 +25,8 @@ import java.util.Collection; import java.util.Collections; +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + /** * Represents a document collection in the Azure Cosmos DB database service. A collection is a named logical container * for documents. @@ -40,6 +43,7 @@ public final class DocumentCollection extends Resource { private UniqueKeyPolicy uniqueKeyPolicy; private PartitionKeyDefinition partitionKeyDefinition; private ClientEncryptionPolicy clientEncryptionPolicyInternal; + private CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy; /** * Constructor. @@ -410,6 +414,33 @@ public void setClientEncryptionPolicy(ClientEncryptionPolicy value) { this.set(Constants.Properties.CLIENT_ENCRYPTION_POLICY, value, CosmosItemSerializer.DEFAULT_SERIALIZER); } + /** + * Gets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item + * used in performing vector search on the items in a collection in the Azure CosmosDB database service. + * + * @return the Vector Embedding Policy. + */ + public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() { + if (this.cosmosVectorEmbeddingPolicy == null) { + if (super.has(Constants.Properties.VECTOR_EMBEDDING_POLICY)) { + this.cosmosVectorEmbeddingPolicy = super.getObject(Constants.Properties.VECTOR_EMBEDDING_POLICY, + CosmosVectorEmbeddingPolicy.class); + } + } + return this.cosmosVectorEmbeddingPolicy; + } + + /** + * Sets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item + * used in performing vector search on the items in a collection in the Azure CosmosDB database service. + * + * @param value the Vector Embedding Policy. + */ + public void setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) { + checkNotNull(value, "cosmosVectorEmbeddingPolicy cannot be null"); + this.set(Constants.Properties.VECTOR_EMBEDDING_POLICY, value, CosmosItemSerializer.DEFAULT_SERIALIZER); + } + public void populatePropertyBag() { super.populatePropertyBag(); if (this.indexingPolicy == null) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CompositePath.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CompositePath.java index a278e0aa8f50..8cfd99b46e37 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CompositePath.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CompositePath.java @@ -93,7 +93,7 @@ public CompositePathSortOrder getOrder() { } /** - * Gets the sort order for the composite path. + * Sets the sort order for the composite path. *

* For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", * then you need to make the order for "/age" "ascending" and the order for "/height" "descending". diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java index 4fae5a797a70..0d357da0cc37 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java @@ -347,6 +347,28 @@ public CosmosContainerProperties setClientEncryptionPolicy(ClientEncryptionPolic return this; } + /** + * Gets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item + * used in performing vector search on the items in a collection in the Azure CosmosDB database service. + * + * @return the Vector Embedding Policy. + */ + public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() { + return this.documentCollection.getVectorEmbeddingPolicy(); + } + + /** + * Sets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item + * used in performing vector search on the items in a collection in the Azure CosmosDB database service. + * + * @param value the Vector Embedding Policy. + * @return the CosmosContainerProperties. + */ + public CosmosContainerProperties setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) { + this.documentCollection.setVectorEmbeddingPolicy(value); + return this; + } + Resource getResource() { return this.documentCollection; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java new file mode 100644 index 000000000000..1a0d42af17a4 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.Arrays; + +/** + * Data types for the embeddings in Cosmos DB database service. + */ +public enum CosmosVectorDataType { + /** + * Represents a int8 data type. + */ + INT8("int8"), + + /** + * Represents a uint8 data type. + */ + UINT8("uint8"), + + /** + * Represents a float16 data type. + */ + FLOAT16("float16"), + + /** + * Represents a float32 data type. + */ + FLOAT32("float32"); + + private final String overWireValue; + + CosmosVectorDataType(String overWireValue) { + this.overWireValue = overWireValue; + } + + @JsonValue + @Override + public String toString() { + return this.overWireValue; + } + + /** + * Method to retrieve the enum constant by its overWireValue. + * @param value the overWire value of the enum constant + * @return the matching CosmosVectorDataType + * @throws IllegalArgumentException if no matching enum constant is found + */ + public static CosmosVectorDataType fromString(String value) { + return Arrays.stream(CosmosVectorDataType.values()) + .filter(vectorDataType -> vectorDataType.toString().equalsIgnoreCase(value)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("Invalid vector data type for the vector embedding policy.")); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java new file mode 100644 index 000000000000..60efd432ad7f --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.Arrays; + +/** + * Distance Function for the embeddings in the Cosmos DB database service. + */ +public enum CosmosVectorDistanceFunction { + /** + * Represents the euclidean distance function. + */ + EUCLIDEAN("euclidean"), + + /** + * Represents the cosine distance function. + */ + COSINE("cosine"), + + /** + * Represents the dot product distance function. + */ + DOT_PRODUCT("dotproduct"); + + private final String overWireValue; + + CosmosVectorDistanceFunction(String overWireValue) { + this.overWireValue = overWireValue; + } + + @JsonValue + @Override + public String toString() { + return this.overWireValue; + } + + /** + * Method to retrieve the enum constant by its overWireValue. + * @param value the overWire value of the enum constant + * @return the matching CosmosVectorDataType + * @throws IllegalArgumentException if no matching enum constant is found + */ + public static CosmosVectorDistanceFunction fromString(String value) { + return Arrays.stream(CosmosVectorDistanceFunction.values()) + .filter(vectorDistanceFunction -> vectorDistanceFunction.toString().equalsIgnoreCase(value)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("Invalid distance function for the vector embedding policy.")); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java new file mode 100644 index 000000000000..94a519ef9d38 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.azure.cosmos.implementation.Constants; +import com.azure.cosmos.implementation.JsonSerializable; +import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + +/** + * Embedding settings within {@link CosmosVectorEmbeddingPolicy} + */ +public final class CosmosVectorEmbedding { + @JsonProperty(Constants.Properties.PATH) + private String path; + @JsonProperty(Constants.Properties.VECTOR_DATA_TYPE) + private String dataType; + @JsonProperty(Constants.Properties.VECTOR_DIMENSIONS) + private Long dimensions; + @JsonProperty(Constants.Properties.DISTANCE_FUNCTION) + private String distanceFunction; + private JsonSerializable jsonSerializable; + + /** + * Constructor + */ + public CosmosVectorEmbedding() { + this.jsonSerializable = new JsonSerializable(); + } + + /** + * Gets the path for the cosmosVectorEmbedding. + * + * @return path + */ + public String getPath() { + return path; + } + + /** + * Sets the path for the cosmosVectorEmbedding. + * + * @param path the path for the cosmosVectorEmbedding + * @return CosmosVectorEmbedding + */ + public CosmosVectorEmbedding setPath(String path) { + if (StringUtils.isEmpty(path)) { + throw new NullPointerException("embedding path is empty"); + } + + if (path.charAt(0) != '/' || path.lastIndexOf('/') != 0) { + throw new IllegalArgumentException(""); + } + + this.path = path; + return this; + } + + /** + * Gets the data type for the cosmosVectorEmbedding. + * + * @return dataType + */ + public CosmosVectorDataType getDataType() { + return CosmosVectorDataType.fromString(dataType); + } + + /** + * Sets the data type for the cosmosVectorEmbedding. + * + * @param dataType the data type for the cosmosVectorEmbedding + * @return CosmosVectorEmbedding + */ + public CosmosVectorEmbedding setDataType(CosmosVectorDataType dataType) { + checkNotNull(dataType, "cosmosVectorDataType cannot be null"); + this.dataType = dataType.toString(); + return this; + } + + /** + * Gets the dimensions for the cosmosVectorEmbedding. + * + * @return dimensions + */ + public Long getDimensions() { + return dimensions; + } + + /** + * Sets the dimensions for the cosmosVectorEmbedding. + * + * @param dimensions the dimensions for the cosmosVectorEmbedding + * @return CosmosVectorEmbedding + */ + public CosmosVectorEmbedding setDimensions(Long dimensions) { + checkNotNull(dimensions, "dimensions cannot be null"); + if (dimensions < 1) { + throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 0 " + + "for the vector embedding policy"); + } + + this.dimensions = dimensions; + return this; + } + + /** + * Gets the distanceFunction for the cosmosVectorEmbedding. + * + * @return distanceFunction + */ + public CosmosVectorDistanceFunction getDistanceFunction() { + return CosmosVectorDistanceFunction.fromString(distanceFunction); + } + + /** + * Sets the distanceFunction for the cosmosVectorEmbedding. + * + * @param distanceFunction the distanceFunction for the cosmosVectorEmbedding + * @return CosmosVectorEmbedding + */ + public CosmosVectorEmbedding setDistanceFunction(CosmosVectorDistanceFunction distanceFunction) { + checkNotNull(distanceFunction, "cosmosVectorDistanceFunction cannot be empty"); + this.distanceFunction = distanceFunction.toString(); + return this; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java new file mode 100644 index 000000000000..c54c843ebd96 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.azure.cosmos.implementation.Constants; +import com.azure.cosmos.implementation.JsonSerializable; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * Vector Embedding Policy + */ +public final class CosmosVectorEmbeddingPolicy { + + private JsonSerializable jsonSerializable; + /** + * Paths for embeddings along with path-specific settings for the item. + */ + @JsonProperty(Constants.Properties.VECTOR_EMBEDDINGS) + private List cosmosVectorEmbeddings; + + /** + * Constructor + */ + public CosmosVectorEmbeddingPolicy() { + this.jsonSerializable = new JsonSerializable(); + } + + /** + * Gets the paths for embeddings along with path-specific settings for the item. + * + * @return the paths for embeddings along with path-specific settings for the item. + */ + public List getVectorEmbeddings() { + return this.cosmosVectorEmbeddings; + } + + /** + * Sets the paths for embeddings along with path-specific settings for the item. + * + * @param cosmosVectorEmbeddings paths for embeddings along with path-specific settings for the item. + */ + public void setCosmosVectorEmbeddings(List cosmosVectorEmbeddings) { + cosmosVectorEmbeddings.forEach(embedding -> { + if (embedding == null) { + throw new NullPointerException("Embedding cannot be null."); + } + }); + this.cosmosVectorEmbeddings = cosmosVectorEmbeddings; +// this.jsonSerializable.set(Constants.Properties.VECTOR_EMBEDDINGS, cosmosVectorEmbeddings); + } + +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java new file mode 100644 index 000000000000..13b1559810ca --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +import com.azure.cosmos.CosmosItemSerializer; +import com.azure.cosmos.implementation.Constants; +import com.azure.cosmos.implementation.JsonSerializable; + +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + +/** + * Vector Indexes spec for Azure CosmosDB service. + */ +public final class CosmosVectorIndexSpec { + + private JsonSerializable jsonSerializable; + private String type; + + /** + * Constructor + */ + public CosmosVectorIndexSpec() { this.jsonSerializable = new JsonSerializable(); } + + /** + * Gets path. + * + * @return the path. + */ + public String getPath() { + return this.jsonSerializable.getString(Constants.Properties.PATH); + } + + /** + * Sets path. + * + * @param path the path. + * @return the SpatialSpec. + */ + public CosmosVectorIndexSpec setPath(String path) { + this.jsonSerializable.set(Constants.Properties.PATH, path, CosmosItemSerializer.DEFAULT_SERIALIZER); + return this; + } + + /** + * Gets the vector index type for the vector index + * + * @return the vector index type + */ + public String getType() { + if (this.type == null) { + this.type = this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE); + } + return this.type; + } + + /** + * Sets the vector index type for the vector index + * + * @param type the vector index type + * @return the VectorIndexSpec + */ + public CosmosVectorIndexSpec setType(String type) { + checkNotNull(type, "cosmosVectorIndexType cannot be null"); + this.type = type; + this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type, CosmosItemSerializer.DEFAULT_SERIALIZER); + return this; + } + + void populatePropertyBag() { + this.jsonSerializable.populatePropertyBag(); + } + + JsonSerializable getJsonSerializable() { + return this.jsonSerializable; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java new file mode 100644 index 000000000000..679ea1f991c0 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.models; + +/** + * Defines the index type of vector index specification in the Azure Cosmos DB service. + */ +public enum CosmosVectorIndexType { + /** + * Represents a flat vector index type. + */ + FLAT("flat"), + + /** + * Represents a quantized flat vector index type. + */ + QUANTIZED_FLAT("quantizedFlat"), + + /** + * Represents a disk ANN vector index type. + */ + DISK_ANN("diskANN"); + + + private final String overWireValue; + + CosmosVectorIndexType(String overWireValue) { + this.overWireValue = overWireValue; + } + + @Override + public String toString() { + return this.overWireValue; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index 4ee5153877f8..678cea56fcc4 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -20,13 +20,12 @@ */ public final class IndexingPolicy { private static final String DEFAULT_PATH = "/*"; - + private final JsonSerializable jsonSerializable; private List includedPaths; private List excludedPaths; private List> compositeIndexes; private List spatialIndexes; - - private JsonSerializable jsonSerializable; + private List vectorIndexes; /** * Constructor. @@ -54,7 +53,7 @@ public IndexingPolicy() { * * * @param defaultIndexOverrides comma separated set of indexes that serve as default index specifications for the - * root path. + * root path. * @throws IllegalArgumentException throws when defaultIndexOverrides is null */ IndexingPolicy(Index[] defaultIndexOverrides) { @@ -235,7 +234,7 @@ public IndexingPolicy setCompositeIndexes(List> compositeInd } /** - * Sets the spatial indexes for additional indexes. + * Gets the spatial indexes for additional indexes. * * @return the spatial indexes. */ @@ -266,11 +265,55 @@ public IndexingPolicy setSpatialIndexes(List spatialIndexes) { return this; } + /** + * Gets the vector indexes. + * + * @return the vector indexes + */ + public List getVectorIndexes() { + if (this.vectorIndexes == null) { + this.vectorIndexes = this.jsonSerializable.getList(Constants.Properties.VECTOR_INDEXES, CosmosVectorIndexSpec.class); + + if (this.vectorIndexes == null) { + this.vectorIndexes = new ArrayList(); + } + } + + return this.vectorIndexes; + } + + /** + * Sets the vector indexes. + * + * Example of the vectorIndexes: + * "vectorIndexes": [ + * { + * "path": "/vector1", + * "type": "diskANN" + * }, + * { + * "path": "/vector1", + * "type": "flat" + * }, + * { + * "path": "/vector2", + * "type": "quantizedFlat" + * }] + * + * @param vectorIndexes the vector indexes + * @return the Indexing Policy. + */ + public IndexingPolicy setVectorIndexes(List vectorIndexes) { + this.vectorIndexes = vectorIndexes; + this.jsonSerializable.set(Constants.Properties.VECTOR_INDEXES,this.vectorIndexes, CosmosItemSerializer.DEFAULT_SERIALIZER); + return this; + } + void populatePropertyBag() { this.jsonSerializable.populatePropertyBag(); // If indexing mode is not 'none' and not paths are set, set them to the defaults if (this.getIndexingMode() != IndexingMode.NONE && this.getIncludedPaths().size() == 0 - && this.getExcludedPaths().size() == 0) { + && this.getExcludedPaths().size() == 0) { IncludedPath includedPath = new IncludedPath(IndexingPolicy.DEFAULT_PATH); this.getIncludedPaths().add(includedPath); } @@ -296,5 +339,7 @@ void populatePropertyBag() { } } - JsonSerializable getJsonSerializable() { return this.jsonSerializable; } + JsonSerializable getJsonSerializable() { + return this.jsonSerializable; + } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java index a8f344ce4e2d..4931c9b3b1b0 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java @@ -435,6 +435,8 @@ public static void populatePropertyBag(T t) { ((PartitionKeyDefinition) t).populatePropertyBag(); } else if (t instanceof SpatialSpec) { ((SpatialSpec) t).populatePropertyBag(); + } else if (t instanceof CosmosVectorIndexSpec) { + ((CosmosVectorIndexSpec) t).populatePropertyBag(); } else if (t instanceof SqlParameter) { ((SqlParameter) t).populatePropertyBag(); } else if (t instanceof SqlQuerySpec) { @@ -468,6 +470,8 @@ public static JsonSerializable getJsonSerializable(T t) { return ((PartitionKeyDefinition) t).getJsonSerializable(); } else if (t instanceof SpatialSpec) { return ((SpatialSpec) t).getJsonSerializable(); + } else if (t instanceof CosmosVectorIndexSpec) { + return ((CosmosVectorIndexSpec) t).getJsonSerializable(); } else if (t instanceof SqlParameter) { return ((SqlParameter) t).getJsonSerializable(); } else if (t instanceof SqlQuerySpec) { From 148cba58e621f90e796f17fd7b9a07dbe8f2da00 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Wed, 8 May 2024 14:45:19 -0700 Subject: [PATCH 19/28] [Cosmos][VectorSearch] Non Streaming Order By Query (#40085) * Increment versions for core releases (#40003) Increment package versions for core releases * Ensure ServiceBus session idle timeout fall back to retry-options::try-timeout (#39994) * Added Alpha3 Java Media Streaming Events (#40002) * Added Alpha3 Java Media Streaming Events * updating readme to add the media streaming events to remove model --------- Co-authored-by: Vinothini Dharmaraj * Update version of github-event-processor to 1.0.0-dev.20240502.2 (#40012) Co-authored-by: James Suplizio * Prepare May 2024 Identity Release (#40006) * Prepare Identity Broker May 2024 Release (#40014) * Increment package versions for identity releases (#40015) * [JobRouter] SDK Review updates (#40011) * SDK Review updates * Update auto-generated models * Add customization * Fix customization * Update package * Update tests * Linting * FixFaultInjectionRuleFailedToApplyPerPartitionInGatewayMode (#40005) * fix fault injection rule failed to apply per partition in gateway mode --------- Co-authored-by: annie-mac * azure-cosmos-test_1.0.0.beta.7Release (#40021) * release azure-cosmos-test 1.0.0.beta.7 --------- Co-authored-by: annie-mac --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: Anu Thomas Chandy Co-authored-by: v-durgeshs <146056835+v-durgeshs@users.noreply.github.com> Co-authored-by: Vinothini Dharmaraj Co-authored-by: James Suplizio Co-authored-by: Bill Wert Co-authored-by: williamzhao87 Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac --- .github/workflows/event-processor.yml | 4 +- .../workflows/scheduled-event-processor.yml | 2 +- common/perf-test-core/pom.xml | 8 +- common/smoke-tests/pom.xml | 12 +- eng/versioning/version_client.txt | 35 ++-- .../azure-resourcemanager-advisor/pom.xml | 8 +- .../azure-resourcemanager-agrifood/pom.xml | 8 +- .../README.md | 2 +- .../azure-verticals-agrifood-farming/pom.xml | 12 +- .../pom.xml | 4 +- .../azure-ai-anomalydetector/README.md | 2 +- .../azure-ai-anomalydetector/pom.xml | 8 +- sdk/aot/azure-aot-graalvm-samples/pom.xml | 2 +- .../azure-resourcemanager-apicenter/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-data-appconfiguration-perf/pom.xml | 6 +- .../azure-data-appconfiguration/pom.xml | 14 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- sdk/astro/azure-resourcemanager-astro/pom.xml | 8 +- .../azure-resourcemanager-attestation/pom.xml | 8 +- .../azure-security-attestation/pom.xml | 14 +- .../azure-resourcemanager-automanage/pom.xml | 4 +- .../azure-resourcemanager-automation/pom.xml | 4 +- sdk/avs/azure-resourcemanager-avs/pom.xml | 8 +- .../pom.xml | 4 +- .../pom.xml | 8 +- .../azure-resourcemanager-azurestack/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- sdk/batch/azure-resourcemanager-batch/pom.xml | 8 +- sdk/batch/microsoft-azure-batch/pom.xml | 2 +- .../azure-resourcemanager-batchai/pom.xml | 4 +- .../azure-resourcemanager-billing/pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-botservice/pom.xml | 4 +- .../pom.xml | 8 +- sdk/chaos/azure-resourcemanager-chaos/pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-commerce/pom.xml | 8 +- .../pom.xml | 14 +- .../CallAutomationEventParser.java | 9 ++ .../models/MediaStreamingFailed.java | 108 +++++++++++++ .../models/MediaStreamingStarted.java | 108 +++++++++++++ .../models/MediaStreamingStatus.java | 40 +++++ .../models/MediaStreamingStatusDetails.java | 78 +++++++++ .../models/MediaStreamingStopped.java | 108 +++++++++++++ .../models/MediaStreamingUpdate.java | 91 +++++++++++ .../models/events/MediaStreamingFailed.java | 52 ++++++ .../models/events/MediaStreamingStarted.java | 53 +++++++ .../models/events/MediaStreamingStatus.java | 39 +++++ .../events/MediaStreamingStatusDetails.java | 77 +++++++++ .../models/events/MediaStreamingStopped.java | 52 ++++++ .../models/events/MediaStreamingUpdate.java | 90 +++++++++++ ...ationEventParserAndProcessorUnitTests.java | 102 ++++++++++++ .../swagger/README.md | 5 +- .../azure-communication-callingserver/pom.xml | 12 +- .../azure-communication-chat/pom.xml | 12 +- .../azure-communication-common-perf/pom.xml | 6 +- .../azure-communication-common/pom.xml | 4 +- .../azure-communication-email/pom.xml | 14 +- .../azure-communication-identity/pom.xml | 14 +- .../azure-communication-jobrouter/assets.json | 2 +- .../main/java/JobRouterSdkCustomization.java | 8 + .../azure-communication-jobrouter/pom.xml | 12 +- .../converters/RouterRuleAdapter.java | 8 +- .../jobrouter/models/BestWorkerMode.java | 10 +- .../models/CancelExceptionAction.java | 10 +- .../ConditionalQueueSelectorAttachment.java | 9 +- .../ConditionalWorkerSelectorAttachment.java | 9 +- .../jobrouter/models/DirectMapRouterRule.java | 10 +- .../jobrouter/models/DistributionMode.java | 6 +- .../jobrouter/models/ExceptionAction.java | 8 +- .../jobrouter/models/ExceptionTrigger.java | 8 +- .../models/ExpressionRouterRule.java | 9 +- .../jobrouter/models/FunctionRouterRule.java | 9 +- .../jobrouter/models/LongestIdleMode.java | 10 +- .../ManualReclassifyExceptionAction.java | 10 +- .../PassThroughQueueSelectorAttachment.java | 9 +- .../PassThroughWorkerSelectorAttachment.java | 9 +- .../models/QueueLengthExceptionTrigger.java | 9 +- .../models/QueueSelectorAttachment.java | 8 +- .../models/ReclassifyExceptionAction.java | 10 +- .../jobrouter/models/RoundRobinMode.java | 10 +- .../jobrouter/models/RouterRule.java | 8 +- .../RuleEngineQueueSelectorAttachment.java | 9 +- .../RuleEngineWorkerSelectorAttachment.java | 9 +- .../jobrouter/models/ScoringRuleOptions.java | 8 +- .../models/StaticQueueSelectorAttachment.java | 9 +- .../jobrouter/models/StaticRouterRule.java | 10 +- .../StaticWorkerSelectorAttachment.java | 9 +- .../models/WaitTimeExceptionTrigger.java | 9 +- .../jobrouter/models/WebhookRouterRule.java | 46 +++--- ...htedAllocationQueueSelectorAttachment.java | 9 +- ...tedAllocationWorkerSelectorAttachment.java | 9 +- .../models/WorkerSelectorAttachment.java | 8 +- .../azure-communication-messages/pom.xml | 14 +- .../azure-communication-phonenumbers/pom.xml | 12 +- .../azure-communication-rooms/pom.xml | 14 +- .../azure-communication-sms/pom.xml | 12 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../README.md | 2 +- .../azure-security-confidentialledger/pom.xml | 10 +- .../azure-resourcemanager-confluent/pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-consumption/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 14 +- .../pom.xml | 8 +- .../azure-ai-contentsafety/pom.xml | 8 +- sdk/core/azure-core-amqp-experimental/pom.xml | 2 +- sdk/core/azure-core-amqp/CHANGELOG.md | 10 ++ sdk/core/azure-core-amqp/pom.xml | 6 +- sdk/core/azure-core-experimental/CHANGELOG.md | 10 ++ sdk/core/azure-core-experimental/pom.xml | 4 +- .../CHANGELOG.md | 10 ++ .../azure-core-http-jdk-httpclient/pom.xml | 10 +- sdk/core/azure-core-http-netty/CHANGELOG.md | 10 ++ sdk/core/azure-core-http-netty/pom.xml | 10 +- sdk/core/azure-core-http-okhttp/CHANGELOG.md | 10 ++ sdk/core/azure-core-http-okhttp/pom.xml | 10 +- sdk/core/azure-core-http-vertx/CHANGELOG.md | 10 ++ sdk/core/azure-core-http-vertx/pom.xml | 10 +- sdk/core/azure-core-management/CHANGELOG.md | 10 ++ sdk/core/azure-core-management/pom.xml | 6 +- .../CHANGELOG.md | 10 ++ .../azure-core-metrics-opentelemetry/pom.xml | 8 +- sdk/core/azure-core-perf/pom.xml | 6 +- .../CHANGELOG.md | 10 ++ .../azure-core-serializer-avro-apache/pom.xml | 6 +- .../pom.xml | 4 +- .../CHANGELOG.md | 10 ++ .../azure-core-serializer-json-gson/pom.xml | 4 +- .../CHANGELOG.md | 10 ++ .../pom.xml | 4 +- sdk/core/azure-core-test/CHANGELOG.md | 10 ++ sdk/core/azure-core-test/pom.xml | 4 +- .../pom.xml | 6 +- .../CHANGELOG.md | 10 ++ .../azure-core-tracing-opentelemetry/pom.xml | 10 +- sdk/core/azure-core-version-tests/pom.xml | 6 +- sdk/core/azure-core/CHANGELOG.md | 10 ++ sdk/core/azure-core/pom.xml | 2 +- sdk/cosmos/azure-cosmos-benchmark/pom.xml | 2 +- sdk/cosmos/azure-cosmos-encryption/pom.xml | 2 +- .../doc/configuration-reference.md | 116 +++++++------- sdk/cosmos/azure-cosmos-kafka-connect/pom.xml | 2 +- .../source/CosmosSourceConfig.java | 5 +- sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml | 4 +- sdk/cosmos/azure-cosmos-test/CHANGELOG.md | 9 +- sdk/cosmos/azure-cosmos-test/README.md | 2 +- sdk/cosmos/azure-cosmos-test/pom.xml | 2 +- sdk/cosmos/azure-cosmos-tests/pom.xml | 2 +- ...njectionServerErrorRuleOnGatewayTests.java | 150 ++++++++++-------- sdk/cosmos/azure-cosmos/pom.xml | 4 +- .../implementation/GlobalEndpointManager.java | 2 +- .../implementation/RxGatewayStoreModel.java | 2 +- .../GatewayServerErrorInjector.java | 92 ++++++++++- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 4 +- .../azure-resourcemanager-dashboard/pom.xml | 8 +- .../azure-resourcemanager-databox/pom.xml | 8 +- .../azure-resourcemanager-databoxedge/pom.xml | 8 +- .../azure-resourcemanager-databricks/pom.xml | 8 +- .../azure-resourcemanager-datadog/pom.xml | 8 +- .../azure-resourcemanager-datafactory/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-developer-devcenter/pom.xml | 8 +- .../azure-resourcemanager-devcenter/pom.xml | 8 +- .../azure-resourcemanager-devhub/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-iot-deviceupdate/pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-devspaces/pom.xml | 8 +- .../azure-resourcemanager-devtestlabs/pom.xml | 8 +- .../azure-digitaltwins-core/pom.xml | 16 +- .../pom.xml | 8 +- .../azure-resourcemanager-dnsresolver/pom.xml | 8 +- .../azure-ai-documentintelligence/README.md | 2 +- .../azure-ai-documentintelligence/pom.xml | 14 +- .../azure-resourcemanager-dynatrace/pom.xml | 8 +- sdk/e2e/pom.xml | 6 +- .../azure-analytics-defender-easm/pom.xml | 8 +- .../azure-resourcemanager-edgeorder/pom.xml | 4 +- .../azure-resourcemanager-edgezones/pom.xml | 8 +- .../azure-resourcemanager-education/pom.xml | 8 +- .../azure-resourcemanager-elastic/pom.xml | 8 +- .../azure-resourcemanager-elasticsan/pom.xml | 8 +- .../pom.xml | 4 +- .../pom.xml | 8 +- .../azure-messaging-eventgrid/pom.xml | 10 +- .../azure-resourcemanager-eventgrid/pom.xml | 8 +- .../pom.xml | 4 +- .../pom.xml | 2 +- .../azure-messaging-eventhubs-stress/pom.xml | 4 +- .../pom.xml | 2 +- .../azure-messaging-eventhubs/README.md | 2 +- .../azure-messaging-eventhubs/pom.xml | 12 +- .../pom.xml | 4 +- .../azure-resourcemanager-fluidrelay/pom.xml | 8 +- .../azure-ai-formrecognizer-perf/pom.xml | 6 +- .../azure-ai-formrecognizer/README.md | 2 +- .../azure-ai-formrecognizer/pom.xml | 14 +- .../azure-resourcemanager-frontdoor/pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-hanaonazure/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-hdinsight/pom.xml | 8 +- .../azure-resourcemanager-healthbot/pom.xml | 4 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 10 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-identity-broker/CHANGELOG.md | 8 + sdk/identity/azure-identity-broker/README.md | 2 +- .../azure-identity-extensions/pom.xml | 2 +- sdk/identity/azure-identity-perf/pom.xml | 4 +- sdk/identity/azure-identity/CHANGELOG.md | 8 + sdk/identity/azure-identity/README.md | 2 +- sdk/identity/azure-identity/pom.xml | 6 +- .../pom.xml | 8 +- .../azure-resourcemanager-iotcentral/pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-iothub/pom.xml | 8 +- .../pom.xml | 14 +- .../pom.xml | 14 +- .../azure-security-keyvault-jca/pom.xml | 2 +- .../azure-security-keyvault-keys/pom.xml | 14 +- .../azure-security-keyvault-perf/pom.xml | 10 +- .../azure-security-keyvault-secrets/pom.xml | 14 +- .../azure-security-test-keyvault-jca/pom.xml | 2 +- .../pom.xml | 8 +- sdk/kusto/azure-resourcemanager-kusto/pom.xml | 8 +- .../azure-resourcemanager-labservices/pom.xml | 4 +- .../pom.xml | 8 +- .../azure-developer-loadtesting/pom.xml | 8 +- .../azure-resourcemanager-loadtesting/pom.xml | 8 +- .../pom.xml | 8 +- .../microsoft-azure-loganalytics/pom.xml | 2 +- sdk/logic/azure-resourcemanager-logic/pom.xml | 8 +- sdk/logz/azure-resourcemanager-logz/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 4 +- .../azure-resourcemanager-maintenance/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- sdk/maps/azure-maps-elevation/pom.xml | 14 +- sdk/maps/azure-maps-geolocation/pom.xml | 14 +- sdk/maps/azure-maps-render/pom.xml | 14 +- sdk/maps/azure-maps-route/pom.xml | 14 +- sdk/maps/azure-maps-search/pom.xml | 14 +- sdk/maps/azure-maps-timezone/pom.xml | 14 +- sdk/maps/azure-maps-traffic/pom.xml | 14 +- sdk/maps/azure-maps-weather/pom.xml | 14 +- sdk/maps/azure-resourcemanager-maps/pom.xml | 8 +- .../azure-resourcemanager-mariadb/pom.xml | 8 +- .../pom.xml | 4 +- .../pom.xml | 8 +- .../azure-ai-metricsadvisor-perf/pom.xml | 4 +- .../azure-ai-metricsadvisor/README.md | 2 +- .../azure-ai-metricsadvisor/pom.xml | 14 +- .../pom.xml | 8 +- .../azure-mixedreality-authentication/pom.xml | 14 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-iot-modelsrepository/pom.xml | 14 +- .../azure-monitor-ingestion-perf/pom.xml | 6 +- sdk/monitor/azure-monitor-ingestion/README.md | 2 +- sdk/monitor/azure-monitor-ingestion/pom.xml | 8 +- .../pom.xml | 10 +- sdk/monitor/azure-monitor-query-perf/pom.xml | 6 +- sdk/monitor/azure-monitor-query/README.md | 2 +- sdk/monitor/azure-monitor-query/pom.xml | 10 +- sdk/mysql/azure-resourcemanager-mysql/pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-netapp/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- sdk/nginx/azure-resourcemanager-nginx/pom.xml | 8 +- .../pom.xml | 8 +- sdk/oep/azure-resourcemanager-oep/pom.xml | 4 +- sdk/openai/azure-ai-openai-assistants/pom.xml | 14 +- sdk/openai/azure-ai-openai/README.md | 2 +- sdk/openai/azure-ai-openai/pom.xml | 14 +- .../pom.xml | 8 +- .../azure-resourcemanager-orbital/pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-peering/pom.xml | 8 +- .../azure-ai-personalizer/pom.xml | 14 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-postgresql/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-providerhub/pom.xml | 8 +- .../README.md | 2 +- .../pom.xml | 8 +- .../azure-analytics-purview-catalog/README.md | 2 +- .../azure-analytics-purview-catalog/pom.xml | 8 +- .../azure-analytics-purview-datamap/pom.xml | 8 +- .../README.md | 2 +- .../azure-analytics-purview-scanning/pom.xml | 8 +- .../azure-analytics-purview-sharing/pom.xml | 8 +- .../README.md | 2 +- .../azure-analytics-purview-workflow/pom.xml | 8 +- .../azure-resourcemanager-purview/pom.xml | 8 +- sdk/quantum/azure-quantum-jobs/pom.xml | 8 +- .../azure-resourcemanager-quantum/pom.xml | 8 +- .../azure-resourcemanager-qumulo/pom.xml | 8 +- sdk/quota/azure-resourcemanager-quota/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- sdk/relay/azure-resourcemanager-relay/pom.xml | 4 +- .../pom.xml | 14 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-appplatform/pom.xml | 2 +- .../azure-resourcemanager-appservice/pom.xml | 2 +- .../pom.xml | 2 +- .../azure-resourcemanager-cdn/pom.xml | 2 +- .../azure-resourcemanager-compute/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../azure-resourcemanager-cosmos/pom.xml | 2 +- .../azure-resourcemanager-dns/pom.xml | 2 +- .../azure-resourcemanager-eventhubs/pom.xml | 2 +- .../azure-resourcemanager-keyvault/pom.xml | 2 +- .../azure-resourcemanager-monitor/pom.xml | 2 +- .../azure-resourcemanager-msi/pom.xml | 2 +- .../azure-resourcemanager-network/pom.xml | 2 +- .../azure-resourcemanager-perf/pom.xml | 4 +- .../azure-resourcemanager-privatedns/pom.xml | 2 +- .../azure-resourcemanager-redis/pom.xml | 2 +- .../azure-resourcemanager-resources/pom.xml | 6 +- .../azure-resourcemanager-samples/pom.xml | 6 +- .../azure-resourcemanager-search/pom.xml | 2 +- .../azure-resourcemanager-servicebus/pom.xml | 2 +- .../azure-resourcemanager-sql/pom.xml | 2 +- .../azure-resourcemanager-storage/pom.xml | 2 +- .../azure-resourcemanager-test/pom.xml | 10 +- .../pom.xml | 2 +- .../azure-resourcemanager/pom.xml | 12 +- sdk/resourcemanagerhybrid/README.md | 2 +- .../azure-resourcemanager-appservice/pom.xml | 2 +- .../pom.xml | 2 +- .../azure-resourcemanager-compute/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../azure-resourcemanager-dns/pom.xml | 2 +- .../azure-resourcemanager-eventhubs/pom.xml | 2 +- .../azure-resourcemanager-keyvault/pom.xml | 2 +- .../azure-resourcemanager-monitor/pom.xml | 2 +- .../azure-resourcemanager-network/pom.xml | 2 +- .../azure-resourcemanager-resources/pom.xml | 6 +- .../azure-resourcemanager-storage/pom.xml | 2 +- .../azure-resourcemanager-test/pom.xml | 12 +- .../azure-resourcemanager/pom.xml | 8 +- .../pom.xml | 8 +- .../README.md | 2 +- .../pom.xml | 6 +- .../README.md | 2 +- .../pom.xml | 6 +- .../azure-data-schemaregistry/README.md | 2 +- .../azure-data-schemaregistry/pom.xml | 8 +- sdk/scvmm/azure-resourcemanager-scvmm/pom.xml | 4 +- sdk/search/azure-search-documents/pom.xml | 10 +- sdk/search/azure-search-perf/pom.xml | 4 +- .../azure-resourcemanager-security/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 4 +- .../azure-resourcemanager-selfhelp/pom.xml | 8 +- .../azure-messaging-servicebus-stress/pom.xml | 4 +- .../pom.xml | 4 +- .../azure-messaging-servicebus/CHANGELOG.md | 1 + .../azure-messaging-servicebus/README.md | 2 +- .../azure-messaging-servicebus/pom.xml | 20 +-- .../servicebus/SessionsMessagePump.java | 2 +- .../servicebus/IntegrationTestBase.java | 6 + .../pom.xml | 8 +- .../pom.xml | 6 +- .../pom.xml | 8 +- .../azure-resourcemanager-signalr/pom.xml | 8 +- .../azure-resourcemanager-sphere/pom.xml | 8 +- .../pom.xml | 2 +- .../spring-cloud-azure-actuator/pom.xml | 2 +- .../pom.xml | 4 +- .../spring-cloud-azure-autoconfigure/pom.xml | 4 +- sdk/spring/spring-cloud-azure-core/pom.xml | 8 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 4 +- .../spring-cloud-azure-trace-sleuth/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-messaging-azure-servicebus/pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-standbypool/pom.xml | 8 +- sdk/storage/azure-storage-blob-batch/pom.xml | 14 +- .../azure-storage-blob-changefeed/pom.xml | 14 +- .../azure-storage-blob-cryptography/pom.xml | 14 +- sdk/storage/azure-storage-blob-nio/pom.xml | 12 +- sdk/storage/azure-storage-blob-stress/pom.xml | 6 +- sdk/storage/azure-storage-blob/pom.xml | 14 +- sdk/storage/azure-storage-common/pom.xml | 14 +- .../pom.xml | 6 +- .../azure-storage-file-datalake/pom.xml | 14 +- .../azure-storage-file-share-stress/pom.xml | 6 +- sdk/storage/azure-storage-file-share/pom.xml | 14 +- .../azure-storage-internal-avro/pom.xml | 4 +- sdk/storage/azure-storage-perf/pom.xml | 6 +- sdk/storage/azure-storage-queue/pom.xml | 14 +- sdk/storage/azure-storage-stress/pom.xml | 6 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-storagepool/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-resourcemanager-support/pom.xml | 8 +- .../pom.xml | 14 +- .../azure-analytics-synapse-artifacts/pom.xml | 14 +- .../pom.xml | 14 +- .../pom.xml | 14 +- .../azure-analytics-synapse-spark/pom.xml | 14 +- .../azure-resourcemanager-synapse/pom.xml | 8 +- sdk/tables/azure-data-tables-perf/pom.xml | 6 +- sdk/tables/azure-data-tables/pom.xml | 8 +- sdk/template/azure-sdk-template-three/pom.xml | 2 +- sdk/template/azure-sdk-template-two/pom.xml | 2 +- sdk/template/azure-sdk-template/pom.xml | 2 +- sdk/template/azure-template-perf/pom.xml | 2 +- sdk/template/azure-template-stress/pom.xml | 10 +- .../azure-ai-textanalytics-perf/pom.xml | 6 +- .../azure-ai-textanalytics/README.md | 2 +- .../azure-ai-textanalytics/pom.xml | 14 +- .../pom.xml | 8 +- sdk/tools/azure-sdk-build-tool/pom.xml | 4 +- .../azure-ai-documenttranslator/pom.xml | 12 +- .../azure-ai-translation-text/pom.xml | 12 +- .../azure-media-videoanalyzer-edge/pom.xml | 4 +- .../pom.xml | 4 +- .../azure-ai-vision-imageanalysis/pom.xml | 8 +- .../pom.xml | 8 +- .../pom.xml | 8 +- .../azure-messaging-webpubsub-client/pom.xml | 6 +- .../azure-messaging-webpubsub/pom.xml | 8 +- .../azure-resourcemanager-webpubsub/pom.xml | 8 +- .../azure-resourcemanager-workloads/pom.xml | 8 +- .../pom.xml | 4 +- 478 files changed, 3092 insertions(+), 1676 deletions(-) create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingFailed.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStarted.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStatus.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStatusDetails.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStopped.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingUpdate.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingFailed.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStarted.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStatus.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStatusDetails.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStopped.java create mode 100644 sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingUpdate.java diff --git a/.github/workflows/event-processor.yml b/.github/workflows/event-processor.yml index 615c51b0f82e..8f448d1d7793 100644 --- a/.github/workflows/event-processor.yml +++ b/.github/workflows/event-processor.yml @@ -58,7 +58,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240311.2 + --version 1.0.0-dev.20240502.2 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash @@ -114,7 +114,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240311.2 + --version 1.0.0-dev.20240502.2 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash diff --git a/.github/workflows/scheduled-event-processor.yml b/.github/workflows/scheduled-event-processor.yml index 120531ac3d5b..09d530acfe98 100644 --- a/.github/workflows/scheduled-event-processor.yml +++ b/.github/workflows/scheduled-event-processor.yml @@ -39,7 +39,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240311.2 + --version 1.0.0-dev.20240502.2 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash diff --git a/common/perf-test-core/pom.xml b/common/perf-test-core/pom.xml index 8b7c9183d965..4ea0c0b19b47 100644 --- a/common/perf-test-core/pom.xml +++ b/common/perf-test-core/pom.xml @@ -82,22 +82,22 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 io.vertx diff --git a/common/smoke-tests/pom.xml b/common/smoke-tests/pom.xml index 350efff330ce..d8303d2dd9b2 100644 --- a/common/smoke-tests/pom.xml +++ b/common/smoke-tests/pom.xml @@ -88,31 +88,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 com.azure azure-core-amqp - 2.9.3 + 2.9.4 @@ -124,7 +124,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 7cef931ae6c8..bc256bc3f118 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -81,23 +81,23 @@ com.azure:azure-communication-rooms;1.1.1;1.2.0-beta.1 com.azure:azure-communication-sms;1.1.23;1.2.0-beta.1 com.azure:azure-containers-containerregistry;1.2.7;1.3.0-beta.1 com.azure:azure-containers-containerregistry-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core;1.48.0;1.49.0 -com.azure:azure-core-amqp;2.9.3;2.9.4 +com.azure:azure-core;1.49.0;1.50.0-beta.1 +com.azure:azure-core-amqp;2.9.4;2.10.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-experimental;1.0.0-beta.49;1.0.0-beta.50 -com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.12;1.0.0-beta.13 -com.azure:azure-core-http-netty;1.14.2;1.15.0 -com.azure:azure-core-http-okhttp;1.11.20;1.11.21 -com.azure:azure-core-http-vertx;1.0.0-beta.17;1.0.0-beta.18 -com.azure:azure-core-management;1.13.0;1.14.0 -com.azure:azure-core-metrics-opentelemetry;1.0.0-beta.18;1.0.0-beta.19 +com.azure:azure-core-experimental;1.0.0-beta.50;1.0.0-beta.51 +com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.13;1.0.0-beta.14 +com.azure:azure-core-http-netty;1.15.0;1.16.0-beta.1 +com.azure:azure-core-http-okhttp;1.11.21;1.12.0-beta.1 +com.azure:azure-core-http-vertx;1.0.0-beta.18;1.0.0-beta.19 +com.azure:azure-core-management;1.14.0;1.15.0-beta.1 +com.azure:azure-core-metrics-opentelemetry;1.0.0-beta.19;1.0.0-beta.20 com.azure:azure-core-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-serializer-avro-apache;1.0.0-beta.45;1.0.0-beta.46 +com.azure:azure-core-serializer-avro-apache;1.0.0-beta.46;1.0.0-beta.47 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-core-serializer-json-gson;1.2.11;1.2.12 -com.azure:azure-core-serializer-json-jackson;1.4.11;1.4.12 -com.azure:azure-core-test;1.24.2;1.25.0 -com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.45;1.0.0-beta.46 +com.azure:azure-core-serializer-json-gson;1.2.12;1.3.0-beta.1 +com.azure:azure-core-serializer-json-jackson;1.4.12;1.5.0-beta.1 +com.azure:azure-core-test;1.25.0;1.26.0-beta.1 +com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.46;1.0.0-beta.47 com.azure:azure-core-tracing-opentelemetry-samples;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-version-tests;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-cosmos;4.59.0;4.60.0-beta.1 @@ -127,9 +127,9 @@ com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-health-insights-clinicalmatching;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-health-insights-cancerprofiling;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-health-insights-radiologyinsights;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-identity;1.12.0;1.13.0-beta.1 +com.azure:azure-identity;1.12.1;1.13.0-beta.1 com.azure:azure-identity-extensions;1.1.15;1.2.0-beta.2 -com.azure:azure-identity-broker;1.1.0;1.2.0-beta.1 +com.azure:azure-identity-broker;1.1.1;1.2.0-beta.1 com.azure:azure-identity-broker-samples;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-iot-deviceupdate;1.0.17;1.1.0-beta.1 @@ -469,9 +469,6 @@ com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 # In the pom, the version update tag after the version should name the unreleased package and the dependency version: # -unreleased_com.azure:azure-core-amqp;2.9.4 -unreleased_com.azure:azure-core-test;1.25.0 - # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid # for dependency versions. These entries are specifically for when we've released a beta for diff --git a/sdk/advisor/azure-resourcemanager-advisor/pom.xml b/sdk/advisor/azure-resourcemanager-advisor/pom.xml index d785f2cadcf2..3f49cd7912ac 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/pom.xml +++ b/sdk/advisor/azure-resourcemanager-advisor/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/agrifood/azure-resourcemanager-agrifood/pom.xml b/sdk/agrifood/azure-resourcemanager-agrifood/pom.xml index 4da2313f7132..58ad6195afda 100644 --- a/sdk/agrifood/azure-resourcemanager-agrifood/pom.xml +++ b/sdk/agrifood/azure-resourcemanager-agrifood/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/agrifood/azure-verticals-agrifood-farming/README.md b/sdk/agrifood/azure-verticals-agrifood-farming/README.md index f4bb0853dab3..d8d1efe2230c 100644 --- a/sdk/agrifood/azure-verticals-agrifood-farming/README.md +++ b/sdk/agrifood/azure-verticals-agrifood-farming/README.md @@ -47,7 +47,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` diff --git a/sdk/agrifood/azure-verticals-agrifood-farming/pom.xml b/sdk/agrifood/azure-verticals-agrifood-farming/pom.xml index 1c15857fb2c4..2380e6c807a5 100644 --- a/sdk/agrifood/azure-verticals-agrifood-farming/pom.xml +++ b/sdk/agrifood/azure-verticals-agrifood-farming/pom.xml @@ -43,17 +43,17 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-experimental - 1.0.0-beta.49 + 1.0.0-beta.50 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -78,13 +78,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -102,7 +102,7 @@ com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/alertsmanagement/azure-resourcemanager-alertsmanagement/pom.xml b/sdk/alertsmanagement/azure-resourcemanager-alertsmanagement/pom.xml index 7cf16d9c4bf8..03eba29e7389 100644 --- a/sdk/alertsmanagement/azure-resourcemanager-alertsmanagement/pom.xml +++ b/sdk/alertsmanagement/azure-resourcemanager-alertsmanagement/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/README.md b/sdk/anomalydetector/azure-ai-anomalydetector/README.md index a3cfe120f28d..ce8a01363436 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/README.md +++ b/sdk/anomalydetector/azure-ai-anomalydetector/README.md @@ -54,7 +54,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/pom.xml b/sdk/anomalydetector/azure-ai-anomalydetector/pom.xml index d29c9b4e9f8d..f502c66f4eac 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/pom.xml +++ b/sdk/anomalydetector/azure-ai-anomalydetector/pom.xml @@ -45,12 +45,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -75,13 +75,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/aot/azure-aot-graalvm-samples/pom.xml b/sdk/aot/azure-aot-graalvm-samples/pom.xml index e3d21b48bff2..a2fb966605e4 100644 --- a/sdk/aot/azure-aot-graalvm-samples/pom.xml +++ b/sdk/aot/azure-aot-graalvm-samples/pom.xml @@ -66,7 +66,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 com.azure diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml b/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml index 8e76961c4592..26b29c6f3e3e 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml +++ b/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/apimanagement/azure-resourcemanager-apimanagement/pom.xml b/sdk/apimanagement/azure-resourcemanager-apimanagement/pom.xml index 532fc2afb94b..ef492c6d15c3 100644 --- a/sdk/apimanagement/azure-resourcemanager-apimanagement/pom.xml +++ b/sdk/apimanagement/azure-resourcemanager-apimanagement/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/appcomplianceautomation/azure-resourcemanager-appcomplianceautomation/pom.xml b/sdk/appcomplianceautomation/azure-resourcemanager-appcomplianceautomation/pom.xml index f3034c9f650f..5c162a6ee8f6 100644 --- a/sdk/appcomplianceautomation/azure-resourcemanager-appcomplianceautomation/pom.xml +++ b/sdk/appcomplianceautomation/azure-resourcemanager-appcomplianceautomation/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/appconfiguration/azure-data-appconfiguration-perf/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration-perf/pom.xml index e88095e82032..ffee58abad69 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration-perf/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration-perf/pom.xml @@ -38,12 +38,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -97,7 +97,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml index f0444709d65a..99f0286fb4a0 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml @@ -51,7 +51,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -61,25 +61,25 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -115,7 +115,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -130,7 +130,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/pom.xml b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/pom.xml index 2149739bd7a1..5d3a96e9709b 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/appcontainers/azure-resourcemanager-appcontainers/pom.xml b/sdk/appcontainers/azure-resourcemanager-appcontainers/pom.xml index f1f9bd039df0..06f2996e3bf5 100644 --- a/sdk/appcontainers/azure-resourcemanager-appcontainers/pom.xml +++ b/sdk/appcontainers/azure-resourcemanager-appcontainers/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/pom.xml b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/pom.xml index b75803d31f0d..3e979aa60ffc 100644 --- a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/pom.xml +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/astro/azure-resourcemanager-astro/pom.xml b/sdk/astro/azure-resourcemanager-astro/pom.xml index 023395aef513..530459379db5 100644 --- a/sdk/astro/azure-resourcemanager-astro/pom.xml +++ b/sdk/astro/azure-resourcemanager-astro/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/attestation/azure-resourcemanager-attestation/pom.xml b/sdk/attestation/azure-resourcemanager-attestation/pom.xml index a8058c54526c..6e80cee07a28 100644 --- a/sdk/attestation/azure-resourcemanager-attestation/pom.xml +++ b/sdk/attestation/azure-resourcemanager-attestation/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/attestation/azure-security-attestation/pom.xml b/sdk/attestation/azure-security-attestation/pom.xml index d22798b09205..df72c6692616 100644 --- a/sdk/attestation/azure-security-attestation/pom.xml +++ b/sdk/attestation/azure-security-attestation/pom.xml @@ -45,7 +45,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.nimbusds @@ -65,13 +65,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 test @@ -113,19 +113,19 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -176,7 +176,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/automanage/azure-resourcemanager-automanage/pom.xml b/sdk/automanage/azure-resourcemanager-automanage/pom.xml index 86b26375f5d1..c657f12b9fc4 100644 --- a/sdk/automanage/azure-resourcemanager-automanage/pom.xml +++ b/sdk/automanage/azure-resourcemanager-automanage/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/automation/azure-resourcemanager-automation/pom.xml b/sdk/automation/azure-resourcemanager-automation/pom.xml index 8cb4888b2e0c..a02970947ab8 100644 --- a/sdk/automation/azure-resourcemanager-automation/pom.xml +++ b/sdk/automation/azure-resourcemanager-automation/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/avs/azure-resourcemanager-avs/pom.xml b/sdk/avs/azure-resourcemanager-avs/pom.xml index cebadcc90173..e5e8bfc77712 100644 --- a/sdk/avs/azure-resourcemanager-avs/pom.xml +++ b/sdk/avs/azure-resourcemanager-avs/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/azureadexternalidentities/azure-resourcemanager-azureadexternalidentities/pom.xml b/sdk/azureadexternalidentities/azure-resourcemanager-azureadexternalidentities/pom.xml index 6a65d7fa0bbb..a9558cb5a4d3 100644 --- a/sdk/azureadexternalidentities/azure-resourcemanager-azureadexternalidentities/pom.xml +++ b/sdk/azureadexternalidentities/azure-resourcemanager-azureadexternalidentities/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml index 58ebaaa4ae70..54953c5f3885 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/azurestack/azure-resourcemanager-azurestack/pom.xml b/sdk/azurestack/azure-resourcemanager-azurestack/pom.xml index 45b4663f8ab5..95aaa1cf35ec 100644 --- a/sdk/azurestack/azure-resourcemanager-azurestack/pom.xml +++ b/sdk/azurestack/azure-resourcemanager-azurestack/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci/pom.xml b/sdk/azurestackhci/azure-resourcemanager-azurestackhci/pom.xml index 0e44cc40a922..5d1c3579d938 100644 --- a/sdk/azurestackhci/azure-resourcemanager-azurestackhci/pom.xml +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml index f86a52c52dad..a2a91feb2726 100644 --- a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/batch/azure-resourcemanager-batch/pom.xml b/sdk/batch/azure-resourcemanager-batch/pom.xml index 487a7e92a780..a9b8d0b6aae5 100644 --- a/sdk/batch/azure-resourcemanager-batch/pom.xml +++ b/sdk/batch/azure-resourcemanager-batch/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/batch/microsoft-azure-batch/pom.xml b/sdk/batch/microsoft-azure-batch/pom.xml index baaac2e5e4b3..31052dbcd565 100644 --- a/sdk/batch/microsoft-azure-batch/pom.xml +++ b/sdk/batch/microsoft-azure-batch/pom.xml @@ -85,7 +85,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 test diff --git a/sdk/batchai/azure-resourcemanager-batchai/pom.xml b/sdk/batchai/azure-resourcemanager-batchai/pom.xml index c538571a5133..2035872f4e34 100644 --- a/sdk/batchai/azure-resourcemanager-batchai/pom.xml +++ b/sdk/batchai/azure-resourcemanager-batchai/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/billing/azure-resourcemanager-billing/pom.xml b/sdk/billing/azure-resourcemanager-billing/pom.xml index 007972bef8cb..67408a92ec32 100644 --- a/sdk/billing/azure-resourcemanager-billing/pom.xml +++ b/sdk/billing/azure-resourcemanager-billing/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/billingbenefits/azure-resourcemanager-billingbenefits/pom.xml b/sdk/billingbenefits/azure-resourcemanager-billingbenefits/pom.xml index 7706a866723a..771f4180eec1 100644 --- a/sdk/billingbenefits/azure-resourcemanager-billingbenefits/pom.xml +++ b/sdk/billingbenefits/azure-resourcemanager-billingbenefits/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/botservice/azure-resourcemanager-botservice/pom.xml b/sdk/botservice/azure-resourcemanager-botservice/pom.xml index 5f8ff020a749..40a6cbf19b52 100644 --- a/sdk/botservice/azure-resourcemanager-botservice/pom.xml +++ b/sdk/botservice/azure-resourcemanager-botservice/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/pom.xml b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/pom.xml index 80c5e532eaa5..3f6b292e38c4 100644 --- a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/pom.xml +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/pom.xml @@ -45,12 +45,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure.resourcemanager @@ -61,13 +61,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/chaos/azure-resourcemanager-chaos/pom.xml b/sdk/chaos/azure-resourcemanager-chaos/pom.xml index b12880124c84..a924e5895b85 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/pom.xml +++ b/sdk/chaos/azure-resourcemanager-chaos/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/pom.xml b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/pom.xml index 76ac0f6e23a4..40b46a3faee9 100644 --- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/pom.xml +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/commerce/azure-resourcemanager-commerce/pom.xml b/sdk/commerce/azure-resourcemanager-commerce/pom.xml index f968aa560610..3ada1b25ccb8 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/pom.xml +++ b/sdk/commerce/azure-resourcemanager-commerce/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/communication/azure-communication-callautomation/pom.xml b/sdk/communication/azure-communication-callautomation/pom.xml index f6b4e4f27fba..32b5e27eb7b8 100644 --- a/sdk/communication/azure-communication-callautomation/pom.xml +++ b/sdk/communication/azure-communication-callautomation/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -77,7 +77,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -119,19 +119,19 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -150,7 +150,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -201,7 +201,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java index a9a96b00a4c0..f130e5a14f6d 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java @@ -45,6 +45,9 @@ import com.azure.communication.callautomation.models.events.SendDtmfTonesCompleted; import com.azure.communication.callautomation.models.events.SendDtmfTonesFailed; import com.azure.communication.callautomation.models.events.TranscriptionUpdated; +import com.azure.communication.callautomation.models.events.MediaStreamingStarted; +import com.azure.communication.callautomation.models.events.MediaStreamingStopped; +import com.azure.communication.callautomation.models.events.MediaStreamingFailed; import com.azure.core.models.CloudEvent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.core.JsonProcessingException; @@ -190,6 +193,12 @@ private static CallAutomationEventBase parseSingleCloudEvent(String data, String ret = mapper.convertValue(eventData, CreateCallFailed.class); } else if (Objects.equals(eventType, "Microsoft.Communication.HoldFailed")) { ret = mapper.convertValue(eventData, HoldFailed.class); + } else if (Objects.equals(eventType, "Microsoft.Communication.MediaStreamingStarted")) { + ret = mapper.convertValue(eventData, MediaStreamingStarted.class); + } else if (Objects.equals(eventType, "Microsoft.Communication.MediaStreamingStopped")) { + ret = mapper.convertValue(eventData, MediaStreamingStopped.class); + } else if (Objects.equals(eventType, "Microsoft.Communication.MediaStreamingFailed")) { + ret = mapper.convertValue(eventData, MediaStreamingFailed.class); } return ret; } catch (RuntimeException e) { diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingFailed.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingFailed.java new file mode 100644 index 000000000000..4f7e6eb921a6 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingFailed.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MediaStreamingFailed model. */ +@Immutable +public final class MediaStreamingFailed { + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext", access = JsonProperty.Access.WRITE_ONLY) + private String operationContext; + + /* + * Contains the resulting SIP code, sub-code and message. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for audio streaming update with the current status + * and the details about the status + */ + @JsonProperty(value = "mediaStreamingUpdate", access = JsonProperty.Access.WRITE_ONLY) + private MediaStreamingUpdate mediaStreamingUpdate; + + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId", access = JsonProperty.Access.WRITE_ONLY) + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId", access = JsonProperty.Access.WRITE_ONLY) + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code, sub-code and message. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the mediaStreamingUpdate property: Defines the result for audio streaming update with the current status and + * the details about the status. + * + * @return the mediaStreamingUpdate value. + */ + public MediaStreamingUpdate getMediaStreamingUpdate() { + return this.mediaStreamingUpdate; + } + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStarted.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStarted.java new file mode 100644 index 000000000000..de6ff9beb057 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStarted.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MediaStreamingStarted model. */ +@Immutable +public final class MediaStreamingStarted { + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext", access = JsonProperty.Access.WRITE_ONLY) + private String operationContext; + + /* + * Contains the resulting SIP code, sub-code and message. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for audio streaming update with the current status + * and the details about the status + */ + @JsonProperty(value = "mediaStreamingUpdate", access = JsonProperty.Access.WRITE_ONLY) + private MediaStreamingUpdate mediaStreamingUpdate; + + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId", access = JsonProperty.Access.WRITE_ONLY) + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId", access = JsonProperty.Access.WRITE_ONLY) + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code, sub-code and message. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the mediaStreamingUpdate property: Defines the result for audio streaming update with the current status and + * the details about the status. + * + * @return the mediaStreamingUpdate value. + */ + public MediaStreamingUpdate getMediaStreamingUpdate() { + return this.mediaStreamingUpdate; + } + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStatus.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStatus.java new file mode 100644 index 000000000000..84ae9e81ff18 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MediaStreamingStatus. */ +public final class MediaStreamingStatus extends ExpandableStringEnum { + /** Static value mediaStreamingStarted for MediaStreamingStatus. */ + public static final MediaStreamingStatus MEDIA_STREAMING_STARTED = fromString("mediaStreamingStarted"); + + /** Static value mediaStreamingFailed for MediaStreamingStatus. */ + public static final MediaStreamingStatus MEDIA_STREAMING_FAILED = fromString("mediaStreamingFailed"); + + /** Static value mediaStreamingStopped for MediaStreamingStatus. */ + public static final MediaStreamingStatus MEDIA_STREAMING_STOPPED = fromString("mediaStreamingStopped"); + + /** Static value unspecifiedError for MediaStreamingStatus. */ + public static final MediaStreamingStatus UNSPECIFIED_ERROR = fromString("unspecifiedError"); + + /** + * Creates or finds a MediaStreamingStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MediaStreamingStatus. + */ + @JsonCreator + public static MediaStreamingStatus fromString(String name) { + return fromString(name, MediaStreamingStatus.class); + } + + /** @return known MediaStreamingStatus values. */ + public static Collection values() { + return values(MediaStreamingStatus.class); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStatusDetails.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStatusDetails.java new file mode 100644 index 000000000000..93430c0d45f5 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStatusDetails.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MediaStreamingStatusDetails. */ +public final class MediaStreamingStatusDetails extends ExpandableStringEnum { + /** Static value subscriptionStarted for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SUBSCRIPTION_STARTED = fromString("subscriptionStarted"); + + /** Static value streamConnectionReestablished for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails STREAM_CONNECTION_REESTABLISHED = + fromString("streamConnectionReestablished"); + + /** Static value streamConnectionUnsuccessful for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails STREAM_CONNECTION_UNSUCCESSFUL = + fromString("streamConnectionUnsuccessful"); + + /** Static value streamUrlMissing for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails STREAM_URL_MISSING = fromString("streamUrlMissing"); + + /** Static value serviceShutdown for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SERVICE_SHUTDOWN = fromString("serviceShutdown"); + + /** Static value streamConnectionInterrupted for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails STREAM_CONNECTION_INTERRUPTED = + fromString("streamConnectionInterrupted"); + + /** Static value speechServicesConnectionError for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SPEECH_SERVICES_CONNECTION_ERROR = + fromString("speechServicesConnectionError"); + + /** Static value subscriptionStopped for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SUBSCRIPTION_STOPPED = fromString("subscriptionStopped"); + + /** Static value unspecifiedError for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails UNSPECIFIED_ERROR = fromString("unspecifiedError"); + + /** Static value authenticationFailure for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails AUTHENTICATION_FAILURE = fromString("authenticationFailure"); + + /** Static value badRequest for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails BAD_REQUEST = fromString("badRequest"); + + /** Static value tooManyRequests for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails TOO_MANY_REQUESTS = fromString("tooManyRequests"); + + /** Static value forbidden for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails FORBIDDEN = fromString("forbidden"); + + /** Static value serviceTimeout for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SERVICE_TIMEOUT = fromString("serviceTimeout"); + + /** Static value initialWebSocketConnectionFailed for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails INITIAL_WEB_SOCKET_CONNECTION_FAILED = + fromString("initialWebSocketConnectionFailed"); + + /** + * Creates or finds a MediaStreamingStatusDetails from its string representation. + * + * @param name a name to look for. + * @return the corresponding MediaStreamingStatusDetails. + */ + @JsonCreator + public static MediaStreamingStatusDetails fromString(String name) { + return fromString(name, MediaStreamingStatusDetails.class); + } + + /** @return known MediaStreamingStatusDetails values. */ + public static Collection values() { + return values(MediaStreamingStatusDetails.class); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStopped.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStopped.java new file mode 100644 index 000000000000..95390daa30f2 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingStopped.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MediaStreamingStopped model. */ +@Immutable +public final class MediaStreamingStopped { + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext", access = JsonProperty.Access.WRITE_ONLY) + private String operationContext; + + /* + * Contains the resulting SIP code, sub-code and message. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for audio streaming update with the current status + * and the details about the status + */ + @JsonProperty(value = "mediaStreamingUpdate", access = JsonProperty.Access.WRITE_ONLY) + private MediaStreamingUpdate mediaStreamingUpdate; + + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId", access = JsonProperty.Access.WRITE_ONLY) + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId", access = JsonProperty.Access.WRITE_ONLY) + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code, sub-code and message. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the mediaStreamingUpdate property: Defines the result for audio streaming update with the current status and + * the details about the status. + * + * @return the mediaStreamingUpdate value. + */ + public MediaStreamingUpdate getMediaStreamingUpdate() { + return this.mediaStreamingUpdate; + } + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingUpdate.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingUpdate.java new file mode 100644 index 000000000000..e3b2347475b0 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/MediaStreamingUpdate.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MediaStreamingUpdate model. */ +@Fluent +public final class MediaStreamingUpdate { + /* + * The contentType property. + */ + @JsonProperty(value = "contentType") + private String contentType; + + /* + * The mediaStreamingStatus property. + */ + @JsonProperty(value = "mediaStreamingStatus") + private MediaStreamingStatus mediaStreamingStatus; + + /* + * The mediaStreamingStatusDetails property. + */ + @JsonProperty(value = "mediaStreamingStatusDetails") + private MediaStreamingStatusDetails mediaStreamingStatusDetails; + + /** + * Get the contentType property: The contentType property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The contentType property. + * + * @param contentType the contentType value to set. + * @return the MediaStreamingUpdate object itself. + */ + public MediaStreamingUpdate setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the mediaStreamingStatus property: The mediaStreamingStatus property. + * + * @return the mediaStreamingStatus value. + */ + public MediaStreamingStatus getMediaStreamingStatus() { + return this.mediaStreamingStatus; + } + + /** + * Set the mediaStreamingStatus property: The mediaStreamingStatus property. + * + * @param mediaStreamingStatus the mediaStreamingStatus value to set. + * @return the MediaStreamingUpdate object itself. + */ + public MediaStreamingUpdate setMediaStreamingStatus(MediaStreamingStatus mediaStreamingStatus) { + this.mediaStreamingStatus = mediaStreamingStatus; + return this; + } + + /** + * Get the mediaStreamingStatusDetails property: The mediaStreamingStatusDetails property. + * + * @return the mediaStreamingStatusDetails value. + */ + public MediaStreamingStatusDetails getMediaStreamingStatusDetails() { + return this.mediaStreamingStatusDetails; + } + + /** + * Set the mediaStreamingStatusDetails property: The mediaStreamingStatusDetails property. + * + * @param mediaStreamingStatusDetails the mediaStreamingStatusDetails value to set. + * @return the MediaStreamingUpdate object itself. + */ + public MediaStreamingUpdate setMediaStreamingStatusDetails( + MediaStreamingStatusDetails mediaStreamingStatusDetails) { + this.mediaStreamingStatusDetails = mediaStreamingStatusDetails; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingFailed.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingFailed.java new file mode 100644 index 000000000000..19d03128d6a6 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingFailed.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models.events; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MediaStreamingFailed model. */ +@Fluent +public final class MediaStreamingFailed extends CallAutomationEventBase { + + /* + * Contains the resulting SIP code, sub-code and message. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for audio streaming update with the current status + * and the details about the status + */ + @JsonProperty(value = "mediaStreamingUpdate", access = JsonProperty.Access.WRITE_ONLY) + private MediaStreamingUpdate mediaStreamingUpdateResult; + + /** + * Creates an instance of MediaStreamingFailed class. + */ + public MediaStreamingFailed() { + resultInformation = null; + mediaStreamingUpdateResult = null; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code, sub-code and message. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the mediaStreamingUpdateResult property: Defines the result for audio streaming update with the current status and + * the details about the status. + * + * @return the mediaStreamingUpdate value. + */ + public MediaStreamingUpdate getMediaStreamingUpdateResult() { + return this.mediaStreamingUpdateResult; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStarted.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStarted.java new file mode 100644 index 000000000000..42514e38512b --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStarted.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models.events; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MediaStreamingStarted model. + */ +@Fluent +public final class MediaStreamingStarted extends CallAutomationEventBase { + /* + * Contains the resulting SIP code/sub-code and message from NGC services. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private final ResultInformation resultInformation; + + /* + * Defines the result for MediaStreamingUpdate with the current status and the details about the status + */ + @JsonProperty(value = "mediaStreamingUpdate", access = JsonProperty.Access.WRITE_ONLY) + private final MediaStreamingUpdate mediaStreamingUpdateResult; + + /** + * Creates an instance of MediaStreamingStarted class. + */ + public MediaStreamingStarted() { + resultInformation = null; + mediaStreamingUpdateResult = null; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code/sub-code and message from NGC services. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the mediaStreamingUpdateResult property: Defines the result for audio streaming update with the current status + * and the details about the status. + * + * @return the mediaStreamingUpdateResult value. + */ + public MediaStreamingUpdate getMediaStreamingUpdateResult() { + return this.mediaStreamingUpdateResult; + } + +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStatus.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStatus.java new file mode 100644 index 000000000000..500a49de3251 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStatus.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models.events; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MediaStreamingStatus. */ +public final class MediaStreamingStatus extends ExpandableStringEnum { + /** Static value mediaStreamingStarted for MediaStreamingStatus. */ + public static final MediaStreamingStatus MEDIA_STREAMING_STARTED = fromString("mediaStreamingStarted"); + + /** Static value mediaStreamingFailed for MediaStreamingStatus. */ + public static final MediaStreamingStatus MEDIA_STREAMING_FAILED = fromString("mediaStreamingFailed"); + + /** Static value mediaStreamingStopped for MediaStreamingStatus. */ + public static final MediaStreamingStatus MEDIA_STREAMING_STOPPED = fromString("mediaStreamingStopped"); + + /** Static value unspecifiedError for MediaStreamingStatus. */ + public static final MediaStreamingStatus UNSPECIFIED_ERROR = fromString("unspecifiedError"); + + /** + * Creates or finds a MediaStreamingStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MediaStreamingStatus. + */ + @JsonCreator + public static MediaStreamingStatus fromString(String name) { + return fromString(name, MediaStreamingStatus.class); + } + + /** @return known MediaStreamingStatus values. */ + public static Collection values() { + return values(MediaStreamingStatus.class); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStatusDetails.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStatusDetails.java new file mode 100644 index 000000000000..97eb4cf6c605 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStatusDetails.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models.events; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MediaStreamingStatusDetails. */ +public final class MediaStreamingStatusDetails extends ExpandableStringEnum { + /** Static value subscriptionStarted for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SUBSCRIPTION_STARTED = fromString("subscriptionStarted"); + + /** Static value streamConnectionReestablished for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails STREAM_CONNECTION_REESTABLISHED = + fromString("streamConnectionReestablished"); + + /** Static value streamConnectionUnsuccessful for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails STREAM_CONNECTION_UNSUCCESSFUL = + fromString("streamConnectionUnsuccessful"); + + /** Static value streamUrlMissing for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails STREAM_URL_MISSING = fromString("streamUrlMissing"); + + /** Static value serviceShutdown for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SERVICE_SHUTDOWN = fromString("serviceShutdown"); + + /** Static value streamConnectionInterrupted for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails STREAM_CONNECTION_INTERRUPTED = + fromString("streamConnectionInterrupted"); + + /** Static value speechServicesConnectionError for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SPEECH_SERVICES_CONNECTION_ERROR = + fromString("speechServicesConnectionError"); + + /** Static value subscriptionStopped for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SUBSCRIPTION_STOPPED = fromString("subscriptionStopped"); + + /** Static value unspecifiedError for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails UNSPECIFIED_ERROR = fromString("unspecifiedError"); + + /** Static value authenticationFailure for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails AUTHENTICATION_FAILURE = fromString("authenticationFailure"); + + /** Static value badRequest for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails BAD_REQUEST = fromString("badRequest"); + + /** Static value tooManyRequests for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails TOO_MANY_REQUESTS = fromString("tooManyRequests"); + + /** Static value forbidden for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails FORBIDDEN = fromString("forbidden"); + + /** Static value serviceTimeout for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails SERVICE_TIMEOUT = fromString("serviceTimeout"); + + /** Static value initialWebSocketConnectionFailed for MediaStreamingStatusDetails. */ + public static final MediaStreamingStatusDetails INITIAL_WEB_SOCKET_CONNECTION_FAILED = + fromString("initialWebSocketConnectionFailed"); + + /** + * Creates or finds a MediaStreamingStatusDetails from its string representation. + * + * @param name a name to look for. + * @return the corresponding MediaStreamingStatusDetails. + */ + @JsonCreator + public static MediaStreamingStatusDetails fromString(String name) { + return fromString(name, MediaStreamingStatusDetails.class); + } + + /** @return known MediaStreamingStatusDetails values. */ + public static Collection values() { + return values(MediaStreamingStatusDetails.class); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStopped.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStopped.java new file mode 100644 index 000000000000..4a8e53891eb9 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingStopped.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models.events; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MediaStreamingStopped model. */ +@Fluent +public final class MediaStreamingStopped extends CallAutomationEventBase { + + /* + * Contains the resulting SIP code, sub-code and message. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for audio streaming update with the current status + * and the details about the status + */ + @JsonProperty(value = "mediaStreamingUpdate", access = JsonProperty.Access.WRITE_ONLY) + private MediaStreamingUpdate mediaStreamingUpdateResult; + + /** + * Creates an instance of MediaStreamingStopped class. + */ + public MediaStreamingStopped() { + resultInformation = null; + mediaStreamingUpdateResult = null; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code, sub-code and message. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the getMediaStreamingUpdateResult property: Defines the result for audio streaming update with the current status and + * the details about the status. + * + * @return the mediaStreamingUpdate value. + */ + public MediaStreamingUpdate getMediaStreamingUpdateResult() { + return this.mediaStreamingUpdateResult; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingUpdate.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingUpdate.java new file mode 100644 index 000000000000..b9e094f913f4 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/MediaStreamingUpdate.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models.events; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MediaStreamingUpdate model. */ +@Fluent +public final class MediaStreamingUpdate { + /* + * The contentType property. + */ + @JsonProperty(value = "contentType") + private String contentType; + + /* + * The mediaStreamingStatus property. + */ + @JsonProperty(value = "mediaStreamingStatus") + private MediaStreamingStatus mediaStreamingStatus; + + /* + * The mediaStreamingStatusDetails property. + */ + @JsonProperty(value = "mediaStreamingStatusDetails") + private MediaStreamingStatusDetails mediaStreamingStatusDetails; + + /** + * Get the contentType property: The contentType property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The contentType property. + * + * @param contentType the contentType value to set. + * @return the MediaStreamingUpdate object itself. + */ + public MediaStreamingUpdate setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the mediaStreamingStatus property: The mediaStreamingStatus property. + * + * @return the mediaStreamingStatus value. + */ + public MediaStreamingStatus getMediaStreamingStatus() { + return this.mediaStreamingStatus; + } + + /** + * Set the mediaStreamingStatus property: The mediaStreamingStatus property. + * + * @param mediaStreamingStatus the mediaStreamingStatus value to set. + * @return the MediaStreamingUpdate object itself. + */ + public MediaStreamingUpdate setMediaStreamingStatus(MediaStreamingStatus mediaStreamingStatus) { + this.mediaStreamingStatus = mediaStreamingStatus; + return this; + } + + /** + * Get the mediaStreamingStatusDetails property: The mediaStreamingStatusDetails property. + * + * @return the mediaStreamingStatusDetails value. + */ + public MediaStreamingStatusDetails getMediaStreamingStatusDetails() { + return this.mediaStreamingStatusDetails; + } + + /** + * Set the mediaStreamingStatusDetails property: The mediaStreamingStatusDetails property. + * + * @param mediaStreamingStatusDetails the mediaStreamingStatusDetails value to set. + * @return the MediaStreamingUpdate object itself. + */ + public MediaStreamingUpdate setMediaStreamingStatusDetails( + MediaStreamingStatusDetails mediaStreamingStatusDetails) { + this.mediaStreamingStatusDetails = mediaStreamingStatusDetails; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationEventParserAndProcessorUnitTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationEventParserAndProcessorUnitTests.java index 3c23a7e0c411..c7c98545a802 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationEventParserAndProcessorUnitTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationEventParserAndProcessorUnitTests.java @@ -49,6 +49,11 @@ import com.azure.communication.callautomation.models.events.TranscriptionStatusDetails; import com.azure.communication.callautomation.models.events.TranscriptionStopped; import com.azure.communication.callautomation.models.events.TranscriptionUpdated; +import com.azure.communication.callautomation.models.events.MediaStreamingStarted; +import com.azure.communication.callautomation.models.events.MediaStreamingStopped; +import com.azure.communication.callautomation.models.events.MediaStreamingFailed; +import com.azure.communication.callautomation.models.events.MediaStreamingStatus; +import com.azure.communication.callautomation.models.events.MediaStreamingStatusDetails; import org.junit.jupiter.api.Test; import java.util.List; @@ -1426,4 +1431,101 @@ public void parseHoldFailedEvent() { assertEquals(400, holdFailed.getResultInformation().getCode()); assertEquals(ReasonCode.Play.DOWNLOAD_FAILED, holdFailed.getReasonCode()); } + + @Test + public void parseMediaStreamingStartedEvent() { + String receivedEvent = "[{\n" + + "\"id\":\"d13c62c5-721e-44b9-a680-9866c33db7e7\",\n" + + "\"source\":\"calling/callConnections/4c1f5600-a9c6-4343-8979-b638a98de98f\",\n" + + "\"type\":\"Microsoft.Communication.MediaStreamingStarted\",\n" + + "\"data\":{\"eventSource\":\"calling/callConnections/4c1f5600-a9c6-4343-8979-b638a98de98f\",\n" + + "\"operationContext\":\"startMediaStreamingContext\",\n" + + "\"resultInformation\":{\"code\":200,\"subCode\":0,\"message\":\"Action completed successfully.\"},\n" + + "\"mediaStreamingUpdate\":{\"contentType\":\"Audio\",\n" + + "\"mediaStreamingStatus\":\"mediaStreamingStarted\",\n" + + "\"mediaStreamingStatusDetails\":\"subscriptionStarted\"},\n" + + "\"version\":\"2024-06-15-preview\",\n" + + "\"callConnectionId\":\"4c1f5600-a9c6-4343-8979-b638a98de98f\",\n" + + "\"serverCallId\":\"aHR0cHM6Ly9hcGkuZmxpZ2h0cHJveHkuc2t5cGUuY29tL2FwaS92Mi9jcC9jb252LW1hc28tMDEtcHJvZC1ha3MuY29udi5za3lwZS5jb20vY29udi9LTTQteUZBUmhVYXN3T1RqbklPSXZnP2k9MTAtMTI4LTk1LTUyJmU9NjM4NTAwMTgzOTYwNzY2MzQ0\",\n" + + "\"correlationId\":\"30f0ad34-d615-4bf3-8476-5630ae7fc3db\",\n" + + "\"publicEventType\":\"Microsoft.Communication.MediaStreamingStarted\"},\n" + + "\"time\":\"2024-05-02T11:20:42.9110236+00:00\",\n" + + "\"specversion\":\"1.0\",\n" + + "\"datacontenttype\":\"application/json\",\n" + + "\"subject\":\"calling/callConnections/4c1f5600-a9c6-4343-8979-b638a98de98f\"}]"; + + MediaStreamingStarted event = (MediaStreamingStarted) CallAutomationEventParser.parseEvents(receivedEvent).get(0); + assertNotNull(event); + assertEquals("aHR0cHM6Ly9hcGkuZmxpZ2h0cHJveHkuc2t5cGUuY29tL2FwaS92Mi9jcC9jb252LW1hc28tMDEtcHJvZC1ha3MuY29udi5za3lwZS5jb20vY29udi9LTTQteUZBUmhVYXN3T1RqbklPSXZnP2k9MTAtMTI4LTk1LTUyJmU9NjM4NTAwMTgzOTYwNzY2MzQ0", event.getServerCallId()); + assertEquals("4c1f5600-a9c6-4343-8979-b638a98de98f", event.getCallConnectionId()); + assertEquals("30f0ad34-d615-4bf3-8476-5630ae7fc3db", event.getCorrelationId()); + assertEquals("Action completed successfully.", event.getResultInformation().getMessage()); + + assertNotNull(event.getMediaStreamingUpdateResult()); + assertEquals(MediaStreamingStatus.MEDIA_STREAMING_STARTED, event.getMediaStreamingUpdateResult().getMediaStreamingStatus()); + assertEquals(MediaStreamingStatusDetails.SUBSCRIPTION_STARTED, event.getMediaStreamingUpdateResult().getMediaStreamingStatusDetails()); + } + + @Test + public void parseMediaStreamingStoppedEvent() { + String receivedEvent = "[{\n" + + "\"id\":\"41039554-9475-491a-875b-08d23c5d0e75\",\n" + + "\"source\":\"calling/callConnections/4c1f5600-a9c6-4343-8979-b638a98de98f\",\n" + + "\"type\":\"Microsoft.Communication.MediaStreamingStopped\",\n" + + "\"data\":{\"eventSource\":\"calling/callConnections/4c1f5600-a9c6-4343-8979-b638a98de98f\",\n" + + "\"operationContext\":\"startMediaStreamingContext\",\n" + + "\"resultInformation\":{\"code\":200,\"subCode\":0,\"message\":\"Action completed successfully.\"},\n" + + "\"mediaStreamingUpdate\":{\"contentType\":\"Audio\",\"mediaStreamingStatus\":\"mediaStreamingStopped\",\n" + + "\"mediaStreamingStatusDetails\":\"subscriptionStopped\"},\n" + + "\"version\":\"2024-06-15-preview\",\"callConnectionId\":\"4c1f5600-a9c6-4343-8979-b638a98de98f\",\n" + + "\"serverCallId\":\"aHR0cHM6Ly9hcGkuZmxpZ2h0cHJveHkuc2t5cGUuY29tL2FwaS92Mi9jcC9jb252LW1hc28tMDEtcHJvZC1ha3MuY29udi5za3lwZS5jb20vY29udi9LTTQteUZBUmhVYXN3T1RqbklPSXZnP2k9MTAtMTI4LTk1LTUyJmU9NjM4NTAwMTgzOTYwNzY2MzQ0\",\n" + + "\"correlationId\":\"30f0ad34-d615-4bf3-8476-5630ae7fc3db\",\n" + + "\"publicEventType\":\"Microsoft.Communication.MediaStreamingStopped\"},\n" + + "\"time\":\"2024-05-02T11:21:10.0261068+00:00\",\"specversion\":\"1.0\",\n" + + "\"datacontenttype\":\"application/json\",\n" + + "\"subject\":\"calling/callConnections/4c1f5600-a9c6-4343-8979-b638a98de98f\"}]"; + + MediaStreamingStopped event = (MediaStreamingStopped) CallAutomationEventParser.parseEvents(receivedEvent).get(0); + assertNotNull(event); + assertEquals("aHR0cHM6Ly9hcGkuZmxpZ2h0cHJveHkuc2t5cGUuY29tL2FwaS92Mi9jcC9jb252LW1hc28tMDEtcHJvZC1ha3MuY29udi5za3lwZS5jb20vY29udi9LTTQteUZBUmhVYXN3T1RqbklPSXZnP2k9MTAtMTI4LTk1LTUyJmU9NjM4NTAwMTgzOTYwNzY2MzQ0", event.getServerCallId()); + assertEquals("4c1f5600-a9c6-4343-8979-b638a98de98f", event.getCallConnectionId()); + assertEquals("30f0ad34-d615-4bf3-8476-5630ae7fc3db", event.getCorrelationId()); + assertEquals("Action completed successfully.", event.getResultInformation().getMessage()); + + assertNotNull(event.getMediaStreamingUpdateResult()); + assertEquals(MediaStreamingStatus.MEDIA_STREAMING_STOPPED, event.getMediaStreamingUpdateResult().getMediaStreamingStatus()); + assertEquals(MediaStreamingStatusDetails.SUBSCRIPTION_STOPPED, event.getMediaStreamingUpdateResult().getMediaStreamingStatusDetails()); + } + + @Test + public void parseMediaStreamingFailedEvent() { + String receivedEvent = "[{\n" + + "\"id\":\"a9bb7545-8f87-42aa-85d0-d7120dbe2414\",\n" + + "\"source\":\"calling/callConnections/761f5600-43ab-48a0-bbad-ecc5ad5b15bb\",\n" + + "\"type\":\"Microsoft.Communication.MediaStreamingFailed\",\n" + + "\"data\":{\"eventSource\":\"calling/callConnections/761f5600-43ab-48a0-bbad-ecc5ad5b15bb\",\n" + + "\"operationContext\":\"startMediaStreamingContext\",\n" + + "\"resultInformation\":{\"code\":500,\"subCode\":8603,\n" + + "\"message\":\"Action failed, not able to establish websocket connection.\"},\n" + + "\"mediaStreamingUpdate\":{\"contentType\":\"Audio\",\n" + + "\"mediaStreamingStatus\":\"mediaStreamingFailed\",\n" + + "\"mediaStreamingStatusDetails\":\"streamConnectionUnsuccessful\"},\n" + + "\"version\":\"2024-06-15-preview\",\"callConnectionId\":\"761f5600-43ab-48a0-bbad-ecc5ad5b15bb\",\n" + + "\"serverCallId\":\"aHR0cHM6Ly9hcGkuZmxpZ2h0cHJveHkuc2t5cGUuY29tL2FwaS92Mi9jcC9jb252LW1hc28tMDQtcHJvZC1ha3MuY29udi5za3lwZS5jb20vY29udi94MVdMX0p3NnlVaW1aOEkzVi1MN3hnP2k9MTAtMTI4LTg0LTE3MSZlPTYzODQ5NzU2ODQ3MzUxNzU3Mg==\",\n" + + "\"correlationId\":\"6032c474-201d-4ad1-8900-f92a595a6d94\",\n" + + "\"publicEventType\":\"Microsoft.Communication.MediaStreamingFailed\"},\n" + + "\"time\":\"2024-05-02T12:38:31.242039+00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\n" + + "\"subject\":\"calling/callConnections/761f5600-43ab-48a0-bbad-ecc5ad5b15bb\"}]"; + + MediaStreamingFailed event = (MediaStreamingFailed) CallAutomationEventParser.parseEvents(receivedEvent).get(0); + assertNotNull(event); + assertEquals("aHR0cHM6Ly9hcGkuZmxpZ2h0cHJveHkuc2t5cGUuY29tL2FwaS92Mi9jcC9jb252LW1hc28tMDQtcHJvZC1ha3MuY29udi5za3lwZS5jb20vY29udi94MVdMX0p3NnlVaW1aOEkzVi1MN3hnP2k9MTAtMTI4LTg0LTE3MSZlPTYzODQ5NzU2ODQ3MzUxNzU3Mg==", event.getServerCallId()); + assertEquals("761f5600-43ab-48a0-bbad-ecc5ad5b15bb", event.getCallConnectionId()); + assertEquals("6032c474-201d-4ad1-8900-f92a595a6d94", event.getCorrelationId()); + assertEquals("Action failed, not able to establish websocket connection.", event.getResultInformation().getMessage()); + + assertNotNull(event.getMediaStreamingUpdateResult()); + assertEquals(MediaStreamingStatus.MEDIA_STREAMING_FAILED, event.getMediaStreamingUpdateResult().getMediaStreamingStatus()); + assertEquals(MediaStreamingStatusDetails.STREAM_CONNECTION_UNSUCCESSFUL, event.getMediaStreamingUpdateResult().getMediaStreamingStatusDetails()); + } } diff --git a/sdk/communication/azure-communication-callautomation/swagger/README.md b/sdk/communication/azure-communication-callautomation/swagger/README.md index ef67ad58215d..ac049ef9e06c 100644 --- a/sdk/communication/azure-communication-callautomation/swagger/README.md +++ b/sdk/communication/azure-communication-callautomation/swagger/README.md @@ -28,7 +28,7 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.20 --use=@autorest/model ``` yaml tag: package-2023-10-03-preview require: - - https://github.com/Azure/azure-rest-api-specs/blob/77d25dd8426c4ba1619d15582a8c9d9b2f6890e8/specification/communication/data-plane/CallAutomation/readme.md + - https://github.com/Azure/azure-rest-api-specs/blob/ebedc156cf07929f3f72e71e5323ecdfa402267d/specification/communication/data-plane/CallAutomation/readme.md java: true output-folder: ../ license-header: MICROSOFT_MIT_SMALL @@ -254,6 +254,9 @@ directive: - remove-model: TranscriptionStopped - remove-model: TranscriptionUpdated - remove-model: TranscriptionFailed +- remove-model: MediaStreamingStarted +- remove-model: MediaStreamingStopped +- remove-model: MediaStreamingFailed ``` diff --git a/sdk/communication/azure-communication-callingserver/pom.xml b/sdk/communication/azure-communication-callingserver/pom.xml index b6000b9e0f8f..902b761a039a 100644 --- a/sdk/communication/azure-communication-callingserver/pom.xml +++ b/sdk/communication/azure-communication-callingserver/pom.xml @@ -54,7 +54,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -70,7 +70,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -132,19 +132,19 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -203,7 +203,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-chat/pom.xml b/sdk/communication/azure-communication-chat/pom.xml index da4e82be4258..6ee8c7d49803 100644 --- a/sdk/communication/azure-communication-chat/pom.xml +++ b/sdk/communication/azure-communication-chat/pom.xml @@ -50,7 +50,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -66,7 +66,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -96,19 +96,19 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 compile com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -161,7 +161,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-common-perf/pom.xml b/sdk/communication/azure-communication-common-perf/pom.xml index 5c3f0c3090df..6fdd38f13fed 100644 --- a/sdk/communication/azure-communication-common-perf/pom.xml +++ b/sdk/communication/azure-communication-common-perf/pom.xml @@ -39,18 +39,18 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 diff --git a/sdk/communication/azure-communication-common/pom.xml b/sdk/communication/azure-communication-common/pom.xml index 2b5cd6525135..d659d4605d63 100644 --- a/sdk/communication/azure-communication-common/pom.xml +++ b/sdk/communication/azure-communication-common/pom.xml @@ -46,12 +46,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 compile diff --git a/sdk/communication/azure-communication-email/pom.xml b/sdk/communication/azure-communication-email/pom.xml index a4a9b036d58d..3bf8ab6c9b7a 100644 --- a/sdk/communication/azure-communication-email/pom.xml +++ b/sdk/communication/azure-communication-email/pom.xml @@ -55,12 +55,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -78,13 +78,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -96,13 +96,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -154,7 +154,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-identity/pom.xml b/sdk/communication/azure-communication-identity/pom.xml index 8ffb4c762845..10f28882ed57 100644 --- a/sdk/communication/azure-communication-identity/pom.xml +++ b/sdk/communication/azure-communication-identity/pom.xml @@ -63,7 +63,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -103,31 +103,31 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-http-netty - 1.14.2 + 1.15.0 compile @@ -175,7 +175,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-jobrouter/assets.json b/sdk/communication/azure-communication-jobrouter/assets.json index b31c312f7260..30f460c18040 100644 --- a/sdk/communication/azure-communication-jobrouter/assets.json +++ b/sdk/communication/azure-communication-jobrouter/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/communication/azure-communication-jobrouter", - "Tag": "java/communication/azure-communication-jobrouter_b970df9fcf" + "Tag": "java/communication/azure-communication-jobrouter_db1da26178" } diff --git a/sdk/communication/azure-communication-jobrouter/customization/src/main/java/JobRouterSdkCustomization.java b/sdk/communication/azure-communication-jobrouter/customization/src/main/java/JobRouterSdkCustomization.java index f85667b535da..20deb030d45f 100644 --- a/sdk/communication/azure-communication-jobrouter/customization/src/main/java/JobRouterSdkCustomization.java +++ b/sdk/communication/azure-communication-jobrouter/customization/src/main/java/JobRouterSdkCustomization.java @@ -3,6 +3,7 @@ import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.type.ClassOrInterfaceType; import org.slf4j.Logger; +import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; @@ -29,6 +30,13 @@ public void customize(LibraryCustomization customization, Logger logger) { addConnectionStringClientMethod(classCustomizationForJobRouterClientBuilder, "JobRouterClientBuilder"); addHttpPipelineAuthPolicyMethod(classCustomizationForJobRouterClientBuilder); updateHttpPipelineMethod(classCustomizationForJobRouterClientBuilder); + + logger.info("Customizing the ScoringRuleOptions class"); + PackageCustomization modelsPackageCustomization = customization.getPackage("com.azure.communication.jobrouter.models"); + ClassCustomization classCustomizationForScoringRuleOptions = modelsPackageCustomization.getClass("ScoringRuleOptions"); + classCustomizationForScoringRuleOptions + .getMethod("setIsBatchScoringEnabled") + .setModifier(Modifier.PRIVATE); } private void addAuthTraits(ClassCustomization classCustomization) { diff --git a/sdk/communication/azure-communication-jobrouter/pom.xml b/sdk/communication/azure-communication-jobrouter/pom.xml index bb6ae294c235..d9963d1725a3 100644 --- a/sdk/communication/azure-communication-jobrouter/pom.xml +++ b/sdk/communication/azure-communication-jobrouter/pom.xml @@ -51,7 +51,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -61,7 +61,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 io.projectreactor @@ -72,7 +72,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -102,13 +102,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -167,7 +167,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/implementation/converters/RouterRuleAdapter.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/implementation/converters/RouterRuleAdapter.java index 6aa3187d248b..cfbc47cbe48f 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/implementation/converters/RouterRuleAdapter.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/implementation/converters/RouterRuleAdapter.java @@ -49,9 +49,9 @@ public static RouterRuleInternal getRouterRuleInternal(RouterRule routerRule) { } else if (routerRule.getClass() == WebhookRouterRule.class) { WebhookRouterRule webhookRouterRule = (WebhookRouterRule) routerRule; prioritizationRuleInternal = new WebhookRouterRuleInternal() - .setAuthorizationServerUri(webhookRouterRule.getAuthorizationServerUri()) + .setAuthorizationServerUri(webhookRouterRule.getAuthorizationServerUrl()) .setClientCredential(webhookRouterRule.getClientCredential()) - .setWebhookUri(webhookRouterRule.getWebhookUri()); + .setWebhookUri(webhookRouterRule.getWebhookUrl()); } } @@ -75,11 +75,11 @@ public static RouterRuleInternal convertRouterRuleToInternal(RouterRule rule) { return new StaticRouterRuleInternal().setValue(RouterValueAdapter.getValue(((StaticRouterRule) rule).getValue())); } else if (rule instanceof WebhookRouterRule) { WebhookRouterRule webhookRouterRule = (WebhookRouterRule) rule; - return new WebhookRouterRuleInternal().setWebhookUri(webhookRouterRule.getWebhookUri()) + return new WebhookRouterRuleInternal().setWebhookUri(webhookRouterRule.getWebhookUrl()) .setClientCredential(new OAuth2WebhookClientCredential() .setClientId(webhookRouterRule.getClientCredential().getClientId()) .setClientSecret(webhookRouterRule.getClientCredential().getClientSecret())) - .setAuthorizationServerUri(webhookRouterRule.getAuthorizationServerUri()); + .setAuthorizationServerUri(webhookRouterRule.getAuthorizationServerUrl()); } return null; diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/BestWorkerMode.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/BestWorkerMode.java index b57f8c5dd8fa..b3bc0e453a3c 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/BestWorkerMode.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/BestWorkerMode.java @@ -30,8 +30,14 @@ public final class BestWorkerMode extends DistributionMode { private ScoringRuleOptions scoringRuleOptions; /** Creates an instance of BestWorkerMode class. */ - public BestWorkerMode() { - this.kind = DistributionModeKind.BEST_WORKER; + public BestWorkerMode() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public DistributionModeKind getKind() { + return DistributionModeKind.BEST_WORKER; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/CancelExceptionAction.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/CancelExceptionAction.java index 584d3ed1ee92..f11eaf39f71c 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/CancelExceptionAction.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/CancelExceptionAction.java @@ -29,8 +29,14 @@ public final class CancelExceptionAction extends ExceptionAction { private String dispositionCode; /** Creates an instance of CancelExceptionAction class. */ - public CancelExceptionAction() { - this.kind = ExceptionActionKind.CANCEL; + public CancelExceptionAction() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public ExceptionActionKind getKind() { + return ExceptionActionKind.CANCEL; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ConditionalQueueSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ConditionalQueueSelectorAttachment.java index 556075b6be11..20c2bff66436 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ConditionalQueueSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ConditionalQueueSelectorAttachment.java @@ -53,7 +53,14 @@ public ConditionalQueueSelectorAttachment( @JsonProperty(value = "queueSelectors") List queueSelectors) { this.condition = condition; this.queueSelectors = queueSelectors; - this.kind = QueueSelectorAttachmentKind.CONDITIONAL; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public QueueSelectorAttachmentKind getKind() { + return QueueSelectorAttachmentKind.CONDITIONAL; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ConditionalWorkerSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ConditionalWorkerSelectorAttachment.java index 894387412718..4b2bdd1f435d 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ConditionalWorkerSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ConditionalWorkerSelectorAttachment.java @@ -53,7 +53,14 @@ public ConditionalWorkerSelectorAttachment( @JsonProperty(value = "workerSelectors") List workerSelectors) { this.condition = condition; this.workerSelectors = workerSelectors; - this.kind = WorkerSelectorAttachmentKind.CONDITIONAL; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public WorkerSelectorAttachmentKind getKind() { + return WorkerSelectorAttachmentKind.CONDITIONAL; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/DirectMapRouterRule.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/DirectMapRouterRule.java index 2f84d7a71c45..b2149e4f73d0 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/DirectMapRouterRule.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/DirectMapRouterRule.java @@ -14,7 +14,13 @@ public final class DirectMapRouterRule extends RouterRule { /** Creates an instance of DirectMapRouterRule class. */ - public DirectMapRouterRule() { - this.kind = RouterRuleKind.DIRECT_MAP; + public DirectMapRouterRule() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public RouterRuleKind getKind() { + return RouterRuleKind.DIRECT_MAP; } } diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/DistributionMode.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/DistributionMode.java index 419c15d7fb70..3b58baf64644 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/DistributionMode.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/DistributionMode.java @@ -28,7 +28,7 @@ public abstract class DistributionMode { * kind discriminator. */ @JsonProperty(value = "kind") - protected DistributionModeKind kind; + private DistributionModeKind kind; /* * Governs the minimum desired number of active concurrent offers a job can have. @@ -123,7 +123,5 @@ public DistributionMode setBypassSelectors(Boolean bypassSelectors) { * Returns kind discriminator. * @return kind. */ - public DistributionModeKind getKind() { - return this.kind; - } + public abstract DistributionModeKind getKind(); } diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExceptionAction.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExceptionAction.java index ed9e2a0ebb38..72611486eb36 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExceptionAction.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExceptionAction.java @@ -3,6 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.communication.jobrouter.models; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -20,12 +21,13 @@ @JsonSubTypes.Type(name = "manualReclassify", value = ManualReclassifyExceptionAction.class), @JsonSubTypes.Type(name = "reclassify", value = ReclassifyExceptionAction.class) }) +@Immutable public abstract class ExceptionAction { /** * kind discriminator. */ @JsonProperty(value = "kind") - protected ExceptionActionKind kind; + private ExceptionActionKind kind; /** Creates an instance of ExceptionAction class. */ public ExceptionAction() {} @@ -49,7 +51,5 @@ public String getId() { * Returns kind discriminator. * @return kind. */ - public ExceptionActionKind getKind() { - return this.kind; - } + public abstract ExceptionActionKind getKind(); } diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExceptionTrigger.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExceptionTrigger.java index 8bdb47fda3ce..d9d5327668a0 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExceptionTrigger.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExceptionTrigger.java @@ -3,6 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.communication.jobrouter.models; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -19,12 +20,13 @@ @JsonSubTypes.Type(name = "queueLength", value = QueueLengthExceptionTrigger.class), @JsonSubTypes.Type(name = "waitTime", value = WaitTimeExceptionTrigger.class) }) +@Immutable public abstract class ExceptionTrigger { /** * kind discriminator. */ @JsonProperty(value = "kind") - protected ExceptionTriggerKind kind; + private ExceptionTriggerKind kind; /** Creates an instance of ExceptionTrigger class. */ public ExceptionTrigger() {} @@ -33,7 +35,5 @@ public ExceptionTrigger() {} * Returns kind discriminator. * @return kind. */ - public ExceptionTriggerKind getKind() { - return this.kind; - } + public abstract ExceptionTriggerKind getKind(); } diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExpressionRouterRule.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExpressionRouterRule.java index 149e4acaf1c8..944c4a2d63de 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExpressionRouterRule.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ExpressionRouterRule.java @@ -35,7 +35,14 @@ public final class ExpressionRouterRule extends RouterRule { @JsonCreator public ExpressionRouterRule(@JsonProperty(value = "expression") String expression) { this.expression = expression; - this.kind = RouterRuleKind.EXPRESSION; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public RouterRuleKind getKind() { + return RouterRuleKind.EXPRESSION; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/FunctionRouterRule.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/FunctionRouterRule.java index ada90799bbbb..ded04cfe37b9 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/FunctionRouterRule.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/FunctionRouterRule.java @@ -35,7 +35,14 @@ public final class FunctionRouterRule extends RouterRule { @JsonCreator public FunctionRouterRule(@JsonProperty(value = "functionUri") String functionUri) { this.functionUri = functionUri; - this.kind = RouterRuleKind.FUNCTION; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public RouterRuleKind getKind() { + return RouterRuleKind.FUNCTION; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/LongestIdleMode.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/LongestIdleMode.java index a107580c4e96..0ca81d91d9dd 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/LongestIdleMode.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/LongestIdleMode.java @@ -13,8 +13,14 @@ @Fluent public final class LongestIdleMode extends DistributionMode { /** Creates an instance of LongestIdleMode class. */ - public LongestIdleMode() { - this.kind = DistributionModeKind.LONGEST_IDLE; + public LongestIdleMode() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public DistributionModeKind getKind() { + return DistributionModeKind.LONGEST_IDLE; } /** {@inheritDoc} */ diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ManualReclassifyExceptionAction.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ManualReclassifyExceptionAction.java index df7caef0085f..c507796f5737 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ManualReclassifyExceptionAction.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ManualReclassifyExceptionAction.java @@ -35,8 +35,14 @@ public final class ManualReclassifyExceptionAction extends ExceptionAction { private List workerSelectors; /** Creates an instance of ManualReclassifyExceptionAction class. */ - public ManualReclassifyExceptionAction() { - this.kind = ExceptionActionKind.MANUAL_RECLASSIFY; + public ManualReclassifyExceptionAction() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public ExceptionActionKind getKind() { + return ExceptionActionKind.MANUAL_RECLASSIFY; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/PassThroughQueueSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/PassThroughQueueSelectorAttachment.java index c13ad012cdfd..8423781cf8f7 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/PassThroughQueueSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/PassThroughQueueSelectorAttachment.java @@ -39,7 +39,14 @@ public PassThroughQueueSelectorAttachment( @JsonProperty(value = "labelOperator") LabelOperator labelOperator) { this.key = key; this.labelOperator = labelOperator; - this.kind = QueueSelectorAttachmentKind.PASS_THROUGH; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public QueueSelectorAttachmentKind getKind() { + return QueueSelectorAttachmentKind.PASS_THROUGH; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/PassThroughWorkerSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/PassThroughWorkerSelectorAttachment.java index 3d220b9b084f..8993e79a71c3 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/PassThroughWorkerSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/PassThroughWorkerSelectorAttachment.java @@ -51,7 +51,14 @@ public PassThroughWorkerSelectorAttachment( @JsonProperty(value = "labelOperator") LabelOperator labelOperator) { this.key = key; this.labelOperator = labelOperator; - this.kind = WorkerSelectorAttachmentKind.PASS_THROUGH; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public WorkerSelectorAttachmentKind getKind() { + return WorkerSelectorAttachmentKind.PASS_THROUGH; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/QueueLengthExceptionTrigger.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/QueueLengthExceptionTrigger.java index 0f43ca81063b..09ee2a721feb 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/QueueLengthExceptionTrigger.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/QueueLengthExceptionTrigger.java @@ -29,7 +29,14 @@ public final class QueueLengthExceptionTrigger extends ExceptionTrigger { @JsonCreator public QueueLengthExceptionTrigger(@JsonProperty(value = "threshold") int threshold) { this.threshold = threshold; - this.kind = ExceptionTriggerKind.QUEUE_LENGTH; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public ExceptionTriggerKind getKind() { + return ExceptionTriggerKind.QUEUE_LENGTH; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/QueueSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/QueueSelectorAttachment.java index af36d7317d86..5f17bf9af3d0 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/QueueSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/QueueSelectorAttachment.java @@ -3,6 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.communication.jobrouter.models; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -24,12 +25,13 @@ name = "weightedAllocation", value = WeightedAllocationQueueSelectorAttachment.class) }) +@Immutable public abstract class QueueSelectorAttachment { /** * kind discriminator. */ @JsonProperty(value = "kind") - protected QueueSelectorAttachmentKind kind; + private QueueSelectorAttachmentKind kind; /** Creates an instance of QueueSelectorAttachment class. */ public QueueSelectorAttachment() {} @@ -38,7 +40,5 @@ public QueueSelectorAttachment() {} * Returns kind discriminator. * @return kind. */ - public QueueSelectorAttachmentKind getKind() { - return this.kind; - } + public abstract QueueSelectorAttachmentKind getKind(); } diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ReclassifyExceptionAction.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ReclassifyExceptionAction.java index fa2c57edceb4..9b9ccb17484b 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ReclassifyExceptionAction.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ReclassifyExceptionAction.java @@ -35,8 +35,14 @@ public final class ReclassifyExceptionAction extends ExceptionAction { private Map labelsToUpsert; /** Creates an instance of ReclassifyExceptionAction class. */ - public ReclassifyExceptionAction() { - this.kind = ExceptionActionKind.RECLASSIFY; + public ReclassifyExceptionAction() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public ExceptionActionKind getKind() { + return ExceptionActionKind.RECLASSIFY; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RoundRobinMode.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RoundRobinMode.java index c3f6beae9d83..9b500a1d8c10 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RoundRobinMode.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RoundRobinMode.java @@ -16,8 +16,14 @@ public final class RoundRobinMode extends DistributionMode { /** Creates an instance of RoundRobinMode class. */ - public RoundRobinMode() { - this.kind = DistributionModeKind.ROUND_ROBIN; + public RoundRobinMode() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public DistributionModeKind getKind() { + return DistributionModeKind.ROUND_ROBIN; } /** {@inheritDoc} */ diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RouterRule.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RouterRule.java index 0b10a599eb29..bd6b57f5fa07 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RouterRule.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RouterRule.java @@ -3,6 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.communication.jobrouter.models; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -27,13 +28,14 @@ @JsonSubTypes.Type(name = "static", value = StaticRouterRule.class), @JsonSubTypes.Type(name = "webhook", value = WebhookRouterRule.class) }) +@Immutable public abstract class RouterRule { /** * kind discriminator. */ @JsonProperty(value = "kind") - protected RouterRuleKind kind; + private RouterRuleKind kind; /** Creates an instance of RouterRule class. */ public RouterRule() {} @@ -42,7 +44,5 @@ public RouterRule() {} * Returns kind discriminator. * @return kind. */ - public RouterRuleKind getKind() { - return this.kind; - } + public abstract RouterRuleKind getKind(); } diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RuleEngineQueueSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RuleEngineQueueSelectorAttachment.java index 33953961bc8a..a17057f47185 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RuleEngineQueueSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RuleEngineQueueSelectorAttachment.java @@ -41,7 +41,14 @@ public final class RuleEngineQueueSelectorAttachment extends QueueSelectorAttach @JsonCreator public RuleEngineQueueSelectorAttachment(@JsonProperty(value = "rule") RouterRule rule) { this.rule = rule; - this.kind = QueueSelectorAttachmentKind.RULE_ENGINE; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public QueueSelectorAttachmentKind getKind() { + return QueueSelectorAttachmentKind.RULE_ENGINE; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RuleEngineWorkerSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RuleEngineWorkerSelectorAttachment.java index dc8333074855..800c8fb25dd8 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RuleEngineWorkerSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/RuleEngineWorkerSelectorAttachment.java @@ -41,7 +41,14 @@ public final class RuleEngineWorkerSelectorAttachment extends WorkerSelectorAtta @JsonCreator public RuleEngineWorkerSelectorAttachment(@JsonProperty(value = "rule") RouterRule rule) { this.rule = rule; - this.kind = WorkerSelectorAttachmentKind.RULE_ENGINE; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public WorkerSelectorAttachmentKind getKind() { + return WorkerSelectorAttachmentKind.RULE_ENGINE; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ScoringRuleOptions.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ScoringRuleOptions.java index 397e403ac548..81761c95b2ef 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ScoringRuleOptions.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/ScoringRuleOptions.java @@ -130,20 +130,20 @@ public Boolean isBatchScoringEnabled() { * @param isBatchScoringEnabled the isBatchScoringEnabled value to set. * @return the ScoringRuleOptions object itself. */ - public ScoringRuleOptions setBatchScoringEnabled(Boolean isBatchScoringEnabled) { + private ScoringRuleOptions setIsBatchScoringEnabled(Boolean isBatchScoringEnabled) { this.isBatchScoringEnabled = isBatchScoringEnabled; return this; } /** - * Set the isBatchScoringEnabled property: If set to true, will score workers in batches, and the parameter name of + * Set the isBatchSco ringEnabled property: If set to true, will score workers in batches, and the parameter name of * the worker labels will be sent as `workers`. By default, set to false and the parameter name for the worker * labels will be sent as `worker`. Note: If enabled, use 'batchSize' to set batch size. * * @param isBatchScoringEnabled the isBatchScoringEnabled value to set. - * @return the ScoringRuleOptions object itself. + * @return theScoringRuleOptions object itself. */ - public ScoringRuleOptions setIsBatchScoringEnabled(Boolean isBatchScoringEnabled) { + public ScoringRuleOptions setBatchScoringEnabled(Boolean isBatchScoringEnabled) { this.isBatchScoringEnabled = isBatchScoringEnabled; return this; } diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticQueueSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticQueueSelectorAttachment.java index bedef4ef5589..b5ca011c9c63 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticQueueSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticQueueSelectorAttachment.java @@ -30,7 +30,14 @@ public final class StaticQueueSelectorAttachment extends QueueSelectorAttachment @JsonCreator public StaticQueueSelectorAttachment(@JsonProperty(value = "queueSelector") RouterQueueSelector queueSelector) { this.queueSelector = queueSelector; - this.kind = QueueSelectorAttachmentKind.STATIC; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public QueueSelectorAttachmentKind getKind() { + return QueueSelectorAttachmentKind.STATIC; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticRouterRule.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticRouterRule.java index ab1bb1a3c620..a5b64841ca21 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticRouterRule.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticRouterRule.java @@ -25,8 +25,14 @@ public final class StaticRouterRule extends RouterRule { private RouterValue value; /** Creates an instance of StaticRouterRule class. */ - public StaticRouterRule() { - this.kind = RouterRuleKind.STATIC; + public StaticRouterRule() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public RouterRuleKind getKind() { + return RouterRuleKind.STATIC; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticWorkerSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticWorkerSelectorAttachment.java index 78974e365188..ba89d4759a58 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticWorkerSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/StaticWorkerSelectorAttachment.java @@ -30,7 +30,14 @@ public final class StaticWorkerSelectorAttachment extends WorkerSelectorAttachme @JsonCreator public StaticWorkerSelectorAttachment(@JsonProperty(value = "workerSelector") RouterWorkerSelector workerSelector) { this.workerSelector = workerSelector; - this.kind = WorkerSelectorAttachmentKind.STATIC; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public WorkerSelectorAttachmentKind getKind() { + return WorkerSelectorAttachmentKind.STATIC; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WaitTimeExceptionTrigger.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WaitTimeExceptionTrigger.java index a4971b067bc2..d69063683294 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WaitTimeExceptionTrigger.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WaitTimeExceptionTrigger.java @@ -35,7 +35,14 @@ public final class WaitTimeExceptionTrigger extends ExceptionTrigger { @JsonCreator public WaitTimeExceptionTrigger(@JsonProperty(value = "thresholdSeconds") Duration threshold) { this.threshold = threshold; - this.kind = ExceptionTriggerKind.WAIT_TIME; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public ExceptionTriggerKind getKind() { + return ExceptionTriggerKind.WAIT_TIME; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WebhookRouterRule.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WebhookRouterRule.java index 75ae7a81f8a4..73748be1151c 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WebhookRouterRule.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WebhookRouterRule.java @@ -17,8 +17,8 @@ public final class WebhookRouterRule extends RouterRule { /* * Uri for Authorization Server. */ - @JsonProperty(value = "authorizationServerUri") - private String authorizationServerUri; + @JsonProperty(value = "authorizationServerUrl") + private String authorizationServerUrl; /* * OAuth2.0 Credentials used to Contoso's Authorization server. Reference: @@ -28,33 +28,39 @@ public final class WebhookRouterRule extends RouterRule { private OAuth2WebhookClientCredential clientCredential; /* - * Uri for Contoso's Web Server. + * Url for Contoso's Web Server. */ - @JsonProperty(value = "webhookUri") - private String webhookUri; + @JsonProperty(value = "webhookUrl") + private String webhookUrl; /** Creates an instance of WebhookRouterRule class. */ - public WebhookRouterRule() { - this.kind = RouterRuleKind.WEBHOOK; + public WebhookRouterRule() {} + + /** + * Returns kind discriminator. + * @return kind. + */ + public RouterRuleKind getKind() { + return RouterRuleKind.WEBHOOK; } /** - * Get the authorizationServerUri property: Uri for Authorization Server. + * Get the authorizationServerUrl property: Url for Authorization Server. * - * @return the authorizationServerUri value. + * @return the authorizationServerUrl value. */ - public String getAuthorizationServerUri() { - return this.authorizationServerUri; + public String getAuthorizationServerUrl() { + return this.authorizationServerUrl; } /** * Set the authorizationServerUri property: Uri for Authorization Server. * - * @param authorizationServerUri the authorizationServerUri value to set. + * @param authorizationServerUrl the authorizationServerUri value to set. * @return the WebhookRouterRule object itself. */ - public WebhookRouterRule setAuthorizationServerUri(String authorizationServerUri) { - this.authorizationServerUri = authorizationServerUri; + public WebhookRouterRule setAuthorizationServerUrl(String authorizationServerUrl) { + this.authorizationServerUrl = authorizationServerUrl; return this; } @@ -71,20 +77,20 @@ public OAuth2WebhookClientCredential getClientCredential() { /** * Get the webhookUri property: Uri for Contoso's Web Server. * - * @return the webhookUri value. + * @return the webhookUrl value. */ - public String getWebhookUri() { - return this.webhookUri; + public String getWebhookUrl() { + return this.getWebhookUrl(); } /** * Set the webhookUri property: Uri for Contoso's Web Server. * - * @param webhookUri the webhookUri value to set. + * @param webhookUrl the webhookUri value to set. * @return the WebhookRouterRule object itself. */ - public WebhookRouterRule setWebhookUri(String webhookUri) { - this.webhookUri = webhookUri; + public WebhookRouterRule setWebhookUrl(String webhookUrl) { + this.webhookUrl = webhookUrl; return this; } diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WeightedAllocationQueueSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WeightedAllocationQueueSelectorAttachment.java index 666b55983909..a2dd2f533cc2 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WeightedAllocationQueueSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WeightedAllocationQueueSelectorAttachment.java @@ -32,7 +32,14 @@ public final class WeightedAllocationQueueSelectorAttachment extends QueueSelect public WeightedAllocationQueueSelectorAttachment( @JsonProperty(value = "allocations") List allocations) { this.allocations = allocations; - this.kind = QueueSelectorAttachmentKind.WEIGHTED_ALLOCATION; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public QueueSelectorAttachmentKind getKind() { + return QueueSelectorAttachmentKind.WEIGHTED_ALLOCATION; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WeightedAllocationWorkerSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WeightedAllocationWorkerSelectorAttachment.java index 9cdaceac4b01..5f1a65d69136 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WeightedAllocationWorkerSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WeightedAllocationWorkerSelectorAttachment.java @@ -32,7 +32,14 @@ public final class WeightedAllocationWorkerSelectorAttachment extends WorkerSele public WeightedAllocationWorkerSelectorAttachment( @JsonProperty(value = "allocations") List allocations) { this.allocations = allocations; - this.kind = WorkerSelectorAttachmentKind.WEIGHTED_ALLOCATION; + } + + /** + * Returns kind discriminator. + * @return kind. + */ + public WorkerSelectorAttachmentKind getKind() { + return WorkerSelectorAttachmentKind.WEIGHTED_ALLOCATION; } /** diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WorkerSelectorAttachment.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WorkerSelectorAttachment.java index 8834c28f447c..1b8fa463d7a1 100644 --- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WorkerSelectorAttachment.java +++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/models/WorkerSelectorAttachment.java @@ -3,6 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.communication.jobrouter.models; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -24,12 +25,13 @@ name = "weightedAllocation", value = WeightedAllocationWorkerSelectorAttachment.class) }) +@Immutable public abstract class WorkerSelectorAttachment { /** * kind discriminator. */ @JsonProperty(value = "kind") - protected WorkerSelectorAttachmentKind kind; + private WorkerSelectorAttachmentKind kind; /** Creates an instance of WorkerSelectorAttachment class. */ public WorkerSelectorAttachment() {} @@ -38,7 +40,5 @@ public WorkerSelectorAttachment() {} * Returns kind discriminator. * @return kind. */ - public WorkerSelectorAttachmentKind getKind() { - return this.kind; - } + public abstract WorkerSelectorAttachmentKind getKind(); } diff --git a/sdk/communication/azure-communication-messages/pom.xml b/sdk/communication/azure-communication-messages/pom.xml index a92a260b1824..cc6e7be55dfa 100644 --- a/sdk/communication/azure-communication-messages/pom.xml +++ b/sdk/communication/azure-communication-messages/pom.xml @@ -51,7 +51,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -61,7 +61,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -78,13 +78,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -108,13 +108,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -166,7 +166,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-phonenumbers/pom.xml b/sdk/communication/azure-communication-phonenumbers/pom.xml index f595b0db6c38..29ef3727cd5a 100644 --- a/sdk/communication/azure-communication-phonenumbers/pom.xml +++ b/sdk/communication/azure-communication-phonenumbers/pom.xml @@ -63,7 +63,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -103,7 +103,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -129,19 +129,19 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -203,7 +203,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-rooms/pom.xml b/sdk/communication/azure-communication-rooms/pom.xml index 770fe0ab910d..aaebb8acefae 100644 --- a/sdk/communication/azure-communication-rooms/pom.xml +++ b/sdk/communication/azure-communication-rooms/pom.xml @@ -59,7 +59,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -75,7 +75,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -105,25 +105,25 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -136,7 +136,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-communication-sms/pom.xml b/sdk/communication/azure-communication-sms/pom.xml index 39d958e5375f..6239888d59e9 100644 --- a/sdk/communication/azure-communication-sms/pom.xml +++ b/sdk/communication/azure-communication-sms/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -65,7 +65,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -101,19 +101,19 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -159,7 +159,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/communication/azure-resourcemanager-communication/pom.xml b/sdk/communication/azure-resourcemanager-communication/pom.xml index cfacdc333677..f23890aa15ba 100644 --- a/sdk/communication/azure-resourcemanager-communication/pom.xml +++ b/sdk/communication/azure-resourcemanager-communication/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml index 9c728ee997e3..ed292f0f8dd0 100644 --- a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/confidentialledger/azure-security-confidentialledger/README.md b/sdk/confidentialledger/azure-security-confidentialledger/README.md index 3e860f7c9dc4..5a41a30d9e04 100644 --- a/sdk/confidentialledger/azure-security-confidentialledger/README.md +++ b/sdk/confidentialledger/azure-security-confidentialledger/README.md @@ -49,7 +49,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` diff --git a/sdk/confidentialledger/azure-security-confidentialledger/pom.xml b/sdk/confidentialledger/azure-security-confidentialledger/pom.xml index 35a1a22c1f87..fbabf480ce88 100644 --- a/sdk/confidentialledger/azure-security-confidentialledger/pom.xml +++ b/sdk/confidentialledger/azure-security-confidentialledger/pom.xml @@ -46,12 +46,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -64,19 +64,19 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/confluent/azure-resourcemanager-confluent/pom.xml b/sdk/confluent/azure-resourcemanager-confluent/pom.xml index 77ce69f47f92..305e4aac16b3 100644 --- a/sdk/confluent/azure-resourcemanager-confluent/pom.xml +++ b/sdk/confluent/azure-resourcemanager-confluent/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/pom.xml b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/pom.xml index 9668138eecd0..465bfa840c1c 100644 --- a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/pom.xml +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/consumption/azure-resourcemanager-consumption/pom.xml b/sdk/consumption/azure-resourcemanager-consumption/pom.xml index c3d2648eb1e8..4a3878aaaebd 100644 --- a/sdk/consumption/azure-resourcemanager-consumption/pom.xml +++ b/sdk/consumption/azure-resourcemanager-consumption/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/containerregistry/azure-containers-containerregistry-perf/pom.xml b/sdk/containerregistry/azure-containers-containerregistry-perf/pom.xml index 63c656c6f050..16c88d8391df 100644 --- a/sdk/containerregistry/azure-containers-containerregistry-perf/pom.xml +++ b/sdk/containerregistry/azure-containers-containerregistry-perf/pom.xml @@ -36,18 +36,18 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 @@ -58,7 +58,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/sdk/containerregistry/azure-containers-containerregistry/pom.xml b/sdk/containerregistry/azure-containers-containerregistry/pom.xml index 4821b8f4cab0..311fc4bc5a52 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/pom.xml +++ b/sdk/containerregistry/azure-containers-containerregistry/pom.xml @@ -46,7 +46,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -56,7 +56,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -105,19 +105,19 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -129,7 +129,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -160,7 +160,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/pom.xml b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/pom.xml index 4c9c3551bf49..790015e76d79 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/pom.xml +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/contentsafety/azure-ai-contentsafety/pom.xml b/sdk/contentsafety/azure-ai-contentsafety/pom.xml index 5be92c41dc2e..e249c7a46e08 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/pom.xml +++ b/sdk/contentsafety/azure-ai-contentsafety/pom.xml @@ -50,12 +50,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -72,13 +72,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/core/azure-core-amqp-experimental/pom.xml b/sdk/core/azure-core-amqp-experimental/pom.xml index 1824ff6aab6f..026496cd94fc 100644 --- a/sdk/core/azure-core-amqp-experimental/pom.xml +++ b/sdk/core/azure-core-amqp-experimental/pom.xml @@ -66,7 +66,7 @@ com.azure azure-core-amqp - 2.9.4 + 2.10.0-beta.1 diff --git a/sdk/core/azure-core-amqp/CHANGELOG.md b/sdk/core/azure-core-amqp/CHANGELOG.md index 8e2a63de7575..90af453d028b 100644 --- a/sdk/core/azure-core-amqp/CHANGELOG.md +++ b/sdk/core/azure-core-amqp/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 2.10.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 2.9.4 (2024-05-01) ### Features Added diff --git a/sdk/core/azure-core-amqp/pom.xml b/sdk/core/azure-core-amqp/pom.xml index 2633d333de29..5a9c092cd499 100644 --- a/sdk/core/azure-core-amqp/pom.xml +++ b/sdk/core/azure-core-amqp/pom.xml @@ -14,7 +14,7 @@ com.azure azure-core-amqp - 2.9.4 + 2.10.0-beta.1 jar Microsoft Azure Java Core AMQP Library @@ -78,7 +78,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.microsoft.azure @@ -139,7 +139,7 @@ com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test diff --git a/sdk/core/azure-core-experimental/CHANGELOG.md b/sdk/core/azure-core-experimental/CHANGELOG.md index 8e0bc293126f..10f571930bb7 100644 --- a/sdk/core/azure-core-experimental/CHANGELOG.md +++ b/sdk/core/azure-core-experimental/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.51 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.50 (2024-05-01) ### Other Changes diff --git a/sdk/core/azure-core-experimental/pom.xml b/sdk/core/azure-core-experimental/pom.xml index 3775b80d5e75..aaacbfc94d44 100644 --- a/sdk/core/azure-core-experimental/pom.xml +++ b/sdk/core/azure-core-experimental/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-experimental jar - 1.0.0-beta.50 + 1.0.0-beta.51 Microsoft Azure Java Core Experimental Library This package contains experimental core types for Azure Java clients. @@ -80,7 +80,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 diff --git a/sdk/core/azure-core-http-jdk-httpclient/CHANGELOG.md b/sdk/core/azure-core-http-jdk-httpclient/CHANGELOG.md index c6f24b7d929a..3c59c64f53df 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/CHANGELOG.md +++ b/sdk/core/azure-core-http-jdk-httpclient/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.14 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.13 (2024-05-01) ### Other Changes diff --git a/sdk/core/azure-core-http-jdk-httpclient/pom.xml b/sdk/core/azure-core-http-jdk-httpclient/pom.xml index 92b098750231..40282939dfda 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/pom.xml +++ b/sdk/core/azure-core-http-jdk-httpclient/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-http-jdk-httpclient jar - 1.0.0-beta.13 + 1.0.0-beta.14 Microsoft Azure JDK HTTP Client Library This package contains the Azure HTTP client library using the JDK HttpClient API. @@ -78,27 +78,27 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.azure azure-core - 1.49.0 + 1.50.0-beta.1 test-jar test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test-jar test diff --git a/sdk/core/azure-core-http-netty/CHANGELOG.md b/sdk/core/azure-core-http-netty/CHANGELOG.md index ce7d5958069e..c62424c82130 100644 --- a/sdk/core/azure-core-http-netty/CHANGELOG.md +++ b/sdk/core/azure-core-http-netty/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.16.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.15.0 (2024-05-01) ### Bugs Fixed diff --git a/sdk/core/azure-core-http-netty/pom.xml b/sdk/core/azure-core-http-netty/pom.xml index 6bdbb6e5e0b1..fae57fc5b8bd 100644 --- a/sdk/core/azure-core-http-netty/pom.xml +++ b/sdk/core/azure-core-http-netty/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-http-netty jar - 1.15.0 + 1.16.0-beta.1 Microsoft Azure Netty HTTP Client Library This package contains the Netty HTTP client plugin for azure-core. @@ -83,7 +83,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 @@ -157,20 +157,20 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 test-jar test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test-jar test diff --git a/sdk/core/azure-core-http-okhttp/CHANGELOG.md b/sdk/core/azure-core-http-okhttp/CHANGELOG.md index faabb91025dc..f9b70ce977ed 100644 --- a/sdk/core/azure-core-http-okhttp/CHANGELOG.md +++ b/sdk/core/azure-core-http-okhttp/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.12.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.11.21 (2024-05-01) ### Other Changes diff --git a/sdk/core/azure-core-http-okhttp/pom.xml b/sdk/core/azure-core-http-okhttp/pom.xml index 261b83240c29..70640ecd77cb 100644 --- a/sdk/core/azure-core-http-okhttp/pom.xml +++ b/sdk/core/azure-core-http-okhttp/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-http-okhttp jar - 1.11.21 + 1.12.0-beta.1 Microsoft Azure OkHttp HTTP Client Library This package contains the OkHttp HTTP client plugin for azure-core. @@ -79,7 +79,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 @@ -98,20 +98,20 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 test-jar test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test-jar test diff --git a/sdk/core/azure-core-http-vertx/CHANGELOG.md b/sdk/core/azure-core-http-vertx/CHANGELOG.md index d5bd9554ede8..8c692e2a2dff 100644 --- a/sdk/core/azure-core-http-vertx/CHANGELOG.md +++ b/sdk/core/azure-core-http-vertx/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.19 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.18 (2024-05-01) ### Other Changes diff --git a/sdk/core/azure-core-http-vertx/pom.xml b/sdk/core/azure-core-http-vertx/pom.xml index 575c2c044153..b077001bce30 100644 --- a/sdk/core/azure-core-http-vertx/pom.xml +++ b/sdk/core/azure-core-http-vertx/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-http-vertx jar - 1.0.0-beta.18 + 1.0.0-beta.19 Microsoft Azure Vert.x HTTP Client Library This package contains the Vert.x HTTP client plugin for azure-core. @@ -79,7 +79,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 @@ -106,20 +106,20 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 test-jar test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test-jar test diff --git a/sdk/core/azure-core-management/CHANGELOG.md b/sdk/core/azure-core-management/CHANGELOG.md index e4481f3a61d8..925820f38911 100644 --- a/sdk/core/azure-core-management/CHANGELOG.md +++ b/sdk/core/azure-core-management/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.15.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.14.0 (2024-05-01) ### Features Added diff --git a/sdk/core/azure-core-management/pom.xml b/sdk/core/azure-core-management/pom.xml index e84a3836ba32..e961b7f3ab1a 100644 --- a/sdk/core/azure-core-management/pom.xml +++ b/sdk/core/azure-core-management/pom.xml @@ -13,7 +13,7 @@ com.azure azure-core-management - 1.14.0 + 1.15.0-beta.1 jar Microsoft Azure Management Java Core Library @@ -77,7 +77,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 @@ -107,7 +107,7 @@ com.azure azure-core-http-netty - 1.15.0 + 1.16.0-beta.1 test diff --git a/sdk/core/azure-core-metrics-opentelemetry/CHANGELOG.md b/sdk/core/azure-core-metrics-opentelemetry/CHANGELOG.md index 5f5b80686437..54e8588013c2 100644 --- a/sdk/core/azure-core-metrics-opentelemetry/CHANGELOG.md +++ b/sdk/core/azure-core-metrics-opentelemetry/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.20 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.19 (2024-05-01) ### Other Changes diff --git a/sdk/core/azure-core-metrics-opentelemetry/pom.xml b/sdk/core/azure-core-metrics-opentelemetry/pom.xml index f00b0692665b..c0af751b63aa 100644 --- a/sdk/core/azure-core-metrics-opentelemetry/pom.xml +++ b/sdk/core/azure-core-metrics-opentelemetry/pom.xml @@ -12,7 +12,7 @@ com.azure azure-core-metrics-opentelemetry - 1.0.0-beta.19 + 1.0.0-beta.20 Microsoft Azure OpenTelemetry metrics plugin This package contains the OpenTelemetry metrics plugin for Azure client libraries. @@ -54,7 +54,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.google.code.findbugs @@ -81,13 +81,13 @@ com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test com.azure azure-core-http-netty - 1.15.0 + 1.16.0-beta.1 test diff --git a/sdk/core/azure-core-perf/pom.xml b/sdk/core/azure-core-perf/pom.xml index 2fd6ea2dbf94..977c2d10af63 100644 --- a/sdk/core/azure-core-perf/pom.xml +++ b/sdk/core/azure-core-perf/pom.xml @@ -25,17 +25,17 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.azure azure-core-http-netty - 1.15.0 + 1.16.0-beta.1 com.azure azure-core-http-okhttp - 1.11.21 + 1.12.0-beta.1 com.azure diff --git a/sdk/core/azure-core-serializer-avro-apache/CHANGELOG.md b/sdk/core/azure-core-serializer-avro-apache/CHANGELOG.md index f156a7ff6534..4215af3441ae 100644 --- a/sdk/core/azure-core-serializer-avro-apache/CHANGELOG.md +++ b/sdk/core/azure-core-serializer-avro-apache/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.47 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.46 (2024-05-01) ### Other Changes diff --git a/sdk/core/azure-core-serializer-avro-apache/pom.xml b/sdk/core/azure-core-serializer-avro-apache/pom.xml index eb9500357e7e..7845d3f184e1 100644 --- a/sdk/core/azure-core-serializer-avro-apache/pom.xml +++ b/sdk/core/azure-core-serializer-avro-apache/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-serializer-avro-apache jar - 1.0.0-beta.46 + 1.0.0-beta.47 Microsoft Azure Apache Avro Serializer Library This package contains the Apache Avro serializer client plugin for azure-core. @@ -78,12 +78,12 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.azure azure-core-experimental - 1.0.0-beta.50 + 1.0.0-beta.51 diff --git a/sdk/core/azure-core-serializer-avro-jackson/pom.xml b/sdk/core/azure-core-serializer-avro-jackson/pom.xml index 8da7949cd41a..e4e8024dcf87 100644 --- a/sdk/core/azure-core-serializer-avro-jackson/pom.xml +++ b/sdk/core/azure-core-serializer-avro-jackson/pom.xml @@ -70,12 +70,12 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.azure azure-core-experimental - 1.0.0-beta.50 + 1.0.0-beta.51 diff --git a/sdk/core/azure-core-serializer-json-gson/CHANGELOG.md b/sdk/core/azure-core-serializer-json-gson/CHANGELOG.md index aff12eeb3a12..9aaa86e7ed26 100644 --- a/sdk/core/azure-core-serializer-json-gson/CHANGELOG.md +++ b/sdk/core/azure-core-serializer-json-gson/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.3.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.2.12 (2024-05-01) ### Other Changes diff --git a/sdk/core/azure-core-serializer-json-gson/pom.xml b/sdk/core/azure-core-serializer-json-gson/pom.xml index e8a42af04ba6..102cf05fa701 100644 --- a/sdk/core/azure-core-serializer-json-gson/pom.xml +++ b/sdk/core/azure-core-serializer-json-gson/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-serializer-json-gson jar - 1.2.12 + 1.3.0-beta.1 Microsoft Azure Gson JSON Serializer Library This package contains the Gson JSON serializer client plugin for azure-core. @@ -79,7 +79,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.azure diff --git a/sdk/core/azure-core-serializer-json-jackson/CHANGELOG.md b/sdk/core/azure-core-serializer-json-jackson/CHANGELOG.md index c40f21203f78..f703eaca6404 100644 --- a/sdk/core/azure-core-serializer-json-jackson/CHANGELOG.md +++ b/sdk/core/azure-core-serializer-json-jackson/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.5.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.4.12 (2024-05-01) ### Other Changes diff --git a/sdk/core/azure-core-serializer-json-jackson/pom.xml b/sdk/core/azure-core-serializer-json-jackson/pom.xml index db5bddfaee68..94ec30f14c4b 100644 --- a/sdk/core/azure-core-serializer-json-jackson/pom.xml +++ b/sdk/core/azure-core-serializer-json-jackson/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core-serializer-json-jackson jar - 1.4.12 + 1.5.0-beta.1 Microsoft Azure Jackson JSON Serializer Library This package contains the Jackson JSON serializer client plugin for azure-core. @@ -91,7 +91,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 diff --git a/sdk/core/azure-core-test/CHANGELOG.md b/sdk/core/azure-core-test/CHANGELOG.md index dee4e183dc0d..2b0b84825831 100644 --- a/sdk/core/azure-core-test/CHANGELOG.md +++ b/sdk/core/azure-core-test/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.26.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.25.0 (2024-05-01) ### Features Added diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index c31ab8189b1c..5bc7fade6ee1 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -13,7 +13,7 @@ com.azure azure-core-test jar - 1.25.0 + 1.26.0-beta.1 Microsoft Azure Java Core Test Library This package contains core test types for Azure Java clients. @@ -72,7 +72,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 diff --git a/sdk/core/azure-core-tracing-opentelemetry-samples/pom.xml b/sdk/core/azure-core-tracing-opentelemetry-samples/pom.xml index 05d3180085a2..daebbbff7e38 100644 --- a/sdk/core/azure-core-tracing-opentelemetry-samples/pom.xml +++ b/sdk/core/azure-core-tracing-opentelemetry-samples/pom.xml @@ -40,14 +40,14 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.46 + 1.0.0-beta.47 com.azure azure-core-http-netty - 1.15.0 + 1.16.0-beta.1 test @@ -77,7 +77,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md b/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md index 14eba26b91a1..81b657de879c 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md +++ b/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.47 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.46 (2024-05-01) ### Breaking Changes diff --git a/sdk/core/azure-core-tracing-opentelemetry/pom.xml b/sdk/core/azure-core-tracing-opentelemetry/pom.xml index 3fe946e6ce08..ceb5e0d93769 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/pom.xml +++ b/sdk/core/azure-core-tracing-opentelemetry/pom.xml @@ -12,7 +12,7 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.46 + 1.0.0-beta.47 Microsoft Azure OpenTelemetry tracing plugin This package contains the OpenTelemetry tracing plugin for Azure client libraries. @@ -67,7 +67,7 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.google.code.findbugs @@ -86,19 +86,19 @@ com.azure azure-core-experimental - 1.0.0-beta.50 + 1.0.0-beta.51 test com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test com.azure azure-core-http-netty - 1.15.0 + 1.16.0-beta.1 test diff --git a/sdk/core/azure-core-version-tests/pom.xml b/sdk/core/azure-core-version-tests/pom.xml index d158c83a5b6b..2219f6dbd19a 100644 --- a/sdk/core/azure-core-version-tests/pom.xml +++ b/sdk/core/azure-core-version-tests/pom.xml @@ -62,12 +62,12 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.azure azure-core-serializer-json-jackson - 1.4.12 + 1.5.0-beta.1 com.fasterxml.jackson.core @@ -113,7 +113,7 @@ com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 io.projectreactor diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index e06e0ff78750..ae330f04e508 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.50.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.49.0 (2024-05-01) ### Features Added diff --git a/sdk/core/azure-core/pom.xml b/sdk/core/azure-core/pom.xml index 5e5c56843e51..f3ca63be12c6 100644 --- a/sdk/core/azure-core/pom.xml +++ b/sdk/core/azure-core/pom.xml @@ -15,7 +15,7 @@ com.azure azure-core jar - 1.49.0 + 1.50.0-beta.1 Microsoft Azure Java Core Library This package contains core types for Azure Java clients. diff --git a/sdk/cosmos/azure-cosmos-benchmark/pom.xml b/sdk/cosmos/azure-cosmos-benchmark/pom.xml index 24ed62af4562..7b600be0aaa6 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/pom.xml +++ b/sdk/cosmos/azure-cosmos-benchmark/pom.xml @@ -63,7 +63,7 @@ Licensed under the MIT License. com.azure azure-identity - 1.12.0 + 1.12.1 com.azure diff --git a/sdk/cosmos/azure-cosmos-encryption/pom.xml b/sdk/cosmos/azure-cosmos-encryption/pom.xml index 9ca5f42b55b6..1d853540d269 100644 --- a/sdk/cosmos/azure-cosmos-encryption/pom.xml +++ b/sdk/cosmos/azure-cosmos-encryption/pom.xml @@ -80,7 +80,7 @@ Licensed under the MIT License. com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/cosmos/azure-cosmos-kafka-connect/doc/configuration-reference.md b/sdk/cosmos/azure-cosmos-kafka-connect/doc/configuration-reference.md index a326f75be4ac..9e5b224b60a1 100644 --- a/sdk/cosmos/azure-cosmos-kafka-connect/doc/configuration-reference.md +++ b/sdk/cosmos/azure-cosmos-kafka-connect/doc/configuration-reference.md @@ -2,65 +2,65 @@ ## Generic Configuration -| Config Property Name | Default | Description | -|:--------------------------------------------------------------------|:-----------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `azure.cosmos.account.endpoint` | None | Cosmos DB Account Endpoint Uri | -| `azure.cosmos.account.environment` | `Azure` | The azure environment of the CosmosDB account: `Azure`, `AzureChina`, `AzureUsGovernment`, `AzureGermany`. | -| `azure.cosmos.account.tenantId` | `""` | The tenantId of the CosmosDB account. Required for `ServicePrincipal` authentication. | -| `azure.cosmos.auth.type` | `MasterKey` | There are two auth types are supported currently: `MasterKey`(PrimaryReadWriteKeys, SecondReadWriteKeys, PrimaryReadOnlyKeys, SecondReadWriteKeys), `ServicePrincipal` | -| `azure.cosmos.account.key` | `""` | Cosmos DB Account Key (only required in case of `auth.type` as `MasterKey`) | -| `azure.cosmos.auth.aad.clientId` | `""` | The clientId/ApplicationId of the service principal. Required for `ServicePrincipal` authentication. | -| `azure.cosmos.auth.aad.clientSecret` | `""` | The client secret/password of the service principal. | -| `azure.cosmos.mode.gateway` | `false` | Flag to indicate whether to use gateway mode. By default it is false, means SDK uses direct mode. https://learn.microsoft.com/azure/cosmos-db/nosql/sdk-connection-modes | -| `azure.cosmos.preferredRegionList` | `[]` | Preferred regions list to be used for a multi region Cosmos DB account. This is a comma separated value (e.g., `[East US, West US]` or `East US, West US`) provided preferred regions will be used as hint. You should use a collocated kafka cluster with your Cosmos DB account and pass the kafka cluster region as preferred region. See list of azure regions [here](https://docs.microsoft.com/dotnet/api/microsoft.azure.documents.locationnames?view=azure-dotnet&preserve-view=true). | -| `azure.cosmos.application.name` | `""` | Application name. Will be added as the userAgent suffix. | -| `azure.cosmos.throughputControl.enabled` | `false` | A flag to indicate whether throughput control is enabled. | -| `azure.cosmos.throughputControl.account.endpoint` | `""` | Cosmos DB Throughput Control Account Endpoint Uri. | -| `azure.cosmos.throughputControl.account.environment` | `Azure` | The azure environment of the CosmosDB account: `Azure`, `AzureChina`, `AzureUsGovernment`, `AzureGermany`. | -| `azure.cosmos.throughputControl.account.tenantId` | `""` | The tenantId of the CosmosDB account. Required for `ServicePrincipal` authentication. | -| `azure.cosmos.throughputControl.auth.type` | `MasterKey` | There are two auth types are supported currently: `MasterKey`(PrimaryReadWriteKeys, SecondReadWriteKeys, PrimaryReadOnlyKeys, SecondReadWriteKeys), `ServicePrincipal` | -| `azure.cosmos.throughputControl.account.key` | `""` | Cosmos DB Throughput Control Account Key (only required in case of `throughputControl.auth.type` as `MasterKey`). | -| `azure.cosmos.throughputControl.auth.aad.clientId` | `""` | The clientId/ApplicationId of the service principal. Required for `ServicePrincipal` authentication. | -| `azure.cosmos.throughputControl.auth.aad.clientSecret` | `""` | The client secret/password of the service principal. | -| `azure.cosmos.throughputControl.preferredRegionList` | `[]` | Preferred regions list to be used for a multi region Cosmos DB account. This is a comma separated value (e.g., `[East US, West US]` or `East US, West US`) provided preferred regions will be used as hint. You should use a collocated kafka cluster with your Cosmos DB account and pass the kafka cluster region as preferred region. See list of azure regions [here](https://docs.microsoft.com/dotnet/api/microsoft.azure.documents.locationnames?view=azure-dotnet&preserve-view=true). | -| `azure.cosmos.throughputControl.mode.gateway` | `false` | Flag to indicate whether to use gateway mode. By default it is false, means SDK uses direct mode. https://learn.microsoft.com/azure/cosmos-db/nosql/sdk-connection-modes | -| `azure.cosmos.throughputControl.group.name` | `""` | Throughput control group name. Since customer is allowed to create many groups for a container, the name should be unique. | -| `azure.cosmos.throughputControl.targetThroughput` | `-1` | Throughput control group target throughput. The value should be larger than 0. | -| `azure.cosmos.throughputControl.targetThroughputThreshold` | `-1` | Throughput control group target throughput threshold. The value should be between (0,1]. | -| `azure.cosmos.throughputControl.priorityLevel` | `None` | Throughput control group priority level. The value can be None, High or Low. | -| `azure.cosmos.throughputControl.globalControl.database.name` | `""` | Database which will be used for throughput global control. | -| `azure.cosmos.throughputControl.globalControl.container.name` | `""` | Container which will be used for throughput global control. | -| `azure.cosmos.throughputControl.globalControl.renewIntervalInMS` | `-1` | This controls how often the client is going to update the throughput usage of itself and adjust its own throughput share based on the throughput usage of other clients. Default is 5s, the allowed min value is 5s. | -| `azure.cosmos.throughputControl.globalControl.expireIntervalInMS` | `-1` | This controls how quickly we will detect the client has been offline and hence allow its throughput share to be taken by other clients. Default is 11s, the allowed min value is 2 * renewIntervalInMS + 1. | +| Config Property Name | Default | Description | +|:------------------------------------------------------------------|:-----------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `azure.cosmos.account.endpoint` | None | Cosmos DB Account Endpoint Uri | +| `azure.cosmos.account.environment` | `Azure` | The azure environment of the CosmosDB account: `Azure`, `AzureChina`, `AzureUsGovernment`, `AzureGermany`. | +| `azure.cosmos.account.tenantId` | `""` | The tenantId of the CosmosDB account. Required for `ServicePrincipal` authentication. | +| `azure.cosmos.auth.type` | `MasterKey` | There are two auth types are supported currently: `MasterKey`(PrimaryReadWriteKeys, SecondReadWriteKeys, PrimaryReadOnlyKeys, SecondReadWriteKeys), `ServicePrincipal` | +| `azure.cosmos.account.key` | `""` | Cosmos DB Account Key (only required in case of `auth.type` as `MasterKey`) | +| `azure.cosmos.auth.aad.clientId` | `""` | The clientId/ApplicationId of the service principal. Required for `ServicePrincipal` authentication. | +| `azure.cosmos.auth.aad.clientSecret` | `""` | The client secret/password of the service principal. | +| `azure.cosmos.mode.gateway` | `false` | Flag to indicate whether to use gateway mode. By default it is false, means SDK uses direct mode. https://learn.microsoft.com/azure/cosmos-db/nosql/sdk-connection-modes | +| `azure.cosmos.preferredRegionList` | `[]` | Preferred regions list to be used for a multi region Cosmos DB account. This is a comma separated value (e.g., `[East US, West US]` or `East US, West US`) provided preferred regions will be used as hint. You should use a collocated kafka cluster with your Cosmos DB account and pass the kafka cluster region as preferred region. See list of azure regions [here](https://docs.microsoft.com/dotnet/api/microsoft.azure.documents.locationnames?view=azure-dotnet&preserve-view=true). | +| `azure.cosmos.application.name` | `""` | Application name. Will be added as the userAgent suffix. | +| `azure.cosmos.throughputControl.enabled` | `false` | A flag to indicate whether throughput control is enabled. | +| `azure.cosmos.throughputControl.account.endpoint` | `""` | Cosmos DB Throughput Control Account Endpoint Uri. | +| `azure.cosmos.throughputControl.account.environment` | `Azure` | The azure environment of the CosmosDB account: `Azure`, `AzureChina`, `AzureUsGovernment`, `AzureGermany`. | +| `azure.cosmos.throughputControl.account.tenantId` | `""` | The tenantId of the CosmosDB account. Required for `ServicePrincipal` authentication. | +| `azure.cosmos.throughputControl.auth.type` | `MasterKey` | There are two auth types are supported currently: `MasterKey`(PrimaryReadWriteKeys, SecondReadWriteKeys, PrimaryReadOnlyKeys, SecondReadWriteKeys), `ServicePrincipal` | +| `azure.cosmos.throughputControl.account.key` | `""` | Cosmos DB Throughput Control Account Key (only required in case of `throughputControl.auth.type` as `MasterKey`). | +| `azure.cosmos.throughputControl.auth.aad.clientId` | `""` | The clientId/ApplicationId of the service principal. Required for `ServicePrincipal` authentication. | +| `azure.cosmos.throughputControl.auth.aad.clientSecret` | `""` | The client secret/password of the service principal. | +| `azure.cosmos.throughputControl.preferredRegionList` | `[]` | Preferred regions list to be used for a multi region Cosmos DB account. This is a comma separated value (e.g., `[East US, West US]` or `East US, West US`) provided preferred regions will be used as hint. You should use a collocated kafka cluster with your Cosmos DB account and pass the kafka cluster region as preferred region. See list of azure regions [here](https://docs.microsoft.com/dotnet/api/microsoft.azure.documents.locationnames?view=azure-dotnet&preserve-view=true). | +| `azure.cosmos.throughputControl.mode.gateway` | `false` | Flag to indicate whether to use gateway mode. By default it is false, means SDK uses direct mode. https://learn.microsoft.com/azure/cosmos-db/nosql/sdk-connection-modes | +| `azure.cosmos.throughputControl.group.name` | `""` | Throughput control group name. Since customer is allowed to create many groups for a container, the name should be unique. | +| `azure.cosmos.throughputControl.targetThroughput` | `-1` | Throughput control group target throughput. The value should be larger than 0. | +| `azure.cosmos.throughputControl.targetThroughputThreshold` | `-1` | Throughput control group target throughput threshold. The value should be between (0,1]. | +| `azure.cosmos.throughputControl.priorityLevel` | `None` | Throughput control group priority level. The value can be None, High or Low. | +| `azure.cosmos.throughputControl.globalControl.database.name` | `""` | Database which will be used for throughput global control. | +| `azure.cosmos.throughputControl.globalControl.container.name` | `""` | Container which will be used for throughput global control. | +| `azure.cosmos.throughputControl.globalControl.renewIntervalInMS` | `-1` | This controls how often the client is going to update the throughput usage of itself and adjust its own throughput share based on the throughput usage of other clients. Default is 5s, the allowed min value is 5s. | +| `azure.cosmos.throughputControl.globalControl.expireIntervalInMS` | `-1` | This controls how quickly we will detect the client has been offline and hence allow its throughput share to be taken by other clients. Default is 11s, the allowed min value is 2 * renewIntervalInMS + 1. | ## Source Connector Configuration -| Config Property Name | Default | Description | -|:--------------------------------------------------|:---------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `azure.cosmos.source.database.name` | None | Cosmos DB database name. | -| `azure.cosmos.source.containers.includeAll` | `false` | Flag to indicate whether reading from all containers. | -| `azure.cosmos.source.containers.includedList` | `[]` | Containers included. This config will be ignored if azure.cosmos.source.containers.includeAll is true. | -| `azure.cosmos.source.containers.topicMap` | `[]` | A comma delimited list of Kafka topics mapped to Cosmos containers. For example: topic1#con1,topic2#con2. By default, container name is used as the name of the kafka topic to publish data to, can use this property to override the default config | -| `azure.cosmos.source.changeFeed.startFrom` | `Beginning` | ChangeFeed Start from settings (Now, Beginning or a certain point in time (UTC) for example 2020-02-10T14:15:03) - the default value is 'Beginning'. | -| `azure.cosmos.source.changeFeed.mode` | `LatestVersion` | ChangeFeed mode (LatestVersion or AllVersionsAndDeletes). | -| `azure.cosmos.source.changeFeed.maxItemCountHint` | `1000` | The maximum number of documents returned in a single change feed request. But the number of items received might be higher than the specified value if multiple items are changed by the same transaction. | -| `azure.cosmos.source.metadata.poll.delay.ms` | `300000` | Indicates how often to check the metadata changes (including container split/merge, adding/removing/recreated containers). When changes are detected, it will reconfigure the tasks. Default is 5 minutes. | -| `azure.cosmos.source.metadata.storage.type` | `Kafka` | The storage type of the metadata. Two types are supported: Cosmos, Kafka. | -| `azure.cosmos.source.metadata.storage.name` | `_cosmos.metadata.topic` | The resource name of the metadata storage. If metadata storage type is Kafka topic, then this config refers to kafka topic name, the metadata topic will be created if it does not already exist, else it will use the pre-created topic. If metadata storage type is CosmosDB container, then this config refers to container name, please pre-create the metadata container partitioned by /id. | -| `azure.cosmos.source.messageKey.enabled` | `true` | Whether to set the kafka record message key. | -| `azure.cosmos.source.messageKey.field` | `id` | The field to use as the message key. | +| Config Property Name | Default | Description | +|:--------------------------------------------------|:-------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `azure.cosmos.source.database.name` | None | Cosmos DB database name. | +| `azure.cosmos.source.containers.includeAll` | `false` | Flag to indicate whether reading from all containers. | +| `azure.cosmos.source.containers.includedList` | `[]` | Containers included. This config will be ignored if azure.cosmos.source.containers.includeAll is true. | +| `azure.cosmos.source.containers.topicMap` | `[]` | A comma delimited list of Kafka topics mapped to Cosmos containers. For example: topic1#con1,topic2#con2. By default, container name is used as the name of the kafka topic to publish data to, can use this property to override the default config | +| `azure.cosmos.source.changeFeed.startFrom` | `Beginning` | ChangeFeed Start from settings (Now, Beginning or a certain point in time (UTC) for example 2020-02-10T14:15:03) - the default value is 'Beginning'. | +| `azure.cosmos.source.changeFeed.mode` | `LatestVersion` | ChangeFeed mode (LatestVersion or AllVersionsAndDeletes). | +| `azure.cosmos.source.changeFeed.maxItemCountHint` | `1000` | The maximum number of documents returned in a single change feed request. But the number of items received might be higher than the specified value if multiple items are changed by the same transaction. | +| `azure.cosmos.source.metadata.poll.delay.ms` | `300000` | Indicates how often to check the metadata changes (including container split/merge, adding/removing/recreated containers). When changes are detected, it will reconfigure the tasks. Default is 5 minutes. | +| `azure.cosmos.source.metadata.storage.type` | `Kafka` | The storage type of the metadata. Two types are supported: Cosmos, Kafka. | +| `azure.cosmos.source.metadata.storage.name` | `_cosmos.metadata.topic` | The resource name of the metadata storage. If metadata storage type is Kafka topic, then this config refers to kafka topic name, the metadata topic will be created if it does not already exist, else it will use the pre-created topic. If metadata storage type is `Cosmos`, then this config refers to container name, for `MasterKey` auth, this container will be created with `AutoScale` with 4000 RU if not already exists, for `ServicePrincipal` auth, it requires the container to be created ahead of time . | +| `azure.cosmos.source.messageKey.enabled` | `true` | Whether to set the kafka record message key. | +| `azure.cosmos.source.messageKey.field` | `id` | The field to use as the message key. | ## Sink Connector Configuration -| Config Property Name | Default | Description | -|:-------------------------------------------------------|:--------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `azure.cosmos.sink.database.name` | `""` | Cosmos DB database name. | -| `azure.cosmos.sink.containers.topicMap` | `""` | A comma delimited list of Kafka topics mapped to Cosmos containers. For example: topic1#con1,topic2#con2. | -| `azure.cosmos.sink.errors.tolerance.level` | `None` | Error tolerance level after exhausting all retries. `None` for fail on error. `All` for log and continue | -| `azure.cosmos.sink.bulk.enabled` | `true` | Flag to indicate whether Cosmos DB bulk mode is enabled for Sink connector. By default it is true. | -| `azure.cosmos.sink.bulk.maxConcurrentCosmosPartitions` | `-1` | Cosmos DB Item Write Max Concurrent Cosmos Partitions. If not specified it will be determined based on the number of the container's physical partitions which would indicate every batch is expected to have data from all Cosmos physical partitions. If specified it indicates from at most how many Cosmos Physical Partitions each batch contains data. So this config can be used to make bulk processing more efficient when input data in each batch has been repartitioned to balance to how many Cosmos partitions each batch needs to write. This is mainly useful for very large containers (with hundreds of physical partitions. | -| `azure.cosmos.sink.bulk.initialBatchSize` | `1` | Cosmos DB initial bulk micro batch size - a micro batch will be flushed to the backend when the number of documents enqueued exceeds this size - or the target payload size is met. The micro batch size is getting automatically tuned based on the throttling rate. By default the initial micro batch size is 1. Reduce this when you want to avoid that the first few requests consume too many RUs. | -| `azure.cosmos.sink.write.strategy` | `ItemOverwrite` | Cosmos DB Item write Strategy: `ItemOverwrite` (using upsert), `ItemAppend` (using create, ignore pre-existing items i.e., Conflicts), `ItemDelete` (deletes based on id/pk of data frame), `ItemDeleteIfNotModified` (deletes based on id/pk of data frame if etag hasn't changed since collecting id/pk), `ItemOverwriteIfNotModified` (using create if etag is empty, update/replace with etag pre-condition otherwise, if document was updated the pre-condition failure is ignored), `ItemPatch` (Partial update all documents based on the patch config) | -| `azure.cosmos.sink.maxRetryCount` | `10` | Cosmos DB max retry attempts on write failures for Sink connector. By default, the connector will retry on transient write errors for up to 10 times. | -| `azure.cosmos.sink.id.strategy` | `ProvidedInValueStrategy` | A strategy used to populate the document with an ``id``. Valid strategies are: ``TemplateStrategy``, ``FullKeyStrategy``, ``KafkaMetadataStrategy``, ``ProvidedInKeyStrategy``, ``ProvidedInValueStrategy``. Configuration properties prefixed with``id.strategy`` are passed through to the strategy. For example, when using ``id.strategy=TemplateStrategy`` , the property ``id.strategy.template`` is passed through to the template strategy and used to specify the template string to be used in constructing the ``id``. | -| `azure.cosmos.sink.write.patch.operationType.default` | `Set` | Default Cosmos DB patch operation type. Supported ones include none, add, set, replace, remove, increment. Choose none for no-op, for others please reference [here](https://docs.microsoft.com/azure/cosmos-db/partial-document-update#supported-operations) for full context. | -| `azure.cosmos.sink.write.patch.property.configs` | `""` | Cosmos DB patch json property configs. It can contain multiple definitions matching the following patterns separated by comma. property(jsonProperty).op(operationType) or property(jsonProperty).path(patchInCosmosdb).op(operationType) - The difference of the second pattern is that it also allows you to define a different cosmosdb path. Note: It does not support nested json property config. | -| `azure.cosmos.sink.write.patch.filter` | `""` | Used for [Conditional patch](https://docs.microsoft.com/azure/cosmos-db/partial-document-update-getting-started#java) | +| Config Property Name | Default | Description | +|:-----------------------------------------------------------|:--------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `azure.cosmos.sink.database.name` | `""` | Cosmos DB database name. | +| `azure.cosmos.sink.containers.topicMap` | `""` | A comma delimited list of Kafka topics mapped to Cosmos containers. For example: topic1#con1,topic2#con2. | +| `azure.cosmos.sink.errors.tolerance.level` | `None` | Error tolerance level after exhausting all retries. `None` for fail on error. `All` for log and continue | +| `azure.cosmos.sink.bulk.enabled` | `true` | Flag to indicate whether Cosmos DB bulk mode is enabled for Sink connector. By default it is true. | +| `azure.cosmos.sink.bulk.maxConcurrentCosmosPartitions` | `-1` | Cosmos DB Item Write Max Concurrent Cosmos Partitions. If not specified it will be determined based on the number of the container's physical partitions which would indicate every batch is expected to have data from all Cosmos physical partitions. If specified it indicates from at most how many Cosmos Physical Partitions each batch contains data. So this config can be used to make bulk processing more efficient when input data in each batch has been repartitioned to balance to how many Cosmos partitions each batch needs to write. This is mainly useful for very large containers (with hundreds of physical partitions. | +| `azure.cosmos.sink.bulk.initialBatchSize` | `1` | Cosmos DB initial bulk micro batch size - a micro batch will be flushed to the backend when the number of documents enqueued exceeds this size - or the target payload size is met. The micro batch size is getting automatically tuned based on the throttling rate. By default the initial micro batch size is 1. Reduce this when you want to avoid that the first few requests consume too many RUs. | +| `azure.cosmos.sink.write.strategy` | `ItemOverwrite` | Cosmos DB Item write Strategy: `ItemOverwrite` (using upsert), `ItemAppend` (using create, ignore pre-existing items i.e., Conflicts), `ItemDelete` (deletes based on id/pk of data frame), `ItemDeleteIfNotModified` (deletes based on id/pk of data frame if etag hasn't changed since collecting id/pk), `ItemOverwriteIfNotModified` (using create if etag is empty, update/replace with etag pre-condition otherwise, if document was updated the pre-condition failure is ignored), `ItemPatch` (Partial update all documents based on the patch config) | +| `azure.cosmos.sink.maxRetryCount` | `10` | Cosmos DB max retry attempts on write failures for Sink connector. By default, the connector will retry on transient write errors for up to 10 times. | +| `azure.cosmos.sink.id.strategy` | `ProvidedInValueStrategy` | A strategy used to populate the document with an ``id``. Valid strategies are: ``TemplateStrategy``, ``FullKeyStrategy``, ``KafkaMetadataStrategy``, ``ProvidedInKeyStrategy``, ``ProvidedInValueStrategy``. Configuration properties prefixed with``id.strategy`` are passed through to the strategy. For example, when using ``id.strategy=TemplateStrategy`` , the property ``id.strategy.template`` is passed through to the template strategy and used to specify the template string to be used in constructing the ``id``. | +| `azure.cosmos.sink.write.patch.operationType.default` | `Set` | Default Cosmos DB patch operation type. Supported ones include none, add, set, replace, remove, increment. Choose none for no-op, for others please reference [here](https://docs.microsoft.com/azure/cosmos-db/partial-document-update#supported-operations) for full context. | +| `azure.cosmos.sink.write.patch.property.configs` | `""` | Cosmos DB patch json property configs. It can contain multiple definitions matching the following patterns separated by comma. property(jsonProperty).op(operationType) or property(jsonProperty).path(patchInCosmosdb).op(operationType) - The difference of the second pattern is that it also allows you to define a different cosmosdb path. Note: It does not support nested json property config. | +| `azure.cosmos.sink.write.patch.filter` | `""` | Used for [Conditional patch](https://docs.microsoft.com/azure/cosmos-db/partial-document-update-getting-started#java) | diff --git a/sdk/cosmos/azure-cosmos-kafka-connect/pom.xml b/sdk/cosmos/azure-cosmos-kafka-connect/pom.xml index 6681aeef5509..ae5e2dfef8f8 100644 --- a/sdk/cosmos/azure-cosmos-kafka-connect/pom.xml +++ b/sdk/cosmos/azure-cosmos-kafka-connect/pom.xml @@ -126,7 +126,7 @@ Licensed under the MIT License. com.azure azure-identity - 1.12.0 + 1.12.1 com.azure diff --git a/sdk/cosmos/azure-cosmos-kafka-connect/src/main/java/com/azure/cosmos/kafka/connect/implementation/source/CosmosSourceConfig.java b/sdk/cosmos/azure-cosmos-kafka-connect/src/main/java/com/azure/cosmos/kafka/connect/implementation/source/CosmosSourceConfig.java index 2cc8ee56c734..ba7a2821ac20 100644 --- a/sdk/cosmos/azure-cosmos-kafka-connect/src/main/java/com/azure/cosmos/kafka/connect/implementation/source/CosmosSourceConfig.java +++ b/sdk/cosmos/azure-cosmos-kafka-connect/src/main/java/com/azure/cosmos/kafka/connect/implementation/source/CosmosSourceConfig.java @@ -79,8 +79,9 @@ public class CosmosSourceConfig extends KafkaCosmosConfig { private static final String DEFAULT_METADATA_STORAGE_TYPE = CosmosMetadataStorageType.KAFKA.getName(); private static final String METADATA_STORAGE_NAME = "azure.cosmos.source.metadata.storage.name"; - private static final String METADATA_STORAGE_NAME_DOC = "The resource name of the metadata storage. If metadata storage type is Kafka topic, then this config refers to kafka topic name, the metadata topic will be created if it does not already exist, else it will use the pre-created topic." - + " If metadata storage type is CosmosDB container, then this config refers to container name, please pre-create the metadata container partitioned by /id."; + private static final String METADATA_STORAGE_NAME_DOC = "The resource name of the metadata storage." + + " If metadata storage type is Kafka topic, then this config refers to kafka topic name, the metadata topic will be created if it does not already exist, else it will use the pre-created topic." + + " If metadata storage type is `Cosmos`, then this config refers to container name, for `MasterKey` auth, this container will be created with `AutoScale` with 4000 RU if not already exists, for `ServicePrincipal` auth, it requires the container to be created ahead of time ."; private static final String METADATA_STORAGE_NAME_DISPLAY = "The metadata storage name."; private static final String DEFAULT_METADATA_STORAGE_NAME = "_cosmos.metadata.topic"; diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml index c775c705de4f..53409ae7e7c8 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml @@ -90,7 +90,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 com.azure @@ -101,7 +101,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure diff --git a/sdk/cosmos/azure-cosmos-test/CHANGELOG.md b/sdk/cosmos/azure-cosmos-test/CHANGELOG.md index 27bdb326a33c..bb5bbe06a853 100644 --- a/sdk/cosmos/azure-cosmos-test/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-test/CHANGELOG.md @@ -1,14 +1,9 @@ ## Release History -### 1.0.0-beta.7 (Unreleased) - -#### Features Added - -#### Breaking Changes +### 1.0.0-beta.7 (2024-05-03) #### Bugs Fixed - -#### Other Changes +* Fixed an issue where `FaultInjectionRule` can not apply on partition level when using `Gateway` Mode and non-session consistency - See [40005](https://github.com/Azure/azure-sdk-for-java/pull/40005) ### 1.0.0-beta.6 (2023-10-24) #### Features Added diff --git a/sdk/cosmos/azure-cosmos-test/README.md b/sdk/cosmos/azure-cosmos-test/README.md index 4dde463568a1..ee05caf2a704 100644 --- a/sdk/cosmos/azure-cosmos-test/README.md +++ b/sdk/cosmos/azure-cosmos-test/README.md @@ -9,7 +9,7 @@ Library containing core fault injection classes used to test Azure Cosmos DB SDK com.azure azure-cosmos-test - 1.0.0-beta.6 + 1.0.0-beta.7 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/cosmos/azure-cosmos-test/pom.xml b/sdk/cosmos/azure-cosmos-test/pom.xml index e94d58f1f5d3..cb2d32eb7ac6 100644 --- a/sdk/cosmos/azure-cosmos-test/pom.xml +++ b/sdk/cosmos/azure-cosmos-test/pom.xml @@ -56,7 +56,7 @@ Licensed under the MIT License. com.azure azure-cosmos - 4.60.0-beta.1 + 4.59.0 diff --git a/sdk/cosmos/azure-cosmos-tests/pom.xml b/sdk/cosmos/azure-cosmos-tests/pom.xml index 38abc7dbac7a..b55fefbf13ea 100644 --- a/sdk/cosmos/azure-cosmos-tests/pom.xml +++ b/sdk/cosmos/azure-cosmos-tests/pom.xml @@ -150,7 +150,7 @@ Licensed under the MIT License. com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnGatewayTests.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnGatewayTests.java index 2be8f657c269..524c9b86d0cd 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnGatewayTests.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnGatewayTests.java @@ -75,7 +75,7 @@ public FaultInjectionServerErrorRuleOnGatewayTests(CosmosClientBuilder clientBui this.subscriberValidationTimeout = TIMEOUT; } - @BeforeClass(groups = {"multi-master", "long"}, timeOut = TIMEOUT) + @BeforeClass(groups = {"multi-master", "fast"}, timeOut = TIMEOUT) public void beforeClass() { client = getClientBuilder().buildAsyncClient(); AsyncDocumentClient asyncDocumentClient = BridgeInternal.getContextClient(client); @@ -225,79 +225,95 @@ public void faultInjectionServerErrorRuleTests_Region() throws JsonProcessingExc } } - @Test(groups = {"multi-master", "long"}, timeOut = 4 * TIMEOUT) + @Test(groups = {"multi-master", "fast"}, timeOut = 4 * TIMEOUT) public void faultInjectionServerErrorRuleTests_Partition() throws JsonProcessingException { - for (int i = 0; i < 10; i++) { - cosmosAsyncContainer.createItem(TestItem.createNewItem()).block(); - } + CosmosAsyncClient testClient = null; - // getting one item from each feedRange - List feedRanges = cosmosAsyncContainer.getFeedRanges().block(); - assertThat(feedRanges.size()).isGreaterThan(1); + try { + testClient = this.getClientBuilder() + .consistencyLevel(this.databaseAccount.getConsistencyPolicy().getDefaultConsistencyLevel()) + .buildAsyncClient(); - String query = "select * from c"; - CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); - cosmosQueryRequestOptions.setFeedRange(feedRanges.get(0)); - TestItem itemOnFeedRange0 = cosmosAsyncContainer.queryItems(query, cosmosQueryRequestOptions, TestItem.class).blockFirst(); + CosmosAsyncContainer testContainer = + testClient + .getDatabase(cosmosAsyncContainer.getDatabase().getId()) + .getContainer(cosmosAsyncContainer.getId()); - cosmosQueryRequestOptions.setFeedRange(feedRanges.get(1)); - TestItem itemOnFeedRange1 = cosmosAsyncContainer.queryItems(query, cosmosQueryRequestOptions, TestItem.class).blockFirst(); + for (int i = 0; i < 10; i++) { + testContainer.createItem(TestItem.createNewItem()).block(); + } - // set rule by feed range - String feedRangeRuleId = "ServerErrorRule-FeedRange-" + UUID.randomUUID(); + // getting one item from each feedRange + List feedRanges = testContainer.getFeedRanges().block(); + assertThat(feedRanges.size()).isGreaterThan(1); + + String query = "select * from c"; + CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); + cosmosQueryRequestOptions.setFeedRange(feedRanges.get(0)); + TestItem itemOnFeedRange0 = testContainer.queryItems(query, cosmosQueryRequestOptions, TestItem.class).blockFirst(); + + cosmosQueryRequestOptions.setFeedRange(feedRanges.get(1)); + TestItem itemOnFeedRange1 = testContainer.queryItems(query, cosmosQueryRequestOptions, TestItem.class).blockFirst(); + + // set rule by feed range + String feedRangeRuleId = "ServerErrorRule-FeedRange-" + UUID.randomUUID(); + + FaultInjectionRule serverErrorRuleByFeedRange = + new FaultInjectionRuleBuilder(feedRangeRuleId) + .condition( + new FaultInjectionConditionBuilder() + .connectionType(FaultInjectionConnectionType.GATEWAY) + .endpoints(new FaultInjectionEndpointBuilder(feedRanges.get(0)).build()) + .build() + ) + .result( + FaultInjectionResultBuilders + .getResultBuilder(FaultInjectionServerErrorType.TOO_MANY_REQUEST) + .times(1) + .build() + ) + .duration(Duration.ofMinutes(5)) + .build(); + + CosmosFaultInjectionHelper.configureFaultInjectionRules(testContainer, Arrays.asList(serverErrorRuleByFeedRange)).block(); + assertThat( + serverErrorRuleByFeedRange.getRegionEndpoints().size() == this.readRegionMap.size() + && serverErrorRuleByFeedRange.getRegionEndpoints().containsAll(this.readRegionMap.keySet())); - FaultInjectionRule serverErrorRuleByFeedRange = - new FaultInjectionRuleBuilder(feedRangeRuleId) - .condition( - new FaultInjectionConditionBuilder() - .connectionType(FaultInjectionConnectionType.GATEWAY) - .endpoints(new FaultInjectionEndpointBuilder(feedRanges.get(0)).build()) - .build() - ) - .result( - FaultInjectionResultBuilders - .getResultBuilder(FaultInjectionServerErrorType.TOO_MANY_REQUEST) - .times(1) - .build() - ) - .duration(Duration.ofMinutes(5)) - .build(); + // Issue a read item for the same feed range as configured in the fault injection rule + CosmosDiagnostics cosmosDiagnostics = + testContainer + .readItem(itemOnFeedRange0.getId(), new PartitionKey(itemOnFeedRange0.getId()), JsonNode.class) + .block() + .getDiagnostics(); - CosmosFaultInjectionHelper.configureFaultInjectionRules(cosmosAsyncContainer, Arrays.asList(serverErrorRuleByFeedRange)).block(); - assertThat( - serverErrorRuleByFeedRange.getRegionEndpoints().size() == this.readRegionMap.size() - && serverErrorRuleByFeedRange.getRegionEndpoints().containsAll(this.readRegionMap.keySet())); - - // Issue a read item for the same feed range as configured in the fault injection rule - CosmosDiagnostics cosmosDiagnostics = - cosmosAsyncContainer - .readItem(itemOnFeedRange0.getId(), new PartitionKey(itemOnFeedRange0.getId()), JsonNode.class) - .block() - .getDiagnostics(); - - this.validateHitCount(serverErrorRuleByFeedRange, 1, OperationType.Read, ResourceType.Document); - this.validateFaultInjectionRuleApplied( - cosmosDiagnostics, - OperationType.Read, - HttpConstants.StatusCodes.TOO_MANY_REQUESTS, - HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE, - feedRangeRuleId, - true - ); - - // Issue a read item to different feed range - try { - cosmosDiagnostics = cosmosAsyncContainer - .readItem(itemOnFeedRange1.getId(), new PartitionKey(itemOnFeedRange1.getId()), JsonNode.class) - .block() - .getDiagnostics(); - this.validateNoFaultInjectionApplied(cosmosDiagnostics, OperationType.Read, FAULT_INJECTION_RULE_NON_APPLICABLE_ADDRESS); + this.validateHitCount(serverErrorRuleByFeedRange, 1, OperationType.Read, ResourceType.Document); + this.validateFaultInjectionRuleApplied( + cosmosDiagnostics, + OperationType.Read, + HttpConstants.StatusCodes.TOO_MANY_REQUESTS, + HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE, + feedRangeRuleId, + true + ); + + // Issue a read item to different feed range + try { + cosmosDiagnostics = testContainer + .readItem(itemOnFeedRange1.getId(), new PartitionKey(itemOnFeedRange1.getId()), JsonNode.class) + .block() + .getDiagnostics(); + this.validateNoFaultInjectionApplied(cosmosDiagnostics, OperationType.Read, FAULT_INJECTION_RULE_NON_APPLICABLE_ADDRESS); + } finally { + serverErrorRuleByFeedRange.disable(); + } } finally { - serverErrorRuleByFeedRange.disable(); + safeClose(testClient); } + } - @Test(groups = {"multi-master", "long"}, timeOut = 4 * TIMEOUT) + @Test(groups = {"multi-master", "fast"}, timeOut = 4 * TIMEOUT) public void faultInjectionServerErrorRuleTests_ServerResponseDelay() throws JsonProcessingException { // define another rule which can simulate timeout String timeoutRuleId = "serverErrorRule-responseDelay-" + UUID.randomUUID(); @@ -347,7 +363,7 @@ public void faultInjectionServerErrorRuleTests_ServerResponseDelay() throws Json } } - @Test(groups = {"multi-master", "long"}, timeOut = 4 * TIMEOUT) + @Test(groups = {"multi-master", "fast"}, timeOut = 4 * TIMEOUT) public void faultInjectionServerErrorRuleTests_ServerConnectionDelay() throws JsonProcessingException { // simulate high channel acquisition/connectionTimeout String ruleId = "serverErrorRule-serverConnectionDelay-" + UUID.randomUUID(); @@ -388,7 +404,7 @@ public void faultInjectionServerErrorRuleTests_ServerConnectionDelay() throws Js } } - @Test(groups = {"multi-master", "long"}, dataProvider = "faultInjectionServerErrorResponseProvider", timeOut = TIMEOUT) + @Test(groups = {"multi-master", "fast"}, dataProvider = "faultInjectionServerErrorResponseProvider", timeOut = TIMEOUT) public void faultInjectionServerErrorRuleTests_ServerErrorResponse( FaultInjectionServerErrorType serverErrorType, boolean canRetry, @@ -460,7 +476,7 @@ public void faultInjectionServerErrorRuleTests_ServerErrorResponse( } } - @Test(groups = {"multi-master", "long"}, dataProvider = "operationTypeProvider", timeOut = TIMEOUT) + @Test(groups = {"multi-master", "fast"}, dataProvider = "operationTypeProvider", timeOut = TIMEOUT) public void faultInjectionServerErrorRuleTests_HitLimit( OperationType operationType, FaultInjectionOperationType faultInjectionOperationType) throws JsonProcessingException { @@ -518,7 +534,7 @@ public void faultInjectionServerErrorRuleTests_HitLimit( } } - @AfterClass(groups = {"multi-master", "long"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + @AfterClass(groups = {"multi-master", "fast"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) public void afterClass() { safeClose(client); } diff --git a/sdk/cosmos/azure-cosmos/pom.xml b/sdk/cosmos/azure-cosmos/pom.xml index 79afc13c71c1..b7270df0e39e 100644 --- a/sdk/cosmos/azure-cosmos/pom.xml +++ b/sdk/cosmos/azure-cosmos/pom.xml @@ -65,12 +65,12 @@ Licensed under the MIT License. com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/GlobalEndpointManager.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/GlobalEndpointManager.java index 7dc27b329c8c..3b4077ef7660 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/GlobalEndpointManager.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/GlobalEndpointManager.java @@ -303,7 +303,7 @@ private Mono startRefreshLocationTimerAsync(boolean initialization) { this::getDatabaseAccountAsync); return databaseAccountObs.flatMap(dbAccount -> { - logger.info("db account retrieved {}", databaseAccountObs); + logger.info("db account retrieved {}", dbAccount); this.refreshInBackground.set(false); return this.refreshLocationPrivateAsync(dbAccount); }); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java index 798e96353477..bd054cd6822b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java @@ -596,7 +596,7 @@ public Flux submitOpenConnectionTasksAndInitCaches(CosmosContainerProactiv @Override public void configureFaultInjectorProvider(IFaultInjectorProvider injectorProvider, Configs configs) { if (this.gatewayServerErrorInjector == null) { - this.gatewayServerErrorInjector = new GatewayServerErrorInjector(configs); + this.gatewayServerErrorInjector = new GatewayServerErrorInjector(configs, collectionCache, partitionKeyRangeCache); } this.gatewayServerErrorInjector.registerServerErrorInjector(injectorProvider.getServerErrorInjector()); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/faultinjection/GatewayServerErrorInjector.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/faultinjection/GatewayServerErrorInjector.java index 812d405ab5ff..7c93bf31d04c 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/faultinjection/GatewayServerErrorInjector.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/faultinjection/GatewayServerErrorInjector.java @@ -3,13 +3,22 @@ package com.azure.cosmos.implementation.faultinjection; +import com.azure.cosmos.BridgeInternal; import com.azure.cosmos.CosmosException; import com.azure.cosmos.implementation.Configs; +import com.azure.cosmos.implementation.HttpConstants; +import com.azure.cosmos.implementation.PartitionKeyRange; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.RxDocumentServiceRequest; import com.azure.cosmos.implementation.Utils; +import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; +import com.azure.cosmos.implementation.caches.RxCollectionCache; +import com.azure.cosmos.implementation.caches.RxPartitionKeyRangeCache; import com.azure.cosmos.implementation.http.HttpRequest; import com.azure.cosmos.implementation.http.HttpResponse; import com.azure.cosmos.implementation.http.ReactorNettyRequestRecord; +import com.azure.cosmos.implementation.routing.PartitionKeyInternal; +import com.azure.cosmos.implementation.routing.PartitionKeyInternalHelper; import io.netty.channel.ConnectTimeoutException; import io.netty.handler.timeout.ReadTimeoutException; import reactor.core.publisher.Mono; @@ -25,12 +34,23 @@ public class GatewayServerErrorInjector { private final Configs configs; + private final RxCollectionCache collectionCache; + private final RxPartitionKeyRangeCache partitionKeyRangeCache; private List faultInjectors = new ArrayList<>(); - public GatewayServerErrorInjector(Configs configs) { + public GatewayServerErrorInjector( + Configs configs, + RxCollectionCache collectionCache, + RxPartitionKeyRangeCache partitionKeyRangeCache) { checkNotNull(configs, "Argument 'configs' can not be null"); this.configs = configs; + this.collectionCache = collectionCache; + this.partitionKeyRangeCache = partitionKeyRangeCache; + } + + public GatewayServerErrorInjector(Configs configs) { + this(configs, null, null); } public void registerServerErrorInjector(IServerErrorInjector serverErrorInjector) { @@ -38,18 +58,74 @@ public void registerServerErrorInjector(IServerErrorInjector serverErrorInjector this.faultInjectors.add(serverErrorInjector); } + private Mono> resolvePartitionKeyRange(RxDocumentServiceRequest request) { + // faultInjection rule can be configured to only apply for a certain partition + // but in the normal flow, only session consistency will populate the resolvePartitionKey when apply session token + // so for other consistencies, we need to calculate here + if (request.getResourceType() != ResourceType.Document) { + return Mono.just(Utils.ValueHolder.initialize(null)); + } + + if (this.collectionCache == null || this.partitionKeyRangeCache == null) { + return Mono.just(Utils.ValueHolder.initialize(null)); + } + + if (request == null || request.requestContext == null) { + return Mono.just(Utils.ValueHolder.initialize(null)); + } + + if (request.requestContext.resolvedPartitionKeyRange != null) { + return Mono.just(Utils.ValueHolder.initialize(request.requestContext.resolvedPartitionKeyRange)); + } + + return this.collectionCache + .resolveCollectionAsync( + BridgeInternal.getMetaDataDiagnosticContext(request.requestContext.cosmosDiagnostics), request) + .flatMap(collectionValueHolder -> { + return partitionKeyRangeCache + .tryLookupAsync( + BridgeInternal.getMetaDataDiagnosticContext(request.requestContext.cosmosDiagnostics), + collectionValueHolder.v.getResourceId(), + null, + null) + .flatMap(collectionRoutingMapValueHolder -> { + String partitionKeyRangeId = + request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID); + PartitionKeyInternal partitionKeyInternal = request.getPartitionKeyInternal(); + if (StringUtils.isNotEmpty(partitionKeyRangeId)) { + PartitionKeyRange range = + collectionRoutingMapValueHolder.v.getRangeByPartitionKeyRangeId(partitionKeyRangeId); + request.requestContext.resolvedPartitionKeyRange = range; + } else if (partitionKeyInternal != null) { + String effectivePartitionKeyString = PartitionKeyInternalHelper + .getEffectivePartitionKeyString( + partitionKeyInternal, + collectionValueHolder.v.getPartitionKey()); + PartitionKeyRange range = + collectionRoutingMapValueHolder.v.getRangeByEffectivePartitionKey(effectivePartitionKeyString); + request.requestContext.resolvedPartitionKeyRange = range; + } + + return Mono.just(Utils.ValueHolder.initialize(request.requestContext.resolvedPartitionKeyRange)); + }); + }); + } + public Mono injectGatewayErrors( Duration responseTimeout, HttpRequest httpRequest, RxDocumentServiceRequest serviceRequest, Mono originalResponseMono) { - return injectGatewayErrors( - responseTimeout, - httpRequest, - serviceRequest, - originalResponseMono, - serviceRequest.requestContext.resolvedPartitionKeyRange != null - ? Arrays.asList(serviceRequest.requestContext.resolvedPartitionKeyRange.getId()) : null); + + return this.resolvePartitionKeyRange(serviceRequest) + .flatMap(resolvedPartitionKeyRangeValueHolder -> { + return injectGatewayErrors( + responseTimeout, + httpRequest, + serviceRequest, + originalResponseMono, + resolvedPartitionKeyRangeValueHolder.v == null ? null : Arrays.asList(resolvedPartitionKeyRangeValueHolder.v.getId())); + }); } public Mono injectGatewayErrors( diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/pom.xml b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/pom.xml index 2ab4fa2725b4..ed92db650b72 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/pom.xml +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/costmanagement/azure-resourcemanager-costmanagement/pom.xml b/sdk/costmanagement/azure-resourcemanager-costmanagement/pom.xml index 3ecfe2691dbb..ccc94600045c 100644 --- a/sdk/costmanagement/azure-resourcemanager-costmanagement/pom.xml +++ b/sdk/costmanagement/azure-resourcemanager-costmanagement/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/customerinsights/azure-resourcemanager-customerinsights/pom.xml b/sdk/customerinsights/azure-resourcemanager-customerinsights/pom.xml index e394d5d165a5..6c354bf388a7 100644 --- a/sdk/customerinsights/azure-resourcemanager-customerinsights/pom.xml +++ b/sdk/customerinsights/azure-resourcemanager-customerinsights/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/dashboard/azure-resourcemanager-dashboard/pom.xml b/sdk/dashboard/azure-resourcemanager-dashboard/pom.xml index 6735682d909f..d49f4a934a2e 100644 --- a/sdk/dashboard/azure-resourcemanager-dashboard/pom.xml +++ b/sdk/dashboard/azure-resourcemanager-dashboard/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/databox/azure-resourcemanager-databox/pom.xml b/sdk/databox/azure-resourcemanager-databox/pom.xml index 6d0a6da6999e..bef7e715dddd 100644 --- a/sdk/databox/azure-resourcemanager-databox/pom.xml +++ b/sdk/databox/azure-resourcemanager-databox/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/databoxedge/azure-resourcemanager-databoxedge/pom.xml b/sdk/databoxedge/azure-resourcemanager-databoxedge/pom.xml index 90d7b619bd38..7baf6613244b 100644 --- a/sdk/databoxedge/azure-resourcemanager-databoxedge/pom.xml +++ b/sdk/databoxedge/azure-resourcemanager-databoxedge/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/databricks/azure-resourcemanager-databricks/pom.xml b/sdk/databricks/azure-resourcemanager-databricks/pom.xml index f40c0ebe5526..e05f2532449c 100644 --- a/sdk/databricks/azure-resourcemanager-databricks/pom.xml +++ b/sdk/databricks/azure-resourcemanager-databricks/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/datadog/azure-resourcemanager-datadog/pom.xml b/sdk/datadog/azure-resourcemanager-datadog/pom.xml index bb8cac34177e..8b729b7e8df0 100644 --- a/sdk/datadog/azure-resourcemanager-datadog/pom.xml +++ b/sdk/datadog/azure-resourcemanager-datadog/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/pom.xml b/sdk/datafactory/azure-resourcemanager-datafactory/pom.xml index f5ad35791d9b..f803d66916df 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/pom.xml +++ b/sdk/datafactory/azure-resourcemanager-datafactory/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/datalakeanalytics/azure-resourcemanager-datalakeanalytics/pom.xml b/sdk/datalakeanalytics/azure-resourcemanager-datalakeanalytics/pom.xml index 8fcfa9344ee9..0f5766d53cfc 100644 --- a/sdk/datalakeanalytics/azure-resourcemanager-datalakeanalytics/pom.xml +++ b/sdk/datalakeanalytics/azure-resourcemanager-datalakeanalytics/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/datalakestore/azure-resourcemanager-datalakestore/pom.xml b/sdk/datalakestore/azure-resourcemanager-datalakestore/pom.xml index 1293a651191d..c357b7abcd4c 100644 --- a/sdk/datalakestore/azure-resourcemanager-datalakestore/pom.xml +++ b/sdk/datalakestore/azure-resourcemanager-datalakestore/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/datamigration/azure-resourcemanager-datamigration/pom.xml b/sdk/datamigration/azure-resourcemanager-datamigration/pom.xml index 2d3b77943b48..9e96a904842e 100644 --- a/sdk/datamigration/azure-resourcemanager-datamigration/pom.xml +++ b/sdk/datamigration/azure-resourcemanager-datamigration/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml b/sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml index 5234fe64164b..a65a2470f2c1 100644 --- a/sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml +++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/defendereasm/azure-resourcemanager-defendereasm/pom.xml b/sdk/defendereasm/azure-resourcemanager-defendereasm/pom.xml index 0368e2132828..e5ff561a5e28 100644 --- a/sdk/defendereasm/azure-resourcemanager-defendereasm/pom.xml +++ b/sdk/defendereasm/azure-resourcemanager-defendereasm/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/delegatednetwork/azure-resourcemanager-delegatednetwork/pom.xml b/sdk/delegatednetwork/azure-resourcemanager-delegatednetwork/pom.xml index ccd3ffd94af3..10354a64efc8 100644 --- a/sdk/delegatednetwork/azure-resourcemanager-delegatednetwork/pom.xml +++ b/sdk/delegatednetwork/azure-resourcemanager-delegatednetwork/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/pom.xml b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/pom.xml index c33085a92982..129e237a227e 100644 --- a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/pom.xml +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/pom.xml b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/pom.xml index 6d73037a8ffe..096cfe6bf100 100644 --- a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/pom.xml +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/devcenter/azure-developer-devcenter/pom.xml b/sdk/devcenter/azure-developer-devcenter/pom.xml index b6429f628275..070971ad964a 100644 --- a/sdk/devcenter/azure-developer-devcenter/pom.xml +++ b/sdk/devcenter/azure-developer-devcenter/pom.xml @@ -43,12 +43,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -59,13 +59,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/pom.xml b/sdk/devcenter/azure-resourcemanager-devcenter/pom.xml index d74602633a98..278a211e1f25 100644 --- a/sdk/devcenter/azure-resourcemanager-devcenter/pom.xml +++ b/sdk/devcenter/azure-resourcemanager-devcenter/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/devhub/azure-resourcemanager-devhub/pom.xml b/sdk/devhub/azure-resourcemanager-devhub/pom.xml index b30121b35bbb..77064c55ef8f 100644 --- a/sdk/devhub/azure-resourcemanager-devhub/pom.xml +++ b/sdk/devhub/azure-resourcemanager-devhub/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml index 2857f9515347..49218f3e87d0 100644 --- a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml @@ -45,12 +45,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 org.junit.jupiter @@ -61,7 +61,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -73,7 +73,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/pom.xml b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/pom.xml index eec0d615ed87..b8c7cf2a23b4 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/pom.xml +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/pom.xml @@ -51,23 +51,23 @@ Code generated by Microsoft (R) TypeSpec Code Generator. com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/deviceupdate/azure-iot-deviceupdate/pom.xml b/sdk/deviceupdate/azure-iot-deviceupdate/pom.xml index 9847e8def47a..9911bad91d56 100644 --- a/sdk/deviceupdate/azure-iot-deviceupdate/pom.xml +++ b/sdk/deviceupdate/azure-iot-deviceupdate/pom.xml @@ -39,23 +39,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/deviceupdate/azure-resourcemanager-deviceupdate/pom.xml b/sdk/deviceupdate/azure-resourcemanager-deviceupdate/pom.xml index 698d0ad587da..a53b16663764 100644 --- a/sdk/deviceupdate/azure-resourcemanager-deviceupdate/pom.xml +++ b/sdk/deviceupdate/azure-resourcemanager-deviceupdate/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/devspaces/azure-resourcemanager-devspaces/pom.xml b/sdk/devspaces/azure-resourcemanager-devspaces/pom.xml index 7e018e3de93e..ba41298f801b 100644 --- a/sdk/devspaces/azure-resourcemanager-devspaces/pom.xml +++ b/sdk/devspaces/azure-resourcemanager-devspaces/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/pom.xml b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/pom.xml index 7e8d2f590de2..dd0fa150a56e 100644 --- a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/pom.xml +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/digitaltwins/azure-digitaltwins-core/pom.xml b/sdk/digitaltwins/azure-digitaltwins-core/pom.xml index ca1912a68560..1a8d8cf3555e 100644 --- a/sdk/digitaltwins/azure-digitaltwins-core/pom.xml +++ b/sdk/digitaltwins/azure-digitaltwins-core/pom.xml @@ -48,17 +48,17 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 com.fasterxml.jackson.core @@ -70,25 +70,25 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -160,7 +160,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/digitaltwins/azure-resourcemanager-digitaltwins/pom.xml b/sdk/digitaltwins/azure-resourcemanager-digitaltwins/pom.xml index dfab516ab531..0cb49f134222 100644 --- a/sdk/digitaltwins/azure-resourcemanager-digitaltwins/pom.xml +++ b/sdk/digitaltwins/azure-resourcemanager-digitaltwins/pom.xml @@ -54,23 +54,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/dnsresolver/azure-resourcemanager-dnsresolver/pom.xml b/sdk/dnsresolver/azure-resourcemanager-dnsresolver/pom.xml index 633e419441d9..b021e1210c1b 100644 --- a/sdk/dnsresolver/azure-resourcemanager-dnsresolver/pom.xml +++ b/sdk/dnsresolver/azure-resourcemanager-dnsresolver/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/README.md b/sdk/documentintelligence/azure-ai-documentintelligence/README.md index 5051206d0d09..0a31b9b47d7e 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/README.md +++ b/sdk/documentintelligence/azure-ai-documentintelligence/README.md @@ -90,7 +90,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/pom.xml b/sdk/documentintelligence/azure-ai-documentintelligence/pom.xml index 4abbe56f489b..ac1f2f2f12e5 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/pom.xml +++ b/sdk/documentintelligence/azure-ai-documentintelligence/pom.xml @@ -47,12 +47,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.slf4j @@ -65,19 +65,19 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -101,7 +101,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -116,7 +116,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/dynatrace/azure-resourcemanager-dynatrace/pom.xml b/sdk/dynatrace/azure-resourcemanager-dynatrace/pom.xml index 1f50332a33c4..10d5303be6bc 100644 --- a/sdk/dynatrace/azure-resourcemanager-dynatrace/pom.xml +++ b/sdk/dynatrace/azure-resourcemanager-dynatrace/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/e2e/pom.xml b/sdk/e2e/pom.xml index f8fdae1adab4..a685a954f5a9 100644 --- a/sdk/e2e/pom.xml +++ b/sdk/e2e/pom.xml @@ -29,12 +29,12 @@ com.azure azure-core - 1.49.0 + 1.50.0-beta.1 com.azure azure-core-http-netty - 1.15.0 + 1.16.0-beta.1 com.azure @@ -70,7 +70,7 @@ com.azure azure-core-test - 1.25.0 + 1.26.0-beta.1 test diff --git a/sdk/easm/azure-analytics-defender-easm/pom.xml b/sdk/easm/azure-analytics-defender-easm/pom.xml index 83547a4ed28e..112ba3d517d5 100644 --- a/sdk/easm/azure-analytics-defender-easm/pom.xml +++ b/sdk/easm/azure-analytics-defender-easm/pom.xml @@ -48,12 +48,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -90,13 +90,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/edgeorder/azure-resourcemanager-edgeorder/pom.xml b/sdk/edgeorder/azure-resourcemanager-edgeorder/pom.xml index ea0b311d2347..eb5e53652ea3 100644 --- a/sdk/edgeorder/azure-resourcemanager-edgeorder/pom.xml +++ b/sdk/edgeorder/azure-resourcemanager-edgeorder/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/edgezones/azure-resourcemanager-edgezones/pom.xml b/sdk/edgezones/azure-resourcemanager-edgezones/pom.xml index 5e9c9a6eee6c..9b0f6e2ca74a 100644 --- a/sdk/edgezones/azure-resourcemanager-edgezones/pom.xml +++ b/sdk/edgezones/azure-resourcemanager-edgezones/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/education/azure-resourcemanager-education/pom.xml b/sdk/education/azure-resourcemanager-education/pom.xml index 120dd5c27b80..04d8278d4800 100644 --- a/sdk/education/azure-resourcemanager-education/pom.xml +++ b/sdk/education/azure-resourcemanager-education/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/elastic/azure-resourcemanager-elastic/pom.xml b/sdk/elastic/azure-resourcemanager-elastic/pom.xml index 4052ea835fe3..30a7450ebd0e 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/pom.xml +++ b/sdk/elastic/azure-resourcemanager-elastic/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/elasticsan/azure-resourcemanager-elasticsan/pom.xml b/sdk/elasticsan/azure-resourcemanager-elasticsan/pom.xml index fa555cd787c4..8681d41b0206 100644 --- a/sdk/elasticsan/azure-resourcemanager-elasticsan/pom.xml +++ b/sdk/elasticsan/azure-resourcemanager-elasticsan/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/pom.xml b/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/pom.xml index d16878c23653..5d13cb1a4e76 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/pom.xml +++ b/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/pom.xml @@ -83,7 +83,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -118,7 +118,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/eventgrid/azure-messaging-eventgrid-namespaces/pom.xml b/sdk/eventgrid/azure-messaging-eventgrid-namespaces/pom.xml index c0ffe5cd0922..da3775d7374b 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid-namespaces/pom.xml +++ b/sdk/eventgrid/azure-messaging-eventgrid-namespaces/pom.xml @@ -48,12 +48,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -70,13 +70,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/eventgrid/azure-messaging-eventgrid/pom.xml b/sdk/eventgrid/azure-messaging-eventgrid/pom.xml index f169b9799985..2cecbe06c200 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid/pom.xml +++ b/sdk/eventgrid/azure-messaging-eventgrid/pom.xml @@ -72,7 +72,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -82,14 +82,14 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test @@ -101,7 +101,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -125,7 +125,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/eventgrid/azure-resourcemanager-eventgrid/pom.xml b/sdk/eventgrid/azure-resourcemanager-eventgrid/pom.xml index 62d66c18aacf..31fb652e37c2 100644 --- a/sdk/eventgrid/azure-resourcemanager-eventgrid/pom.xml +++ b/sdk/eventgrid/azure-resourcemanager-eventgrid/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml index bbd71c5e68df..e02a8d8a3678 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml @@ -61,13 +61,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/pom.xml index e06dd6056191..78befa6ea0e6 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/pom.xml @@ -53,7 +53,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml index 4a55b0fe21cf..05f389908bad 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml @@ -65,12 +65,12 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 com.azure azure-core-metrics-opentelemetry - 1.0.0-beta.18 + 1.0.0-beta.19 diff --git a/sdk/eventhubs/azure-messaging-eventhubs-track2-perf/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-track2-perf/pom.xml index f59807386fb8..ff48744e2576 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-track2-perf/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-track2-perf/pom.xml @@ -45,7 +45,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 diff --git a/sdk/eventhubs/azure-messaging-eventhubs/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md index 1f19b14ccdc8..c2ad1c9ad750 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md @@ -137,7 +137,7 @@ platform. First, add the package: com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml index c756dcb2061d..031f1d57c31f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml @@ -44,25 +44,25 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-amqp - 2.9.4 + 2.9.4 com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.25.0 + 1.25.0 test @@ -114,7 +114,7 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 test @@ -142,7 +142,7 @@ com.azure azure-core-experimental - 1.0.0-beta.49 + 1.0.0-beta.50 test diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml index 5f468a9c629d..f090a0669be0 100644 --- a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/pom.xml b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/pom.xml index 08b16a822c5a..56eede15cc84 100644 --- a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/pom.xml +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure.resourcemanager @@ -60,13 +60,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/formrecognizer/azure-ai-formrecognizer-perf/pom.xml b/sdk/formrecognizer/azure-ai-formrecognizer-perf/pom.xml index 06e06cc77ab9..62752492073d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer-perf/pom.xml +++ b/sdk/formrecognizer/azure-ai-formrecognizer-perf/pom.xml @@ -36,12 +36,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -105,7 +105,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index 1943095524b9..81253a51b3fa 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -167,7 +167,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/pom.xml b/sdk/formrecognizer/azure-ai-formrecognizer/pom.xml index cef83ed06274..dea2055b12dc 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/pom.xml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/pom.xml @@ -52,31 +52,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -100,7 +100,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -115,7 +115,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/frontdoor/azure-resourcemanager-frontdoor/pom.xml b/sdk/frontdoor/azure-resourcemanager-frontdoor/pom.xml index c86f8c9e9da4..395deda047a2 100644 --- a/sdk/frontdoor/azure-resourcemanager-frontdoor/pom.xml +++ b/sdk/frontdoor/azure-resourcemanager-frontdoor/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/pom.xml b/sdk/graphservices/azure-resourcemanager-graphservices/pom.xml index dd7e65e8a555..ac12aed100a1 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/pom.xml +++ b/sdk/graphservices/azure-resourcemanager-graphservices/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/hanaonazure/azure-resourcemanager-hanaonazure/pom.xml b/sdk/hanaonazure/azure-resourcemanager-hanaonazure/pom.xml index b17c0d388421..6e598e13f97f 100644 --- a/sdk/hanaonazure/azure-resourcemanager-hanaonazure/pom.xml +++ b/sdk/hanaonazure/azure-resourcemanager-hanaonazure/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/pom.xml b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/pom.xml index 1bfea5c248d0..2a05de57cc95 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/pom.xml +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/hdinsight/azure-resourcemanager-hdinsight-containers/pom.xml b/sdk/hdinsight/azure-resourcemanager-hdinsight-containers/pom.xml index 1c0fa199c8a4..4b6b750f3e4f 100644 --- a/sdk/hdinsight/azure-resourcemanager-hdinsight-containers/pom.xml +++ b/sdk/hdinsight/azure-resourcemanager-hdinsight-containers/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/hdinsight/azure-resourcemanager-hdinsight/pom.xml b/sdk/hdinsight/azure-resourcemanager-hdinsight/pom.xml index 39da8f78db34..e5ba1331b736 100644 --- a/sdk/hdinsight/azure-resourcemanager-hdinsight/pom.xml +++ b/sdk/hdinsight/azure-resourcemanager-hdinsight/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml b/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml index ee09a75af017..c3717fb7bfa1 100644 --- a/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml +++ b/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/healthcareapis/azure-resourcemanager-healthcareapis/pom.xml b/sdk/healthcareapis/azure-resourcemanager-healthcareapis/pom.xml index 19a6dc562dd4..795d067040a4 100644 --- a/sdk/healthcareapis/azure-resourcemanager-healthcareapis/pom.xml +++ b/sdk/healthcareapis/azure-resourcemanager-healthcareapis/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/healthinsights/azure-health-insights-cancerprofiling/pom.xml b/sdk/healthinsights/azure-health-insights-cancerprofiling/pom.xml index 303754f5b14b..394e8517ddc9 100644 --- a/sdk/healthinsights/azure-health-insights-cancerprofiling/pom.xml +++ b/sdk/healthinsights/azure-health-insights-cancerprofiling/pom.xml @@ -52,12 +52,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -74,13 +74,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/healthinsights/azure-health-insights-clinicalmatching/pom.xml b/sdk/healthinsights/azure-health-insights-clinicalmatching/pom.xml index 6de4b045c742..5337ff430cd0 100644 --- a/sdk/healthinsights/azure-health-insights-clinicalmatching/pom.xml +++ b/sdk/healthinsights/azure-health-insights-clinicalmatching/pom.xml @@ -52,12 +52,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -74,13 +74,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/healthinsights/azure-health-insights-radiologyinsights/pom.xml b/sdk/healthinsights/azure-health-insights-radiologyinsights/pom.xml index 8f95d6cd136a..fd1d0be13c94 100644 --- a/sdk/healthinsights/azure-health-insights-radiologyinsights/pom.xml +++ b/sdk/healthinsights/azure-health-insights-radiologyinsights/pom.xml @@ -50,12 +50,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -78,13 +78,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -96,7 +96,7 @@ com.azure azure-core-experimental - 1.0.0-beta.49 + 1.0.0-beta.50 diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml index e277f7ec5957..956615575002 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml index fa9f67b44444..2ba709079055 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/hybridcontainerservice/azure-resourcemanager-hybridcontainerservice/pom.xml b/sdk/hybridcontainerservice/azure-resourcemanager-hybridcontainerservice/pom.xml index a5664e21374a..d62191bd7b86 100644 --- a/sdk/hybridcontainerservice/azure-resourcemanager-hybridcontainerservice/pom.xml +++ b/sdk/hybridcontainerservice/azure-resourcemanager-hybridcontainerservice/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/hybridkubernetes/azure-resourcemanager-hybridkubernetes/pom.xml b/sdk/hybridkubernetes/azure-resourcemanager-hybridkubernetes/pom.xml index ceb23bb7a5a5..148318ef91b4 100644 --- a/sdk/hybridkubernetes/azure-resourcemanager-hybridkubernetes/pom.xml +++ b/sdk/hybridkubernetes/azure-resourcemanager-hybridkubernetes/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/hybridnetwork/azure-resourcemanager-hybridnetwork/pom.xml b/sdk/hybridnetwork/azure-resourcemanager-hybridnetwork/pom.xml index a413071efc3a..ddfb42753743 100644 --- a/sdk/hybridnetwork/azure-resourcemanager-hybridnetwork/pom.xml +++ b/sdk/hybridnetwork/azure-resourcemanager-hybridnetwork/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/identity/azure-identity-broker/CHANGELOG.md b/sdk/identity/azure-identity-broker/CHANGELOG.md index 229b0eec4254..47e72455d437 100644 --- a/sdk/identity/azure-identity-broker/CHANGELOG.md +++ b/sdk/identity/azure-identity-broker/CHANGELOG.md @@ -10,6 +10,14 @@ ### Other Changes +## 1.1.1 (2024-05-02) + +### Other Changes + +#### Dependency Updates +- +- Upgraded `azure-identity` from `1.12.0` to version `1.12.1`. + ## 1.1.0 (2024-04-08) ### Features Added diff --git a/sdk/identity/azure-identity-broker/README.md b/sdk/identity/azure-identity-broker/README.md index 1ab5a19d332f..6705e6905062 100644 --- a/sdk/identity/azure-identity-broker/README.md +++ b/sdk/identity/azure-identity-broker/README.md @@ -46,7 +46,7 @@ To take dependency on a particular version of the library that isn't present in com.azure azure-identity-broker - 1.0.4 + 1.1.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/identity/azure-identity-extensions/pom.xml b/sdk/identity/azure-identity-extensions/pom.xml index 70fcceab73c8..63548790a343 100644 --- a/sdk/identity/azure-identity-extensions/pom.xml +++ b/sdk/identity/azure-identity-extensions/pom.xml @@ -34,7 +34,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/sdk/identity/azure-identity-perf/pom.xml b/sdk/identity/azure-identity-perf/pom.xml index 54f9e4c79337..a1fd31978704 100644 --- a/sdk/identity/azure-identity-perf/pom.xml +++ b/sdk/identity/azure-identity-perf/pom.xml @@ -36,12 +36,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index 15beaa987653..4f6a9036f3d0 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -10,6 +10,14 @@ ### Other Changes +## 1.12.1 (2024-05-02) + +### Other Changes + +#### Dependency Updates +- Upgraded `azure-core` from `1.48.0` to version `1.49.0`. +- Upgraded `azure-core-http-netty` from `1.14.2` to version `1.15.0`. + ## 1.12.0 (2024-04-08) ### Features Added diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md index 85a2e8b6f624..c7333c8e8f44 100644 --- a/sdk/identity/azure-identity/README.md +++ b/sdk/identity/azure-identity/README.md @@ -46,7 +46,7 @@ To take dependency on a particular version of the library that isn't present in com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/identity/azure-identity/pom.xml b/sdk/identity/azure-identity/pom.xml index 7e2bf61b6749..973bcff00872 100644 --- a/sdk/identity/azure-identity/pom.xml +++ b/sdk/identity/azure-identity/pom.xml @@ -31,12 +31,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -56,7 +56,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml index dfd2621ecd38..6369a7f16bca 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml @@ -50,17 +50,17 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -78,7 +78,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml b/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml index 5771c40cc033..fe5b69c7ad42 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure.resourcemanager @@ -60,13 +60,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/pom.xml b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/pom.xml index c9c8ba1ec864..4b04a4724aa6 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/pom.xml +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/iothub/azure-resourcemanager-iothub/pom.xml b/sdk/iothub/azure-resourcemanager-iothub/pom.xml index 379aa513ed5d..f45e88c9c584 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/pom.xml +++ b/sdk/iothub/azure-resourcemanager-iothub/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/keyvault/azure-security-keyvault-administration/pom.xml b/sdk/keyvault/azure-security-keyvault-administration/pom.xml index f4e730332345..2358a7694e43 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-administration/pom.xml @@ -48,7 +48,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -58,7 +58,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -94,19 +94,19 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -124,7 +124,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -139,7 +139,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml index 1de15ab61437..92d1b55f2287 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml @@ -47,7 +47,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -58,7 +58,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -89,25 +89,25 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -155,7 +155,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/keyvault/azure-security-keyvault-jca/pom.xml b/sdk/keyvault/azure-security-keyvault-jca/pom.xml index 80917369c595..68ab36114719 100644 --- a/sdk/keyvault/azure-security-keyvault-jca/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-jca/pom.xml @@ -86,7 +86,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 test diff --git a/sdk/keyvault/azure-security-keyvault-keys/pom.xml b/sdk/keyvault/azure-security-keyvault-keys/pom.xml index ccf90146e3d8..73076bb9428b 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-keys/pom.xml @@ -50,7 +50,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 @@ -62,7 +62,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -93,25 +93,25 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -140,7 +140,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/keyvault/azure-security-keyvault-perf/pom.xml b/sdk/keyvault/azure-security-keyvault-perf/pom.xml index 3421ea82fd2b..c6d05ddbf2cd 100644 --- a/sdk/keyvault/azure-security-keyvault-perf/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-perf/pom.xml @@ -41,12 +41,12 @@ com.azure azure-identity - 1.12.0 + 1.12.1 com.azure azure-core-test - 1.24.2 + 1.25.0 com.azure @@ -57,12 +57,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -126,7 +126,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml index 9e3ec2acae67..b385dc052e3b 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml @@ -46,7 +46,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 @@ -58,20 +58,20 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -109,14 +109,14 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -131,7 +131,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/pom.xml b/sdk/keyvault/azure-security-test-keyvault-jca/pom.xml index fefc45eb308c..016f683c6b29 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/pom.xml +++ b/sdk/keyvault/azure-security-test-keyvault-jca/pom.xml @@ -82,7 +82,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml index 3a59c9e6d37e..df2697d113a0 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/kusto/azure-resourcemanager-kusto/pom.xml b/sdk/kusto/azure-resourcemanager-kusto/pom.xml index 4f3091da7686..d9029116c3e6 100644 --- a/sdk/kusto/azure-resourcemanager-kusto/pom.xml +++ b/sdk/kusto/azure-resourcemanager-kusto/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/labservices/azure-resourcemanager-labservices/pom.xml b/sdk/labservices/azure-resourcemanager-labservices/pom.xml index 9b95608409f2..6fc37018dd2f 100644 --- a/sdk/labservices/azure-resourcemanager-labservices/pom.xml +++ b/sdk/labservices/azure-resourcemanager-labservices/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/largeinstance/azure-resourcemanager-largeinstance/pom.xml b/sdk/largeinstance/azure-resourcemanager-largeinstance/pom.xml index 3dac3bb7d9ab..fb6975f4e041 100644 --- a/sdk/largeinstance/azure-resourcemanager-largeinstance/pom.xml +++ b/sdk/largeinstance/azure-resourcemanager-largeinstance/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/loadtesting/azure-developer-loadtesting/pom.xml b/sdk/loadtesting/azure-developer-loadtesting/pom.xml index f24030b6d0ca..df3c48e460d8 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/pom.xml +++ b/sdk/loadtesting/azure-developer-loadtesting/pom.xml @@ -43,12 +43,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -59,13 +59,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/pom.xml b/sdk/loadtesting/azure-resourcemanager-loadtesting/pom.xml index 7e1bf72f905b..19883aadf3a1 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/pom.xml +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/pom.xml @@ -45,23 +45,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/pom.xml b/sdk/loganalytics/azure-resourcemanager-loganalytics/pom.xml index de929c52bc73..5631069ebd22 100644 --- a/sdk/loganalytics/azure-resourcemanager-loganalytics/pom.xml +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/loganalytics/microsoft-azure-loganalytics/pom.xml b/sdk/loganalytics/microsoft-azure-loganalytics/pom.xml index 1c51726287e1..428e1e32bae2 100644 --- a/sdk/loganalytics/microsoft-azure-loganalytics/pom.xml +++ b/sdk/loganalytics/microsoft-azure-loganalytics/pom.xml @@ -75,7 +75,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/logic/azure-resourcemanager-logic/pom.xml b/sdk/logic/azure-resourcemanager-logic/pom.xml index ecb729e16298..1235a60fb3b2 100644 --- a/sdk/logic/azure-resourcemanager-logic/pom.xml +++ b/sdk/logic/azure-resourcemanager-logic/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/logz/azure-resourcemanager-logz/pom.xml b/sdk/logz/azure-resourcemanager-logz/pom.xml index 30d27c5aa2f6..15df8012fa52 100644 --- a/sdk/logz/azure-resourcemanager-logz/pom.xml +++ b/sdk/logz/azure-resourcemanager-logz/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/machinelearning/azure-resourcemanager-machinelearning/pom.xml b/sdk/machinelearning/azure-resourcemanager-machinelearning/pom.xml index 1b0f634acbd2..135ecd753652 100644 --- a/sdk/machinelearning/azure-resourcemanager-machinelearning/pom.xml +++ b/sdk/machinelearning/azure-resourcemanager-machinelearning/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure.resourcemanager @@ -78,13 +78,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/machinelearningservices/azure-resourcemanager-machinelearningservices/pom.xml b/sdk/machinelearningservices/azure-resourcemanager-machinelearningservices/pom.xml index ac3edd41e63b..b8f75794700c 100644 --- a/sdk/machinelearningservices/azure-resourcemanager-machinelearningservices/pom.xml +++ b/sdk/machinelearningservices/azure-resourcemanager-machinelearningservices/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/maintenance/azure-resourcemanager-maintenance/pom.xml b/sdk/maintenance/azure-resourcemanager-maintenance/pom.xml index ae141b087774..5e18339ed8d7 100644 --- a/sdk/maintenance/azure-resourcemanager-maintenance/pom.xml +++ b/sdk/maintenance/azure-resourcemanager-maintenance/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/pom.xml b/sdk/managedapplications/azure-resourcemanager-managedapplications/pom.xml index b24b8007e59e..7022e9dc67be 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/pom.xml +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/managednetworkfabric/azure-resourcemanager-managednetworkfabric/pom.xml b/sdk/managednetworkfabric/azure-resourcemanager-managednetworkfabric/pom.xml index ecd466143413..a5381a40236f 100644 --- a/sdk/managednetworkfabric/azure-resourcemanager-managednetworkfabric/pom.xml +++ b/sdk/managednetworkfabric/azure-resourcemanager-managednetworkfabric/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml b/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml index a55907c4fe3d..7cbbef840df3 100644 --- a/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml @@ -53,23 +53,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/maps/azure-maps-elevation/pom.xml b/sdk/maps/azure-maps-elevation/pom.xml index 99e5af1ff6a8..656e9faec5c4 100644 --- a/sdk/maps/azure-maps-elevation/pom.xml +++ b/sdk/maps/azure-maps-elevation/pom.xml @@ -51,35 +51,35 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -118,7 +118,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/maps/azure-maps-geolocation/pom.xml b/sdk/maps/azure-maps-geolocation/pom.xml index 6d657c53dfb5..307153389c17 100644 --- a/sdk/maps/azure-maps-geolocation/pom.xml +++ b/sdk/maps/azure-maps-geolocation/pom.xml @@ -55,35 +55,35 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -122,7 +122,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/maps/azure-maps-render/pom.xml b/sdk/maps/azure-maps-render/pom.xml index a8520f3d1e59..880502be161f 100644 --- a/sdk/maps/azure-maps-render/pom.xml +++ b/sdk/maps/azure-maps-render/pom.xml @@ -64,35 +64,35 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -131,7 +131,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/maps/azure-maps-route/pom.xml b/sdk/maps/azure-maps-route/pom.xml index e229bd7e1af2..79ddc49533a3 100644 --- a/sdk/maps/azure-maps-route/pom.xml +++ b/sdk/maps/azure-maps-route/pom.xml @@ -63,36 +63,36 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -137,7 +137,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/maps/azure-maps-search/pom.xml b/sdk/maps/azure-maps-search/pom.xml index b1d4dcba17a7..8a544a3a92e0 100644 --- a/sdk/maps/azure-maps-search/pom.xml +++ b/sdk/maps/azure-maps-search/pom.xml @@ -65,35 +65,35 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -132,7 +132,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/maps/azure-maps-timezone/pom.xml b/sdk/maps/azure-maps-timezone/pom.xml index 2f210bc6bc87..c820ce8b4b95 100644 --- a/sdk/maps/azure-maps-timezone/pom.xml +++ b/sdk/maps/azure-maps-timezone/pom.xml @@ -61,35 +61,35 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -128,7 +128,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/maps/azure-maps-traffic/pom.xml b/sdk/maps/azure-maps-traffic/pom.xml index dfd14f3e55a4..357df211fb51 100644 --- a/sdk/maps/azure-maps-traffic/pom.xml +++ b/sdk/maps/azure-maps-traffic/pom.xml @@ -52,35 +52,35 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -119,7 +119,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/maps/azure-maps-weather/pom.xml b/sdk/maps/azure-maps-weather/pom.xml index a6b82b5a4b96..21341c4c85e2 100644 --- a/sdk/maps/azure-maps-weather/pom.xml +++ b/sdk/maps/azure-maps-weather/pom.xml @@ -62,35 +62,35 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -129,7 +129,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/maps/azure-resourcemanager-maps/pom.xml b/sdk/maps/azure-resourcemanager-maps/pom.xml index 9e2845c6b292..9f05a1aa34b0 100644 --- a/sdk/maps/azure-resourcemanager-maps/pom.xml +++ b/sdk/maps/azure-resourcemanager-maps/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/pom.xml b/sdk/mariadb/azure-resourcemanager-mariadb/pom.xml index 0c435a5c41c2..4d48e2e79916 100644 --- a/sdk/mariadb/azure-resourcemanager-mariadb/pom.xml +++ b/sdk/mariadb/azure-resourcemanager-mariadb/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/marketplaceordering/azure-resourcemanager-marketplaceordering/pom.xml b/sdk/marketplaceordering/azure-resourcemanager-marketplaceordering/pom.xml index 74c9c7bc7df9..fdbc1edb5e41 100644 --- a/sdk/marketplaceordering/azure-resourcemanager-marketplaceordering/pom.xml +++ b/sdk/marketplaceordering/azure-resourcemanager-marketplaceordering/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/mediaservices/azure-resourcemanager-mediaservices/pom.xml b/sdk/mediaservices/azure-resourcemanager-mediaservices/pom.xml index 5364afd9b4d8..455663d13ce1 100644 --- a/sdk/mediaservices/azure-resourcemanager-mediaservices/pom.xml +++ b/sdk/mediaservices/azure-resourcemanager-mediaservices/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/pom.xml b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/pom.xml index 221864475046..dec4e3ab909b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/pom.xml +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/pom.xml @@ -35,12 +35,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md index fcd985950136..71b797c9cde7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md @@ -112,7 +112,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml b/sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml index 9feb53f48e22..692aa61b4ef6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml @@ -45,12 +45,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -62,19 +62,19 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -98,7 +98,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -113,7 +113,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/migrationdiscoverysap/azure-resourcemanager-migrationdiscoverysap/pom.xml b/sdk/migrationdiscoverysap/azure-resourcemanager-migrationdiscoverysap/pom.xml index 782817ca4c9f..0840ead6d6c4 100644 --- a/sdk/migrationdiscoverysap/azure-resourcemanager-migrationdiscoverysap/pom.xml +++ b/sdk/migrationdiscoverysap/azure-resourcemanager-migrationdiscoverysap/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/mixedreality/azure-mixedreality-authentication/pom.xml b/sdk/mixedreality/azure-mixedreality-authentication/pom.xml index 7d31410e6bed..9315c02c9a29 100644 --- a/sdk/mixedreality/azure-mixedreality-authentication/pom.xml +++ b/sdk/mixedreality/azure-mixedreality-authentication/pom.xml @@ -34,31 +34,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -94,7 +94,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -119,7 +119,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/pom.xml b/sdk/mixedreality/azure-resourcemanager-mixedreality/pom.xml index f5c8a81aaaf0..fef5c414467d 100644 --- a/sdk/mixedreality/azure-resourcemanager-mixedreality/pom.xml +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/mobilenetwork/azure-resourcemanager-mobilenetwork/pom.xml b/sdk/mobilenetwork/azure-resourcemanager-mobilenetwork/pom.xml index 0f68e92c836a..5d4c26f41c77 100644 --- a/sdk/mobilenetwork/azure-resourcemanager-mobilenetwork/pom.xml +++ b/sdk/mobilenetwork/azure-resourcemanager-mobilenetwork/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/modelsrepository/azure-iot-modelsrepository/pom.xml b/sdk/modelsrepository/azure-iot-modelsrepository/pom.xml index 080ca4632280..84c0f6050e97 100644 --- a/sdk/modelsrepository/azure-iot-modelsrepository/pom.xml +++ b/sdk/modelsrepository/azure-iot-modelsrepository/pom.xml @@ -46,37 +46,37 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -148,7 +148,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/monitor/azure-monitor-ingestion-perf/pom.xml b/sdk/monitor/azure-monitor-ingestion-perf/pom.xml index 994742bd97fc..9d6fbf46217f 100644 --- a/sdk/monitor/azure-monitor-ingestion-perf/pom.xml +++ b/sdk/monitor/azure-monitor-ingestion-perf/pom.xml @@ -36,18 +36,18 @@ com.azure azure-identity - 1.12.0 + 1.12.1 com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/monitor/azure-monitor-ingestion/README.md b/sdk/monitor/azure-monitor-ingestion/README.md index 9746b6520b98..8dd87e5055e3 100644 --- a/sdk/monitor/azure-monitor-ingestion/README.md +++ b/sdk/monitor/azure-monitor-ingestion/README.md @@ -76,7 +76,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/monitor/azure-monitor-ingestion/pom.xml b/sdk/monitor/azure-monitor-ingestion/pom.xml index 751db19ef054..31ac26fe7064 100644 --- a/sdk/monitor/azure-monitor-ingestion/pom.xml +++ b/sdk/monitor/azure-monitor-ingestion/pom.xml @@ -66,12 +66,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -101,7 +101,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -113,7 +113,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml b/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml index cb32b0cf362f..cc0f04e15e92 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 io.opentelemetry @@ -164,13 +164,13 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 test com.azure azure-core-test - 1.25.0 + 1.25.0 test @@ -182,7 +182,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/monitor/azure-monitor-query-perf/pom.xml b/sdk/monitor/azure-monitor-query-perf/pom.xml index 11f9abccaebb..d398951cb5a2 100644 --- a/sdk/monitor/azure-monitor-query-perf/pom.xml +++ b/sdk/monitor/azure-monitor-query-perf/pom.xml @@ -36,18 +36,18 @@ com.azure azure-identity - 1.12.0 + 1.12.1 com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 257508df5ac9..a3061aeed430 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -86,7 +86,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/monitor/azure-monitor-query/pom.xml b/sdk/monitor/azure-monitor-query/pom.xml index 8571b6eeb3ee..96dc29243de2 100644 --- a/sdk/monitor/azure-monitor-query/pom.xml +++ b/sdk/monitor/azure-monitor-query/pom.xml @@ -42,12 +42,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -75,19 +75,19 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/mysql/azure-resourcemanager-mysql/pom.xml b/sdk/mysql/azure-resourcemanager-mysql/pom.xml index 113e566c4442..89d02b81952a 100644 --- a/sdk/mysql/azure-resourcemanager-mysql/pom.xml +++ b/sdk/mysql/azure-resourcemanager-mysql/pom.xml @@ -45,23 +45,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/pom.xml b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/pom.xml index f210688ae6e3..62a2d8568f3d 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/pom.xml +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/netapp/azure-resourcemanager-netapp/pom.xml b/sdk/netapp/azure-resourcemanager-netapp/pom.xml index 279395504109..8b3f2f83c4ab 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/pom.xml +++ b/sdk/netapp/azure-resourcemanager-netapp/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/networkanalytics/azure-resourcemanager-networkanalytics/pom.xml b/sdk/networkanalytics/azure-resourcemanager-networkanalytics/pom.xml index 56bb521f33ac..b96ce3ab166f 100644 --- a/sdk/networkanalytics/azure-resourcemanager-networkanalytics/pom.xml +++ b/sdk/networkanalytics/azure-resourcemanager-networkanalytics/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/networkcloud/azure-resourcemanager-networkcloud/pom.xml b/sdk/networkcloud/azure-resourcemanager-networkcloud/pom.xml index c6fa5824190e..9ddb398ad77d 100644 --- a/sdk/networkcloud/azure-resourcemanager-networkcloud/pom.xml +++ b/sdk/networkcloud/azure-resourcemanager-networkcloud/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml b/sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml index 8fcf731728f3..b86c7ad58bb2 100644 --- a/sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml index b472147da228..124e60f80f16 100644 --- a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/nginx/azure-resourcemanager-nginx/pom.xml b/sdk/nginx/azure-resourcemanager-nginx/pom.xml index b7bf2678fb69..5213d1960d96 100644 --- a/sdk/nginx/azure-resourcemanager-nginx/pom.xml +++ b/sdk/nginx/azure-resourcemanager-nginx/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/pom.xml b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/pom.xml index cde4dd9b329f..532b228bc942 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/pom.xml +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/oep/azure-resourcemanager-oep/pom.xml b/sdk/oep/azure-resourcemanager-oep/pom.xml index b4eb3143c263..c06508942cfb 100644 --- a/sdk/oep/azure-resourcemanager-oep/pom.xml +++ b/sdk/oep/azure-resourcemanager-oep/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/openai/azure-ai-openai-assistants/pom.xml b/sdk/openai/azure-ai-openai-assistants/pom.xml index a549f206d3cd..f2c4f8e177a1 100644 --- a/sdk/openai/azure-ai-openai-assistants/pom.xml +++ b/sdk/openai/azure-ai-openai-assistants/pom.xml @@ -61,12 +61,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -81,25 +81,25 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -148,7 +148,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/openai/azure-ai-openai/README.md b/sdk/openai/azure-ai-openai/README.md index a5931f79b513..b02646953455 100644 --- a/sdk/openai/azure-ai-openai/README.md +++ b/sdk/openai/azure-ai-openai/README.md @@ -105,7 +105,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/openai/azure-ai-openai/pom.xml b/sdk/openai/azure-ai-openai/pom.xml index bd14a3390594..d6e636c28fc7 100644 --- a/sdk/openai/azure-ai-openai/pom.xml +++ b/sdk/openai/azure-ai-openai/pom.xml @@ -58,12 +58,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -78,13 +78,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -96,13 +96,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -143,7 +143,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/operationsmanagement/azure-resourcemanager-operationsmanagement/pom.xml b/sdk/operationsmanagement/azure-resourcemanager-operationsmanagement/pom.xml index 174a6bbf7d50..4739d84fbad7 100644 --- a/sdk/operationsmanagement/azure-resourcemanager-operationsmanagement/pom.xml +++ b/sdk/operationsmanagement/azure-resourcemanager-operationsmanagement/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/orbital/azure-resourcemanager-orbital/pom.xml b/sdk/orbital/azure-resourcemanager-orbital/pom.xml index 5f64214f3e38..91f799b06661 100644 --- a/sdk/orbital/azure-resourcemanager-orbital/pom.xml +++ b/sdk/orbital/azure-resourcemanager-orbital/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/pom.xml b/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/pom.xml index 8c94d9f82066..1f26e567ddb2 100644 --- a/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/pom.xml +++ b/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/peering/azure-resourcemanager-peering/pom.xml b/sdk/peering/azure-resourcemanager-peering/pom.xml index 6b26ffc2d209..502444fe2cfd 100644 --- a/sdk/peering/azure-resourcemanager-peering/pom.xml +++ b/sdk/peering/azure-resourcemanager-peering/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/personalizer/azure-ai-personalizer/pom.xml b/sdk/personalizer/azure-ai-personalizer/pom.xml index b42bdbcc28a0..e57ba41b5ee7 100644 --- a/sdk/personalizer/azure-ai-personalizer/pom.xml +++ b/sdk/personalizer/azure-ai-personalizer/pom.xml @@ -49,31 +49,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -97,7 +97,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -112,7 +112,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml index dfc392a267ca..35842bff9162 100644 --- a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml b/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml index 50d0814f0b85..d9347c44efc0 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml b/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml index 4f42e43e32a5..51a294ffd9cb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml +++ b/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml @@ -45,23 +45,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml index 14415548685c..70b796387190 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/powerbidedicated/azure-resourcemanager-powerbidedicated/pom.xml b/sdk/powerbidedicated/azure-resourcemanager-powerbidedicated/pom.xml index 8e0b9bbce695..e90760793c47 100644 --- a/sdk/powerbidedicated/azure-resourcemanager-powerbidedicated/pom.xml +++ b/sdk/powerbidedicated/azure-resourcemanager-powerbidedicated/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/providerhub/azure-resourcemanager-providerhub/pom.xml b/sdk/providerhub/azure-resourcemanager-providerhub/pom.xml index 0a88535b4ff8..d5d4418af3f9 100644 --- a/sdk/providerhub/azure-resourcemanager-providerhub/pom.xml +++ b/sdk/providerhub/azure-resourcemanager-providerhub/pom.xml @@ -50,12 +50,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure.resourcemanager @@ -66,13 +66,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/purview/azure-analytics-purview-administration/README.md b/sdk/purview/azure-analytics-purview-administration/README.md index 0b81c92d8695..f850e82e639d 100644 --- a/sdk/purview/azure-analytics-purview-administration/README.md +++ b/sdk/purview/azure-analytics-purview-administration/README.md @@ -48,7 +48,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/purview/azure-analytics-purview-administration/pom.xml b/sdk/purview/azure-analytics-purview-administration/pom.xml index 394b99fb78cc..d304cd4f1110 100644 --- a/sdk/purview/azure-analytics-purview-administration/pom.xml +++ b/sdk/purview/azure-analytics-purview-administration/pom.xml @@ -42,12 +42,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -60,13 +60,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/purview/azure-analytics-purview-catalog/README.md b/sdk/purview/azure-analytics-purview-catalog/README.md index 185f682fe839..17d1980db0bc 100644 --- a/sdk/purview/azure-analytics-purview-catalog/README.md +++ b/sdk/purview/azure-analytics-purview-catalog/README.md @@ -51,7 +51,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/purview/azure-analytics-purview-catalog/pom.xml b/sdk/purview/azure-analytics-purview-catalog/pom.xml index 1354ac17ab6c..61cf77f866a3 100644 --- a/sdk/purview/azure-analytics-purview-catalog/pom.xml +++ b/sdk/purview/azure-analytics-purview-catalog/pom.xml @@ -42,12 +42,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -60,13 +60,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/purview/azure-analytics-purview-datamap/pom.xml b/sdk/purview/azure-analytics-purview-datamap/pom.xml index dfc64e4e1da9..751134a472d0 100644 --- a/sdk/purview/azure-analytics-purview-datamap/pom.xml +++ b/sdk/purview/azure-analytics-purview-datamap/pom.xml @@ -50,12 +50,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -78,13 +78,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/purview/azure-analytics-purview-scanning/README.md b/sdk/purview/azure-analytics-purview-scanning/README.md index c1ca47efb968..207359590b58 100644 --- a/sdk/purview/azure-analytics-purview-scanning/README.md +++ b/sdk/purview/azure-analytics-purview-scanning/README.md @@ -50,7 +50,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/purview/azure-analytics-purview-scanning/pom.xml b/sdk/purview/azure-analytics-purview-scanning/pom.xml index 0a8a066d4e2d..fa56476d5c11 100644 --- a/sdk/purview/azure-analytics-purview-scanning/pom.xml +++ b/sdk/purview/azure-analytics-purview-scanning/pom.xml @@ -42,12 +42,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -66,13 +66,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/purview/azure-analytics-purview-sharing/pom.xml b/sdk/purview/azure-analytics-purview-sharing/pom.xml index d80e6b7990bc..00e44549b714 100644 --- a/sdk/purview/azure-analytics-purview-sharing/pom.xml +++ b/sdk/purview/azure-analytics-purview-sharing/pom.xml @@ -50,12 +50,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -72,13 +72,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/purview/azure-analytics-purview-workflow/README.md b/sdk/purview/azure-analytics-purview-workflow/README.md index 53c9c00ce0c9..1fef6f8c98b4 100644 --- a/sdk/purview/azure-analytics-purview-workflow/README.md +++ b/sdk/purview/azure-analytics-purview-workflow/README.md @@ -29,7 +29,7 @@ To use the [UsernamePasswordCredential][username_password_credential] provider s com.azure azure-identity - 1.11.4 + 1.12.0 ``` diff --git a/sdk/purview/azure-analytics-purview-workflow/pom.xml b/sdk/purview/azure-analytics-purview-workflow/pom.xml index 623d5de86570..daad6ff14111 100644 --- a/sdk/purview/azure-analytics-purview-workflow/pom.xml +++ b/sdk/purview/azure-analytics-purview-workflow/pom.xml @@ -51,12 +51,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -73,13 +73,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/purview/azure-resourcemanager-purview/pom.xml b/sdk/purview/azure-resourcemanager-purview/pom.xml index 78f265051bb1..49b5a4f75fdb 100644 --- a/sdk/purview/azure-resourcemanager-purview/pom.xml +++ b/sdk/purview/azure-resourcemanager-purview/pom.xml @@ -45,23 +45,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/quantum/azure-quantum-jobs/pom.xml b/sdk/quantum/azure-quantum-jobs/pom.xml index 9f9806b75b51..17e7fbe9be72 100644 --- a/sdk/quantum/azure-quantum-jobs/pom.xml +++ b/sdk/quantum/azure-quantum-jobs/pom.xml @@ -50,12 +50,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -70,13 +70,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/quantum/azure-resourcemanager-quantum/pom.xml b/sdk/quantum/azure-resourcemanager-quantum/pom.xml index 431f4f942d07..f7cfa6dff44c 100644 --- a/sdk/quantum/azure-resourcemanager-quantum/pom.xml +++ b/sdk/quantum/azure-resourcemanager-quantum/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/qumulo/azure-resourcemanager-qumulo/pom.xml b/sdk/qumulo/azure-resourcemanager-qumulo/pom.xml index d8bbf40c7ca2..143ca3718da1 100644 --- a/sdk/qumulo/azure-resourcemanager-qumulo/pom.xml +++ b/sdk/qumulo/azure-resourcemanager-qumulo/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/quota/azure-resourcemanager-quota/pom.xml b/sdk/quota/azure-resourcemanager-quota/pom.xml index 654e6fb38ccd..eed293092753 100644 --- a/sdk/quota/azure-resourcemanager-quota/pom.xml +++ b/sdk/quota/azure-resourcemanager-quota/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml index d10816d2fb27..4c52e850a803 100644 --- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml +++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml index ec622e92c0d4..9c51ce3c136e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/recoveryservicesdatareplication/azure-resourcemanager-recoveryservicesdatareplication/pom.xml b/sdk/recoveryservicesdatareplication/azure-resourcemanager-recoveryservicesdatareplication/pom.xml index f10f9a8824cf..39726fb87eed 100644 --- a/sdk/recoveryservicesdatareplication/azure-resourcemanager-recoveryservicesdatareplication/pom.xml +++ b/sdk/recoveryservicesdatareplication/azure-resourcemanager-recoveryservicesdatareplication/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/pom.xml b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/pom.xml index f4ec105bb66d..631a179dcd1e 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/pom.xml +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/redisenterprise/azure-resourcemanager-redisenterprise/pom.xml b/sdk/redisenterprise/azure-resourcemanager-redisenterprise/pom.xml index a8fdb85fafad..16b9ec0585bb 100644 --- a/sdk/redisenterprise/azure-resourcemanager-redisenterprise/pom.xml +++ b/sdk/redisenterprise/azure-resourcemanager-redisenterprise/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/relay/azure-resourcemanager-relay/pom.xml b/sdk/relay/azure-resourcemanager-relay/pom.xml index cf30757ef1ef..28438a20288d 100644 --- a/sdk/relay/azure-resourcemanager-relay/pom.xml +++ b/sdk/relay/azure-resourcemanager-relay/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/pom.xml b/sdk/remoterendering/azure-mixedreality-remoterendering/pom.xml index a67697979d6b..fe520f42c35e 100644 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/pom.xml +++ b/sdk/remoterendering/azure-mixedreality-remoterendering/pom.xml @@ -31,7 +31,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -43,19 +43,19 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -91,13 +91,13 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-http-netty - 1.14.2 + 1.15.0 compile @@ -111,7 +111,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/reservations/azure-resourcemanager-reservations/pom.xml b/sdk/reservations/azure-resourcemanager-reservations/pom.xml index 073b1e61fbd2..929cea4bb8ab 100644 --- a/sdk/reservations/azure-resourcemanager-reservations/pom.xml +++ b/sdk/reservations/azure-resourcemanager-reservations/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml index e6337bb72b79..e33e00de78e3 100644 --- a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml index c1af612319eb..bc8726111fcc 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml index 928bc9210126..ba2e245aaee3 100644 --- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/resourcemanager/azure-resourcemanager-appplatform/pom.xml b/sdk/resourcemanager/azure-resourcemanager-appplatform/pom.xml index bfc291dec640..e2c95f834ef9 100644 --- a/sdk/resourcemanager/azure-resourcemanager-appplatform/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-appplatform/pom.xml @@ -96,7 +96,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml b/sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml index ef59fbbf95f8..24bd9eefa9e8 100644 --- a/sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml @@ -107,7 +107,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml b/sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml index 9afecacf393c..d494ba12f838 100644 --- a/sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml @@ -83,7 +83,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-cdn/pom.xml b/sdk/resourcemanager/azure-resourcemanager-cdn/pom.xml index fb0f70837110..fe7d4b77ab3b 100644 --- a/sdk/resourcemanager/azure-resourcemanager-cdn/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-cdn/pom.xml @@ -81,7 +81,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml b/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml index af9d3e6b689a..45b735db3efb 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml @@ -112,7 +112,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-containerinstance/pom.xml b/sdk/resourcemanager/azure-resourcemanager-containerinstance/pom.xml index b31d01fc035c..baac256d8684 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerinstance/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-containerinstance/pom.xml @@ -114,7 +114,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-containerregistry/pom.xml b/sdk/resourcemanager/azure-resourcemanager-containerregistry/pom.xml index ec25d2a1308e..7944fe5d0b0e 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerregistry/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-containerregistry/pom.xml @@ -77,7 +77,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-containerservice/pom.xml b/sdk/resourcemanager/azure-resourcemanager-containerservice/pom.xml index 208c83658d8b..0965d172614b 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerservice/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-containerservice/pom.xml @@ -79,7 +79,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-cosmos/pom.xml b/sdk/resourcemanager/azure-resourcemanager-cosmos/pom.xml index e3b3b6661d9a..cce2ad8ef0dd 100644 --- a/sdk/resourcemanager/azure-resourcemanager-cosmos/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-cosmos/pom.xml @@ -91,7 +91,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-dns/pom.xml b/sdk/resourcemanager/azure-resourcemanager-dns/pom.xml index 9f32d6839ecb..64e9166bbab9 100644 --- a/sdk/resourcemanager/azure-resourcemanager-dns/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-dns/pom.xml @@ -87,7 +87,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-eventhubs/pom.xml b/sdk/resourcemanager/azure-resourcemanager-eventhubs/pom.xml index 3e2c6c1549ec..c7de377933ba 100644 --- a/sdk/resourcemanager/azure-resourcemanager-eventhubs/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-eventhubs/pom.xml @@ -81,7 +81,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-keyvault/pom.xml b/sdk/resourcemanager/azure-resourcemanager-keyvault/pom.xml index 2363c47ce906..cb2457610b00 100644 --- a/sdk/resourcemanager/azure-resourcemanager-keyvault/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-keyvault/pom.xml @@ -103,7 +103,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-monitor/pom.xml b/sdk/resourcemanager/azure-resourcemanager-monitor/pom.xml index 7cde991c40f1..35237f9e2f30 100644 --- a/sdk/resourcemanager/azure-resourcemanager-monitor/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-monitor/pom.xml @@ -78,7 +78,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-msi/pom.xml b/sdk/resourcemanager/azure-resourcemanager-msi/pom.xml index 1660606cdde1..c8c080cda37f 100644 --- a/sdk/resourcemanager/azure-resourcemanager-msi/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-msi/pom.xml @@ -73,7 +73,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-network/pom.xml b/sdk/resourcemanager/azure-resourcemanager-network/pom.xml index d985b890f40c..e441f26de7fc 100644 --- a/sdk/resourcemanager/azure-resourcemanager-network/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-network/pom.xml @@ -81,7 +81,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-perf/pom.xml b/sdk/resourcemanager/azure-resourcemanager-perf/pom.xml index 6247d3576aec..3f31453d58e2 100644 --- a/sdk/resourcemanager/azure-resourcemanager-perf/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-perf/pom.xml @@ -41,12 +41,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/resourcemanager/azure-resourcemanager-privatedns/pom.xml b/sdk/resourcemanager/azure-resourcemanager-privatedns/pom.xml index 2d010f3074ef..4952385c06f8 100644 --- a/sdk/resourcemanager/azure-resourcemanager-privatedns/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-privatedns/pom.xml @@ -84,7 +84,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/pom.xml b/sdk/resourcemanager/azure-resourcemanager-redis/pom.xml index 5ac0f3d3cb18..400c8d119520 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-redis/pom.xml @@ -78,7 +78,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml b/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml index 98d5b7c5bb32..0eb8b5b498aa 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml @@ -60,12 +60,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 org.slf4j @@ -88,7 +88,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml b/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml index be4b2b34b093..708b387ded37 100644 --- a/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml @@ -64,17 +64,17 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-identity - 1.12.0 + 1.12.1 com.jcraft diff --git a/sdk/resourcemanager/azure-resourcemanager-search/pom.xml b/sdk/resourcemanager/azure-resourcemanager-search/pom.xml index c9df6bc8451e..97a643d4c676 100644 --- a/sdk/resourcemanager/azure-resourcemanager-search/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-search/pom.xml @@ -75,7 +75,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-servicebus/pom.xml b/sdk/resourcemanager/azure-resourcemanager-servicebus/pom.xml index 4c838f1b07a3..5f5e3d96eb61 100644 --- a/sdk/resourcemanager/azure-resourcemanager-servicebus/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-servicebus/pom.xml @@ -75,7 +75,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-sql/pom.xml b/sdk/resourcemanager/azure-resourcemanager-sql/pom.xml index b68bf8147d82..d8083fa7a271 100644 --- a/sdk/resourcemanager/azure-resourcemanager-sql/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-sql/pom.xml @@ -91,7 +91,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-storage/pom.xml b/sdk/resourcemanager/azure-resourcemanager-storage/pom.xml index 210d270ad0c0..7d60c1900cb9 100644 --- a/sdk/resourcemanager/azure-resourcemanager-storage/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-storage/pom.xml @@ -89,7 +89,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-test/pom.xml b/sdk/resourcemanager/azure-resourcemanager-test/pom.xml index a555122036fa..1546e2077050 100644 --- a/sdk/resourcemanager/azure-resourcemanager-test/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-test/pom.xml @@ -52,27 +52,27 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-identity - 1.12.0 + 1.12.1 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/resourcemanager/azure-resourcemanager-trafficmanager/pom.xml b/sdk/resourcemanager/azure-resourcemanager-trafficmanager/pom.xml index 3969f55be934..6375f939fdc9 100644 --- a/sdk/resourcemanager/azure-resourcemanager-trafficmanager/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-trafficmanager/pom.xml @@ -75,7 +75,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager/pom.xml b/sdk/resourcemanager/azure-resourcemanager/pom.xml index b6bfe27c81dd..4af1b38e220e 100644 --- a/sdk/resourcemanager/azure-resourcemanager/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager/pom.xml @@ -71,12 +71,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure.resourcemanager @@ -214,19 +214,19 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -282,7 +282,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/resourcemanagerhybrid/README.md b/sdk/resourcemanagerhybrid/README.md index 4ee4b5ea0bf5..5fbadce0fbac 100644 --- a/sdk/resourcemanagerhybrid/README.md +++ b/sdk/resourcemanagerhybrid/README.md @@ -85,7 +85,7 @@ Azure Management Libraries require a `TokenCredential` implementation for authen com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-appservice/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-appservice/pom.xml index af6806056a18..3055692f2bd4 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-appservice/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-appservice/pom.xml @@ -101,7 +101,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-authorization/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-authorization/pom.xml index 1fcc0db6c6ac..10a811a0c097 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-authorization/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-authorization/pom.xml @@ -81,7 +81,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-compute/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-compute/pom.xml index b0197d166f1d..26c3fa65e7dd 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-compute/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-compute/pom.xml @@ -111,7 +111,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-containerregistry/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-containerregistry/pom.xml index e4dd8241f396..53c445215235 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-containerregistry/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-containerregistry/pom.xml @@ -81,7 +81,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-containerservice/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-containerservice/pom.xml index 03002491fe28..f49a7a694b92 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-containerservice/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-containerservice/pom.xml @@ -77,7 +77,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-dns/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-dns/pom.xml index 78839695a6df..37b14911e4da 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-dns/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-dns/pom.xml @@ -86,7 +86,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-eventhubs/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-eventhubs/pom.xml index e128abbcee8a..28f0d00b2e91 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-eventhubs/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-eventhubs/pom.xml @@ -80,7 +80,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/pom.xml index 4d2e7df07df6..8f26f0c2c5d4 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/pom.xml @@ -102,7 +102,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-monitor/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-monitor/pom.xml index 29aa703f0e83..2ea6596073f4 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-monitor/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-monitor/pom.xml @@ -77,7 +77,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-network/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-network/pom.xml index c3676ad2a077..31573344b9ac 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-network/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-network/pom.xml @@ -81,7 +81,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-resources/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-resources/pom.xml index d0ff246eb8cc..d38064245774 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-resources/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-resources/pom.xml @@ -59,12 +59,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 org.slf4j @@ -87,7 +87,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-storage/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-storage/pom.xml index fb8ec1260a9e..3079a77c370c 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-storage/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-storage/pom.xml @@ -74,7 +74,7 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-test/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-test/pom.xml index b335e80edfae..017abe22e3b2 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-test/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-test/pom.xml @@ -52,32 +52,32 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-identity - 1.12.0 + 1.12.1 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager/pom.xml index e4c1bcb1e723..15f9b3b90230 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager/pom.xml @@ -147,19 +147,19 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -196,7 +196,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/resourcemover/azure-resourcemanager-resourcemover/pom.xml b/sdk/resourcemover/azure-resourcemanager-resourcemover/pom.xml index b9e0c7c5734a..8ec1e0775d68 100644 --- a/sdk/resourcemover/azure-resourcemanager-resourcemover/pom.xml +++ b/sdk/resourcemover/azure-resourcemanager-resourcemover/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/README.md b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/README.md index 5ecc88649b94..7af30a89a79f 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/README.md +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/README.md @@ -51,7 +51,7 @@ with the Azure SDK, please include the `azure-identity` package: com.azure azure-identity - 1.11.4 + 1.12.0 ``` diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml index c4e65876c09d..1b7e42a32cff 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml @@ -50,7 +50,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -104,13 +104,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/README.md b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/README.md index 414b018ad6cb..2093523a716f 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/README.md +++ b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/README.md @@ -50,7 +50,7 @@ with the Azure SDK, please include the `azure-identity` package: com.azure azure-identity - 1.11.4 + 1.12.0 ``` diff --git a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/pom.xml index bf6dfddccc17..c90f60c49595 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/pom.xml @@ -49,7 +49,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -85,13 +85,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/schemaregistry/azure-data-schemaregistry/README.md b/sdk/schemaregistry/azure-data-schemaregistry/README.md index 7f5f07a97908..3d5918679bc4 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/README.md +++ b/sdk/schemaregistry/azure-data-schemaregistry/README.md @@ -75,7 +75,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.11.4 + 1.12.0 ``` diff --git a/sdk/schemaregistry/azure-data-schemaregistry/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry/pom.xml index b8725bb3f266..672b5838c011 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry/pom.xml @@ -52,12 +52,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -94,13 +94,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/pom.xml b/sdk/scvmm/azure-resourcemanager-scvmm/pom.xml index 9e1d26ea53d7..d2764ea6490e 100644 --- a/sdk/scvmm/azure-resourcemanager-scvmm/pom.xml +++ b/sdk/scvmm/azure-resourcemanager-scvmm/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/search/azure-search-documents/pom.xml b/sdk/search/azure-search-documents/pom.xml index 2a92185aefa7..974db62b9f51 100644 --- a/sdk/search/azure-search-documents/pom.xml +++ b/sdk/search/azure-search-documents/pom.xml @@ -62,7 +62,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -72,12 +72,12 @@ com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/search/azure-search-perf/pom.xml b/sdk/search/azure-search-perf/pom.xml index d5e059ee78cb..99c82327d705 100644 --- a/sdk/search/azure-search-perf/pom.xml +++ b/sdk/search/azure-search-perf/pom.xml @@ -35,12 +35,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/security/azure-resourcemanager-security/pom.xml b/sdk/security/azure-resourcemanager-security/pom.xml index 0266ed05ffc1..87e11f36a998 100644 --- a/sdk/security/azure-resourcemanager-security/pom.xml +++ b/sdk/security/azure-resourcemanager-security/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/securitydevops/azure-resourcemanager-securitydevops/pom.xml b/sdk/securitydevops/azure-resourcemanager-securitydevops/pom.xml index 631df6f9d4a3..a1eaed2c65bc 100644 --- a/sdk/securitydevops/azure-resourcemanager-securitydevops/pom.xml +++ b/sdk/securitydevops/azure-resourcemanager-securitydevops/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/pom.xml b/sdk/securityinsights/azure-resourcemanager-securityinsights/pom.xml index 71ead875bbe5..5d35c522cdaf 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/pom.xml +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml b/sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml index ece43f87f84b..aada4fd31496 100644 --- a/sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml b/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml index b3d5b01d22ff..863ce3a617b8 100644 --- a/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml @@ -67,12 +67,12 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 com.azure azure-core-metrics-opentelemetry - 1.0.0-beta.18 + 1.0.0-beta.19 diff --git a/sdk/servicebus/azure-messaging-servicebus-track2-perf/pom.xml b/sdk/servicebus/azure-messaging-servicebus-track2-perf/pom.xml index 27324f344262..ddeb33bf3870 100644 --- a/sdk/servicebus/azure-messaging-servicebus-track2-perf/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus-track2-perf/pom.xml @@ -34,12 +34,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md index fb7bdc4d6d32..62e74ebff15c 100644 --- a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md +++ b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md @@ -9,6 +9,7 @@ ### Bugs Fixed - Fixes the session message disposition to use management node as fall back. ([#39913](https://github.com/Azure/azure-sdk-for-java/issues/ 39913)) +- Fixes the session processor idle timeout to fall back to RetryOptions::tryTimeout. ([#39993](https://github.com/Azure/azure-sdk-for-java/issues/39993)) ### Other Changes diff --git a/sdk/servicebus/azure-messaging-servicebus/README.md b/sdk/servicebus/azure-messaging-servicebus/README.md index 413c54396d3c..4cd5ddc50248 100644 --- a/sdk/servicebus/azure-messaging-servicebus/README.md +++ b/sdk/servicebus/azure-messaging-servicebus/README.md @@ -89,7 +89,7 @@ First, add the package: com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/servicebus/azure-messaging-servicebus/pom.xml b/sdk/servicebus/azure-messaging-servicebus/pom.xml index c7c279120b9c..e0687d632fa7 100644 --- a/sdk/servicebus/azure-messaging-servicebus/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus/pom.xml @@ -57,7 +57,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -67,37 +67,37 @@ com.azure azure-core-amqp - 2.9.4 + 2.9.4 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.25.0 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -148,14 +148,14 @@ com.azure azure-core-experimental - 1.0.0-beta.49 + 1.0.0-beta.50 test com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 test @@ -184,7 +184,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/SessionsMessagePump.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/SessionsMessagePump.java index c9cc2b352fd3..2afe6d63cedc 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/SessionsMessagePump.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/SessionsMessagePump.java @@ -167,7 +167,7 @@ final class SessionsMessagePump { this.instrumentation = Objects.requireNonNull(instrumentation, "'instrumentation' cannot be null"); this.sessionAcquirer = Objects.requireNonNull(sessionAcquirer, "'sessionAcquirer' cannot be null"); this.maxSessionLockRenew = Objects.requireNonNull(maxSessionLockRenew, "'maxSessionLockRenew' cannot be null."); - this.sessionIdleTimeout = sessionIdleTimeout; + this.sessionIdleTimeout = sessionIdleTimeout != null ? sessionIdleTimeout : retryPolicy.getRetryOptions().getTryTimeout(); this.maxConcurrentSessions = maxConcurrentSessions; this.concurrencyPerSession = concurrencyPerSession; this.prefetch = prefetch; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java index edff2426fec0..4921dda64f3a 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java @@ -471,10 +471,16 @@ protected final Configuration v1OrV2(boolean isV2) { if (isV2) { configSource.put("com.azure.messaging.servicebus.nonSession.asyncReceive.v2", "true"); configSource.put("com.azure.messaging.servicebus.nonSession.syncReceive.v2", "true"); + configSource.put("com.azure.messaging.servicebus.session.processor.asyncReceive.v2", "true"); + configSource.put("com.azure.messaging.servicebus.session.reactor.asyncReceive.v2", "true"); + configSource.put("com.azure.messaging.servicebus.session.syncReceive.v2", "true"); configSource.put("com.azure.messaging.servicebus.sendAndManageRules.v2", "true"); } else { configSource.put("com.azure.messaging.servicebus.nonSession.asyncReceive.v2", "false"); configSource.put("com.azure.messaging.servicebus.nonSession.syncReceive.v2", "false"); + configSource.put("com.azure.messaging.servicebus.session.processor.asyncReceive.v2", "false"); + configSource.put("com.azure.messaging.servicebus.session.reactor.asyncReceive.v2", "false"); + configSource.put("com.azure.messaging.servicebus.session.syncReceive.v2", "false"); configSource.put("com.azure.messaging.servicebus.sendAndManageRules.v2", "false"); } return new ConfigurationBuilder(configSource) diff --git a/sdk/servicefabric/azure-resourcemanager-servicefabric/pom.xml b/sdk/servicefabric/azure-resourcemanager-servicefabric/pom.xml index fd08ce4d8641..11162a92f26a 100644 --- a/sdk/servicefabric/azure-resourcemanager-servicefabric/pom.xml +++ b/sdk/servicefabric/azure-resourcemanager-servicefabric/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/pom.xml b/sdk/servicelinker/azure-resourcemanager-servicelinker/pom.xml index afbc68cee54c..d59c8b6298e5 100644 --- a/sdk/servicelinker/azure-resourcemanager-servicelinker/pom.xml +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/pom.xml @@ -44,17 +44,17 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/servicenetworking/azure-resourcemanager-servicenetworking/pom.xml b/sdk/servicenetworking/azure-resourcemanager-servicenetworking/pom.xml index e6553ef1b8c2..7546f84a8112 100644 --- a/sdk/servicenetworking/azure-resourcemanager-servicenetworking/pom.xml +++ b/sdk/servicenetworking/azure-resourcemanager-servicenetworking/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/signalr/azure-resourcemanager-signalr/pom.xml b/sdk/signalr/azure-resourcemanager-signalr/pom.xml index 3b63128c1b38..3b4aadd39663 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/pom.xml +++ b/sdk/signalr/azure-resourcemanager-signalr/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/sphere/azure-resourcemanager-sphere/pom.xml b/sdk/sphere/azure-resourcemanager-sphere/pom.xml index 3461d6eaa21f..fb5ad78b6a8c 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/pom.xml +++ b/sdk/sphere/azure-resourcemanager-sphere/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml index 0a0f4e08fc7e..1fba53d1705f 100644 --- a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml +++ b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml @@ -63,7 +63,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 true diff --git a/sdk/spring/spring-cloud-azure-actuator/pom.xml b/sdk/spring/spring-cloud-azure-actuator/pom.xml index a6e0fd7274ff..de867f093e46 100644 --- a/sdk/spring/spring-cloud-azure-actuator/pom.xml +++ b/sdk/spring/spring-cloud-azure-actuator/pom.xml @@ -51,7 +51,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 true diff --git a/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml b/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml index ac7344ffe605..9aca0209389d 100644 --- a/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml +++ b/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml @@ -43,7 +43,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -53,7 +53,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 com.azure diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml b/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml index 1c62570da79c..6cd733b405b2 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml +++ b/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml @@ -151,13 +151,13 @@ com.azure azure-core - 1.48.0 + 1.49.0 true com.azure azure-identity - 1.12.0 + 1.12.1 true diff --git a/sdk/spring/spring-cloud-azure-core/pom.xml b/sdk/spring/spring-cloud-azure-core/pom.xml index 15eaead90876..e52f7d5e25ef 100644 --- a/sdk/spring/spring-cloud-azure-core/pom.xml +++ b/sdk/spring/spring-cloud-azure-core/pom.xml @@ -41,22 +41,22 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-identity - 1.12.0 + 1.12.1 com.azure azure-core-amqp - 2.9.3 + 2.9.4 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/spring/spring-cloud-azure-integration-tests/pom.xml b/sdk/spring/spring-cloud-azure-integration-tests/pom.xml index ceda5d77f5b0..a27b86269a21 100644 --- a/sdk/spring/spring-cloud-azure-integration-tests/pom.xml +++ b/sdk/spring/spring-cloud-azure-integration-tests/pom.xml @@ -131,7 +131,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/sdk/spring/spring-cloud-azure-starter-monitor-test/pom.xml b/sdk/spring/spring-cloud-azure-starter-monitor-test/pom.xml index fdc0b6f6c483..4117f0adbe44 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor-test/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-monitor-test/pom.xml @@ -60,7 +60,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml b/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml index 42ea6e7e02c2..42e4ce22afa9 100644 --- a/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml @@ -122,13 +122,13 @@ currently released version and a lower version is resolved. --> com.azure azure-core - 1.48.0 + 1.49.0 true com.azure azure-identity - 1.12.0 + 1.12.1 true diff --git a/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml b/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml index ac4c691702ef..08f755475e38 100644 --- a/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml +++ b/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml @@ -66,7 +66,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test diff --git a/sdk/spring/spring-integration-azure-servicebus/pom.xml b/sdk/spring/spring-integration-azure-servicebus/pom.xml index 089d3c18f02e..55c5376e7452 100644 --- a/sdk/spring/spring-integration-azure-servicebus/pom.xml +++ b/sdk/spring/spring-integration-azure-servicebus/pom.xml @@ -70,7 +70,7 @@ com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/spring/spring-messaging-azure-servicebus/pom.xml b/sdk/spring/spring-messaging-azure-servicebus/pom.xml index 5462aa00ba45..5a8526bbca21 100644 --- a/sdk/spring/spring-messaging-azure-servicebus/pom.xml +++ b/sdk/spring/spring-messaging-azure-servicebus/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 org.springframework @@ -122,7 +122,7 @@ com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/spring/spring-messaging-azure-storage-queue/pom.xml b/sdk/spring/spring-messaging-azure-storage-queue/pom.xml index 620bfb1ddc5f..8df3a2d0ca0f 100644 --- a/sdk/spring/spring-messaging-azure-storage-queue/pom.xml +++ b/sdk/spring/spring-messaging-azure-storage-queue/pom.xml @@ -54,7 +54,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 @@ -98,7 +98,7 @@ com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/springappdiscovery/azure-resourcemanager-springappdiscovery/pom.xml b/sdk/springappdiscovery/azure-resourcemanager-springappdiscovery/pom.xml index 4d579b89c23e..01bef12ff971 100644 --- a/sdk/springappdiscovery/azure-resourcemanager-springappdiscovery/pom.xml +++ b/sdk/springappdiscovery/azure-resourcemanager-springappdiscovery/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/pom.xml b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/pom.xml index 026be9327447..cfbde5ba6a7d 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/pom.xml +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/standbypool/azure-resourcemanager-standbypool/pom.xml b/sdk/standbypool/azure-resourcemanager-standbypool/pom.xml index 8e9a6854e660..0786c388ac65 100644 --- a/sdk/standbypool/azure-resourcemanager-standbypool/pom.xml +++ b/sdk/standbypool/azure-resourcemanager-standbypool/pom.xml @@ -51,23 +51,23 @@ Code generated by Microsoft (R) AutoRest Code Generator. com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index a6f0735ea871..e2bec14ebe69 100644 --- a/sdk/storage/azure-storage-blob-batch/pom.xml +++ b/sdk/storage/azure-storage-blob-batch/pom.xml @@ -55,12 +55,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -95,13 +95,13 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -125,13 +125,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -165,7 +165,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-blob-changefeed/pom.xml b/sdk/storage/azure-storage-blob-changefeed/pom.xml index 1a86be6400d9..83432f89e669 100644 --- a/sdk/storage/azure-storage-blob-changefeed/pom.xml +++ b/sdk/storage/azure-storage-blob-changefeed/pom.xml @@ -62,12 +62,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -102,13 +102,13 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -140,13 +140,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -198,7 +198,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-blob-cryptography/pom.xml b/sdk/storage/azure-storage-blob-cryptography/pom.xml index 442cac45c2fa..e621d002af51 100644 --- a/sdk/storage/azure-storage-blob-cryptography/pom.xml +++ b/sdk/storage/azure-storage-blob-cryptography/pom.xml @@ -56,12 +56,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -86,7 +86,7 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test @@ -126,7 +126,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -156,13 +156,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -196,7 +196,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-blob-nio/pom.xml b/sdk/storage/azure-storage-blob-nio/pom.xml index 8b2ca9f476f2..04303e035c9c 100644 --- a/sdk/storage/azure-storage-blob-nio/pom.xml +++ b/sdk/storage/azure-storage-blob-nio/pom.xml @@ -53,12 +53,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -83,7 +83,7 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test @@ -119,13 +119,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -179,7 +179,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-blob-stress/pom.xml b/sdk/storage/azure-storage-blob-stress/pom.xml index fe67d52f5589..4f0aed7eacfd 100644 --- a/sdk/storage/azure-storage-blob-stress/pom.xml +++ b/sdk/storage/azure-storage-blob-stress/pom.xml @@ -30,12 +30,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -68,7 +68,7 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index c0655ef15bb4..9b5114104bea 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -70,12 +70,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -114,13 +114,13 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -182,13 +182,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -291,7 +291,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml index 1a7f8a1478ab..e7b785ddeccb 100644 --- a/sdk/storage/azure-storage-common/pom.xml +++ b/sdk/storage/azure-storage-common/pom.xml @@ -58,12 +58,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -85,13 +85,13 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -115,13 +115,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -206,7 +206,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-file-datalake-stress/pom.xml b/sdk/storage/azure-storage-file-datalake-stress/pom.xml index 1210e977cba0..19f639763822 100644 --- a/sdk/storage/azure-storage-file-datalake-stress/pom.xml +++ b/sdk/storage/azure-storage-file-datalake-stress/pom.xml @@ -30,12 +30,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -68,7 +68,7 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 diff --git a/sdk/storage/azure-storage-file-datalake/pom.xml b/sdk/storage/azure-storage-file-datalake/pom.xml index 011ca4fc0068..b387394d7825 100644 --- a/sdk/storage/azure-storage-file-datalake/pom.xml +++ b/sdk/storage/azure-storage-file-datalake/pom.xml @@ -66,12 +66,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -106,13 +106,13 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -142,13 +142,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -222,7 +222,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-file-share-stress/pom.xml b/sdk/storage/azure-storage-file-share-stress/pom.xml index 87f919894d28..d1e5560be6ad 100644 --- a/sdk/storage/azure-storage-file-share-stress/pom.xml +++ b/sdk/storage/azure-storage-file-share-stress/pom.xml @@ -30,12 +30,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -68,7 +68,7 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 diff --git a/sdk/storage/azure-storage-file-share/pom.xml b/sdk/storage/azure-storage-file-share/pom.xml index 7e166f01ec9f..4515240b37fc 100644 --- a/sdk/storage/azure-storage-file-share/pom.xml +++ b/sdk/storage/azure-storage-file-share/pom.xml @@ -71,12 +71,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -106,7 +106,7 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test @@ -136,7 +136,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -148,13 +148,13 @@ com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -209,7 +209,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-internal-avro/pom.xml b/sdk/storage/azure-storage-internal-avro/pom.xml index 67c071a4be93..4b118063b76c 100644 --- a/sdk/storage/azure-storage-internal-avro/pom.xml +++ b/sdk/storage/azure-storage-internal-avro/pom.xml @@ -53,7 +53,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure @@ -88,7 +88,7 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test diff --git a/sdk/storage/azure-storage-perf/pom.xml b/sdk/storage/azure-storage-perf/pom.xml index ecb30d7b6175..41d959a0e33c 100644 --- a/sdk/storage/azure-storage-perf/pom.xml +++ b/sdk/storage/azure-storage-perf/pom.xml @@ -55,12 +55,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -130,7 +130,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml index ec69df8eed26..6327d32743e2 100644 --- a/sdk/storage/azure-storage-queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -66,12 +66,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -90,7 +90,7 @@ com.azure azure-core-test - 1.25.0 + 1.25.0 test @@ -120,19 +120,19 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -187,7 +187,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/storage/azure-storage-stress/pom.xml b/sdk/storage/azure-storage-stress/pom.xml index 64e1c784b8c7..8350241c9e3b 100644 --- a/sdk/storage/azure-storage-stress/pom.xml +++ b/sdk/storage/azure-storage-stress/pom.xml @@ -30,12 +30,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -63,7 +63,7 @@ com.azure azure-core-tracing-opentelemetry - 1.0.0-beta.45 + 1.0.0-beta.46 diff --git a/sdk/storageactions/azure-resourcemanager-storageactions/pom.xml b/sdk/storageactions/azure-resourcemanager-storageactions/pom.xml index be28a80b68b8..478113ffb667 100644 --- a/sdk/storageactions/azure-resourcemanager-storageactions/pom.xml +++ b/sdk/storageactions/azure-resourcemanager-storageactions/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml b/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml index 601fb8f3607f..8f1e1d0e4fcb 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml +++ b/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/storageimportexport/azure-resourcemanager-storageimportexport/pom.xml b/sdk/storageimportexport/azure-resourcemanager-storageimportexport/pom.xml index 3d2dc49ea5cb..9e47cb3e6e48 100644 --- a/sdk/storageimportexport/azure-resourcemanager-storageimportexport/pom.xml +++ b/sdk/storageimportexport/azure-resourcemanager-storageimportexport/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml b/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml index 13b9c88c5ccc..063ce81afa64 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml +++ b/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/storagepool/azure-resourcemanager-storagepool/pom.xml b/sdk/storagepool/azure-resourcemanager-storagepool/pom.xml index f9a657b69aa9..8cd3ec1e5b69 100644 --- a/sdk/storagepool/azure-resourcemanager-storagepool/pom.xml +++ b/sdk/storagepool/azure-resourcemanager-storagepool/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/streamanalytics/azure-resourcemanager-streamanalytics/pom.xml b/sdk/streamanalytics/azure-resourcemanager-streamanalytics/pom.xml index 46f5bad86822..7dc44128c3f3 100644 --- a/sdk/streamanalytics/azure-resourcemanager-streamanalytics/pom.xml +++ b/sdk/streamanalytics/azure-resourcemanager-streamanalytics/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/subscription/azure-resourcemanager-subscription/pom.xml b/sdk/subscription/azure-resourcemanager-subscription/pom.xml index 9034425ab02e..2898c44010ec 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/pom.xml +++ b/sdk/subscription/azure-resourcemanager-subscription/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/support/azure-resourcemanager-support/pom.xml b/sdk/support/azure-resourcemanager-support/pom.xml index b418368e5725..1352bbdc463a 100644 --- a/sdk/support/azure-resourcemanager-support/pom.xml +++ b/sdk/support/azure-resourcemanager-support/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/synapse/azure-analytics-synapse-accesscontrol/pom.xml b/sdk/synapse/azure-analytics-synapse-accesscontrol/pom.xml index d4575847fed9..0a533d44215a 100644 --- a/sdk/synapse/azure-analytics-synapse-accesscontrol/pom.xml +++ b/sdk/synapse/azure-analytics-synapse-accesscontrol/pom.xml @@ -41,31 +41,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -89,7 +89,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -103,7 +103,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/synapse/azure-analytics-synapse-artifacts/pom.xml b/sdk/synapse/azure-analytics-synapse-artifacts/pom.xml index 2179b1a2f846..6970544a274f 100644 --- a/sdk/synapse/azure-analytics-synapse-artifacts/pom.xml +++ b/sdk/synapse/azure-analytics-synapse-artifacts/pom.xml @@ -41,31 +41,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -89,7 +89,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -103,7 +103,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/synapse/azure-analytics-synapse-managedprivateendpoints/pom.xml b/sdk/synapse/azure-analytics-synapse-managedprivateendpoints/pom.xml index 1d002b3feda0..b226fa2cfcec 100644 --- a/sdk/synapse/azure-analytics-synapse-managedprivateendpoints/pom.xml +++ b/sdk/synapse/azure-analytics-synapse-managedprivateendpoints/pom.xml @@ -41,31 +41,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -89,7 +89,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -103,7 +103,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/synapse/azure-analytics-synapse-monitoring/pom.xml b/sdk/synapse/azure-analytics-synapse-monitoring/pom.xml index 1e83efecfe79..7eb95c650d20 100644 --- a/sdk/synapse/azure-analytics-synapse-monitoring/pom.xml +++ b/sdk/synapse/azure-analytics-synapse-monitoring/pom.xml @@ -41,31 +41,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -89,7 +89,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -103,7 +103,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/synapse/azure-analytics-synapse-spark/pom.xml b/sdk/synapse/azure-analytics-synapse-spark/pom.xml index 3c839d29bdd5..af50d888b303 100644 --- a/sdk/synapse/azure-analytics-synapse-spark/pom.xml +++ b/sdk/synapse/azure-analytics-synapse-spark/pom.xml @@ -47,31 +47,31 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -95,7 +95,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -109,7 +109,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/synapse/azure-resourcemanager-synapse/pom.xml b/sdk/synapse/azure-resourcemanager-synapse/pom.xml index 60deb441e6d6..e9b540d24be3 100644 --- a/sdk/synapse/azure-resourcemanager-synapse/pom.xml +++ b/sdk/synapse/azure-resourcemanager-synapse/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/tables/azure-data-tables-perf/pom.xml b/sdk/tables/azure-data-tables-perf/pom.xml index 96910f81b08e..9c7f29b11ec8 100644 --- a/sdk/tables/azure-data-tables-perf/pom.xml +++ b/sdk/tables/azure-data-tables-perf/pom.xml @@ -30,7 +30,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 com.azure @@ -41,12 +41,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/tables/azure-data-tables/pom.xml b/sdk/tables/azure-data-tables/pom.xml index 74167d7d36e5..0a173e4e707b 100644 --- a/sdk/tables/azure-data-tables/pom.xml +++ b/sdk/tables/azure-data-tables/pom.xml @@ -48,12 +48,12 @@ Licensed under the MIT License. com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -92,13 +92,13 @@ Licensed under the MIT License. com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/template/azure-sdk-template-three/pom.xml b/sdk/template/azure-sdk-template-three/pom.xml index 461d988504cd..e8b3d64ae080 100644 --- a/sdk/template/azure-sdk-template-three/pom.xml +++ b/sdk/template/azure-sdk-template-three/pom.xml @@ -41,7 +41,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure diff --git a/sdk/template/azure-sdk-template-two/pom.xml b/sdk/template/azure-sdk-template-two/pom.xml index 7144fd45980a..035c5f0e714a 100644 --- a/sdk/template/azure-sdk-template-two/pom.xml +++ b/sdk/template/azure-sdk-template-two/pom.xml @@ -41,7 +41,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure diff --git a/sdk/template/azure-sdk-template/pom.xml b/sdk/template/azure-sdk-template/pom.xml index f59c5765430f..b5de7593b099 100644 --- a/sdk/template/azure-sdk-template/pom.xml +++ b/sdk/template/azure-sdk-template/pom.xml @@ -41,7 +41,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 org.junit.jupiter diff --git a/sdk/template/azure-template-perf/pom.xml b/sdk/template/azure-template-perf/pom.xml index 6a3b4746d5a3..4960fba08ce2 100644 --- a/sdk/template/azure-template-perf/pom.xml +++ b/sdk/template/azure-template-perf/pom.xml @@ -37,7 +37,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 diff --git a/sdk/template/azure-template-stress/pom.xml b/sdk/template/azure-template-stress/pom.xml index cea5548cf189..21894bfdd6b2 100644 --- a/sdk/template/azure-template-stress/pom.xml +++ b/sdk/template/azure-template-stress/pom.xml @@ -33,28 +33,28 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 io.vertx diff --git a/sdk/textanalytics/azure-ai-textanalytics-perf/pom.xml b/sdk/textanalytics/azure-ai-textanalytics-perf/pom.xml index 0e3bcfb59ffe..2c67be09fe48 100644 --- a/sdk/textanalytics/azure-ai-textanalytics-perf/pom.xml +++ b/sdk/textanalytics/azure-ai-textanalytics-perf/pom.xml @@ -38,12 +38,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -107,7 +107,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 diff --git a/sdk/textanalytics/azure-ai-textanalytics/README.md b/sdk/textanalytics/azure-ai-textanalytics/README.md index abade4defd47..748e39b75bbc 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/README.md +++ b/sdk/textanalytics/azure-ai-textanalytics/README.md @@ -141,7 +141,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.11.4 + 1.12.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/textanalytics/azure-ai-textanalytics/pom.xml b/sdk/textanalytics/azure-ai-textanalytics/pom.xml index f45b9e98c5d4..c3bda200c3d0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/pom.xml +++ b/sdk/textanalytics/azure-ai-textanalytics/pom.xml @@ -46,12 +46,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.azure @@ -73,19 +73,19 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-core-http-okhttp - 1.11.20 + 1.11.21 test com.azure azure-core-http-vertx - 1.0.0-beta.17 + 1.0.0-beta.18 test @@ -109,7 +109,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -124,7 +124,7 @@ com.azure azure-core-http-jdk-httpclient - 1.0.0-beta.12 + 1.0.0-beta.13 test diff --git a/sdk/timeseriesinsights/azure-resourcemanager-timeseriesinsights/pom.xml b/sdk/timeseriesinsights/azure-resourcemanager-timeseriesinsights/pom.xml index b4cf1ef9d6e7..15fc532d1983 100644 --- a/sdk/timeseriesinsights/azure-resourcemanager-timeseriesinsights/pom.xml +++ b/sdk/timeseriesinsights/azure-resourcemanager-timeseriesinsights/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/tools/azure-sdk-build-tool/pom.xml b/sdk/tools/azure-sdk-build-tool/pom.xml index a8752c033b59..b78e9db6457c 100644 --- a/sdk/tools/azure-sdk-build-tool/pom.xml +++ b/sdk/tools/azure-sdk-build-tool/pom.xml @@ -101,12 +101,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 diff --git a/sdk/translation/azure-ai-documenttranslator/pom.xml b/sdk/translation/azure-ai-documenttranslator/pom.xml index 9158d31c671e..c61ac4544575 100644 --- a/sdk/translation/azure-ai-documenttranslator/pom.xml +++ b/sdk/translation/azure-ai-documenttranslator/pom.xml @@ -41,17 +41,17 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-experimental - 1.0.0-beta.49 + 1.0.0-beta.50 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -76,13 +76,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -100,7 +100,7 @@ com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/translation/azure-ai-translation-text/pom.xml b/sdk/translation/azure-ai-translation-text/pom.xml index 28794993525e..e4c9ee13278a 100644 --- a/sdk/translation/azure-ai-translation-text/pom.xml +++ b/sdk/translation/azure-ai-translation-text/pom.xml @@ -47,17 +47,17 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-experimental - 1.0.0-beta.49 + 1.0.0-beta.50 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 @@ -82,13 +82,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test @@ -106,7 +106,7 @@ com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/videoanalyzer/azure-media-videoanalyzer-edge/pom.xml b/sdk/videoanalyzer/azure-media-videoanalyzer-edge/pom.xml index 412d6e8543ec..da247f2e918a 100644 --- a/sdk/videoanalyzer/azure-media-videoanalyzer-edge/pom.xml +++ b/sdk/videoanalyzer/azure-media-videoanalyzer-edge/pom.xml @@ -35,7 +35,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 org.junit.jupiter @@ -58,7 +58,7 @@ com.azure azure-core-serializer-json-jackson - 1.4.11 + 1.4.12 test diff --git a/sdk/videoanalyzer/azure-resourcemanager-videoanalyzer/pom.xml b/sdk/videoanalyzer/azure-resourcemanager-videoanalyzer/pom.xml index b6075df4b8de..1428a3272950 100644 --- a/sdk/videoanalyzer/azure-resourcemanager-videoanalyzer/pom.xml +++ b/sdk/videoanalyzer/azure-resourcemanager-videoanalyzer/pom.xml @@ -44,12 +44,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 diff --git a/sdk/vision/azure-ai-vision-imageanalysis/pom.xml b/sdk/vision/azure-ai-vision-imageanalysis/pom.xml index b6203a721aa1..b96e26bc7fbf 100644 --- a/sdk/vision/azure-ai-vision-imageanalysis/pom.xml +++ b/sdk/vision/azure-ai-vision-imageanalysis/pom.xml @@ -48,12 +48,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 org.junit.jupiter @@ -90,13 +90,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/vmwarecloudsimple/azure-resourcemanager-vmwarecloudsimple/pom.xml b/sdk/vmwarecloudsimple/azure-resourcemanager-vmwarecloudsimple/pom.xml index 22467b57d379..6ced62fd3510 100644 --- a/sdk/vmwarecloudsimple/azure-resourcemanager-vmwarecloudsimple/pom.xml +++ b/sdk/vmwarecloudsimple/azure-resourcemanager-vmwarecloudsimple/pom.xml @@ -44,23 +44,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml b/sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml index 62c8f8e00136..ac1524ce18e7 100644 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml @@ -50,23 +50,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/webpubsub/azure-messaging-webpubsub-client/pom.xml b/sdk/webpubsub/azure-messaging-webpubsub-client/pom.xml index 8515c6dc87af..6e99065451f8 100644 --- a/sdk/webpubsub/azure-messaging-webpubsub-client/pom.xml +++ b/sdk/webpubsub/azure-messaging-webpubsub-client/pom.xml @@ -42,7 +42,7 @@ com.azure azure-core - 1.48.0 + 1.49.0 @@ -56,7 +56,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -80,7 +80,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/webpubsub/azure-messaging-webpubsub/pom.xml b/sdk/webpubsub/azure-messaging-webpubsub/pom.xml index 6f33192de7b0..43285d85cbb5 100644 --- a/sdk/webpubsub/azure-messaging-webpubsub/pom.xml +++ b/sdk/webpubsub/azure-messaging-webpubsub/pom.xml @@ -36,12 +36,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-http-netty - 1.14.2 + 1.15.0 com.nimbusds @@ -53,7 +53,7 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test @@ -89,7 +89,7 @@ com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/webpubsub/azure-resourcemanager-webpubsub/pom.xml b/sdk/webpubsub/azure-resourcemanager-webpubsub/pom.xml index eab21d35b4a9..2105826564a5 100644 --- a/sdk/webpubsub/azure-resourcemanager-webpubsub/pom.xml +++ b/sdk/webpubsub/azure-resourcemanager-webpubsub/pom.xml @@ -51,23 +51,23 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/workloads/azure-resourcemanager-workloads/pom.xml b/sdk/workloads/azure-resourcemanager-workloads/pom.xml index d841252d6607..b94fb98e04c7 100644 --- a/sdk/workloads/azure-resourcemanager-workloads/pom.xml +++ b/sdk/workloads/azure-resourcemanager-workloads/pom.xml @@ -50,12 +50,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 com.azure.resourcemanager @@ -78,13 +78,13 @@ com.azure azure-core-test - 1.24.2 + 1.25.0 test com.azure azure-identity - 1.12.0 + 1.12.1 test diff --git a/sdk/workloadssapvirtualinstance/azure-resourcemanager-workloadssapvirtualinstance/pom.xml b/sdk/workloadssapvirtualinstance/azure-resourcemanager-workloadssapvirtualinstance/pom.xml index bb2fd98069f9..e34564edef9c 100644 --- a/sdk/workloadssapvirtualinstance/azure-resourcemanager-workloadssapvirtualinstance/pom.xml +++ b/sdk/workloadssapvirtualinstance/azure-resourcemanager-workloadssapvirtualinstance/pom.xml @@ -51,12 +51,12 @@ com.azure azure-core - 1.48.0 + 1.49.0 com.azure azure-core-management - 1.13.0 + 1.14.0 From df7e838ca7f63fcf034f68bb81fce94113b6e8ab Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Thu, 9 May 2024 11:07:17 -0700 Subject: [PATCH 20/28] [Cosmos][VectorSearch] Non Streaming Order By Query (#40096) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial changes * Initial changes * Increment versions for core releases (#40003) Increment package versions for core releases * Ensure ServiceBus session idle timeout fall back to retry-options::try-timeout (#39994) * Added Alpha3 Java Media Streaming Events (#40002) * Added Alpha3 Java Media Streaming Events * updating readme to add the media streaming events to remove model --------- Co-authored-by: Vinothini Dharmaraj * Update version of github-event-processor to 1.0.0-dev.20240502.2 (#40012) Co-authored-by: James Suplizio * Prepare May 2024 Identity Release (#40006) * Prepare Identity Broker May 2024 Release (#40014) * Increment package versions for identity releases (#40015) * [JobRouter] SDK Review updates (#40011) * SDK Review updates * Update auto-generated models * Add customization * Fix customization * Update package * Update tests * Linting * FixFaultInjectionRuleFailedToApplyPerPartitionInGatewayMode (#40005) * fix fault injection rule failed to apply per partition in gateway mode --------- Co-authored-by: annie-mac * azure-cosmos-test_1.0.0.beta.7Release (#40021) * release azure-cosmos-test 1.0.0.beta.7 --------- Co-authored-by: annie-mac * Fixed existsById API in ReactiveCosmosTemplate (#40022) * Fixed existsById API in ReactiveCosmosTemplate * Added changelog * Initial changes * Initial changes * Skip Recorded test and delete Event record until test proxy to work with Event recordings (#40029) Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com> * Fix invalid CODEOWNERS (#40032) * Initial changes * ServiceBus: fix session tracing (#39962) * remove additional matrix * Fix session processing and disposition instrumentation * return matrix config * review suggestions * [Automation] Generate SDK based on TypeSpec 0.15.15 (#40048) * [CODEOWNERS] Updates for org changes (#40049) * [CODEOWNERS] Updates for org changes The focus of these changes is to remove an individual who no longer is responsible for the products which their GH account is associated to. * Move from using the docker image to java2docfx for docs validation (#39744) * Move from using the docker image to java2docfx for docs validation * Temporarily turn on docs processing for template libraries for testing * Actually install the rex validation tool * Fix the if not Test-Path statement * Update java2docfx version and add a couple of diagnostics output lines * Add missing close paren * Ensure that Sort-Object always returns an array even if there's only one item * add another piece of diagnostics output * trying one more thing * remove some diag, add other * Remove the additional diagnostics, add permanent output message * Invoke java -jar on java2docfx to show the help command to ensure the install is okay * fiddling with the java -jar command * Set the working directory to the java2docfx directory before executing the mvn dependency download * Actually create the directory before trying to set location...oops * Update rex validation to verify MAVEN_HOME is set * Updates for Java PR 39875 which had changes from this PR that were more immediate * Update java2docfx version * remove check for MAVEN_HOME which was only for testing * Update the version of java2docfx to test a fix * Update version of java2docfx to 1.0.4 * revert template's ci.yml changes that were only necessary to test java2docfx * owners (#39686) * Use ClientLogger in testing output (#40010) Use ClientLogger in testing output * Fix null pointer exception and context usage (#40053) * Rename AML to AzureMachineLearning (#40056) * Fixed the Key Vault `test-resources.json` file to properly configure a deployment script for certificate creation. (#40037) * Close response body in bearer policy (#40052) * Running Prepare-Release for azure-messaging-servicebus 7.17.0 (#40058) * mgmt, TypeSpec code generation pipeline (#39963) * typespec generation pipeline echo command PR_TITLE * generation typespec Update generation.yml for Azure Pipelines Update generation.yml for Azure Pipelines Update generation.yml for Azure Pipelines * remove typespec pipeline file * fix pr title * address comments * Add codeowner linter owners (#39997) * Update to ESRP task version that supports federated auth (#40059) * Increment package versions for cosmos releases (#40031) * Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#39627) * Add reduced embeddings sample to azure-search-documents (#40069) * Add reduced embeddings sample * Fix cspell * Fix link * Search May Preview Regen Updates (#40057) * Search May Preview Regeneration - Still need to add varargs convenience * Removing ovveride statements from `setFields` for `VectorizableImageUrlQuery` and `VectorizableImageBinaryQuery` * Removing ovveride statements from `setFields` for `VectorizableImageUrlQuery` and `VectorizableImageBinaryQuery` * adding varargs * Additional adjustments to FieldBuilder and Search Index Customizations * Updating cspell.json * Adjust `SearchScoreThreshold` customization Re-enable code generation in CI * Updates: - Updated Cspell - Rename `maxStoragePerIndex` property to `maxStoragePerIndexInBytes` in SearchServiceLimits - Set `hybridSearch` property to be type `HybridSearch` in SearchRequest - Add `hybridSearch` to SearchOptions and `SearchAsyncClient.createSearchRequest()` * Adding Support and testing byte[] and List within field builder * Fix linting --------- Co-authored-by: alzimmermsft <48699787+alzimmermsft@users.noreply.github.com> * Preparing Search May 2024 Beta Release (#40071) * Preparing Search May 2024 Beta Release * Preparing Search May 2024 Beta Release * Resolving comments * Fixing build issues * eng, update autorest.java, improve error output in sdk automation (#40073) * improve error output * autorest.java 4.1.29 * Merge to main after spring cloud azure 4.18.0 released (#40075) * Prepare for Spring Cloud Azure 4.18.0 release (#40063) * update version client * update version/changelog/readme * update changelog * Increment versions for spring releases (#40074) * Increment package versions for spring releases * Update version_client.txt * Update pom.xml --------- Co-authored-by: Muyao Feng <92105726+Netyyyy@users.noreply.github.com> --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> * Miscellaneous Core performance improvements (#39552) Miscellaneous Core performance improvements * Increment package versions for search releases (#40072) * Update io.fabric8:kubernetes-client (#40086) 5.12.3 -> 6.12.1 * Increment package versions for servicebus releases (#40094) * Emit stable auto-instrumented otel metrics (#39960) * Update otel metrics logic * add runtime metrics * adding a few metrics I forgot * small correction * Update * Fix * Update * Delete pre-stable metrics --------- Co-authored-by: Harsimar Kaur (from Dev Box) --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: Anu Thomas Chandy Co-authored-by: v-durgeshs <146056835+v-durgeshs@users.noreply.github.com> Co-authored-by: Vinothini Dharmaraj Co-authored-by: James Suplizio Co-authored-by: Bill Wert Co-authored-by: williamzhao87 Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac Co-authored-by: Kushagra Thapar Co-authored-by: minwoolee-msft <77083090+minwoolee-msft@users.noreply.github.com> Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com> Co-authored-by: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Co-authored-by: Liudmila Molkova Co-authored-by: Jesse Squire Co-authored-by: Harsimar Kaur Co-authored-by: vcolin7 Co-authored-by: Xiaofei Cao <92354331+XiaofeiCao@users.noreply.github.com> Co-authored-by: Wes Haggard Co-authored-by: Patrick Hallisey Co-authored-by: Jair Myree Co-authored-by: Weidong Xu Co-authored-by: Muyao Feng <92105726+Netyyyy@users.noreply.github.com> Co-authored-by: Helen <56097766+heyams@users.noreply.github.com> Co-authored-by: Harsimar Kaur (from Dev Box) --- .github/CODEOWNERS | 18 +- .github/CODEOWNERS_baseline_errors.txt | 5 + eng/emitter-package-lock.json | 36 +- eng/emitter-package.json | 10 +- eng/mgmt/automation/changelog.py | 4 +- eng/mgmt/automation/generate.py | 8 +- eng/mgmt/automation/generate_data.py | 6 +- eng/mgmt/automation/generate_utils.py | 2 +- eng/mgmt/automation/generation.yml | 30 +- eng/mgmt/automation/generation_data.yml | 2 +- eng/mgmt/automation/parameters.py | 2 +- eng/mgmt/automation/sdk_generate.py | 6 +- eng/pipelines/docindex.yml | 24 +- .../templates/stages/1es-redirect.yml | 2 +- .../stages/archetype-java-release-batch.yml | 13 +- .../stages/archetype-java-release-patch.yml | 5 +- .../stages/archetype-java-release.yml | 11 +- .../steps/install-rex-validation-tool.yml | 22 + .../templates/steps/java-publishing.yml | 8 +- eng/repo-docs/docms/daily.update.setting.xml | 10 + eng/scripts/Language-Settings.ps1 | 487 +++--------------- eng/scripts/docs/java2docfx.version.txt | 1 + eng/versioning/external_dependencies.txt | 2 +- eng/versioning/version_client.txt | 110 ++-- .../ConfigurationAsyncClient.java | 197 +++---- .../appconfiguration/ConfigurationClient.java | 154 ++---- .../ConfigurationClientBuilder.java | 5 +- .../implementation/Utility.java | 100 +--- .../ConfigurationClientTest.java | 28 +- .../security/attestation/AttestationTest.java | 26 +- .../spring-cloud-azure-dependencies/pom.xml | 6 +- .../pom.xml | 2 +- ...tomationAsyncClientAutomatedLiveTests.java | 3 + .../CallAutomationAutomatedLiveTestBase.java | 56 +- .../CallAutomationLiveTestBase.java | 24 +- ...CallConnectionAsyncAutomatedLiveTests.java | 8 +- .../CallDialogAsyncAutomatedLiveTests.java | 2 + .../CallMediaAsyncAutomatedLiveTests.java | 3 + .../CallRecordingAutomatedLiveTests.java | 3 + .../createACSCallAndUnmixedAudioTest.json | 1 - ...createACSCallUnmixedAudioAffinityTest.json | 1 - ...articipantFinallyCancelAddParticipant.json | 1 - ...FinallyRemoveParticipantAutomatedTest.json | 1 - ...PCallAndAnswerThenHangupAutomatedTest.json | 1 - .../createVOIPCallAndRejectAutomatedTest.json | 1 - .../dialogActionInACallAutomatedTest.json | 1 - .../dtmfActionsInACallAutomatedTest.json | 1 - .../playMediaInACallAutomatedTest.json | 1 - .../CallAutomationLiveTestBase.java | 6 +- .../DownloadContentAsyncLiveTests.java | 9 +- .../communication/chat/ChatClientTest.java | 30 +- .../chat/CommunicationLoggerPolicy.java | 5 +- .../CommunicationIdentityClientTestBase.java | 5 +- .../ClassificationPolicyAsyncLiveTests.java | 5 +- .../ClassificationPolicyLiveTests.java | 5 +- .../RouterJobAsyncLiveTests.java | 13 +- .../RouterJobLiveTests.java | 17 +- .../RouterWorkerAsyncLiveTests.java | 5 +- .../RouterWorkerLiveTests.java | 5 +- .../CommunicationMessagesTestBase.java | 5 +- .../PhoneNumbersIntegrationTestBase.java | 8 +- .../SipRoutingIntegrationTestBase.java | 10 +- .../rooms/RoomsAsyncClientTests.java | 121 +++-- .../communication/rooms/RoomsTestBase.java | 40 +- .../azure/communication/sms/SmsTestBase.java | 8 +- .../ConfidentialLedgerClientTestBase.java | 7 +- .../containerregistry/TestUtils.java | 3 +- .../implementation/JdkHttpUtils.java | 6 +- .../NettyAsyncHttpResponseBase.java | 18 +- .../http/netty/implementation/Utility.java | 7 +- .../polling/LROPollerTests.java | 20 +- sdk/core/azure-core/spotbugs-exclude.xml | 6 + .../java/com/azure/core/http/HttpHeaders.java | 17 +- .../BearerTokenAuthenticationPolicy.java | 24 +- .../core/http/policy/RedirectPolicy.java | 2 - .../com/azure/core/http/rest/RestProxy.java | 2 - .../http/rest/AsyncRestProxy.java | 2 - .../http/rest/RestProxyBase.java | 2 - .../http/rest/SwaggerMethodParser.java | 2 + .../util/HttpHeadersAccessHelper.java | 62 +++ .../util/serializer/SerializerEncoding.java | 58 ++- .../PolicyConsumesResponseBodyTest.java | 430 ++++++++++++++++ sdk/cosmos/azure-cosmos-kafka-connect/pom.xml | 2 +- sdk/cosmos/azure-cosmos-test/CHANGELOG.md | 9 + sdk/cosmos/azure-cosmos-test/pom.xml | 2 +- sdk/cosmos/azure-cosmos-tests/pom.xml | 2 +- sdk/cosmos/azure-cosmos/CHANGELOG.md | 2 + .../azure/cosmos/implementation/Configs.java | 15 + .../CosmosQueryRequestOptionsImpl.java | 22 + .../DocumentQueryExecutionContextFactory.java | 36 +- ...onStreamingOrderByBadRequestException.java | 20 + .../NonStreamingOrderByDocumentProducer.java | 43 ++ ...gOrderByDocumentQueryExecutionContext.java | 264 ++++++++++ .../query/NonStreamingOrderByUtils.java | 111 ++++ ...ParallelDocumentQueryExecutionContext.java | 3 +- ...ipelinedDocumentQueryExecutionContext.java | 19 +- .../query/PipelinedQueryExecutionContext.java | 2 +- .../PipelinedQueryExecutionContextBase.java | 3 +- .../implementation/query/QueryFeature.java | 3 +- .../implementation/query/QueryInfo.java | 6 + .../query/QueryPlanRetriever.java | 3 +- .../models/CosmosQueryRequestOptions.java | 9 + .../cosmos/models/ModelBridgeInternal.java | 5 + .../core/DigitalTwinsTestBase.java | 5 +- .../eventhubs/EventDataAggregatorTest.java | 6 +- ...EventHubBufferedPartitionProducerTest.java | 6 +- ...redProducerAsyncClientIntegrationTest.java | 7 +- .../EventHubConsumerAsyncClientTest.java | 5 +- .../eventhubs/EventHubConsumerClientTest.java | 12 +- .../EventPositionIntegrationTest.java | 3 +- .../EventProcessorClientBuilderTest.java | 97 ++-- .../eventhubs/IntegrationTestBase.java | 5 +- .../messaging/eventhubs/LongRunningTest.java | 70 +-- .../PartitionBasedLoadBalancerTest.java | 7 +- .../eventhubs/ProxySelectorTest.java | 5 +- .../AmqpReceiveLinkProcessorTest.java | 10 +- .../README.md | 8 +- .../certificates/CertificateClientTest.java | 6 +- .../keyvault/keys/KeyAsyncClientTest.java | 5 +- .../security/keyvault/keys/KeyClientTest.java | 6 +- .../cryptography/CryptographyClientTest.java | 6 +- .../CryptographyClientTestBase.java | 9 +- .../secrets/SecretAsyncClientTest.java | 6 +- .../keyvault/secrets/SecretClientTest.java | 6 +- sdk/keyvault/test-resources.json | 46 +- .../ingestion/LogsIngestionTestBase.java | 6 +- .../ingestion/implementation/UtilsTest.java | 6 +- .../implementation/MetricDataMapper.java | 33 +- .../DefaultHeartBeatPropertyProvider.java | 2 +- .../heartbeat/HeartbeatTests.java | 50 +- .../assistants/AzureFunctionsSyncTests.java | 6 +- .../assistants/AzureRetrievalSyncTest.java | 6 +- .../assistants/AzureRunThreadAsyncTest.java | 30 +- .../assistants/AzureRunThreadSyncTest.java | 30 +- .../openai/assistants/FunctionsSyncTests.java | 6 +- .../openai/assistants/RetrievalSyncTest.java | 6 +- .../openai/assistants/RunThreadAsyncTest.java | 30 +- .../openai/assistants/RunThreadSyncTest.java | 30 +- .../models/FunctionCallPreset.java | 8 +- .../quantum/jobs/QuantumClientTestBase.java | 16 +- .../appplatform/AppPlatformTest.java | 14 +- .../appservice/OneDeployTests.java | 2 +- .../implementation/RetryTests.java | 13 +- .../VirtualMachineImageOperationsTests.java | 6 +- ...tualMachineManagedDiskOperationsTests.java | 6 +- .../VirtualMachineOperationsTests.java | 6 +- ...lMachineRelatedResourcesDeletionTests.java | 16 +- .../KubernetesClustersTests.java | 10 +- .../MonitorActivityAndMetricsTests.java | 8 +- .../resources/DeploymentsTests.java | 6 +- .../fluentcore/dag/BreadSliceImpl.java | 6 +- .../fluentcore/dag/DAGErrorTests.java | 46 +- .../fluentcore/dag/DAGraphTests.java | 34 +- .../resources/fluentcore/dag/OrderImpl.java | 6 +- .../resources/fluentcore/dag/PanCakeImpl.java | 12 +- .../resources/fluentcore/dag/PastaImpl.java | 12 +- .../resources/fluentcore/dag/PizzaImpl.java | 10 +- .../fluentcore/dag/ProxyTaskGroupTests.java | 5 +- .../fluentcore/dag/SandwichImpl.java | 6 +- .../azure-resourcemanager-samples/pom.xml | 6 +- .../ApplicationGatewayTests.java | 10 +- .../AzureResourceManagerTests.java | 140 ++--- .../resourcemanager/PrivateLinkTests.java | 28 +- .../TestApplicationGateway.java | 138 ++--- .../com/azure/resourcemanager/TestCdn.java | 8 +- ...hPublicIpAddressWithSystemAssignedMSI.java | 10 +- .../com/azure/resourcemanager/TestDns.java | 70 +-- .../TestExpressRouteCircuit.java | 22 +- .../resourcemanager/TestLoadBalancer.java | 31 +- .../TestLocalNetworkGateway.java | 10 +- .../com/azure/resourcemanager/TestNSG.java | 14 +- .../azure/resourcemanager/TestNetwork.java | 14 +- .../resourcemanager/TestNetworkInterface.java | 6 +- .../resourcemanager/TestNetworkWatcher.java | 20 +- .../azure/resourcemanager/TestPrivateDns.java | 62 +-- .../resourcemanager/TestPublicIPAddress.java | 8 +- .../resourcemanager/TestPublicIPPrefix.java | 8 +- .../com/azure/resourcemanager/TestRedis.java | 6 +- .../resourcemanager/TestRouteTables.java | 18 +- .../resourcemanager/TestSearchService.java | 13 +- .../azure/resourcemanager/TestTemplate.java | 19 +- .../resourcemanager/TestTrafficManager.java | 5 +- .../com/azure/resourcemanager/TestUtils.java | 33 +- .../TestVirtualNetworkGateway.java | 8 +- .../azure-search-documents/CHANGELOG.md | 23 +- sdk/search/azure-search-documents/README.md | 2 +- sdk/search/azure-search-documents/pom.xml | 7 +- .../implementation/util/FieldBuilder.java | 2 + ...va => AzureMachineLearningParameters.java} | 53 +- ...va => AzureMachineLearningVectorizer.java} | 35 +- .../indexes/models/SearchServiceLimits.java | 26 +- .../models/VectorSearchVectorizer.java | 8 +- .../src/samples/README.md | 3 +- .../VectorSearchReducedEmbeddings.java | 347 +++++++++++++ .../documents/indexes/FieldBuilderTests.java | 17 +- .../azure-search-documents/swagger/README.md | 30 +- sdk/search/azure-search-perf/pom.xml | 2 +- .../azure-messaging-servicebus-stress/pom.xml | 2 +- .../pom.xml | 2 +- .../azure-messaging-servicebus/CHANGELOG.md | 10 +- .../azure-messaging-servicebus/README.md | 2 +- .../azure-messaging-servicebus/docs/pom.xml | 2 +- .../azure-messaging-servicebus/pom.xml | 2 +- .../azure/messaging/servicebus/FluxTrace.java | 5 +- .../messaging/servicebus/FluxTraceV2.java | 71 --- .../servicebus/ServiceBusAsyncConsumer.java | 17 +- .../ServiceBusSessionReceiverAsyncClient.java | 2 +- .../ServiceBusSingleSessionManager.java | 12 +- .../servicebus/SessionsMessagePump.java | 13 +- .../servicebus/TracingFluxOperator.java | 82 +++ .../ServiceBusReceiverInstrumentation.java | 72 ++- .../instrumentation/ServiceBusTracer.java | 10 +- .../servicebus/ProxySelectorTest.java | 5 +- .../messaging/servicebus/ReceiveLinkTest.java | 12 +- .../ServiceBusMixClientIntegrationTest.java | 43 +- .../ServiceBusReceiverAsyncClientTest.java | 6 +- ...ceBusSenderAsyncClientIntegrationTest.java | 9 +- .../ServiceBusSessionManagerTest.java | 17 +- .../azure/messaging/servicebus/TestUtils.java | 5 +- .../servicebus/TracingIntegrationTests.java | 56 ++ .../ServiceBusReceiveLinkProcessorTest.java | 19 +- ...erviceBusReceiverInstrumentationTests.java | 6 +- sdk/spring/CHANGELOG.md | 13 + sdk/spring/README.md | 2 +- .../azure-spring-data-cosmos/CHANGELOG.md | 14 +- sdk/spring/azure-spring-data-cosmos/README.md | 2 +- sdk/spring/azure-spring-data-cosmos/pom.xml | 2 +- .../cosmos/core/ReactiveCosmosTemplate.java | 3 +- .../cosmos/core/ReactiveCosmosTemplateIT.java | 20 + .../ReactiveUUIDIdDomainRepositoryIT.java | 3 + ...dDomainPartitionPartitionRepositoryIT.java | 3 + .../CHANGELOG.md | 6 +- .../pom.xml | 8 +- .../spring-cloud-azure-actuator/CHANGELOG.md | 6 +- .../spring-cloud-azure-actuator/pom.xml | 4 +- .../CHANGELOG.md | 6 +- .../pom.xml | 4 +- .../CHANGELOG.md | 6 +- .../pom.xml | 6 +- .../config/implementation/TestUtils.java | 5 +- .../CHANGELOG.md | 6 +- .../spring-cloud-azure-autoconfigure/pom.xml | 18 +- .../aad/implementation/TestJwks.java | 5 +- .../UserPrincipalMicrosoftGraphTests.java | 5 +- .../ThreadInterruptedStatusRestoreTest.java | 14 +- .../AzureServiceBusJmsPropertiesTests.java | 8 +- .../spring-cloud-azure-core/CHANGELOG.md | 6 +- sdk/spring/spring-cloud-azure-core/pom.xml | 2 +- .../CHANGELOG.md | 6 +- .../pom.xml | 6 +- .../CHANGELOG.md | 6 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 28 +- .../CHANGELOG.md | 6 +- .../pom.xml | 4 +- .../spring-cloud-azure-service/CHANGELOG.md | 6 +- sdk/spring/spring-cloud-azure-service/pom.xml | 6 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 6 +- .../CHANGELOG.md | 6 +- .../README.md | 4 +- .../pom.xml | 6 +- .../pom.xml | 4 +- .../spring-cloud-azure-starter-cosmos/pom.xml | 4 +- .../pom.xml | 6 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 6 +- .../pom.xml | 6 +- .../pom.xml | 6 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 6 +- .../spring-cloud-azure-starter-redis/pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 6 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 8 +- .../pom.xml | 4 +- .../pom.xml | 4 +- sdk/spring/spring-cloud-azure-starter/pom.xml | 4 +- .../CHANGELOG.md | 6 +- .../pom.xml | 4 +- .../CHANGELOG.md | 6 +- .../pom.xml | 8 +- .../CHANGELOG.md | 6 +- .../pom.xml | 6 +- .../CHANGELOG.md | 6 +- .../pom.xml | 8 +- .../CHANGELOG.md | 6 +- .../spring-cloud-azure-trace-sleuth/pom.xml | 4 +- .../CHANGELOG.md | 6 +- .../spring-integration-azure-core/pom.xml | 4 +- .../CHANGELOG.md | 6 +- .../pom.xml | 8 +- .../CHANGELOG.md | 6 +- .../pom.xml | 10 +- .../CHANGELOG.md | 6 +- .../pom.xml | 6 +- .../CHANGELOG.md | 6 +- .../spring-messaging-azure-eventhubs/pom.xml | 6 +- .../core/EventHubsTemplateTests.java | 35 +- .../CHANGELOG.md | 6 +- .../spring-messaging-azure-servicebus/pom.xml | 8 +- .../CHANGELOG.md | 6 +- .../pom.xml | 6 +- .../spring-messaging-azure/CHANGELOG.md | 6 +- sdk/spring/spring-messaging-azure/pom.xml | 4 +- .../storage/blob/RequestRetryTestFactory.java | 7 +- .../com/azure/storage/blob/RetryTests.java | 3 +- .../storage/file/share/DirectoryApiTests.java | 6 +- .../ImageAnalysisClientTestBase.java | 118 +++-- .../webpubsub/client/GroupMessageTests.java | 8 +- 319 files changed, 3800 insertions(+), 2489 deletions(-) create mode 100644 eng/pipelines/templates/steps/install-rex-validation-tool.yml create mode 100644 eng/scripts/docs/java2docfx.version.txt delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createACSCallAndUnmixedAudioTest.json delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createACSCallUnmixedAudioAffinityTest.json delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenAddParticipantFinallyCancelAddParticipant.json delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenAddParticipantFinallyRemoveParticipantAutomatedTest.json delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenHangupAutomatedTest.json delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndRejectAutomatedTest.json delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/dialogActionInACallAutomatedTest.json delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/dtmfActionsInACallAutomatedTest.json delete mode 100644 sdk/communication/azure-communication-callautomation/src/test/resources/session-records/playMediaInACallAutomatedTest.json create mode 100644 sdk/core/azure-core/src/test/java/com/azure/core/http/policy/PolicyConsumesResponseBodyTest.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByBadRequestException.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentProducer.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java rename sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/{AMLParameters.java => AzureMachineLearningParameters.java} (79%) rename sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/{AMLVectorizer.java => AzureMachineLearningVectorizer.java} (69%) create mode 100644 sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/VectorSearchReducedEmbeddings.java delete mode 100644 sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTraceV2.java create mode 100644 sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/TracingFluxOperator.java diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 193c8b69c4f4..b2005c647e31 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -396,10 +396,10 @@ # ServiceOwners: @raedJarrar @jifems # PRLabel: %DevCenter -/sdk/devcenter/ @sebrenna @mharlan +/sdk/devcenter/ @sebrenna # ServiceLabel: %DevCenter -# ServiceOwners: @sebrenna @mharlan +# ServiceOwners: @sebrenna # ServiceLabel: %Device Provisioning Service # ServiceOwners: @nberdy @@ -430,7 +430,7 @@ # ServiceLabel: %Event Grid # AzureSdkOwners: @billwert -# ServiceOwners: @jfggdl +# ServiceOwners: @Kishp01 @ahamad-MS # PRLabel: %Event Hubs /sdk/eventhubs/ @conniey @anuchandy @lmolkova @@ -558,7 +558,7 @@ # ServiceOwners: @ambhatna @savjani # PRLabel: %OpenTelemetry -/sdk/monitor/azure-monitor-opentelemetry-exporter/ @trask @ramthi @heyams @jeanbisutti +/sdk/monitor/azure-monitor-opentelemetry-exporter/ @trask @ramthi @heyams @jeanbisutti @harsimar # ServiceLabel: %Network # ServiceOwners: @aznetsuppgithub @@ -647,9 +647,6 @@ # ServiceLabel: %Redis Cache # ServiceOwners: @yegu-ms -# ServiceLabel: %Relay -# ServiceOwners: @jfggdl - # PRLabel: %Remote Rendering /sdk/remoterendering/ @MichaelZp0 @ChristopherManthei @@ -796,13 +793,13 @@ /sdk/spring-experimental/ @chenrujun @netyyyy @saragluna @moarychan # PRLabel: %Monitor - Spring -/sdk/spring/spring-cloud-azure-starter-monitor @jeanbisutti @trask @ramthi @heyams +/sdk/spring/spring-cloud-azure-starter-monitor @jeanbisutti @trask @ramthi @heyams @harsimar # PRLabel: %Monitor - Spring -/sdk/spring/spring-cloud-azure-starter-monitor-test @jeanbisutti @trask @ramthi @heyams +/sdk/spring/spring-cloud-azure-starter-monitor-test @jeanbisutti @trask @ramthi @heyams @harsimar # ServiceLabel: %Monitor - Spring -# AzureSdkOwners: @jeanbisutti @trask @ramthi @heyams +# AzureSdkOwners: @jeanbisutti @trask @ramthi @heyams @harsimar # PRLabel: %azure-spring /sdk/spring/spring-cloud-azure-appconfiguration-config*/ @mrm9084 @chenrujun @netyyyy @saragluna @moarychan @@ -853,3 +850,4 @@ # Add owners for notifications for specific pipelines /eng/pipelines/aggregate-reports.yml @joshfree @jonathangiles +/eng/common/pipelines/codeowners-linter.yml @alzimmermsft @srnagar @lmolkova diff --git a/.github/CODEOWNERS_baseline_errors.txt b/.github/CODEOWNERS_baseline_errors.txt index e0dbd7daa065..faf15e0ee168 100644 --- a/.github/CODEOWNERS_baseline_errors.txt +++ b/.github/CODEOWNERS_baseline_errors.txt @@ -267,3 +267,8 @@ ccmixpdevs is an invalid user. Ensure the user exists, is public member of Azure ccmbpxpcrew is an invalid user. Ensure the user exists, is public member of Azure and has write permissions. TiagoCrewGitHubIssues is an invalid user. Ensure the user exists, is public member of Azure and has write permissions. ccmshowbackdevs is an invalid user. Ensure the user exists, is public member of Azure and has write permissions. +sagivf is not a public member of Azure. +Aviv-Yaniv is not a public member of Azure. +tmahmood-microsoft is not a public member of Azure. +Kishp01 is not a public member of Azure. +ahamad-MS is an invalid user. Ensure the user exists, is public member of Azure and has write permissions. \ No newline at end of file diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index d74bddeb2891..7d1f72e79429 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,13 +5,13 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-java": "0.15.14" + "@azure-tools/typespec-java": "0.15.15" }, "devDependencies": { "@azure-tools/typespec-autorest": "0.41.1", "@azure-tools/typespec-azure-core": "0.41.0", "@azure-tools/typespec-azure-resource-manager": "0.41.0", - "@azure-tools/typespec-client-generator-core": "0.41.6", + "@azure-tools/typespec-client-generator-core": "0.41.8", "@typespec/compiler": "0.55.0", "@typespec/http": "0.55.0", "@typespec/openapi": "0.55.0", @@ -114,9 +114,9 @@ } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.41.6", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.41.6.tgz", - "integrity": "sha512-pEv0LQb415QioO6hsYYXWwmsG6Ka3J7SRUgf5zlA6/m6inc8OR1MwFGHdTTjzbp3jG0GDr1C/T7jF1Jy+edyfw==", + "version": "0.41.8", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.41.8.tgz", + "integrity": "sha512-d72LPwkEio/swqyAAgcuOaw+K4ghSbZcRjpjsvddxHWHh25ZukjD2hU/BfCtidnKptgKjs79fV++w2MYE6sTyw==", "dependencies": { "change-case": "~5.4.4", "pluralize": "^8.0.0" @@ -133,9 +133,9 @@ } }, "node_modules/@azure-tools/typespec-java": { - "version": "0.15.14", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-java/-/typespec-java-0.15.14.tgz", - "integrity": "sha512-Cpa92KG09UMAq76oM21x/PswYSjuE3LMLtqYv21JEz30TcjaL0/KVtVum2hKzK9s2/eZzY70acaMNkuDQyQVBw==", + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-java/-/typespec-java-0.15.15.tgz", + "integrity": "sha512-46zyPBkDF5NEbL4DEwDt/WiiQgTvsLI1CtiYD5Cfjt+stbmSNVb77urcxlzqgEbQiFPCV6UJWGnuu09ilYT/Dw==", "dependencies": { "@autorest/codemodel": "~4.20.0", "js-yaml": "~4.1.0", @@ -167,19 +167,19 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", + "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.24.2", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.2.tgz", - "integrity": "sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==", + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", + "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", + "@babel/helper-validator-identifier": "^7.24.5", "chalk": "^2.4.2", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" @@ -973,9 +973,9 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yaml": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", - "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz", + "integrity": "sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA==", "bin": { "yaml": "bin.mjs" }, diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 15fe2aad5a8e..d566172a15d6 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,16 +1,16 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-java": "0.15.14" + "@azure-tools/typespec-java": "0.15.15" }, "devDependencies": { - "@typespec/versioning": "0.55.0", - "@azure-tools/typespec-client-generator-core": "0.41.6", - "@typespec/http": "0.55.0", - "@typespec/openapi": "0.55.0", + "@azure-tools/typespec-client-generator-core": "0.41.8", "@typespec/rest": "0.55.0", "@typespec/compiler": "0.55.0", + "@typespec/openapi": "0.55.0", "@azure-tools/typespec-azure-core": "0.41.0", + "@typespec/versioning": "0.55.0", + "@typespec/http": "0.55.0", "@azure-tools/typespec-azure-resource-manager": "0.41.0", "@azure-tools/typespec-autorest": "0.41.1" } diff --git a/eng/mgmt/automation/changelog.py b/eng/mgmt/automation/changelog.py index fd62451eae7e..72f7a5767305 100755 --- a/eng/mgmt/automation/changelog.py +++ b/eng/mgmt/automation/changelog.py @@ -9,7 +9,7 @@ from parameters import * from generate import update_parameters from generate_utils import get_version -from generate import compile_package +from generate_utils import compile_arm_package from generate import compare_with_maven_package os.chdir(pwd) @@ -31,7 +31,7 @@ def main(): update_parameters(args.get('suffix')) if args.get('compile'): - compile_package(sdk_root, service) + compile_arm_package(sdk_root, service) versions = get_version(sdk_root, service).split(';') stable_version = versions[1] diff --git a/eng/mgmt/automation/generate.py b/eng/mgmt/automation/generate.py index da692c27e539..1c56b9e154b7 100755 --- a/eng/mgmt/automation/generate.py +++ b/eng/mgmt/automation/generate.py @@ -24,7 +24,7 @@ ) from generate_utils import ( compare_with_maven_package, - compile_package, + compile_arm_package, generate, get_and_update_service_from_api_specs, get_suffix_from_api_specs, @@ -187,7 +187,7 @@ def sdk_automation_autorest(config: dict) -> List[dict]: tag=tag, ) if succeeded: - compile_package(sdk_root, module) + compile_arm_package(sdk_root, module) packages.append({ 'packageName': @@ -256,7 +256,7 @@ def sdk_automation_typespec_project(tsp_project: str, config: dict) -> dict: update_root_pom(sdk_root, service) # compile - succeeded = compile_package(sdk_root, module) + succeeded = compile_arm_package(sdk_root, module) # output if sdk_folder and module and service: @@ -359,7 +359,7 @@ def main(): ) if succeeded: - succeeded = compile_package(sdk_root, module) + succeeded = compile_arm_package(sdk_root, module) if succeeded: compare_with_maven_package(sdk_root, service, stable_version, current_version, module) diff --git a/eng/mgmt/automation/generate_data.py b/eng/mgmt/automation/generate_data.py index aee8301e8d57..fa885c58a0e9 100755 --- a/eng/mgmt/automation/generate_data.py +++ b/eng/mgmt/automation/generate_data.py @@ -335,7 +335,11 @@ def compile_package(sdk_root: str, group_id: str, module: str) -> bool: sdk_root, group_id, module) logging.info(command) if os.system(command) != 0: - logging.error('[COMPILE] Maven build fail') + error_message = ('[COMPILE] Maven build fail.\n' + 'One reason of the compilation failure is that the existing code customization in SDK repository being incompatible with the class generated from updated TypeSpec source. In such case, you can ignore the failure, and fix the customization in SDK repository.\n' + 'You can inquire in "Language - Java" Teams channel. Please include the link of this Pull Request in the query.') + logging.error(error_message) + print(error_message, file=sys.stderr) return False return True diff --git a/eng/mgmt/automation/generate_utils.py b/eng/mgmt/automation/generate_utils.py index 8194eae9be2b..422db00d3471 100644 --- a/eng/mgmt/automation/generate_utils.py +++ b/eng/mgmt/automation/generate_utils.py @@ -95,7 +95,7 @@ def generate( return True -def compile_package(sdk_root, module) -> bool: +def compile_arm_package(sdk_root: str, module: str) -> bool: if os.system( 'mvn --no-transfer-progress clean verify -f {0}/pom.xml -Dmaven.javadoc.skip -Dgpg.skip -DskipTestCompile -Djacoco.skip -Drevapi.skip -pl {1}:{2} -am'.format( sdk_root, GROUP_ID, module)) != 0: diff --git a/eng/mgmt/automation/generation.yml b/eng/mgmt/automation/generation.yml index d1423af5d341..ef7306beaa24 100644 --- a/eng/mgmt/automation/generation.yml +++ b/eng/mgmt/automation/generation.yml @@ -12,7 +12,9 @@ variables: - name: MAVEN_OPTS value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - name: NodeVersion - value: '16.x' + value: '18.x' +- name: fromTypeSpec + value: $[ne(variables['TSP_CONFIG'], '')] steps: - bash: | @@ -29,6 +31,12 @@ steps: - bash: | npm install -g autorest displayName: 'Install autorest' + condition: eq(variables.fromTypeSpec, false) + +- bash: | + npm install -g @azure-tools/typespec-client-generator-cli + displayName: 'Install tsp-client' + condition: eq(variables.fromTypeSpec, true) # - template: /eng/common/testproxy/test-proxy-tool.yml # parameters: @@ -38,13 +46,27 @@ steps: - bash: | export PATH=$JAVA_HOME_11_X64/bin:$PATH java -version + set -x + ./eng/mgmt/automation/generate.py --tsp-config "$(TSP_CONFIG)" --version "$(VERSION)" --auto-commit-external-change --user-name "azure-sdk" --user-email "azuresdk@microsoft.com" + displayName: Generation from TypeSpec + condition: eq(variables.fromTypeSpec, true) + +- bash: | + export PATH=$JAVA_HOME_11_X64/bin:$PATH + java -version + set -x ./eng/mgmt/automation/generate.py --readme "$(README)" --tag "$(TAG)" --autorest-options="$(AUTOREST_OPTIONS)" --service "$(SERVICE)" --version "$(VERSION)" --suffix "$(SUFFIX)" --auto-commit-external-change --user-name "azure-sdk" --user-email "azuresdk@microsoft.com" - displayName: Generation + displayName: Generation from Swagger + condition: eq(variables.fromTypeSpec, false) - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: PRBranchName: fluent-lite-generation-$(Build.BuildId) - CommitMsg: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' - PRTitle: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' + ${{ if variables.fromTypeSpec }}: + CommitMsg: '[Automation] Generate Fluent Lite from TypeSpec $(README)' + PRTitle: '[Automation] Generate Fluent Lite from TypeSpec $(README)' + ${{ else }}: + CommitMsg: '[Automation] Generate Fluent Lite from Swagger $(README)#$(TAG)' + PRTitle: '[Automation] Generate Fluent Lite from Swagger $(README)#$(TAG)' PRLabels: 'Mgmt - Track 2' OpenAsDraft: '$(DRAFT_PULL_REQUEST)' diff --git a/eng/mgmt/automation/generation_data.yml b/eng/mgmt/automation/generation_data.yml index 55378d235324..7cacdc1877c9 100644 --- a/eng/mgmt/automation/generation_data.yml +++ b/eng/mgmt/automation/generation_data.yml @@ -12,7 +12,7 @@ variables: - name: MAVEN_OPTS value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - name: NodeVersion - value: '16.x' + value: '18.x' steps: - bash: | diff --git a/eng/mgmt/automation/parameters.py b/eng/mgmt/automation/parameters.py index 158efbd6c896..85fe90bc5d0a 100644 --- a/eng/mgmt/automation/parameters.py +++ b/eng/mgmt/automation/parameters.py @@ -16,7 +16,7 @@ SDK_ROOT = '../../../' # related to file dir AUTOREST_CORE_VERSION = '3.9.7' -AUTOREST_JAVA = '@autorest/java@4.1.28' +AUTOREST_JAVA = '@autorest/java@4.1.29' DEFAULT_VERSION = '1.0.0-beta.1' GROUP_ID = 'com.azure.resourcemanager' API_SPECS_FILE = 'api-specs.yaml' diff --git a/eng/mgmt/automation/sdk_generate.py b/eng/mgmt/automation/sdk_generate.py index e6ffeaceeccc..d1d1e9a0a51e 100755 --- a/eng/mgmt/automation/sdk_generate.py +++ b/eng/mgmt/automation/sdk_generate.py @@ -20,7 +20,7 @@ ) from generate_utils import ( compare_with_maven_package, - compile_package, + compile_arm_package, generate, get_and_update_service_from_api_specs, get_suffix_from_api_specs, @@ -215,7 +215,7 @@ def sdk_automation_autorest(config: dict) -> List[dict]: tag = tag, ) if succeeded: - compile_package(sdk_root, module) + compile_arm_package(sdk_root, module) packages.append({ 'packageName': @@ -294,7 +294,7 @@ def main(): ) if succeeded: - succeeded = compile_package(sdk_root, module) + succeeded = compile_arm_package(sdk_root, module) if succeeded: compare_with_maven_package(sdk_root, service, stable_version, current_version, module) diff --git a/eng/pipelines/docindex.yml b/eng/pipelines/docindex.yml index 0cb3f6205908..c128f858955d 100644 --- a/eng/pipelines/docindex.yml +++ b/eng/pipelines/docindex.yml @@ -13,7 +13,6 @@ jobs: DailyDocRepoLocation: $(Pipeline.Workspace)/daily DocRepoOwner: Azure DocRepoName: azure-docs-sdk-java - DocValidationImageId: azuresdkimages.azurecr.io/javarefautocr:latest steps: # Sync docs repo onboarding files/folders - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml @@ -29,10 +28,6 @@ jobs: WorkingDirectory: $(DocRepoLocation) - Name: azure-sdk/$(DocRepoName) WorkingDirectory: $(DailyDocRepoLocation) - # Pull and build the docker image. - - template: /eng/common/pipelines/templates/steps/docker-pull-image.yml - parameters: - ImageId: "$(DocValidationImageId)" - task: Powershell@2 inputs: @@ -46,7 +41,7 @@ jobs: inputs: pwsh: true filePath: eng/common/scripts/Update-DocsMsPackages.ps1 - arguments: -DocRepoLocation $(DocRepoLocation) -ImageId '$(DocValidationImageId)' + arguments: -DocRepoLocation $(DocRepoLocation) displayName: Update Docs Onboarding for main branch condition: and(succeeded(), or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Force.MainUpdate'], 'true'))) @@ -85,7 +80,7 @@ jobs: parameters: BaseRepoBranch: $(DefaultBranch) BaseRepoOwner: $(DocRepoOwner) - CommitMsg: "Update docs CI configuration" + CommitMsg: "Update docs CI configuration Build: $(System.CollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)" TargetRepoName: $(DocRepoName) TargetRepoOwner: $(DocRepoOwner) WorkingDirectory: $(DocRepoLocation) @@ -95,20 +90,7 @@ jobs: parameters: DailyBranchVariableName: DailyDocsBranchName - # Docs daily updates is supposed to download packages from public feed repository, so we have to specify additional repositories in a POM or the profile. - # Here is maven documentation: https://maven.apache.org/guides/mini/guide-multiple-repositories.html - - powershell: | - # Linux mvn `setting.xml` is sitting under path `~/.m2/setting.xml` - Get-Command mvn - if (!(Test-Path '~/.m2/')) { - mkdir ~/.m2/ - } - if (Test-Path '~/.m2/setting.xml') { - Write-Host "'setting.xml' exists. Overwriting the file to support multiple repositories." - } - Copy-Item "./eng/repo-docs/docms/daily.update.setting.xml" -Destination "~/.m2/settings.xml" - displayName: 'Configure mvn' - workingDirectory: $(Build.SourcesDirectory) + - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml - task: Powershell@2 inputs: diff --git a/eng/pipelines/templates/stages/1es-redirect.yml b/eng/pipelines/templates/stages/1es-redirect.yml index d97a6c8e6fec..0cad046eea7a 100644 --- a/eng/pipelines/templates/stages/1es-redirect.yml +++ b/eng/pipelines/templates/stages/1es-redirect.yml @@ -11,7 +11,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20240320.1 + ref: refs/tags/azure-sdk-build-tools_20240507.1 parameters: - name: stages diff --git a/eng/pipelines/templates/stages/archetype-java-release-batch.yml b/eng/pipelines/templates/stages/archetype-java-release-batch.yml index 24a2d7c7e723..7b0cf0945427 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-batch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-batch.yml @@ -319,10 +319,6 @@ stages: image: azsdk-pool-mms-ubuntu-2004-1espt os: linux - variables: - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest - strategy: runOnce: deploy: @@ -341,6 +337,8 @@ stages: - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml + - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -354,7 +352,6 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - deployment: PublishDocs displayName: Publish Docs to GitHubIO Blob Storage @@ -464,9 +461,6 @@ stages: name: azsdk-pool-mms-ubuntu-2004-general image: azsdk-pool-mms-ubuntu-2004-1espt os: linux - variables: - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: @@ -485,6 +479,8 @@ stages: - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml + - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -499,6 +495,5 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - template: /eng/common/pipelines/templates/steps/docsms-ensure-validation.yml diff --git a/eng/pipelines/templates/stages/archetype-java-release-patch.yml b/eng/pipelines/templates/stages/archetype-java-release-patch.yml index 50e817b937fd..c22cff36f32c 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-patch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-patch.yml @@ -239,8 +239,6 @@ stages: variables: - template: /eng/pipelines/templates/variables/globals.yml - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest strategy: runOnce: @@ -261,6 +259,8 @@ stages: - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml + - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -274,7 +274,6 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - deployment: PublishDocs displayName: Publish Docs to GitHubIO Blob Storage diff --git a/eng/pipelines/templates/stages/archetype-java-release.yml b/eng/pipelines/templates/stages/archetype-java-release.yml index bcb7e5c37892..6d689be35605 100644 --- a/eng/pipelines/templates/stages/archetype-java-release.yml +++ b/eng/pipelines/templates/stages/archetype-java-release.yml @@ -257,8 +257,6 @@ stages: variables: - template: /eng/pipelines/templates/variables/globals.yml - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest strategy: runOnce: @@ -275,10 +273,11 @@ stages: - download: current displayName: 'Download Artifact: ${{parameters.ArtifactName}}' artifact: ${{parameters.ArtifactName}} - # Pull and build the docker image. - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml + - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -290,7 +289,6 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - ${{if ne(artifact.skipPublishDocGithubIo, 'true')}}: - deployment: PublishDocs @@ -446,8 +444,6 @@ stages: os: linux variables: - template: /eng/pipelines/templates/variables/globals.yml - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: @@ -466,6 +462,8 @@ stages: - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml + - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -480,6 +478,5 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - template: /eng/common/pipelines/templates/steps/docsms-ensure-validation.yml diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml new file mode 100644 index 000000000000..904e04402123 --- /dev/null +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -0,0 +1,22 @@ +steps: + # Create a java2docfx subdirectory in the $(Build.BinariesDirectory) and install the java2docfx there + # This way, the jar file is in its own subdirectory and isolated. + - pwsh: | + $java2docfxVer = Get-Content eng/scripts/docs/java2docfx.version.txt + $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" + New-Item $java2docfxDir -ItemType Directory | Out-Null + $originLocation = Get-Location + try { + # Set the location into the created java2docfx directory . Running mvn from the repository root + # picks up the root POM and processes that while doing the dependency:copy in spite of + # the fact it has nothing to do with this download. + Set-Location $java2docfxDir + Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" + mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" + $java2docfxJarLoc = Join-Path $java2docfxDir -ChildPath "java2docfx-$java2docfxVer.jar" + Write-Host "Testing the install, running java -jar $java2docfxJarLoc -h" + java -jar $java2docfxJarLoc -h + } finally { + Set-Location $originLocation + } + displayName: Install java2docfx for package validation \ No newline at end of file diff --git a/eng/pipelines/templates/steps/java-publishing.yml b/eng/pipelines/templates/steps/java-publishing.yml index 6f8aeecf8156..016495e8e130 100644 --- a/eng/pipelines/templates/steps/java-publishing.yml +++ b/eng/pipelines/templates/steps/java-publishing.yml @@ -107,10 +107,14 @@ steps: -Path ${{ parameters.OutputDirectory }} -InformationAction Continue - ${{if and(eq(parameters.ShouldPublish, 'true'), ne(parameters.StageOnly, 'true'))}}: - - task: EsrpRelease@4 + - task: EsrpRelease@7 displayName: 'Publish to ESRP' inputs: - ConnectedServiceName: 'ESRP Release Service' + ConnectedServiceName: 'Azure SDK Engineering System' + ClientId: '5f81938c-2544-4f1f-9251-dd9de5b8a81b' + KeyVaultName: 'AzureSDKEngKeyVault' + AuthCertName: 'azure-sdk-esrp-release-auth-certificate' + SignCertName: 'azure-sdk-esrp-release-sign-certificate' Intent: 'PackageDistribution' ContentType: 'Maven' FolderLocation: ${{ parameters.OutputDirectory }} diff --git a/eng/repo-docs/docms/daily.update.setting.xml b/eng/repo-docs/docms/daily.update.setting.xml index fc1b359a3a62..f30128b6d146 100644 --- a/eng/repo-docs/docms/daily.update.setting.xml +++ b/eng/repo-docs/docms/daily.update.setting.xml @@ -18,6 +18,16 @@ true + + docs-public-packages + https://docfx.pkgs.visualstudio.com/docfx/_packaging/docs-public-packages/maven/v1 + + true + + + true + + diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 27cfa73218be..dfbd0f1ba16c 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -163,7 +163,11 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou # through the javadoc, like track 1 libraries whose javadoc.jar files don't contain anything, in # the metadata json files. if ($namespaces.Count -gt 0) { + Write-Host "Get-java-DocsMsDevLanguageSpecificPackageInfo:adding namespaces property with the following namespaces:" + $namespaces | Write-Host $packageInfo | Add-Member -Type NoteProperty -Name "Namespaces" -Value $namespaces + } else { + Write-Host "Get-java-DocsMsDevLanguageSpecificPackageInfo: no namespaces to add" } } return $packageInfo @@ -262,412 +266,6 @@ function Get-java-GithubIoDocIndex() GenerateDocfxTocContent -tocContent $tocContent -lang "Java" -campaignId "UA-62780441-42" } -# a "package.json configures target packages for all the monikers in a Repository, it also has a slightly different -# schema than the moniker-specific json config that is seen in python and js -function Update-java-CIConfig($pkgs, $ciRepo, $locationInDocRepo, $monikerId=$null) -{ - $pkgJsonLoc = (Join-Path -Path $ciRepo -ChildPath $locationInDocRepo) - - if (-not (Test-Path $pkgJsonLoc)) { - Write-Error "Unable to locate package json at location $pkgJsonLoc, exiting." - exit(1) - } - - $allJsonData = Get-Content $pkgJsonLoc | ConvertFrom-Json - - $visibleInCI = @{} - - for ($i=0; $i -lt $allJsonData[$monikerId].packages.Length; $i++) { - $pkgDef = $allJsonData[$monikerId].packages[$i] - $visibleInCI[$pkgDef.packageArtifactId] = $i - } - - foreach ($releasingPkg in $pkgs) { - if ($visibleInCI.ContainsKey($releasingPkg.PackageId)) { - $packagesIndex = $visibleInCI[$releasingPkg.PackageId] - $existingPackageDef = $allJsonData[$monikerId].packages[$packagesIndex] - $existingPackageDef.packageVersion = $releasingPkg.PackageVersion - } - else { - $newItem = New-Object PSObject -Property @{ - packageDownloadUrl = $PackageRepositoryUri - packageGroupId = $releasingPkg.GroupId - packageArtifactId = $releasingPkg.PackageId - packageVersion = $releasingPkg.PackageVersion - inputPath = @() - excludePath = @() - } - - $allJsonData[$monikerId].packages += $newItem - } - } - - $jsonContent = $allJsonData | ConvertTo-Json -Depth 10 | % {$_ -replace "(?m) (?<=^(?: )*)", " " } - - Set-Content -Path $pkgJsonLoc -Value $jsonContent -} - -$PackageExclusions = @{ - "azure-core-experimental" = "Don't want to include an experimental package."; - "azure-core-test" = "Don't want to include the test framework package."; - "azure-sdk-bom" = "Don't want to include the sdk bom."; - "azure-storage-internal-avro" = "No external APIs."; - "azure-cosmos-spark_3-1_2-12" = "Javadoc dependency issue."; - "azure-cosmos-spark_3-2_2-12" = "Javadoc dependency issue."; - "azure-cosmos-spark_3-3_2-12" = "Javadoc dependency issue."; - "azure-cosmos-spark_3-4_2-12" = "Javadoc dependency issue."; - "azure-cosmos-spark_3-5_2-12" = "Javadoc dependency issue."; - "azure-cosmos-test" = "Don't want to include the test framework package."; - "azure-aot-graalvm-support-netty" = "No Javadocs for the package."; - "azure-aot-graalvm-support" = "No Javadocs for the package."; - "azure-sdk-template" = "Depends on unreleased core."; - "azure-sdk-template-two" = "Depends on unreleased core."; - "azure-sdk-template-three" = "Depends on unreleased core."; - "azure-ai-personalizer" = "No java docs in this package."; - "azure-sdk-build-tool" = "Do not release docs for this package."; - "azure-resourcemanager-voiceservices" = "Doc build attempts to download a package that does not have published sources."; - "azure-resourcemanager-storagemover" = "Attempts to azure-sdk-build-tool and fails"; - "azure-security-keyvault-jca" = "Consistently hangs docs build, might be a spring package https://github.com/Azure/azure-sdk-for-java/issues/35389"; -} - -# Validates if the package will succeed in the CI build by validating the -# existence of a com folder in the unzipped source package -function SourcePackageHasComFolder($artifactNamePrefix, $packageDirectory) { - try - { - $packageArtifact = "${artifactNamePrefix}:jar:sources" - $mvnResults = mvn ` - dependency:copy ` - -Dartifact="$packageArtifact" ` - -DoutputDirectory="$packageDirectory" - - if ($LASTEXITCODE) { - LogWarning "Could not download source artifact: $packageArtifact" - $mvnResults | Write-Host - return $false - } - - $sourcesJarPath = (Get-ChildItem -File -Path $packageDirectory -Filter "*-sources.jar")[0] - $sourcesExtractPath = Join-Path $packageDirectory "sources" - - # Ensure that the sources folder is empty before extracting the jar - # otherwise there could be file collisions from a previous extraction run on - # the same system. - Remove-Item $sourcesExtractPath/* -Force -Recurse -ErrorAction Ignore - - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($sourcesJarPath, $sourcesExtractPath) - - if (!(Test-Path "$sourcesExtractPath\com")) { - LogWarning "Could not locate 'com' folder extracting $packageArtifact" - return $false - } - } - catch - { - LogError "Exception while updating checking if package can be documented: $($package.packageGroupId):$($package.packageArtifactId)" - LogError $_ - LogError $_.ScriptStackTrace - return $false - } - - return $true -} - -function PackageDependenciesResolve($artifactNamePrefix, $packageDirectory) { - - $pomArtifactName = "${artifactNamePrefix}:pom" - $artifactDownloadOutput = mvn ` - dependency:copy ` - -Dartifact="$pomArtifactName" ` - -DoutputDirectory="$packageDirectory" - - if ($LASTEXITCODE) { - LogWarning "Could not download pom artifact: $pomArtifactName" - $artifactDownloadOutput | Write-Host - return $false - } - - $downloadedPomPath = (Get-ChildItem -File -Path $packageDirectory -Filter '*.pom')[0] - - # -P '!azure-mgmt-sdk-test-jar' excludes the unpublished test jar from - # dependencies - $copyDependencyOutput = mvn ` - -f $downloadedPomPath ` - dependency:copy-dependencies ` - -P '!azure-mgmt-sdk-test-jar' ` - -DoutputDirectory="$packageDirectory" - - if ($LASTEXITCODE) { - LogWarning "Could not resolve dependencies for: $pomArtifactName" - $copyDependencyOutput | Write-Host - return $false - } - - return $true -} - -function ValidatePackage($groupId, $artifactId, $version, $DocValidationImageId) { - return ValidatePackages @{ Group = $groupId; Name = $artifactId; Version = $version; } $DocValidationImageId -} - -function ValidatePackages([array]$packageInfos, $DocValidationImageId) { - $workingDirectory = Join-Path ([System.IO.Path]::GetTempPath()) "validation" - if (!(Test-Path $workingDirectory)) { - New-Item -ItemType Directory -Force -Path $workingDirectory | Out-Null - } - - # Add more validation by replicating as much of the docs CI process as - # possible - # https://github.com/Azure/azure-sdk-for-python/issues/20109 - if (!$DocValidationImageId) - { - return FallbackValidation -packageInfos $packageInfos -workingDirectory $workingDirectory - } - else - { - return DockerValidation -packageInfos $packageInfos -DocValidationImageId $DocValidationImageId -workingDirectory $workingDirectory - } -} - -function FallbackValidation ($packageInfos, $workingDirectory) { - $results = @() - - foreach ($packageInfo in $packageInfos) { - $groupId = $packageInfo.Group - $artifactId = $packageInfo.Name - $version = $packageInfo.Version - - Write-Host "Validating using mvn command directly on $artifactId." - - $artifactNamePrefix = "${groupId}:${artifactId}:${version}" - - $packageDirectory = Join-Path $workingDirectory "${groupId}__${artifactId}__${version}" - New-Item -ItemType Directory -Path $packageDirectory -Force | Out-Null - - $isValid = (SourcePackageHasComFolder $artifactNamePrefix $packageDirectory) ` - -and (PackageDependenciesResolve $artifactNamePrefix $packageDirectory) - - if (!$isValid) { - LogWarning "Package $artifactNamePrefix ref docs validation failed." - } - - $results += $isValid - } - - $allValid = $results.Where({ $_ -eq $false }).Count -eq 0 - - return $allValid -} - -function DockerValidation ($packageInfos, $DocValidationImageId, $workingDirectory) { - Write-Host "Validating $($packageInfos.Length) package(s) using $DocValidationImageId." - - $containerWorkingDirectory = '/workdir/out' - $configurationFileName = 'configuration.json' - - $hostConfigurationPath = Join-Path $workingDirectory $configurationFileName - - # Cannot use Join-Path because the container and host path separators may differ - $containerConfigurationPath = "$containerWorkingDirectory/$configurationFileName" - - $configuration = [ordered]@{ - "output_path" = "docs-ref-autogen"; - "packages" = @($packageInfos | ForEach-Object { [ordered]@{ - packageGroupId = $_.Group; - packageArtifactId = $_.Name; - packageVersion = $_.Version; - packageDownloadUrl = $PackageRepositoryUri; - } }); - } - - Set-Content -Path $hostConfigurationPath -Value ($configuration | ConvertTo-Json) | Out-Null - - docker run -v "${workingDirectory}:${containerWorkingDirectory}" ` - -e TARGET_CONFIGURATION_PATH=$containerConfigurationPath $DocValidationImageId 2>&1 ` - | Where-Object { -not ($_ -match '^Progress .*B\s*$') } ` # Remove progress messages - | Out-Host - - if ($LASTEXITCODE -ne 0) { - LogWarning "The `docker` command failed with exit code $LASTEXITCODE." - - # The docker exit codes: https://docs.docker.com/engine/reference/run/#exit-status - # If the docker validation failed because of docker itself instead of the application, or if we don't know which - # package failed, fall back to mvn validation - if ($LASTEXITCODE -in 125..127 -Or $packageInfos.Length -gt 1) { - return FallbackValidation -packageInfos $packageInfos -workingDirectory $workingDirectory - } - - return $false - } - - return $true -} - -function Update-java-DocsMsPackages($DocsRepoLocation, $DocsMetadata, $DocValidationImageId) { - Write-Host "Excluded packages:" - foreach ($excludedPackage in $PackageExclusions.Keys) { - Write-Host " $excludedPackage - $($PackageExclusions[$excludedPackage])" - } - - # Also exclude 'spring' packages - # https://github.com/Azure/azure-sdk-for-java/issues/23087 - $FilteredMetadata = $DocsMetadata.Where({ !($PackageExclusions.ContainsKey($_.Package) -or $_.Type -eq 'spring') }) - - UpdateDocsMsPackages ` - (Join-Path $DocsRepoLocation 'package.json') ` - 'preview' ` - $FilteredMetadata ` - $DocValidationImageId - - UpdateDocsMsPackages ` - (Join-Path $DocsRepoLocation 'package.json') ` - 'latest' ` - $FilteredMetadata ` - $DocValidationImageId -} - -function UpdateDocsMsPackages($DocConfigFile, $Mode, $DocsMetadata, $DocValidationImageId) { - $packageConfig = Get-Content $DocConfigFile -Raw | ConvertFrom-Json - - $packageOutputPath = 'docs-ref-autogen' - if ($Mode -eq 'preview') { - $packageOutputPath = 'preview/docs-ref-autogen' - } - $targetPackageList = $packageConfig.Where({ $_.output_path -eq $packageOutputPath}) - if ($targetPackageList.Length -eq 0) { - LogError "Unable to find package config for $packageOutputPath in $DocConfigFile" - exit 1 - } elseif ($targetPackageList.Length -gt 1) { - LogError "Found multiple package configs for $packageOutputPath in $DocConfigFile" - exit 1 - } - - $targetPackageList = $targetPackageList[0] - - $outputPackages = @() - foreach ($package in $targetPackageList.packages) { - $packageGroupId = $package.packageGroupId - $packageName = $package.packageArtifactId - - $matchingPublishedPackageArray = $DocsMetadata.Where({ - $_.Package -eq $packageName -and $_.GroupId -eq $packageGroupId - }) - - # If this package does not match any published packages keep it in the list. - # This handles packages which are not tracked in metadata but still need to - # be built in Docs CI. - if ($matchingPublishedPackageArray.Count -eq 0) { - Write-Host "Keep non-tracked package: $packageName" - $outputPackages += $package - continue - } - - if ($matchingPublishedPackageArray.Count -gt 1) { - LogWarning "Found more than one matching published package in metadata for $packageName; only updating first entry" - } - $matchingPublishedPackage = $matchingPublishedPackageArray[0] - - if ($Mode -eq 'preview' -and !$matchingPublishedPackage.VersionPreview.Trim()) { - # If we are in preview mode and the package does not have a superseding - # preview version, remove the package from the list. - Write-Host "Remove superseded preview package: $packageName" - continue - } - - if ($Mode -eq 'latest' -and !$matchingPublishedPackage.VersionGA.Trim()) { - LogWarning "Metadata is missing GA version for GA package $packageName. Keeping existing package." - $outputPackages += $package - continue - } - - $packageVersion = $($matchingPublishedPackage.VersionGA) - if ($Mode -eq 'preview') { - if (!$matchingPublishedPackage.VersionPreview.Trim()) { - LogWarning "Metadata is missing preview version for preview package $packageName. Keeping existing package." - $outputPackages += $package - continue - } - $packageVersion = $matchingPublishedPackage.VersionPreview - } - - # If upgrading the package, run basic sanity checks against the package - if ($package.packageVersion -ne $packageVersion) { - Write-Host "Validating new version detected for $packageName ($packageVersion)" - $validatePackageResult = ValidatePackage $package.packageGroupId $package.packageArtifactId $packageVersion $DocValidationImageId - - if (!$validatePackageResult) { - LogWarning "Package is not valid: $packageName. Keeping old version." - $outputPackages += $package - continue - } - - $package.packageVersion = $packageVersion - } - - Write-Host "Keeping tracked package: $packageName." - $outputPackages += $package - } - - $outputPackagesHash = @{} - foreach ($package in $outputPackages) { - $outputPackagesHash["$($package.packageGroupId):$($package.packageArtifactId)"] = $true - } - - $remainingPackages = @() - if ($Mode -eq 'preview') { - $remainingPackages = $DocsMetadata.Where({ - ![string]::IsNullOrWhiteSpace($_.VersionPreview) -and !$outputPackagesHash.ContainsKey("$($_.GroupId):$($_.Package)") - }) - } else { - $remainingPackages = $DocsMetadata.Where({ - ![string]::IsNullOrWhiteSpace($_.VersionGA) -and !$outputPackagesHash.ContainsKey("$($_.GroupId):$($_.Package)") - }) - } - - # Add packages that exist in the metadata but are not onboarded in docs config - foreach ($package in $remainingPackages) { - $packageName = $package.Package - $packageGroupId = $package.GroupId - $packageVersion = $package.VersionGA - if ($Mode -eq 'preview') { - $packageVersion = $package.VersionPreview - } - - Write-Host "Validating new package $($packageGroupId):$($packageName):$($packageVersion)" - $validatePackageResult = ValidatePackage $packageGroupId $packageName $packageVersion $DocValidationImageId - if (!$validatePackageResult) { - LogWarning "Package is not valid: ${packageGroupId}:$packageName. Cannot onboard." - continue - } - - Write-Host "Add new package from metadata: ${packageGroupId}:$packageName" - $package = [ordered]@{ - packageArtifactId = $packageName - packageGroupId = $packageGroupId - packageVersion = $packageVersion - packageDownloadUrl = $PackageRepositoryUri - } - - $outputPackages += $package - } - - $targetPackageList.packages = $outputPackages - - # It is assumed that there is a matching config from above when the number of - # matching $targetPackageList is 1 - foreach ($config in $packageConfig) { - if ($config.output_path -eq $packageOutputPath) { - $config = $targetPackageList - break - } - } - - $outputJson = ConvertTo-Json $packageConfig -Depth 100 - Set-Content -Path $DocConfigFile -Value $outputJson - Write-Host "Onboarding configuration $Mode written to: $DocConfigFile" -} - # function is used to filter packages to submit to API view tool function Find-java-Artifacts-For-Apireview($artifactDir, $pkgName) { @@ -754,6 +352,8 @@ function GetExistingPackageVersions ($PackageName, $GroupId=$null) } } +# Defined in common.ps1 +# $GetDocsMsMetadataForPackageFn = "Get-${Language}-DocsMsMetadataForPackage" function Get-java-DocsMsMetadataForPackage($PackageInfo) { $readmeName = $PackageInfo.Name.ToLower() Write-Host "Docs.ms Readme name: $($readmeName)" @@ -787,12 +387,81 @@ function Validate-java-DocMsPackages ($PackageInfo, $PackageInfos, $DocValidatio $PackageInfos = @($PackageInfo) } - if (!(ValidatePackages $PackageInfos $DocValidationImageId)) { - Write-Error "Package validation failed" -ErrorAction Continue + # The install-rex-validation-tool.yml will install the java2docfx jar file into the Build.BinariesDirectory + # which is a DevOps variable for the directory. In PS that variable is BUILD_BINARIESDIRECTORY. + # The reason why this is necessary is that the command for java2docfx is in the following format: + # java –jar java2docfx-1.0.0.jar.jar --packagesJsonFile "C\temp\package.json" + # or + # java –jar java2docfx-1.0.0.jar --package "::" + # which means we need to know where, exactly, because the java command requires the full path + # to the jar file as an argument + $java2docfxJar = $null + if (!$Env:BUILD_BINARIESDIRECTORY) { + LogError "Env:BUILD_BINARIESDIRECTORY is not set and this is where the java2docfx jar file should be installed." + return $false + } + $java2docfxDir = Join-Path $Env:BUILD_BINARIESDIRECTORY "java2docfx" + if (!(Test-Path $java2docfxDir)) { + LogError "There should be a java2docfx directory under Env:BUILD_BINARIESDIRECTORY. Ensure that the /eng/pipelines/templates/steps/install-rex-validation-tool.yml template was run prior to whatever step is running this." + return $false + } + $java2docfxJarLoc = @(Get-ChildItem -Path $java2docfxDir -File -Filter "java2docfx*.jar") + if (!$java2docfxJarLoc) { + LogError "The java2docfx jar file should be installed in $java2docfxDir and is not there." return $false + } else { + # In theory, this shouldn't happen as the install-rex-validation-tool.yml is the only thing + # that'll ever install the jar + if ($java2docfxJarLoc.Count -gt 1) { + Write-Host "There were $($java2docfxJarLoc.Count) java2docfx jar files found in $Build_BinariesDirectory, using the first one" + } + $java2docfxJar = $java2docfxJarLoc[0] + Write-Host "java2docfx jar location=$java2docfxJar" + } + + $allSuccess = $true + $originLocation = Get-Location + foreach ($packageInfo in $PackageInfos) { + $artifact = "$($packageInfo.Group):$($packageInfo.Name):$($packageInfo.Version)" + $tempDirectory = Join-Path ([System.IO.Path]::GetTempPath()) "$($packageInfo.Group)-$($packageInfo.Name)-$($packageInfo.Version)" + New-Item $tempDirectory -ItemType Directory | Out-Null + # Set the location to the temp directory. The reason being is that it'll effectively be empty, no + # other jars, no POM files aka nothing Java related to pick up. + Set-Location $tempDirectory + try { + Write-Host "Calling java2docfx for $artifact" + Write-Host "java -jar ""$java2docfxJar"" -p ""$artifact""" + $java2docfxResults = java ` + -jar "$java2docfxJar"` + -p "$artifact" + # JRS-TODO: The -o option is something I'm currently questioning the behavior of but + # I can do some initial testing without that option being set + # -p "$artifact" ` + # -o "$tempDirectory" + + if ($LASTEXITCODE -ne 0) { + LogWarning "java2docfx failed for $artifact" + $java2docfxResults | Write-Host + $allSuccess = $false + } + } + catch { + LogError "Exception while trying to download: $artifact" + LogError $_ + LogError $_.ScriptStackTrace + $allSuccess = $false + } + finally { + # Ensure that the origianl location is restored + Set-Location $originLocation + # everything is contained within the temp directory, clean it up every time + if (Test-Path $tempDirectory) { + Remove-Item $tempDirectory -Recurse -Force + } + } } - return $true + return $allSuccess } function Get-java-EmitterName() { diff --git a/eng/scripts/docs/java2docfx.version.txt b/eng/scripts/docs/java2docfx.version.txt new file mode 100644 index 000000000000..a6a3a43c3a04 --- /dev/null +++ b/eng/scripts/docs/java2docfx.version.txt @@ -0,0 +1 @@ +1.0.4 \ No newline at end of file diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index d5644c733269..4300df19b15d 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -54,7 +54,7 @@ commons-codec:commons-codec;1.15 commons-net:commons-net;3.9.0 io.cloudevents:cloudevents-api;2.2.0 io.cloudevents:cloudevents-core;2.2.0 -io.fabric8:kubernetes-client;5.12.3 +io.fabric8:kubernetes-client;6.12.1 io.micrometer:micrometer-core;1.9.17 io.micrometer:micrometer-registry-azure-monitor;1.9.17 io.micrometer:micrometer-registry-graphite;1.9.17 diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index bc256bc3f118..0566ad82773d 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -110,7 +110,7 @@ com.azure.cosmos.spark:azure-cosmos-spark_3-2_2-12;4.30.0;4.31.0-beta.1 com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12;4.30.0;4.31.0-beta.1 com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12;4.30.0;4.31.0-beta.1 com.azure.cosmos.spark:azure-cosmos-spark_3-5_2-12;4.30.0;4.31.0-beta.1 -com.azure:azure-cosmos-test;1.0.0-beta.6;1.0.0-beta.7 +com.azure:azure-cosmos-test;1.0.0-beta.7;1.0.0-beta.8 com.azure:azure-cosmos-tests;1.0.0-beta.1;1.0.0-beta.1 com.azure.cosmos.kafka:azure-cosmos-kafka-connect;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-data-appconfiguration;1.6.0;1.7.0-beta.1 @@ -155,7 +155,7 @@ com.azure:azure-messaging-eventhubs-checkpointstore-jedis;1.0.0-beta.2;1.0.0-bet com.azure:azure-messaging-eventhubs-stress;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventhubs-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventhubs-track2-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-messaging-servicebus;7.16.0;7.17.0-beta.1 +com.azure:azure-messaging-servicebus;7.17.0;7.18.0-beta.1 com.azure:azure-messaging-servicebus-stress;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 @@ -170,7 +170,7 @@ com.azure:azure-monitor-query;1.3.1;1.4.0-beta.1 com.azure:azure-monitor-query-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-perf-test-parent;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-quantum-jobs;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-search-documents;11.6.4;11.7.0-beta.3 +com.azure:azure-search-documents;11.6.4;11.7.0-beta.4 com.azure:azure-search-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-security-attestation;1.1.23;1.2.0-beta.1 com.azure:azure-security-confidentialledger;1.0.19;1.1.0-beta.1 @@ -184,7 +184,7 @@ com.azure:azure-security-keyvault-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-sdk-template;1.1.1234;1.2.2-beta.1 com.azure:azure-sdk-template-two;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-sdk-template-three;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-spring-data-cosmos;3.44.0;3.45.0-beta.1 +com.azure:azure-spring-data-cosmos;3.45.0;3.46.0-beta.1 com.azure:azure-storage-blob;12.25.4;12.26.0-beta.2 com.azure:azure-storage-blob-batch;12.21.4;12.22.0-beta.2 com.azure:azure-storage-blob-changefeed;12.0.0-beta.20;12.0.0-beta.21 @@ -208,58 +208,58 @@ com.azure:identity-test-vm;1.0-SNAPSHOT;1.0-SNAPSHOT com.azure:identity-test-webapp;0.0.1-SNAPSHOT;0.0.1-SNAPSHOT com.azure.spring:azure-monitor-spring-native;1.0.0-beta.1;1.0.0-beta.1 com.azure.spring:azure-monitor-spring-native-test;1.0.0-beta.1;1.0.0-beta.1 -com.azure.spring:spring-cloud-azure-appconfiguration-config-web;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-appconfiguration-config;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-feature-management-web;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-feature-management;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-appconfiguration-config;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-dependencies;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-messaging-azure;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-messaging-azure-eventhubs;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-messaging-azure-servicebus;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-messaging-azure-storage-queue;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-integration-azure-core;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-integration-azure-eventhubs;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-integration-azure-servicebus;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-integration-azure-storage-queue;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-core;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-actuator-autoconfigure;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-actuator;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-autoconfigure;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-resourcemanager;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-service;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-active-directory;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-active-directory-b2c;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-actuator;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-appconfiguration;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-cosmos;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-data-cosmos;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-eventhubs;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-eventgrid;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-jdbc-mysql;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-jdbc-postgresql;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-redis;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-keyvault;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-keyvault-certificates;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-keyvault-secrets;4.17.0;4.18.0-beta.1 +com.azure.spring:spring-cloud-azure-appconfiguration-config-web;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-appconfiguration-config;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-feature-management-web;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-feature-management;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-appconfiguration-config;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-dependencies;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-messaging-azure;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-messaging-azure-eventhubs;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-messaging-azure-servicebus;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-messaging-azure-storage-queue;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-integration-azure-core;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-integration-azure-eventhubs;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-integration-azure-servicebus;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-integration-azure-storage-queue;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-core;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-actuator-autoconfigure;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-actuator;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-autoconfigure;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-resourcemanager;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-service;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-active-directory;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-active-directory-b2c;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-actuator;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-appconfiguration;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-cosmos;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-data-cosmos;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-eventhubs;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-eventgrid;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-jdbc-mysql;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-jdbc-postgresql;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-redis;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-keyvault;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-keyvault-certificates;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-keyvault-secrets;4.18.0;4.19.0-beta.1 com.azure.spring:spring-cloud-azure-starter-monitor;1.0.0-beta.5;1.0.0-beta.6 -com.azure.spring:spring-cloud-azure-starter-servicebus-jms;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-servicebus;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-storage;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-storage-blob;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-storage-file-share;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-storage-queue;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-integration-eventhubs;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-integration-servicebus;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-integration-storage-queue;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-stream-eventhubs;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-stream-servicebus;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-starter;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-stream-binder-eventhubs-core;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-stream-binder-eventhubs;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-stream-binder-servicebus-core;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-stream-binder-servicebus;4.17.0;4.18.0-beta.1 -com.azure.spring:spring-cloud-azure-trace-sleuth;4.17.0;4.18.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-servicebus-jms;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-servicebus;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-storage;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-storage-blob;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-storage-file-share;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-storage-queue;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-integration-eventhubs;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-integration-servicebus;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-integration-storage-queue;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-stream-eventhubs;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-stream-servicebus;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-starter;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-stream-binder-eventhubs-core;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-stream-binder-eventhubs;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-stream-binder-servicebus-core;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-stream-binder-servicebus;4.18.0;4.19.0-beta.1 +com.azure.spring:spring-cloud-azure-trace-sleuth;4.18.0;4.19.0-beta.1 com.azure.resourcemanager:azure-resourcemanager;2.38.0;2.39.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appplatform;2.38.0;2.39.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appservice;2.38.0;2.39.0-beta.1 diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java index ef014fb4d65e..e044d4ca5cc4 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java @@ -21,8 +21,10 @@ import com.azure.core.util.polling.PollOperationDetails; import com.azure.core.util.polling.PollerFlux; import com.azure.data.appconfiguration.implementation.AzureAppConfigurationImpl; +import com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper; import com.azure.data.appconfiguration.implementation.CreateSnapshotUtilClient; import com.azure.data.appconfiguration.implementation.SyncTokenPolicy; +import com.azure.data.appconfiguration.implementation.Utility; import com.azure.data.appconfiguration.implementation.models.GetKeyValueHeaders; import com.azure.data.appconfiguration.implementation.models.KeyValue; import com.azure.data.appconfiguration.models.ConfigurationSetting; @@ -44,13 +46,9 @@ import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; -import static com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper.toConfigurationSettingWithPagedResponse; -import static com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper.toConfigurationSettingWithResponse; import static com.azure.data.appconfiguration.implementation.Utility.ETAG_ANY; -import static com.azure.data.appconfiguration.implementation.Utility.addTracingNamespace; import static com.azure.data.appconfiguration.implementation.Utility.getETag; import static com.azure.data.appconfiguration.implementation.Utility.getPageETag; -import static com.azure.data.appconfiguration.implementation.Utility.handleNotModifiedErrorToValidResponse; import static com.azure.data.appconfiguration.implementation.Utility.toKeyValue; import static com.azure.data.appconfiguration.implementation.Utility.toSettingFieldsList; import static com.azure.data.appconfiguration.implementation.Utility.updateSnapshotAsync; @@ -354,7 +352,7 @@ public Mono addConfigurationSetting(String key, String lab /** * Adds a configuration value in the service if that key and label does not exist. The label value of the * ConfigurationSetting is optional. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -391,7 +389,7 @@ public Mono addConfigurationSetting(ConfigurationSetting s /** * Adds a configuration value in the service if that key and label does not exist. The label value of the * ConfigurationSetting is optional. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -429,9 +427,8 @@ public Mono> addConfigurationSettingWithResponse( return withContext( context -> validateSettingAsync(setting).flatMap( settingInternal -> serviceClient.putKeyValueWithResponseAsync(settingInternal.getKey(), - settingInternal.getLabel(), null, ETAG_ANY, toKeyValue(settingInternal), - addTracingNamespace(context)) - .map(response -> toConfigurationSettingWithResponse(response)))); + settingInternal.getLabel(), null, ETAG_ANY, toKeyValue(settingInternal), context) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithResponse))); } /** @@ -471,7 +468,7 @@ public Mono setConfigurationSetting(String key, String lab /** * Creates or updates a configuration value in the service. Partial updates are not supported and the entire * configuration setting is updated. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -515,10 +512,10 @@ public Mono setConfigurationSetting(ConfigurationSetting s /** * Creates or updates a configuration value in the service. Partial updates are not supported and the entire * configuration setting is updated. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. - * + *

* If {@link ConfigurationSetting#getETag() ETag} is specified, the configuration value is updated if the current * setting's ETag matches. If the ETag's value is equal to the wildcard character ({@code "*"}), the setting will * always be updated. @@ -574,8 +571,8 @@ public Mono> setConfigurationSettingWithResponse( context -> validateSettingAsync(setting).flatMap( settingInternal -> serviceClient.putKeyValueWithResponseAsync(settingInternal.getKey(), settingInternal.getLabel(), getETag(ifUnchanged, settingInternal), null, - toKeyValue(settingInternal), addTracingNamespace(context)) - .map(response -> toConfigurationSettingWithResponse(response)))); + toKeyValue(settingInternal), context) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithResponse))); } /** @@ -716,25 +713,20 @@ public Mono getConfigurationSetting(ConfigurationSetting s @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getConfigurationSettingWithResponse(ConfigurationSetting setting, OffsetDateTime acceptDateTime, boolean ifChanged) { - return withContext( - context -> validateSettingAsync(setting).flatMap( - settingInternal -> - serviceClient.getKeyValueWithResponseAsync(settingInternal.getKey(), settingInternal.getLabel(), - acceptDateTime == null ? null : acceptDateTime.toString(), null, - getETag(ifChanged, settingInternal), null, addTracingNamespace(context)) - .onErrorResume( - HttpResponseException.class, - (Function>>) throwable -> { - HttpResponseException e = (HttpResponseException) throwable; - HttpResponse httpResponse = e.getResponse(); - if (httpResponse.getStatusCode() == 304) { - return Mono.just(new ResponseBase( - httpResponse.getRequest(), httpResponse.getStatusCode(), - httpResponse.getHeaders(), null, null)); - } - return Mono.error(throwable); - }) - .map(response -> toConfigurationSettingWithResponse(response)))); + return withContext(context -> validateSettingAsync(setting).flatMap(settingInternal -> + serviceClient.getKeyValueWithResponseAsync(settingInternal.getKey(), settingInternal.getLabel(), + acceptDateTime == null ? null : acceptDateTime.toString(), null, + getETag(ifChanged, settingInternal), null, context) + .onErrorResume(HttpResponseException.class, + (Function>>) throwable -> { + HttpResponseException e = (HttpResponseException) throwable; + HttpResponse httpResponse = e.getResponse(); + if (httpResponse.getStatusCode() == 304) { + return Mono.just(new ResponseBase(httpResponse.getRequest(), + httpResponse.getStatusCode(), httpResponse.getHeaders(), null, null)); + } + return Mono.error(throwable); + }).map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithResponse))); } /** @@ -770,7 +762,7 @@ public Mono deleteConfigurationSetting(String key, String * {@link ConfigurationSetting#getLabel() label} and optional ETag combination from the service. * For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. - * + *

* If {@link ConfigurationSetting#getETag() ETag} is specified and is not the wildcard character ({@code "*"}), then * the setting is only deleted if the ETag matches the current ETag; this means that no one has updated the * ConfigurationSetting yet. @@ -809,10 +801,10 @@ public Mono deleteConfigurationSetting(ConfigurationSettin /** * Deletes the {@link ConfigurationSetting} with a matching {@link ConfigurationSetting#getKey() key}, and optional * {@link ConfigurationSetting#getLabel() label} and optional ETag combination from the service. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. - * + *

* If {@link ConfigurationSetting#getETag() ETag} is specified and is not the wildcard character ({@code "*"}), then * the setting is only deleted if the ETag matches the current ETag; this means that no one has updated the * ConfigurationSetting yet. @@ -855,8 +847,8 @@ public Mono> deleteConfigurationSettingWithRespon boolean ifUnchanged) { return withContext(context -> validateSettingAsync(setting).flatMap( settingInternal -> serviceClient.deleteKeyValueWithResponseAsync(settingInternal.getKey(), - settingInternal.getLabel(), getETag(ifUnchanged, settingInternal), addTracingNamespace(context)) - .map(response -> toConfigurationSettingWithResponse(response)))); + settingInternal.getLabel(), getETag(ifUnchanged, settingInternal), context) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithResponse))); } /** @@ -901,7 +893,7 @@ public Mono setReadOnly(String key, String label, boolean /** * Sets the read-only status for the {@link ConfigurationSetting}. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -949,7 +941,7 @@ public Mono setReadOnly(ConfigurationSetting setting, bool /** * Sets the read-only status for the {@link ConfigurationSetting}. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -1000,16 +992,14 @@ public Mono setReadOnly(ConfigurationSetting setting, bool @ServiceMethod(returns = ReturnType.SINGLE) public Mono> setReadOnlyWithResponse(ConfigurationSetting setting, boolean isReadOnly) { - return withContext(context -> validateSettingAsync(setting).flatMap( - settingInternal -> { - final String key = settingInternal.getKey(); - final String label = settingInternal.getLabel(); - final Context contextInternal = addTracingNamespace(context); - return (isReadOnly - ? serviceClient.putLockWithResponseAsync(key, label, null, null, contextInternal) - : serviceClient.deleteLockWithResponseAsync(key, label, null, null, contextInternal)) - .map(response -> toConfigurationSettingWithResponse(response)); - })); + return withContext(context -> validateSettingAsync(setting).flatMap(settingInternal -> { + final String key = settingInternal.getKey(); + final String label = settingInternal.getLabel(); + return (isReadOnly + ? serviceClient.putLockWithResponseAsync(key, label, null, null, context) + : serviceClient.deleteLockWithResponseAsync(key, label, null, null, context)) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithResponse); + })); } /** @@ -1042,31 +1032,19 @@ public PagedFlux listConfigurationSettings(SettingSelector final List settingFields = selector == null ? null : toSettingFieldsList(selector.getFields()); final List matchConditionsList = selector == null ? null : selector.getMatchConditions(); AtomicInteger pageETagIndex = new AtomicInteger(0); - return new PagedFlux<>( - () -> withContext(context -> serviceClient.getKeyValuesSinglePageAsync( - keyFilter, - labelFilter, - null, - acceptDateTime, - settingFields, - null, - null, - getPageETag(matchConditionsList, pageETagIndex), - addTracingNamespace(context)) - .onErrorResume(HttpResponseException.class, - (Function>>) throwable -> - handleNotModifiedErrorToValidResponse(throwable)) - .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))), - nextLink -> withContext(context -> serviceClient.getKeyValuesNextSinglePageAsync( - nextLink, - acceptDateTime, - null, - getPageETag(matchConditionsList, pageETagIndex), - addTracingNamespace(context)) - .onErrorResume(HttpResponseException.class, - (Function>>) throwable -> - handleNotModifiedErrorToValidResponse(throwable)) - .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))) + return new PagedFlux<>(() -> withContext(context -> serviceClient.getKeyValuesSinglePageAsync(keyFilter, + labelFilter, null, acceptDateTime, settingFields, null, null, + getPageETag(matchConditionsList, pageETagIndex), context) + .onErrorResume(HttpResponseException.class, + (Function>>) + Utility::handleNotModifiedErrorToValidResponse) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithPagedResponse)), + nextLink -> withContext(context -> serviceClient.getKeyValuesNextSinglePageAsync(nextLink, + acceptDateTime, null, getPageETag(matchConditionsList, pageETagIndex), context) + .onErrorResume(HttpResponseException.class, + (Function>>) + Utility::handleNotModifiedErrorToValidResponse) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithPagedResponse)) ); } @@ -1124,29 +1102,13 @@ public PagedFlux listConfigurationSettingsForSnapshot(Stri */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listConfigurationSettingsForSnapshot(String snapshotName, - List fields) { - return new PagedFlux<>( - () -> withContext( - context -> serviceClient.getKeyValuesSinglePageAsync( - null, - null, - null, - null, - fields, - snapshotName, - null, - null, - addTracingNamespace(context)) - .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))), - nextLink -> withContext( - context -> serviceClient.getKeyValuesNextSinglePageAsync( - nextLink, - null, - null, - null, - addTracingNamespace(context)) - .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))) - ); + List fields) { + return new PagedFlux<>(() -> withContext(context -> serviceClient.getKeyValuesSinglePageAsync(null, null, null, + null, fields, snapshotName, null, null, context) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithPagedResponse)), + nextLink -> withContext(context -> serviceClient.getKeyValuesNextSinglePageAsync(nextLink, null, null, null, + context) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithPagedResponse))); } /** @@ -1154,7 +1116,7 @@ public PagedFlux listConfigurationSettingsForSnapshot(Stri * in descending order from their {@link ConfigurationSetting#getLastModified() lastModified} date. * Revisions expire after a period of time, see Pricing * for more information. - * + *

* If {@code selector} is {@code null}, then all the {@link ConfigurationSetting ConfigurationSettings} are fetched * in their current state. Otherwise, the results returned match the parameters given in {@code selector}. * @@ -1181,21 +1143,12 @@ public PagedFlux listRevisions(SettingSelector selector) { final String labelFilter = selector == null ? null : selector.getLabelFilter(); final String acceptDateTime = selector == null ? null : selector.getAcceptDateTime(); final List settingFields = selector == null ? null : toSettingFieldsList(selector.getFields()); - return new PagedFlux<>( - () -> withContext( - context -> serviceClient.getRevisionsSinglePageAsync( - keyFilter, - labelFilter, - null, - acceptDateTime, - settingFields, - addTracingNamespace(context)) - .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))), - nextLink -> withContext( - context -> - serviceClient.getRevisionsNextSinglePageAsync(nextLink, acceptDateTime, - addTracingNamespace(context)) - .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse)))); + return new PagedFlux<>(() -> withContext(context -> serviceClient.getRevisionsSinglePageAsync(keyFilter, + labelFilter, null, acceptDateTime, settingFields, context) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithPagedResponse)), + nextLink -> withContext(context -> serviceClient.getRevisionsNextSinglePageAsync(nextLink, acceptDateTime, + context) + .map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithPagedResponse))); } /** @@ -1440,17 +1393,11 @@ public Mono> recoverSnapshotWithResponse( @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listSnapshots(SnapshotSelector selector) { try { - return new PagedFlux<>( - () -> withContext( - context -> serviceClient.getSnapshotsSinglePageAsync( - selector == null ? null : selector.getNameFilter(), - null, - selector == null ? null : selector.getFields(), - selector == null ? null : selector.getStatus(), - addTracingNamespace(context))), - nextLink -> withContext( - context -> serviceClient.getSnapshotsNextSinglePageAsync(nextLink, addTracingNamespace(context))) - ); + return new PagedFlux<>(() -> withContext(context -> serviceClient.getSnapshotsSinglePageAsync( + selector == null ? null : selector.getNameFilter(), null, + selector == null ? null : selector.getFields(), selector == null ? null : selector.getStatus(), + context)), nextLink -> withContext(context -> + serviceClient.getSnapshotsNextSinglePageAsync(nextLink, context))); } catch (RuntimeException ex) { return new PagedFlux<>(() -> monoError(LOGGER, ex)); } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java index 94d07ff34f5c..30e97c8af057 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java @@ -46,8 +46,6 @@ import static com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper.toConfigurationSettingWithPagedResponse; import static com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper.toConfigurationSettingWithResponse; import static com.azure.data.appconfiguration.implementation.Utility.ETAG_ANY; -import static com.azure.data.appconfiguration.implementation.Utility.addTracingNamespace; -import static com.azure.data.appconfiguration.implementation.Utility.enableSyncRestProxy; import static com.azure.data.appconfiguration.implementation.Utility.getETag; import static com.azure.data.appconfiguration.implementation.Utility.getPageETag; import static com.azure.data.appconfiguration.implementation.Utility.handleNotModifiedErrorToValidResponse; @@ -356,7 +354,7 @@ public ConfigurationSetting addConfigurationSetting(String key, String label, St /** * Adds a configuration value in the service if that key and label does not exist. The label value of the * ConfigurationSetting is optional. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -392,7 +390,7 @@ public ConfigurationSetting addConfigurationSetting(ConfigurationSetting setting /** * Adds a configuration value in the service if that key and label does not exist. The label value of the * ConfigurationSetting is optional. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -433,7 +431,7 @@ public Response addConfigurationSettingWithResponse(Config // return an error. final ResponseBase response = serviceClient.putKeyValueWithResponse(setting.getKey(), setting.getLabel(), null, ETAG_ANY, - toKeyValue(setting), enableSyncRestProxy(addTracingNamespace(context))); + toKeyValue(setting), context); return toConfigurationSettingWithResponse(response); } @@ -475,7 +473,7 @@ public ConfigurationSetting setConfigurationSetting(String key, String label, St /** * Creates or updates a configuration value in the service. Partial updates are not supported and the entire * configuration setting is updated. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -521,10 +519,10 @@ public ConfigurationSetting setConfigurationSetting(ConfigurationSetting setting /** * Creates or updates a configuration value in the service. Partial updates are not supported and the entire * configuration setting is updated. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. - * + *

* If {@link ConfigurationSetting#getETag() ETag} is specified, the configuration value is updated if the current * setting's ETag matches. If the ETag's value is equal to the wildcard character ({@code "*"}), the setting will * always be updated. @@ -578,9 +576,8 @@ public Response setConfigurationSettingWithResponse(Config boolean ifUnchanged, Context context) { validateSetting(setting); final ResponseBase response = - serviceClient.putKeyValueWithResponse(setting.getKey(), setting.getLabel(), - getETag(ifUnchanged, setting), null, toKeyValue(setting), - enableSyncRestProxy(addTracingNamespace(context))); + serviceClient.putKeyValueWithResponse(setting.getKey(), setting.getLabel(), getETag(ifUnchanged, setting), + null, toKeyValue(setting), context); return toConfigurationSettingWithResponse(response); } @@ -646,7 +643,7 @@ public ConfigurationSetting getConfigurationSetting(String key, String label, Of /** * Attempts to get the ConfigurationSetting with a matching {@link ConfigurationSetting#getKey() key}, and optional * {@link ConfigurationSetting#getLabel() label}, optional {@code acceptDateTime} and optional ETag combination. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -681,7 +678,7 @@ public ConfigurationSetting getConfigurationSetting(ConfigurationSetting setting /** * Attempts to get the ConfigurationSetting with a matching {@link ConfigurationSetting#getKey() key}, and optional * {@link ConfigurationSetting#getLabel() label}, optional {@code acceptDateTime} and optional ETag combination. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -725,8 +722,8 @@ public Response getConfigurationSettingWithResponse(Config try { final ResponseBase response = serviceClient.getKeyValueWithResponse(setting.getKey(), setting.getLabel(), - acceptDateTime == null ? null : acceptDateTime.toString(), null, - getETag(ifChanged, setting), null, enableSyncRestProxy(addTracingNamespace(context))); + acceptDateTime == null ? null : acceptDateTime.toString(), null, getETag(ifChanged, setting), null, + context); return toConfigurationSettingWithResponse(response); } catch (HttpResponseException ex) { final HttpResponse httpResponse = ex.getResponse(); @@ -769,7 +766,7 @@ public ConfigurationSetting deleteConfigurationSetting(String key, String label) /** * Deletes the {@link ConfigurationSetting} with a matching {@link ConfigurationSetting#getKey() key}, and optional * {@link ConfigurationSetting#getLabel() label} and optional ETag combination. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -806,10 +803,10 @@ public ConfigurationSetting deleteConfigurationSetting(ConfigurationSetting sett /** * Deletes the {@link ConfigurationSetting} with a matching {@link ConfigurationSetting#getKey() key}, and optional * {@link ConfigurationSetting#getLabel() label} and optional ETag combination. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. - * + *

* If {@link ConfigurationSetting#getETag() ETag} is specified and is not the wildcard character ({@code "*"}), then * the setting is only deleted if the ETag matches the current ETag; this means that no one has updated the * ConfigurationSetting yet. @@ -852,7 +849,7 @@ public Response deleteConfigurationSettingWithResponse(Con validateSetting(setting); final ResponseBase response = serviceClient.deleteKeyValueWithResponse(setting.getKey(), setting.getLabel(), - getETag(ifUnchanged, setting), enableSyncRestProxy(addTracingNamespace(context))); + getETag(ifUnchanged, setting), context); return toConfigurationSettingWithResponse(response); } @@ -898,7 +895,7 @@ public ConfigurationSetting setReadOnly(String key, String label, boolean isRead /** * Sets the read-only status for the {@link ConfigurationSetting}. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -945,7 +942,7 @@ public ConfigurationSetting setReadOnly(ConfigurationSetting setting, boolean is /** * Sets the read-only status for the {@link ConfigurationSetting}. - * + *

* For more configuration setting types, see {@link FeatureFlagConfigurationSetting} and * {@link SecretReferenceConfigurationSetting}. * @@ -995,7 +992,6 @@ public Response setReadOnlyWithResponse(ConfigurationSetti validateSetting(setting); final String key = setting.getKey(); final String label = setting.getLabel(); - context = enableSyncRestProxy(addTracingNamespace(context)); return isReadOnly ? toConfigurationSettingWithResponse(serviceClient.putLockWithResponse(key, label, null, null, context)) @@ -1061,34 +1057,21 @@ public PagedIterable listConfigurationSettings(SettingSele final List settingFields = selector == null ? null : toSettingFieldsList(selector.getFields()); final List matchConditionsList = selector == null ? null : selector.getMatchConditions(); AtomicInteger pageETagIndex = new AtomicInteger(0); - return new PagedIterable<>( - () -> { - PagedResponse pagedResponse; - try { - pagedResponse = serviceClient.getKeyValuesSinglePage( - keyFilter, - labelFilter, - null, - acceptDateTime, - settingFields, - null, - null, - getPageETag(matchConditionsList, pageETagIndex), - enableSyncRestProxy(addTracingNamespace(context))); - } catch (HttpResponseException ex) { - return handleNotModifiedErrorToValidResponse(ex, LOGGER); - } - return toConfigurationSettingWithPagedResponse(pagedResponse); - }, + return new PagedIterable<>(() -> { + PagedResponse pagedResponse; + try { + pagedResponse = serviceClient.getKeyValuesSinglePage(keyFilter, labelFilter, null, acceptDateTime, + settingFields, null, null, getPageETag(matchConditionsList, pageETagIndex), context); + } catch (HttpResponseException ex) { + return handleNotModifiedErrorToValidResponse(ex, LOGGER); + } + return toConfigurationSettingWithPagedResponse(pagedResponse); + }, nextLink -> { PagedResponse pagedResponse; try { - pagedResponse = serviceClient.getKeyValuesNextSinglePage( - nextLink, - acceptDateTime, - null, - getPageETag(matchConditionsList, pageETagIndex), - enableSyncRestProxy(addTracingNamespace(context))); + pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, acceptDateTime, null, + getPageETag(matchConditionsList, pageETagIndex), context); } catch (HttpResponseException ex) { return handleNotModifiedErrorToValidResponse(ex, LOGGER); } @@ -1152,28 +1135,16 @@ public PagedIterable listConfigurationSettingsForSnapshot( */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listConfigurationSettingsForSnapshot(String snapshotName, - List fields, - Context context) { - return new PagedIterable<>( - () -> { - final PagedResponse pagedResponse = serviceClient.getKeyValuesSinglePage( - null, - null, - null, - null, - fields, - snapshotName, - null, - null, - enableSyncRestProxy(addTracingNamespace(context))); - return toConfigurationSettingWithPagedResponse(pagedResponse); - }, - nextLink -> { - final PagedResponse pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, - null, null, null, enableSyncRestProxy(addTracingNamespace(context))); - return toConfigurationSettingWithPagedResponse(pagedResponse); - } - ); + List fields, Context context) { + return new PagedIterable<>(() -> { + final PagedResponse pagedResponse = serviceClient.getKeyValuesSinglePage(null, null, null, null, + fields, snapshotName, null, null, context); + return toConfigurationSettingWithPagedResponse(pagedResponse); + }, nextLink -> { + final PagedResponse pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, null, null, + null, context); + return toConfigurationSettingWithPagedResponse(pagedResponse); + }); } /** @@ -1181,8 +1152,7 @@ public PagedIterable listConfigurationSettingsForSnapshot( * in descending order from their {@link ConfigurationSetting#getLastModified() lastModified} date. * Revisions expire after a period of time, see Pricing * for more information. - * - * + *

* If {@code selector} is {@code null}, then all the {@link ConfigurationSetting ConfigurationSettings} are fetched * in their current state. Otherwise, the results returned match the parameters given in {@code selector}. * @@ -1217,7 +1187,7 @@ public PagedIterable listRevisions(SettingSelector selecto * in descending order from their {@link ConfigurationSetting#getLastModified() lastModified} date. * Revisions expire after a period of time, see Pricing * for more information. - * + *

* If {@code selector} is {@code null}, then all the {@link ConfigurationSetting ConfigurationSettings} are fetched * in their current state. Otherwise, the results returned match the parameters given in {@code selector}. * @@ -1243,23 +1213,16 @@ public PagedIterable listRevisions(SettingSelector selecto @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listRevisions(SettingSelector selector, Context context) { final String acceptDateTime = selector == null ? null : selector.getAcceptDateTime(); - return new PagedIterable<>( - () -> { - final PagedResponse pagedResponse = serviceClient.getRevisionsSinglePage( - selector == null ? null : selector.getKeyFilter(), - selector == null ? null : selector.getLabelFilter(), - null, - acceptDateTime, - selector == null ? null : toSettingFieldsList(selector.getFields()), - enableSyncRestProxy(addTracingNamespace(context))); - return toConfigurationSettingWithPagedResponse(pagedResponse); - }, - nextLink -> { - final PagedResponse pagedResponse = serviceClient.getRevisionsNextSinglePage(nextLink, - acceptDateTime, enableSyncRestProxy(addTracingNamespace(context))); - return toConfigurationSettingWithPagedResponse(pagedResponse); - } - ); + return new PagedIterable<>(() -> { + final PagedResponse pagedResponse = serviceClient.getRevisionsSinglePage( + selector == null ? null : selector.getKeyFilter(), selector == null ? null : selector.getLabelFilter(), + null, acceptDateTime, selector == null ? null : toSettingFieldsList(selector.getFields()), context); + return toConfigurationSettingWithPagedResponse(pagedResponse); + }, nextLink -> { + final PagedResponse pagedResponse = serviceClient.getRevisionsNextSinglePage(nextLink, + acceptDateTime, context); + return toConfigurationSettingWithPagedResponse(pagedResponse); + }); } /** @@ -1525,15 +1488,10 @@ public PagedIterable listSnapshots(SnapshotSelector selec */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listSnapshots(SnapshotSelector selector, Context context) { - return new PagedIterable<>( - () -> serviceClient.getSnapshotsSinglePage( - selector == null ? null : selector.getNameFilter(), - null, - selector == null ? null : selector.getFields(), - selector == null ? null : selector.getStatus(), - enableSyncRestProxy(addTracingNamespace(context))), - nextLink -> serviceClient.getSnapshotsNextSinglePage(nextLink, - enableSyncRestProxy(addTracingNamespace(context)))); + return new PagedIterable<>(() -> serviceClient.getSnapshotsSinglePage( + selector == null ? null : selector.getNameFilter(), null, selector == null ? null : selector.getFields(), + selector == null ? null : selector.getStatus(), context), + nextLink -> serviceClient.getSnapshotsNextSinglePage(nextLink, context)); } /** diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java index a743a01d56bc..489a1b35b7d3 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java @@ -12,6 +12,7 @@ import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeader; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -126,8 +127,8 @@ public final class ConfigurationClientBuilder implements CLIENT_VERSION = properties.getOrDefault("version", "UnknownVersion"); ADD_HEADERS_POLICY = new AddHeadersPolicy(new HttpHeaders() .set("x-ms-return-client-request-id", "true") - .set("Content-Type", "application/json") - .set("Accept", "application/vnd.microsoft.azconfig.kv+json")); + .set(HttpHeaderName.CONTENT_TYPE, "application/json") + .set(HttpHeaderName.ACCEPT, "application/vnd.microsoft.azconfig.kv+json")); } private static final ClientLogger LOGGER = new ClientLogger(ConfigurationClientBuilder.class); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java index 5bc1cca355d7..f40318800e33 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java @@ -13,6 +13,7 @@ import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.data.appconfiguration.implementation.models.KeyValue; import com.azure.data.appconfiguration.implementation.models.SnapshotUpdateParameters; @@ -24,19 +25,15 @@ import reactor.core.publisher.Mono; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; -import static com.azure.core.util.tracing.Tracer.AZ_TRACING_NAMESPACE_KEY; - /** * App Configuration Utility methods, use internally. */ public class Utility { - private static final String HTTP_REST_PROXY_SYNC_PROXY_ENABLE = "com.azure.core.http.restproxy.syncproxy.enable"; - public static final String APP_CONFIG_TRACING_NAMESPACE_VALUE = "Microsoft.AppConfiguration"; - public static final String ID = "id"; public static final String DESCRIPTION = "description"; public static final String DISPLAY_NAME = "display_name"; @@ -67,36 +64,9 @@ public static KeyValue toKeyValue(ConfigurationSetting setting) { .setTags(setting.getTags()); } - // List to SettingFields[] - public static SettingFields[] toSettingFieldsArray(List settingFieldsList) { - int size = settingFieldsList.size(); - SettingFields[] fields = new SettingFields[size]; - for (int i = 0; i < size; i++) { - fields[i] = settingFieldsList.get(i); - } - return fields; - } - // SettingFields[] to List public static List toSettingFieldsList(SettingFields[] settingFieldsArray) { - int size = settingFieldsArray.length; - List settingFieldsList = new ArrayList<>(size); - for (int i = 0; i < size; i++) { - settingFieldsList.add(settingFieldsArray[i]); - } - return settingFieldsList; - } - - // Iterable to List - public static List iterableToList(Iterable iterable) { - if (iterable == null) { - return null; - } - List outputList = new ArrayList<>(); - for (E item : iterable) { - outputList.add(item); - } - return outputList; + return new ArrayList<>(Arrays.asList(settingFieldsArray)); } /* @@ -117,14 +87,6 @@ public static String getETag(boolean isETagRequired, ConfigurationSetting settin return isETagRequired ? getETagValue(setting.getETag()) : null; } - public static String getETagSnapshot(boolean isETagRequired, ConfigurationSnapshot snapshot) { - if (!isETagRequired) { - return null; - } - Objects.requireNonNull(snapshot); - return getETagValue(snapshot.getETag()); - } - /* * Ensure that setting is not null. And, key cannot be null because it is part of the service REST URL. */ @@ -149,24 +111,6 @@ public static Mono validateSettingAsync(ConfigurationSetti return Mono.just(setting); } - /** - * Enable the sync stack rest proxy. - * - * @param context It offers a means of passing arbitrary data (key-value pairs) to pipeline policies. - * Most applications do not need to pass arbitrary data to the pipeline and can pass Context.NONE or null. - * - * @return The Context. - */ - public static Context enableSyncRestProxy(Context context) { - context = context == null ? Context.NONE : context; - return context.addData(HTTP_REST_PROXY_SYNC_PROXY_ENABLE, true); - } - - public static Context addTracingNamespace(Context context) { - context = context == null ? Context.NONE : context; - return context.addData(AZ_TRACING_NAMESPACE_KEY, APP_CONFIG_TRACING_NAMESPACE_VALUE); - } - public static Response updateSnapshotSync(String snapshotName, MatchConditions matchConditions, ConfigurationSnapshotStatus status, AzureAppConfigurationImpl serviceClient, Context context) { @@ -203,44 +147,44 @@ public static String parseNextLink(String nextLink) { // Async handler public static Mono> handleNotModifiedErrorToValidResponse(HttpResponseException error) { HttpResponse httpResponse = error.getResponse(); + if (httpResponse == null) { + return Mono.error(error); + } + String continuationToken = parseNextLink(httpResponse.getHeaderValue(HttpHeaderName.LINK)); if (httpResponse.getStatusCode() == 304) { - return Mono.just( - new PagedResponseBase<>( - httpResponse.getRequest(), - httpResponse.getStatusCode(), - httpResponse.getHeaders(), - null, - continuationToken, - null)); + return Mono.just(new PagedResponseBase<>(httpResponse.getRequest(), httpResponse.getStatusCode(), + httpResponse.getHeaders(), null, continuationToken, null)); } + return Mono.error(error); } // Sync Handler public static PagedResponse handleNotModifiedErrorToValidResponse(HttpResponseException error, ClientLogger logger) { HttpResponse httpResponse = error.getResponse(); + if (httpResponse == null) { + throw logger.logExceptionAsError(error); + } + String continuationToken = parseNextLink(httpResponse.getHeaderValue(HttpHeaderName.LINK)); if (httpResponse.getStatusCode() == 304) { - return new PagedResponseBase<>( - httpResponse.getRequest(), - httpResponse.getStatusCode(), - httpResponse.getHeaders(), - null, - continuationToken, - null); + return new PagedResponseBase<>(httpResponse.getRequest(), httpResponse.getStatusCode(), + httpResponse.getHeaders(), null, continuationToken, null); } + throw logger.logExceptionAsError(error); } // Get the ETag from a list public static String getPageETag(List matchConditionsList, AtomicInteger pageETagIndex) { - int pageETagListSize = (matchConditionsList == null || matchConditionsList.isEmpty()) - ? 0 - : matchConditionsList.size(); + if (CoreUtils.isNullOrEmpty(matchConditionsList)) { + return null; + } + String nextPageETag = null; int pageETagIndexValue = pageETagIndex.get(); - if (pageETagIndexValue < pageETagListSize) { + if (pageETagIndexValue < matchConditionsList.size()) { nextPageETag = matchConditionsList.get(pageETagIndexValue).getIfNoneMatch(); pageETagIndex.set(pageETagIndexValue + 1); } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java index 3d0c3e5a491e..744dddcf1bee 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java @@ -777,15 +777,11 @@ public void listConfigurationSettingsAcceptDateTime(HttpClient httpClient, Confi final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); // Create 3 revisions of the same key. - try { - assertConfigurationEquals(original, client.setConfigurationSettingWithResponse(original, false, Context.NONE).getValue()); - Thread.sleep(2000); - assertConfigurationEquals(updated, client.setConfigurationSettingWithResponse(updated, false, Context.NONE).getValue()); - Thread.sleep(2000); - assertConfigurationEquals(updated2, client.setConfigurationSettingWithResponse(updated2, false, Context.NONE).getValue()); - } catch (InterruptedException ex) { - // Do nothing. - } + assertConfigurationEquals(original, client.setConfigurationSettingWithResponse(original, false, Context.NONE).getValue()); + sleepIfRunningAgainstService(2000); + assertConfigurationEquals(updated, client.setConfigurationSettingWithResponse(updated, false, Context.NONE).getValue()); + sleepIfRunningAgainstService(2000); + assertConfigurationEquals(updated2, client.setConfigurationSettingWithResponse(updated2, false, Context.NONE).getValue()); // Gets all versions of this value so we can get the one we want at that particular date. List revisions = client.listRevisions(new SettingSelector().setKeyFilter(keyName)).stream().collect(Collectors.toList()); @@ -886,15 +882,11 @@ public void listRevisionsAcceptDateTime(HttpClient httpClient, ConfigurationServ final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); // Create 3 revisions of the same key. - try { - assertConfigurationEquals(original, client.setConfigurationSettingWithResponse(original, false, Context.NONE).getValue()); - Thread.sleep(2000); - assertConfigurationEquals(updated, client.setConfigurationSettingWithResponse(updated, false, Context.NONE).getValue()); - Thread.sleep(2000); - assertConfigurationEquals(updated2, client.setConfigurationSettingWithResponse(updated2, false, Context.NONE).getValue()); - } catch (InterruptedException ex) { - // Do nothing. - } + assertConfigurationEquals(original, client.setConfigurationSettingWithResponse(original, false, Context.NONE).getValue()); + sleepIfRunningAgainstService(2000); + assertConfigurationEquals(updated, client.setConfigurationSettingWithResponse(updated, false, Context.NONE).getValue()); + sleepIfRunningAgainstService(2000); + assertConfigurationEquals(updated2, client.setConfigurationSettingWithResponse(updated2, false, Context.NONE).getValue()); // Gets all versions of this value. List revisions = client.listRevisions(new SettingSelector().setKeyFilter(keyName)).stream().collect(Collectors.toList()); diff --git a/sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/AttestationTest.java b/sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/AttestationTest.java index 21c89af0fc57..0dada17dbdf1 100644 --- a/sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/AttestationTest.java +++ b/sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/AttestationTest.java @@ -9,6 +9,7 @@ import com.azure.core.test.utils.TestUtils; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.security.attestation.models.AttestationData; import com.azure.security.attestation.models.AttestationDataInterpretation; @@ -354,7 +355,8 @@ void testTpmAttestation(HttpClient httpClient, String clientUri) { .setAttestationSigner(new AttestationSigningKey(getIsolatedSigningCertificate(), getIsolatedSigningKey()))); if (result.getPolicyResolution() != PolicyModification.UPDATED) { - System.out.printf("Unexpected resolution setting TPM policy: %s", result.getPolicyResolution().toString()); + LOGGER.log(LogLevel.VERBOSE, + () -> "Unexpected resolution setting TPM policy: " + result.getPolicyResolution()); return; } @@ -373,11 +375,11 @@ void testTpmAttestation(HttpClient httpClient, String clientUri) { Object deserializedResponse = assertDoesNotThrow(() -> ADAPTER.deserialize(tpmResponse.getTpmResult().toBytes(), Object.class, SerializerEncoding.JSON)); - assertTrue(deserializedResponse instanceof LinkedHashMap); + assertInstanceOf(LinkedHashMap.class, deserializedResponse); @SuppressWarnings("unchecked") LinkedHashMap initialResponse = (LinkedHashMap) deserializedResponse; assertTrue(initialResponse.containsKey("payload")); - assertTrue(initialResponse.get("payload") instanceof LinkedHashMap); + assertInstanceOf(LinkedHashMap.class, initialResponse.get("payload")); @SuppressWarnings("unchecked") LinkedHashMap payload = (LinkedHashMap) initialResponse.get("payload"); assertTrue(payload.containsKey("challenge")); @@ -402,7 +404,8 @@ void testTpmAttestationWithResult(HttpClient httpClient, String clientUri) { .setAttestationSigner(new AttestationSigningKey(getIsolatedSigningCertificate(), getIsolatedSigningKey()))); if (result.getPolicyResolution() != PolicyModification.UPDATED) { - System.out.printf("Unexpected resolution setting TPM policy: %s", result.getPolicyResolution().toString()); + LOGGER.log(LogLevel.VERBOSE, + () -> "Unexpected resolution setting TPM policy: " + result.getPolicyResolution()); return; } @@ -423,11 +426,11 @@ void testTpmAttestationWithResult(HttpClient httpClient, String clientUri) { Object deserializedResponse = assertDoesNotThrow(() -> ADAPTER.deserialize( tpmResponse.getValue().getTpmResult().toBytes(), Object.class, SerializerEncoding.JSON)); - assertTrue(deserializedResponse instanceof LinkedHashMap); + assertInstanceOf(LinkedHashMap.class, deserializedResponse); @SuppressWarnings("unchecked") LinkedHashMap initialResponse = (LinkedHashMap) deserializedResponse; assertTrue(initialResponse.containsKey("payload")); - assertTrue(initialResponse.get("payload") instanceof LinkedHashMap); + assertInstanceOf(LinkedHashMap.class, initialResponse.get("payload")); @SuppressWarnings("unchecked") LinkedHashMap payload = (LinkedHashMap) initialResponse.get("payload"); assertTrue(payload.containsKey("challenge")); @@ -450,7 +453,8 @@ void testTpmAttestationAsync(HttpClient httpClient, String clientUri) { .setAttestationSigner(new AttestationSigningKey(getIsolatedSigningCertificate(), getIsolatedSigningKey()))); if (result.getPolicyResolution() != PolicyModification.UPDATED) { - System.out.printf("Unexpected resolution setting TPM policy: %s", result.getPolicyResolution().toString()); + LOGGER.log(LogLevel.VERBOSE, + () -> "Unexpected resolution setting TPM policy: " + result.getPolicyResolution()); return; } @@ -469,11 +473,11 @@ void testTpmAttestationAsync(HttpClient httpClient, String clientUri) { .assertNext(tpmResponse -> { Object deserializedResponse = assertDoesNotThrow(() -> ADAPTER.deserialize( tpmResponse.getTpmResult().toBytes(), Object.class, SerializerEncoding.JSON)); - assertTrue(deserializedResponse instanceof LinkedHashMap); + assertInstanceOf(LinkedHashMap.class, deserializedResponse); @SuppressWarnings("unchecked") LinkedHashMap initialResponse = (LinkedHashMap) deserializedResponse; assertTrue(initialResponse.containsKey("payload")); - assertTrue(initialResponse.get("payload") instanceof LinkedHashMap); + assertInstanceOf(LinkedHashMap.class, initialResponse.get("payload")); @SuppressWarnings("unchecked") LinkedHashMap payload = (LinkedHashMap) initialResponse.get("payload"); assertTrue(payload.containsKey("challenge")); @@ -669,7 +673,7 @@ private static void verifyAttestationResult(TestMode testMode, String clientUri, assertNull(result.getNonce()); if (expectJson) { - assertTrue(result.getRuntimeClaims() instanceof Map); + assertInstanceOf(Map.class, result.getRuntimeClaims()); @SuppressWarnings("unchecked") Map runtimeClaims = (Map) result.getRuntimeClaims(); Map expectedClaims = assertDoesNotThrow(() -> @@ -685,7 +689,7 @@ static void assertObjectEqual(Map expected, Map LOGGER.verbose("Key: " + key); assertTrue(actual.containsKey(key)); if (expected.get(key) instanceof Map) { - assertTrue(actual.get(key) instanceof Map); + assertInstanceOf(Map.class, actual.get(key)); @SuppressWarnings("unchecked") Map expectedInner = (Map) expected.get(key); @SuppressWarnings("unchecked") diff --git a/sdk/boms/spring-cloud-azure-dependencies/pom.xml b/sdk/boms/spring-cloud-azure-dependencies/pom.xml index 01737e7633d1..cbb7b2fd5ae8 100644 --- a/sdk/boms/spring-cloud-azure-dependencies/pom.xml +++ b/sdk/boms/spring-cloud-azure-dependencies/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-dependencies - 4.18.0-beta.1 + 4.19.0-beta.1 pom Spring Cloud Azure Dependencies @@ -51,14 +51,14 @@ com.azure azure-sdk-bom - 1.2.22 + 1.2.23 pom import com.azure azure-spring-data-cosmos - 3.45.0-beta.1 + 3.46.0-beta.1 com.azure.resourcemanager diff --git a/sdk/communication/azure-communication-callautomation/pom.xml b/sdk/communication/azure-communication-callautomation/pom.xml index 32b5e27eb7b8..722ac6b09f44 100644 --- a/sdk/communication/azure-communication-callautomation/pom.xml +++ b/sdk/communication/azure-communication-callautomation/pom.xml @@ -71,7 +71,7 @@ com.azure azure-messaging-servicebus - 7.16.0 + 7.17.0 test diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationAsyncClientAutomatedLiveTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationAsyncClientAutomatedLiveTests.java index 31efad130aa1..27e11915f67f 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationAsyncClientAutomatedLiveTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationAsyncClientAutomatedLiveTests.java @@ -17,6 +17,7 @@ import com.azure.communication.identity.CommunicationIdentityAsyncClient; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; +import com.azure.core.test.annotation.DoNotRecord; import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -32,6 +33,7 @@ import static org.junit.jupiter.api.Assertions.fail; public class CallAutomationAsyncClientAutomatedLiveTests extends CallAutomationAutomatedLiveTestBase { + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( @@ -132,6 +134,7 @@ public void createVOIPCallAndAnswerThenHangupAutomatedTest(HttpClient httpClient } } + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationAutomatedLiveTestBase.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationAutomatedLiveTestBase.java index 500d2108a25c..a7a831b0b173 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationAutomatedLiveTestBase.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationAutomatedLiveTestBase.java @@ -8,28 +8,27 @@ import com.azure.communication.callautomation.models.events.CallAutomationEventBase; import com.azure.communication.common.CommunicationIdentifier; import com.azure.core.amqp.AmqpTransportType; +import com.azure.core.http.HttpClient; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.test.TestMode; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.servicebus.ServiceBusClientBuilder; import com.azure.messaging.servicebus.ServiceBusErrorContext; import com.azure.messaging.servicebus.ServiceBusException; import com.azure.messaging.servicebus.ServiceBusFailureReason; import com.azure.messaging.servicebus.ServiceBusProcessorClient; -import com.azure.core.http.HttpClient; import com.azure.messaging.servicebus.ServiceBusReceivedMessage; import com.azure.messaging.servicebus.ServiceBusReceivedMessageContext; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import com.azure.core.util.CoreUtils; -import java.util.StringJoiner; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -39,11 +38,15 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.StringJoiner; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class CallAutomationAutomatedLiveTestBase extends CallAutomationLiveTestBase { + private static final ClientLogger LOGGER = new ClientLogger(CallAutomationAutomatedLiveTestBase.class); + protected ConcurrentHashMap processorStore; // Key: callerId + receiverId, Value: incomingCallContext protected ConcurrentHashMap incomingCallContextStore; @@ -60,7 +63,7 @@ public class CallAutomationAutomatedLiveTestBase extends CallAutomationLiveTestB protected static final String BOT_APP_ID = Configuration.getGlobalConfiguration() .get("BOT_APP_ID", "REDACTED-bedb-REDACTED-b8c6-REDACTED"); - private static final StringJoiner JSON_PROPERTIES_TO_REDACT + private static final StringJoiner JSON_PROPERTIES_TO_REDACT = new StringJoiner("\":\"|\"", "\"", "\":\"") .add("value") .add("rawId") @@ -70,11 +73,11 @@ public class CallAutomationAutomatedLiveTestBase extends CallAutomationLiveTestB .add("ivrContext") .add("incomingCallContext") .add("serverCallId"); - + protected static final Pattern JSON_PROPERTY_VALUE_REDACTION_PATTERN = Pattern.compile(String.format("(?:%s)(.*?)(?:\",|\"})", JSON_PROPERTIES_TO_REDACT), Pattern.CASE_INSENSITIVE); - + protected static final String URL_REGEX = "(?<=http:\\/\\/|https:\\/\\/)([^\\/?]+)"; @Override @@ -206,11 +209,12 @@ private void messageBodyHandler(String body) { } protected void errorHandler(ServiceBusErrorContext context, CountDownLatch countdownLatch) { - System.out.printf("Error when receiving messages from namespace: '%s'. Entity: '%s'%n", - context.getFullyQualifiedNamespace(), context.getEntityPath()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error when receiving messages from namespace: '%s'. Entity: '%s'%n", + context.getFullyQualifiedNamespace(), context.getEntityPath())); if (!(context.getException() instanceof ServiceBusException)) { - System.out.printf("Non-ServiceBusException occurred: %s%n", context.getException()); + LOGGER.log(LogLevel.VERBOSE, () -> "Non-ServiceBusException occurred: " + context.getException()); return; } @@ -220,22 +224,20 @@ protected void errorHandler(ServiceBusErrorContext context, CountDownLatch count if (reason == ServiceBusFailureReason.MESSAGING_ENTITY_DISABLED || reason == ServiceBusFailureReason.MESSAGING_ENTITY_NOT_FOUND || reason == ServiceBusFailureReason.UNAUTHORIZED) { - System.out.printf("An unrecoverable error occurred. Stopping processing with reason %s: %s%n", - reason, exception.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "An unrecoverable error occurred. Stopping processing with reason %s: %s%n", + reason, exception.getMessage())); countdownLatch.countDown(); } else if (reason == ServiceBusFailureReason.MESSAGE_LOCK_LOST) { - System.out.printf("Message lock lost for message: %s%n", context.getException()); + LOGGER.log(LogLevel.VERBOSE, + () -> String.format("Message lock lost for message: %s%n", context.getException())); } else if (reason == ServiceBusFailureReason.SERVICE_BUSY) { - try { - // Choosing an arbitrary amount of time to wait until trying again. - TimeUnit.SECONDS.sleep(1); - } catch (InterruptedException e) { - System.err.println("Unable to sleep for period of time"); - } + // Choosing an arbitrary amount of time to wait until trying again. + sleepIfRunningAgainstService(1000); } else { - System.out.printf("Error source %s, reason %s, message: %s%n", context.getErrorSource(), - reason, context.getException()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format("Error source %s, reason %s, message: %s%n", + context.getErrorSource(), reason, context.getException())); } } @@ -260,7 +262,7 @@ protected String waitForIncomingCallContext(String uniqueId, Duration timeOut) t if (incomingCallContext != null) { return incomingCallContext; } - Thread.sleep(1000); + sleepIfRunningAgainstService(1000); } return null; } @@ -275,11 +277,11 @@ protected T waitForEvent(Class eventType, return event; } } - Thread.sleep(1000); + sleepIfRunningAgainstService(1000); } return null; } - + protected String redact(String content, Matcher matcher) { while (matcher.find()) { String captureGroup = matcher.group(1); diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationLiveTestBase.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationLiveTestBase.java index fbd9a81bd697..ca45f40b8eba 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationLiveTestBase.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationLiveTestBase.java @@ -62,17 +62,17 @@ public class CallAutomationLiveTestBase extends TestProxyTestBase { protected static final String MEDIA_SOURCE = Configuration.getGlobalConfiguration() .get("ACS_MEDIA_SOURCE", "https://contoso.com/music.wav"); protected static final String URL_REGEX = "(?<=http:\\/\\/|https:\\/\\/)([^\\/?]+)"; - + protected CommunicationIdentityClientBuilder getCommunicationIdentityClientUsingConnectionString(HttpClient httpClient) { CommunicationIdentityClientBuilder builder = new CommunicationIdentityClientBuilder() .connectionString(CONNECTION_STRING) .httpClient(getHttpClientOrUsePlayback(httpClient)); - + if (getTestMode() == TestMode.RECORD) { builder.addPolicy(interceptorManager.getRecordPolicy()); } addTestProxyTestSanitizersAndMatchers(interceptorManager); - + return builder; } @@ -88,12 +88,12 @@ protected CallAutomationClientBuilder getCallAutomationClientUsingConnectionStri .connectionString(CONNECTION_STRING) .httpClient(getHttpClientOrUsePlayback(httpClient)); } - + if (getTestMode() == TestMode.RECORD) { builder.addPolicy(interceptorManager.getRecordPolicy()); } addTestProxyTestSanitizersAndMatchers(interceptorManager); - + return builder; } @@ -137,12 +137,6 @@ protected Mono logHeaders(String testName, HttpPipelineNextPolicy }); } - protected void waitForOperationCompletion(int milliSeconds) throws InterruptedException { - if (getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(milliSeconds); - } - } - static class FakeCredentials implements TokenCredential { @Override public Mono getToken(TokenRequestContext tokenRequestContext) { @@ -159,15 +153,15 @@ protected String redact(String content, Matcher matcher) { } return content; } - + protected void addTestProxyTestSanitizersAndMatchers(InterceptorManager interceptorManager) { - + if (interceptorManager.isLiveMode()) { return; } List customSanitizers = new ArrayList<>(); - + customSanitizers.add(new TestProxySanitizer("Authorization", null, "REDACTED", TestProxySanitizerType.HEADER)); customSanitizers.add(new TestProxySanitizer("x-ms-client-request-id", null, "REDACTED", TestProxySanitizerType.HEADER)); customSanitizers.add(new TestProxySanitizer("x-ms-content-sha256", null, "REDACTED", TestProxySanitizerType.HEADER)); @@ -187,7 +181,7 @@ protected void addTestProxyTestSanitizersAndMatchers(InterceptorManager intercep customSanitizers.add(new TestProxySanitizer("$..mediaSubscriptionId", null, "REDACTED", TestProxySanitizerType.BODY_KEY)); customSanitizers.add(new TestProxySanitizer("$..dataSubscriptionId", null, "REDACTED", TestProxySanitizerType.BODY_KEY)); customSanitizers.add(new TestProxySanitizer(URL_REGEX, "REDACTED", TestProxySanitizerType.BODY_REGEX)); - + interceptorManager.addSanitizers(customSanitizers); if (interceptorManager.isPlaybackMode()) { diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionAsyncAutomatedLiveTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionAsyncAutomatedLiveTests.java index c807992bf2a3..69662ce92337 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionAsyncAutomatedLiveTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionAsyncAutomatedLiveTests.java @@ -15,14 +15,14 @@ import com.azure.communication.callautomation.models.RemoveParticipantResult; import com.azure.communication.callautomation.models.events.AddParticipantSucceeded; import com.azure.communication.callautomation.models.events.CallConnected; -import com.azure.communication.callautomation.models.events.RemoveParticipantSucceeded; import com.azure.communication.callautomation.models.events.CancelAddParticipantSucceeded; +import com.azure.communication.callautomation.models.events.RemoveParticipantSucceeded; import com.azure.communication.common.CommunicationIdentifier; import com.azure.communication.common.CommunicationUserIdentifier; import com.azure.communication.identity.CommunicationIdentityAsyncClient; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; - +import com.azure.core.test.annotation.DoNotRecord; import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -39,6 +39,7 @@ public class CallConnectionAsyncAutomatedLiveTests extends CallAutomationAutomatedLiveTestBase { + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( @@ -157,6 +158,7 @@ public void createVOIPCallAndAnswerThenAddParticipantFinallyRemoveParticipantAut } } + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( @@ -232,7 +234,7 @@ public void createVOIPCallAndAnswerThenAddParticipantFinallyCancelAddParticipant assertNotNull(addParticipantsResultResponse); // ensure invitation is sent - Thread.sleep(3000); + sleepIfRunningAgainstService(3000); // cancel add participant CancelAddParticipantOperationResult cancelAddParticipantResponse = createCallResult diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallDialogAsyncAutomatedLiveTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallDialogAsyncAutomatedLiveTests.java index c12f8a6f6e83..4dac2c5d8b31 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallDialogAsyncAutomatedLiveTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallDialogAsyncAutomatedLiveTests.java @@ -12,6 +12,7 @@ import com.azure.communication.identity.CommunicationIdentityAsyncClient; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; +import com.azure.core.test.annotation.DoNotRecord; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; @@ -25,6 +26,7 @@ public class CallDialogAsyncAutomatedLiveTests extends CallAutomationAutomatedLiveTestBase { + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaAsyncAutomatedLiveTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaAsyncAutomatedLiveTests.java index 60e5034b3d1d..a7d6c8f17887 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaAsyncAutomatedLiveTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaAsyncAutomatedLiveTests.java @@ -24,6 +24,7 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; import com.azure.core.test.TestMode; +import com.azure.core.test.annotation.DoNotRecord; import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import org.junit.jupiter.params.ParameterizedTest; @@ -42,6 +43,7 @@ public class CallMediaAsyncAutomatedLiveTests extends CallAutomationAutomatedLiveTestBase { + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( @@ -128,6 +130,7 @@ public void playMediaInACallAutomatedTest(HttpClient httpClient) { } } + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallRecordingAutomatedLiveTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallRecordingAutomatedLiveTests.java index 98e6ee049631..8187e92aaef8 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallRecordingAutomatedLiveTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallRecordingAutomatedLiveTests.java @@ -21,6 +21,7 @@ import com.azure.communication.common.CommunicationUserIdentifier; import com.azure.communication.identity.CommunicationIdentityClient; import com.azure.core.http.HttpClient; +import com.azure.core.test.annotation.DoNotRecord; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -34,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.fail; public class CallRecordingAutomatedLiveTests extends CallAutomationAutomatedLiveTestBase { + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void createACSCallAndUnmixedAudioTest(HttpClient httpClient) { @@ -118,6 +120,7 @@ public void createACSCallAndUnmixedAudioTest(HttpClient httpClient) { } } + @DoNotRecord(skipInPlayback = true) @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void createACSCallUnmixedAudioAffinityTest(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createACSCallAndUnmixedAudioTest.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createACSCallAndUnmixedAudioTest.json deleted file mode 100644 index 41689d777012..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createACSCallAndUnmixedAudioTest.json +++ /dev/null @@ -1 +0,0 @@ -["{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"802fc64d-4d4e-4280-be90-228202784cd6\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-d9b1-40b6-805b-56cef20d7f13\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"802fc64d-4d4e-4280-be90-228202784cd6\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:17:14.5301986\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-d9b1-40b6-805b-56cef20d7f13\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"802fc64d-4d4e-4280-be90-228202784cd6\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:17:14.5301986\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":3,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-d9b1-40b6-805b-56cef20d7f13\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"802fc64d-4d4e-4280-be90-228202784cd6\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:17:19.8119571\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\",\"type\":\"Microsoft.Communication.CallDisconnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-d9b1-40b6-805b-56cef20d7f13\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"802fc64d-4d4e-4280-be90-228202784cd6\",\"publicEventType\":\"Microsoft.Communication.CallDisconnected\"},\"time\":\"2024-04-24T19:17:20.2182933\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-d9b1-40b6-805b-56cef20d7f13\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createACSCallUnmixedAudioAffinityTest.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createACSCallUnmixedAudioAffinityTest.json deleted file mode 100644 index 3b6fc1e33a39..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createACSCallUnmixedAudioAffinityTest.json +++ /dev/null @@ -1 +0,0 @@ -["{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"54f85e11-3105-433f-aac8-19cf1df95d36\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-78fd-4327-bf24-44ec170f86cd\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"54f85e11-3105-433f-aac8-19cf1df95d36\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:17:26.4688368\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-78fd-4327-bf24-44ec170f86cd\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"54f85e11-3105-433f-aac8-19cf1df95d36\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:17:26.4688368\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":3,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-78fd-4327-bf24-44ec170f86cd\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"54f85e11-3105-433f-aac8-19cf1df95d36\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:17:30.9536716\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\",\"type\":\"Microsoft.Communication.CallDisconnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-78fd-4327-bf24-44ec170f86cd\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"54f85e11-3105-433f-aac8-19cf1df95d36\",\"publicEventType\":\"Microsoft.Communication.CallDisconnected\"},\"time\":\"2024-04-24T19:17:31.3599728\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-78fd-4327-bf24-44ec170f86cd\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenAddParticipantFinallyCancelAddParticipant.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenAddParticipantFinallyCancelAddParticipant.json deleted file mode 100644 index 8bc5f1f63488..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenAddParticipantFinallyCancelAddParticipant.json +++ /dev/null @@ -1 +0,0 @@ -["{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"7d16dfce-c0c5-490d-8105-7debd7893a32\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-cbad-484c-bcde-27c5edc765db\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"7d16dfce-c0c5-490d-8105-7debd7893a32\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:37.484509\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-8ff1-4fe6-a575-d0e702b71497\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"7d16dfce-c0c5-490d-8105-7debd7893a32\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:37.5001327\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-8ff1-4fe6-a575-d0e702b71497\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"7d16dfce-c0c5-490d-8105-7debd7893a32\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:37.5157768\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-cbad-484c-bcde-27c5edc765db\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"7d16dfce-c0c5-490d-8105-7debd7893a32\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:37.5157768\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":3,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-8ff1-4fe6-a575-d0e702b71497\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"7d16dfce-c0c5-490d-8105-7debd7893a32\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:39.5471963\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":3,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-cbad-484c-bcde-27c5edc765db\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"7d16dfce-c0c5-490d-8105-7debd7893a32\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:39.5471963\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-cbad-484c-bcde-27c5edc765db\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\",\"type\":\"Microsoft.Communication.CancelAddParticipantSucceeded\",\"data\":{\"invitationId\":\"03b7d0e2-1d59-4f37-9fd1-f827d275eb59\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-8ff1-4fe6-a575-d0e702b71497\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"7d16dfce-c0c5-490d-8105-7debd7893a32\",\"publicEventType\":\"Microsoft.Communication.CancelAddParticipantSucceeded\"},\"time\":\"2024-04-24T19:16:41.2504076\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-8ff1-4fe6-a575-d0e702b71497\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenAddParticipantFinallyRemoveParticipantAutomatedTest.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenAddParticipantFinallyRemoveParticipantAutomatedTest.json deleted file mode 100644 index cb7d3ec5caf6..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenAddParticipantFinallyRemoveParticipantAutomatedTest.json +++ /dev/null @@ -1 +0,0 @@ -["{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:23.5615833\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:23.6240133\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:23.6083905\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:23.6240133\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":3,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:26.4836617\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":3,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:26.5148471\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:28.2649797\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.AddParticipantSucceeded\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participant\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.AddParticipantSucceeded\"},\"time\":\"2024-04-24T19:16:28.358734\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":4,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:28.358734\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":4,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:28.358734\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":6,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:28.6244317\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":6,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:28.8431467\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":5,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:28.8431467\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":7,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:29.0931748\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":6,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:29.3119818\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":6,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:29.3119818\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":9,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:29.5775742\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"type\":\"Microsoft.Communication.CallDisconnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-c9dd-4c59-b2b3-d50aaa67159f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.CallDisconnected\"},\"time\":\"2024-04-24T19:16:29.6557095\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-c9dd-4c59-b2b3-d50aaa67159f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":9,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:30.0464126\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.RemoveParticipantSucceeded\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participant\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.RemoveParticipantSucceeded\"},\"time\":\"2024-04-24T19:16:29.6557095\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":7,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:29.7807154\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":9,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:30.5151508\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":8,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:30.6089007\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":11,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-9ebd-43a1-95f7-92e9994edb3f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:30.9996063\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-9ebd-43a1-95f7-92e9994edb3f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":9,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-7b70-4bfd-b026-739e6c663e81\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"448c7527-7911-4149-b835-e49afb83a6bf\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:31.1246381\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-7b70-4bfd-b026-739e6c663e81\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenHangupAutomatedTest.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenHangupAutomatedTest.json deleted file mode 100644 index ecc6d9ed6c24..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndAnswerThenHangupAutomatedTest.json +++ /dev/null @@ -1 +0,0 @@ -["{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"b94e5319-f526-4538-aaef-6d59b28d3aa2\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-4f90-4199-9a2c-e07e3af80407\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"b94e5319-f526-4538-aaef-6d59b28d3aa2\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:12.9357522\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"b94e5319-f526-4538-aaef-6d59b28d3aa2\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:12.9670517\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"b94e5319-f526-4538-aaef-6d59b28d3aa2\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:12.9984379\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-4f90-4199-9a2c-e07e3af80407\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"b94e5319-f526-4538-aaef-6d59b28d3aa2\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:13.0451895\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\",\"type\":\"Microsoft.Communication.CallDisconnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-4f90-4199-9a2c-e07e3af80407\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"b94e5319-f526-4538-aaef-6d59b28d3aa2\",\"publicEventType\":\"Microsoft.Communication.CallDisconnected\"},\"time\":\"2024-04-24T19:16:14.4514859\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-4f90-4199-9a2c-e07e3af80407\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"type\":\"Microsoft.Communication.CallDisconnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-2077-4ee0-b8ac-017ad075c7bb\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"b94e5319-f526-4538-aaef-6d59b28d3aa2\",\"publicEventType\":\"Microsoft.Communication.CallDisconnected\"},\"time\":\"2024-04-24T19:16:14.529611\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-2077-4ee0-b8ac-017ad075c7bb\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndRejectAutomatedTest.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndRejectAutomatedTest.json deleted file mode 100644 index b2a384ab4c74..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/createVOIPCallAndRejectAutomatedTest.json +++ /dev/null @@ -1 +0,0 @@ -["{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"5556ad81-73a7-4fa7-a5c7-b4b7d08a2001\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-c0ef-474b-8b58-ad685a4b1ce9\",\"type\":\"Microsoft.Communication.CreateCallFailed\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-c0ef-474b-8b58-ad685a4b1ce9\",\"resultInformation\":{\"code\":603,\"subCode\":0,\"message\":\"Decline. DiagCode: 603#0.@\"},\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-c0ef-474b-8b58-ad685a4b1ce9\",\"correlationId\":\"5556ad81-73a7-4fa7-a5c7-b4b7d08a2001\",\"publicEventType\":\"Microsoft.Communication.CreateCallFailed\"},\"time\":\"2024-04-24T19:16:06.0905745\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-c0ef-474b-8b58-ad685a4b1ce9\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/dialogActionInACallAutomatedTest.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/dialogActionInACallAutomatedTest.json deleted file mode 100644 index 4647cc0dd9a7..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/dialogActionInACallAutomatedTest.json +++ /dev/null @@ -1 +0,0 @@ -["{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"41820b15-8dca-430f-b226-b3d26a3f80b5\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-688b-44d7-8081-1282028cdd97\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"41820b15-8dca-430f-b226-b3d26a3f80b5\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T18:28:31.0979781\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-688b-44d7-8081-1282028cdd97\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"41820b15-8dca-430f-b226-b3d26a3f80b5\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T18:28:31.1448558\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-3a6a-431c-8c4a-7c1f8b27f9f5\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-3a6a-431c-8c4a-7c1f8b27f9f5\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-3a6a-431c-8c4a-7c1f8b27f9f5\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"41820b15-8dca-430f-b226-b3d26a3f80b5\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T18:28:31.1762164\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-3a6a-431c-8c4a-7c1f8b27f9f5\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-3a6a-431c-8c4a-7c1f8b27f9f5\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-3a6a-431c-8c4a-7c1f8b27f9f5\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-3a6a-431c-8c4a-7c1f8b27f9f5\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"41820b15-8dca-430f-b226-b3d26a3f80b5\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T18:28:31.1762164\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-3a6a-431c-8c4a-7c1f8b27f9f5\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\",\"type\":\"Microsoft.Communication.DialogFailed\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\",\"resultInformation\":{\"code\":500,\"subCode\":8595,\"message\":\"Action failed, missing bot config or app id.\"},\"dialogInputType\":\"powerVirtualAgents\",\"dialogId\":\"92e08834-b6ee-4ede-8956-9fefa27a691c\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-688b-44d7-8081-1282028cdd97\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"41820b15-8dca-430f-b226-b3d26a3f80b5\",\"publicEventType\":\"Microsoft.Communication.DialogFailed\"},\"time\":\"2024-04-24T18:28:33.2388006\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-688b-44d7-8081-1282028cdd97\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/dtmfActionsInACallAutomatedTest.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/dtmfActionsInACallAutomatedTest.json deleted file mode 100644 index 63208076fd7d..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/dtmfActionsInACallAutomatedTest.json +++ /dev/null @@ -1 +0,0 @@ -["[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-09a1-4ad4-9320-4f2d89459535\",\"type\":\"Microsoft.Communication.CallDisconnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-09a1-4ad4-9320-4f2d89459535\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-09a1-4ad4-9320-4f2d89459535\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"892264d7-e380-44f1-88fd-7764e019664b\",\"publicEventType\":\"Microsoft.Communication.CallDisconnected\"},\"time\":\"2024-04-24T18:29:05.7916051\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-09a1-4ad4-9320-4f2d89459535\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-567b-47c2-93a4-546fa6997899\",\"type\":\"Microsoft.Communication.CallDisconnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-567b-47c2-93a4-546fa6997899\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-567b-47c2-93a4-546fa6997899\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"63ad2792-7c3d-497d-bbae-aa384c7a8f03\",\"publicEventType\":\"Microsoft.Communication.CallDisconnected\"},\"time\":\"2024-04-24T18:29:06.0572971\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-567b-47c2-93a4-546fa6997899\"}]","{\"to\":{\"kind\":\"phoneNumber\",\"rawId\":\"REDACTED\",\"phoneNumber\":{\"value\":\"REDACTED\"}},\"from\":{\"kind\":\"phoneNumber\",\"rawId\":\"REDACTED\",\"phoneNumber\":{\"value\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"1a14f457-e406-4aed-95b3-7e6259d23851\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-476a-4aed-ae4b-fb8657609c2f\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-476a-4aed-ae4b-fb8657609c2f\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-476a-4aed-ae4b-fb8657609c2f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"1a14f457-e406-4aed-95b3-7e6259d23851\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:50.3802422\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-476a-4aed-ae4b-fb8657609c2f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-476a-4aed-ae4b-fb8657609c2f\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-476a-4aed-ae4b-fb8657609c2f\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"phoneNumber\",\"phoneNumber\":{\"value\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-476a-4aed-ae4b-fb8657609c2f\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"1a14f457-e406-4aed-95b3-7e6259d23851\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:50.5365\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-476a-4aed-ae4b-fb8657609c2f\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-e121-46d6-ab08-b468bd18edd5\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"d6d82270-ed3c-49b0-aeb9-2a157ca1af60\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:16:50.6345661\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"phoneNumber\",\"phoneNumber\":{\"value\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-e121-46d6-ab08-b468bd18edd5\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"d6d82270-ed3c-49b0-aeb9-2a157ca1af60\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:16:50.6345661\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\",\"type\":\"Microsoft.Communication.SendDtmfTonesCompleted\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-e121-46d6-ab08-b468bd18edd5\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"d6d82270-ed3c-49b0-aeb9-2a157ca1af60\",\"publicEventType\":\"Microsoft.Communication.SendDtmfTonesCompleted\"},\"time\":\"2024-04-24T19:16:55.6194105\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\",\"type\":\"Microsoft.Communication.ContinuousDtmfRecognitionStopped\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-e121-46d6-ab08-b468bd18edd5\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"d6d82270-ed3c-49b0-aeb9-2a157ca1af60\",\"publicEventType\":\"Microsoft.Communication.ContinuousDtmfRecognitionStopped\"},\"time\":\"2024-04-24T19:16:56.1352209\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-e121-46d6-ab08-b468bd18edd5\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/playMediaInACallAutomatedTest.json b/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/playMediaInACallAutomatedTest.json deleted file mode 100644 index ef82e3d66c80..000000000000 --- a/sdk/communication/azure-communication-callautomation/src/test/resources/session-records/playMediaInACallAutomatedTest.json +++ /dev/null @@ -1 +0,0 @@ -["{\"to\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"from\":{\"kind\":\"communicationUser\",\"rawId\":\"REDACTED\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"serverCallId\":\"REDACTED\",\"callerDisplayName\":\"\",\"incomingCallContext\":\"REDACTED\",\"correlationId\":\"ef73aa27-a842-4fb1-bdaa-3a46db20014e\"}","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-b29e-4059-8f3c-f78434c99035\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"ef73aa27-a842-4fb1-bdaa-3a46db20014e\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:17:02.3387065\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-5e6f-47d8-bc89-5489b351cd37\",\"type\":\"Microsoft.Communication.CallConnected\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-5e6f-47d8-bc89-5489b351cd37\",\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-5e6f-47d8-bc89-5489b351cd37\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"ef73aa27-a842-4fb1-bdaa-3a46db20014e\",\"publicEventType\":\"Microsoft.Communication.CallConnected\"},\"time\":\"2024-04-24T19:17:02.307396\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-5e6f-47d8-bc89-5489b351cd37\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-5e6f-47d8-bc89-5489b351cd37\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-5e6f-47d8-bc89-5489b351cd37\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-5e6f-47d8-bc89-5489b351cd37\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"ef73aa27-a842-4fb1-bdaa-3a46db20014e\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:17:02.3543277\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-5e6f-47d8-bc89-5489b351cd37\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\",\"type\":\"Microsoft.Communication.ParticipantsUpdated\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\",\"participants\":[{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false},{\"identifier\":{\"rawId\":\"REDACTED\",\"kind\":\"communicationUser\",\"communicationUser\":{\"id\":\"REDACTED\"}},\"isMuted\":false,\"isOnHold\":false}],\"sequenceNumber\":1,\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-b29e-4059-8f3c-f78434c99035\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"ef73aa27-a842-4fb1-bdaa-3a46db20014e\",\"publicEventType\":\"Microsoft.Communication.ParticipantsUpdated\"},\"time\":\"2024-04-24T19:17:02.3543277\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\"}]","[{\"id\":\"REDACTED\",\"source\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\",\"type\":\"Microsoft.Communication.PlayCompleted\",\"data\":{\"eventSource\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\",\"resultInformation\":{\"code\":200,\"subCode\":0,\"message\":\"Action completed successfully.\"},\"version\":\"2023-10-03-preview\",\"callConnectionId\":\"451f3600-b29e-4059-8f3c-f78434c99035\",\"serverCallId\":\"REDACTED\",\"correlationId\":\"ef73aa27-a842-4fb1-bdaa-3a46db20014e\",\"publicEventType\":\"Microsoft.Communication.PlayCompleted\"},\"time\":\"2024-04-24T19:17:08.357708\\u002B00:00\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"calling/callConnections/451f3600-b29e-4059-8f3c-f78434c99035\"}]"] \ No newline at end of file diff --git a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallAutomationLiveTestBase.java b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallAutomationLiveTestBase.java index e5cf3dc2817e..fbfb3defe424 100644 --- a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallAutomationLiveTestBase.java +++ b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallAutomationLiveTestBase.java @@ -13,6 +13,8 @@ import com.azure.core.test.TestMode; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.identity.DefaultAzureCredentialBuilder; import reactor.core.publisher.Mono; @@ -25,6 +27,8 @@ import java.util.regex.Pattern; public class CallAutomationLiveTestBase extends TestBase { + private static final ClientLogger LOGGER = new ClientLogger(CallAutomationLiveTestBase.class); + protected static final String CONNECTION_STRING = Configuration.getGlobalConfiguration() .get("COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING", "endpoint=https://REDACTED.communication.azure.com/;accesskey=QWNjZXNzS2V5"); @@ -109,7 +113,7 @@ protected Mono logHeaders(String testName, HttpPipelineNextPolicy final HttpResponse bufferedResponse = httpResponse.buffer(); /* Should sanitize printed response url */ - System.out.println("Chain-ID header for " + testName + " request " + LOGGER.log(LogLevel.VERBOSE, () -> "Chain-ID header for " + testName + " request " + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("X-Microsoft-Skype-Chain-ID")); return Mono.just(bufferedResponse); diff --git a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/DownloadContentAsyncLiveTests.java b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/DownloadContentAsyncLiveTests.java index 4a397fa5a51f..732a8df93167 100644 --- a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/DownloadContentAsyncLiveTests.java +++ b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/DownloadContentAsyncLiveTests.java @@ -8,6 +8,8 @@ import com.azure.communication.callingserver.models.ParallelDownloadOptions; import com.azure.core.http.HttpClient; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -31,6 +33,7 @@ import static org.mockito.Mockito.times; public class DownloadContentAsyncLiveTests extends CallAutomationLiveTestBase { + private static final ClientLogger LOGGER = new ClientLogger(DownloadContentAsyncLiveTests.class); @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @@ -61,7 +64,7 @@ private void downloadMetadata(CallAutomationAsyncClient conversationAsyncClient) try { validateMetadata(conversationAsyncClient.getCallRecordingAsync().downloadStream(METADATA_URL)); } catch (Exception e) { - System.out.println("Error: " + e.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> "Error", e); throw e; } } @@ -79,7 +82,7 @@ public void downloadMetadataRetryingAsync(HttpClient httpClient) { try { validateMetadata(conversationAsyncClient.getCallRecordingAsync().downloadStream(METADATA_URL)); } catch (Exception e) { - System.out.println("Error: " + e.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> "Error", e); throw e; } } @@ -104,7 +107,7 @@ public void downloadVideoAsync(HttpClient httpClient) { .verifyComplete()) .verifyComplete(); } catch (Exception e) { - System.out.println("Error: " + e.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> "Error", e); throw e; } } diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java index 89cd18a49ba8..4bdb19fff1e7 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java @@ -3,28 +3,30 @@ package com.azure.communication.chat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; - +import com.azure.communication.chat.implementation.ChatOptionsProvider; +import com.azure.communication.chat.models.ChatThreadItem; +import com.azure.communication.chat.models.CreateChatThreadOptions; +import com.azure.communication.chat.models.CreateChatThreadResult; +import com.azure.communication.chat.models.ListChatThreadsOptions; +import com.azure.communication.common.CommunicationUserIdentifier; import com.azure.communication.identity.CommunicationIdentityClient; import com.azure.communication.identity.models.CommunicationTokenScope; -import com.azure.communication.common.CommunicationUserIdentifier; -import com.azure.communication.chat.implementation.ChatOptionsProvider; -import com.azure.communication.chat.models.*; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + /** * Set the AZURE_TEST_MODE environment variable to either PLAYBACK or RECORD to determine if tests are playback or * live. By default, tests are run in playback mode. @@ -129,7 +131,7 @@ public void canDeleteChatThreadWithResponse(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void canListChatThreads(HttpClient httpClient) throws InterruptedException { + public void canListChatThreads(HttpClient httpClient) { // Arrange setupTest(httpClient, "canListChatThreadsSync"); CreateChatThreadOptions threadRequest1 = ChatOptionsProvider.createThreadOptions( @@ -139,7 +141,7 @@ public void canListChatThreads(HttpClient httpClient) throws InterruptedExceptio client.createChatThread(threadRequest1); client.createChatThread(threadRequest2); - Thread.sleep(500); + sleepIfRunningAgainstService(500); // Action & Assert PagedIterable threadsResponse = client.listChatThreads(); @@ -156,7 +158,7 @@ public void canListChatThreads(HttpClient httpClient) throws InterruptedExceptio @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void canListChatThreadsWithMaxPageSize(HttpClient httpClient) throws InterruptedException { + public void canListChatThreadsWithMaxPageSize(HttpClient httpClient) { // Arrange setupTest(httpClient, "canListChatThreadsWithMaxPageSizeSync"); CreateChatThreadOptions threadRequest1 = ChatOptionsProvider.createThreadOptions( @@ -166,7 +168,7 @@ public void canListChatThreadsWithMaxPageSize(HttpClient httpClient) throws Inte client.createChatThread(threadRequest1); client.createChatThread(threadRequest2); - Thread.sleep(500); + sleepIfRunningAgainstService(500); ListChatThreadsOptions options = new ListChatThreadsOptions(); options.setMaxPageSize(10); diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/CommunicationLoggerPolicy.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/CommunicationLoggerPolicy.java index 362f2f720f74..74737342374d 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/CommunicationLoggerPolicy.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/CommunicationLoggerPolicy.java @@ -9,6 +9,7 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import reactor.core.publisher.Mono; /** @@ -16,7 +17,7 @@ */ public class CommunicationLoggerPolicy implements HttpPipelinePolicy { - private final ClientLogger logger = new ClientLogger(CommunicationLoggerPolicy.class); + private static final ClientLogger LOGGER = new ClientLogger(CommunicationLoggerPolicy.class); private final String testName; /** @@ -34,7 +35,7 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN final HttpResponse bufferedResponse = httpResponse.buffer(); // Should sanitize printed reponse url - System.out.println("MS-CV header for " + testName + " request " + LOGGER.log(LogLevel.VERBOSE, () -> "MS-CV header for " + testName + " request " + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV")); return Mono.just(bufferedResponse); }); diff --git a/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java b/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java index 4a2be505d72a..0b183b1b4d6a 100644 --- a/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java +++ b/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java @@ -19,6 +19,8 @@ import com.azure.core.test.models.TestProxySanitizerType; import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.identity.DefaultAzureCredentialBuilder; import reactor.core.publisher.Mono; @@ -33,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; public class CommunicationIdentityClientTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(CommunicationIdentityClientTestBase.class); private static final String REDACTED = "REDACTED"; private static final String URI_IDENTITY_REPLACER_REGEX = "/identities/([^/?]+)"; @@ -159,7 +162,7 @@ private Mono logHeaders(String testName, HttpPipelineNextPolicy ne final HttpResponse bufferedResponse = httpResponse.buffer(); // Should sanitize printed reponse url - System.out.println("MS-CV header for " + testName + " request " + LOGGER.log(LogLevel.VERBOSE, () -> "MS-CV header for " + testName + " request " + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV")); return Mono.just(bufferedResponse); }); diff --git a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/ClassificationPolicyAsyncLiveTests.java b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/ClassificationPolicyAsyncLiveTests.java index b180abf99367..deac224f7551 100644 --- a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/ClassificationPolicyAsyncLiveTests.java +++ b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/ClassificationPolicyAsyncLiveTests.java @@ -26,7 +26,6 @@ import com.azure.communication.jobrouter.models.WorkerSelectorAttachment; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestMode; import com.azure.core.util.BinaryData; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -139,9 +138,7 @@ public void createClassificationPolicy(HttpClient httpClient) throws Interrupted } })).block(); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(5000); - } + sleepIfRunningAgainstService(5000); // Verify assertEquals(classificationPolicyId, policy.getId()); diff --git a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/ClassificationPolicyLiveTests.java b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/ClassificationPolicyLiveTests.java index 5639631436e9..1da46b2b40da 100644 --- a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/ClassificationPolicyLiveTests.java +++ b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/ClassificationPolicyLiveTests.java @@ -24,7 +24,6 @@ import com.azure.communication.jobrouter.models.WorkerSelectorAttachment; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestMode; import com.azure.core.util.BinaryData; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -107,9 +106,7 @@ public void createClassificationPolicy(HttpClient httpClient) throws Interrupted RouterJob job = routerClient.createJobWithClassificationPolicy( new CreateJobWithClassificationPolicyOptions(jobId, channelId, classificationPolicyId)); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(5000); - } + sleepIfRunningAgainstService(5000); // Verify assertEquals(classificationPolicyId, policy.getId()); diff --git a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterJobAsyncLiveTests.java b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterJobAsyncLiveTests.java index 92e21536b168..ccf6b55c2157 100644 --- a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterJobAsyncLiveTests.java +++ b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterJobAsyncLiveTests.java @@ -25,7 +25,6 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestMode; import com.azure.core.util.BinaryData; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -150,9 +149,7 @@ public void unassignJob(HttpClient httpClient) throws InterruptedException { assertEquals(2, jobDeserialized.getRequestedWorkerSelectors().size()); assertEquals(Duration.ofSeconds(100), jobDeserialized.getRequestedWorkerSelectors().get(0).getExpiresAfter()); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(2000); - } + sleepIfRunningAgainstService(2000); jobDeserialized.setPriority(10); RouterJob updatedJob = jobRouterAsyncClient.updateJob(jobId, jobDeserialized).block(); @@ -207,9 +204,7 @@ public void unassignJob(HttpClient httpClient) throws InterruptedException { // Verify assertTrue(unassignJobResult.getUnassignmentCount() > 0); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(5000); - } + sleepIfRunningAgainstService(5000); RouterQueueStatistics queueStatistics = jobRouterAsyncClient.getQueueStatistics(queueId).block(); @@ -236,9 +231,7 @@ public void unassignJob(HttpClient httpClient) throws InterruptedException { jobRouterAsyncClient.cancelJob(jobId, requestOptions).block(); jobRouterAsyncClient.deleteJob(jobId).block(); jobRouterAsyncClient.deleteWorker(workerId).block(); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(5000); - } + sleepIfRunningAgainstService(5000); administrationAsyncClient.deleteQueue(queueId).block(); administrationAsyncClient.deleteDistributionPolicy(distributionPolicyId).block(); } diff --git a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterJobLiveTests.java b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterJobLiveTests.java index 23447f8edab1..2363a4d1228a 100644 --- a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterJobLiveTests.java +++ b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterJobLiveTests.java @@ -25,7 +25,6 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestMode; import com.azure.core.util.BinaryData; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -151,9 +150,7 @@ public void unassignJob(HttpClient httpClient) throws InterruptedException { assertEquals(2, jobDeserialized.getRequestedWorkerSelectors().size()); assertEquals(Duration.ofSeconds(100), jobDeserialized.getRequestedWorkerSelectors().get(0).getExpiresAfter()); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(2000); - } + sleepIfRunningAgainstService(2000); jobDeserialized.setPriority(10); RouterJob updatedJob = jobRouterClient.updateJob(jobId, jobDeserialized); @@ -207,9 +204,7 @@ public void unassignJob(HttpClient httpClient) throws InterruptedException { // Verify assertTrue(unassignJobResult.getUnassignmentCount() > 0); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(5000); - } + sleepIfRunningAgainstService(5000); RouterQueueStatistics queueStatistics = jobRouterClient.getQueueStatistics(queueId); @@ -235,9 +230,7 @@ public void unassignJob(HttpClient httpClient) throws InterruptedException { jobRouterClient.cancelJob(jobId, requestOptions); jobRouterClient.deleteJob(jobId); jobRouterClient.deleteWorker(workerId); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(5000); - } + sleepIfRunningAgainstService(5000); routerAdminClient.deleteQueue(queueId); routerAdminClient.deleteDistributionPolicy(distributionPolicyId); } @@ -264,9 +257,7 @@ public void jobScheduling(HttpClient httpClient) throws InterruptedException { OffsetDateTime.of(2040, 1, 1, 1, 1, 1, 1, ZoneOffset.UTC)))); assertEquals(RouterJobStatus.PENDING_SCHEDULE, job.getStatus()); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(2000); - } + sleepIfRunningAgainstService(2000); // Action job.setMatchingMode(new QueueAndMatchMode()); diff --git a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterWorkerAsyncLiveTests.java b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterWorkerAsyncLiveTests.java index 800d9d47d2f1..4cd77b5ce427 100644 --- a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterWorkerAsyncLiveTests.java +++ b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterWorkerAsyncLiveTests.java @@ -14,7 +14,6 @@ import com.azure.communication.jobrouter.models.RouterWorker; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestMode; import com.azure.core.util.BinaryData; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -132,9 +131,7 @@ public void createWorker(HttpClient httpClient) throws InterruptedException { assertEquals(channels.size(), deserialized.getChannels().size()); assertEquals(deserialized.getEtag(), result.getEtag()); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(2000); - } + sleepIfRunningAgainstService(2000); deserialized.setAvailableForOffers(true); deserialized.setChannels(new ArrayList() { diff --git a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterWorkerLiveTests.java b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterWorkerLiveTests.java index 008f0b3a0eea..b4423b1403e9 100644 --- a/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterWorkerLiveTests.java +++ b/sdk/communication/azure-communication-jobrouter/src/test/java/com.azure.communication.jobrouter/RouterWorkerLiveTests.java @@ -11,7 +11,6 @@ import com.azure.communication.jobrouter.models.RouterWorker; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestMode; import com.azure.core.util.BinaryData; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -108,9 +107,7 @@ public void createWorker(HttpClient httpClient) throws InterruptedException { assertEquals(channels.size(), deserialized.getChannels().size()); assertEquals(deserialized.getEtag(), result.getEtag()); - if (this.getTestMode() != TestMode.PLAYBACK) { - Thread.sleep(2000); - } + sleepIfRunningAgainstService(2000); deserialized.setAvailableForOffers(true); deserialized.setChannels(new ArrayList() { diff --git a/sdk/communication/azure-communication-messages/src/test/java/com/azure/communication/messages/CommunicationMessagesTestBase.java b/sdk/communication/azure-communication-messages/src/test/java/com/azure/communication/messages/CommunicationMessagesTestBase.java index 34bfb174ebde..ebb1ceae3992 100644 --- a/sdk/communication/azure-communication-messages/src/test/java/com/azure/communication/messages/CommunicationMessagesTestBase.java +++ b/sdk/communication/azure-communication-messages/src/test/java/com/azure/communication/messages/CommunicationMessagesTestBase.java @@ -14,11 +14,14 @@ import com.azure.core.test.models.TestProxySanitizer; import com.azure.core.test.models.TestProxySanitizerType; import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import reactor.core.publisher.Mono; import java.util.Arrays; public class CommunicationMessagesTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(CommunicationMessagesTestBase.class); protected static final String CONNECTION_STRING = Configuration.getGlobalConfiguration() .get("COMMUNICATION_CONNECTION_STRING_CPM", @@ -101,7 +104,7 @@ public Mono logHeaders(HttpPipelineNextPolicy next) { final HttpResponse bufferedResponse = httpResponse.buffer(); // Should sanitize printed reponse url - System.out.println("MS-CV header for request " + LOGGER.log(LogLevel.VERBOSE, () -> "MS-CV header for request " + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV")); return Mono.just(bufferedResponse); }); diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index 43789327783c..15d95cadd7c3 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -16,12 +16,16 @@ import com.azure.core.test.models.TestProxySanitizerType; import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.identity.DefaultAzureCredentialBuilder; import reactor.core.publisher.Mono; import java.util.Arrays; public class PhoneNumbersIntegrationTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(PhoneNumbersIntegrationTestBase.class); + private static final String CONNECTION_STRING = Configuration.getGlobalConfiguration() .get("COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING", "endpoint=https://REDACTED.communication.azure.com/;accesskey=QWNjZXNzS2V5"); @@ -141,8 +145,8 @@ private Mono logHeaders(String testName, HttpPipelineNextPolicy ne final HttpResponse bufferedResponse = httpResponse.buffer(); // Should sanitize printed reponse url - System.out.println("MS-CV header for " + testName + " request " - + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV")); + LOGGER.log(LogLevel.VERBOSE, () -> "MS-CV header for " + testName + " request " + + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV")); return Mono.just(bufferedResponse); }); } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/siprouting/SipRoutingIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/siprouting/SipRoutingIntegrationTestBase.java index b74c96e53805..8d0b33036d34 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/siprouting/SipRoutingIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/siprouting/SipRoutingIntegrationTestBase.java @@ -19,16 +19,20 @@ import com.azure.core.test.models.TestProxySanitizerType; import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.identity.DefaultAzureCredentialBuilder; import reactor.core.publisher.Mono; import java.util.Arrays; import java.util.List; -import java.util.UUID; import static java.util.Arrays.asList; public class SipRoutingIntegrationTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(SipRoutingIntegrationTestBase.class); + private static final String CONNECTION_STRING = Configuration.getGlobalConfiguration() .get("COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING", "endpoint=https://REDACTED.communication.azure.com/;accesskey=QWNjZXNzS2V5"); private static final String AZURE_TEST_DOMAIN = Configuration.getGlobalConfiguration() @@ -192,7 +196,7 @@ private Mono logHeaders(String testName, HttpPipelineNextPolicy ne final HttpResponse bufferedResponse = httpResponse.buffer(); // Should sanitize printed reponse url - System.out.println("MS-CV header for " + testName + " request " + LOGGER.log(LogLevel.VERBOSE, () -> "MS-CV header for " + testName + " request " + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV")); return Mono.just(bufferedResponse); }); @@ -203,7 +207,7 @@ private static String getUniqueFqdn(String order) { return order + ".redacted" + "." + AZURE_TEST_DOMAIN; } - String unique = UUID.randomUUID().toString().replace("-", ""); + String unique = CoreUtils.randomUuid().toString().replace("-", ""); return order + "-" + unique + "." + AZURE_TEST_DOMAIN; } } diff --git a/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsAsyncClientTests.java b/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsAsyncClientTests.java index dc472774da6f..6fe6e520b73d 100644 --- a/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsAsyncClientTests.java +++ b/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsAsyncClientTests.java @@ -3,33 +3,42 @@ package com.azure.communication.rooms; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - +import com.azure.communication.common.CommunicationIdentifier; +import com.azure.communication.common.CommunicationUserIdentifier; import com.azure.communication.identity.CommunicationIdentityClient; -import com.azure.communication.rooms.models.*; import com.azure.communication.rooms.implementation.models.CommunicationErrorResponseException; +import com.azure.communication.rooms.models.AddOrUpdateParticipantsResult; +import com.azure.communication.rooms.models.CommunicationRoom; +import com.azure.communication.rooms.models.CreateRoomOptions; +import com.azure.communication.rooms.models.ParticipantRole; +import com.azure.communication.rooms.models.RemoveParticipantsResult; +import com.azure.communication.rooms.models.RoomParticipant; +import com.azure.communication.rooms.models.UpdateRoomOptions; import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.Response; import com.azure.core.test.http.AssertingHttpClientBuilder; -import java.util.Arrays; -import java.util.List; - -import com.azure.communication.common.CommunicationIdentifier; -import com.azure.communication.common.CommunicationUserIdentifier; - +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; - import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.util.Arrays; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class RoomsAsyncClientTests extends RoomsTestBase { + private static final ClientLogger LOGGER = new ClientLogger(RoomsAsyncClientTests.class); + private RoomsAsyncClient roomsAsyncClient; private CommunicationIdentityClient communicationClient; private final String nonExistRoomId = "NotExistingRoomID"; @@ -78,7 +87,7 @@ public void createRoomFullCycleWithResponseStep(HttpClient httpClient) { Mono> response3 = roomsAsyncClient.updateRoomWithResponse(roomId, updateOptions); - System.out.println(VALID_FROM.plusMonths(3).getDayOfYear()); + LOGGER.log(LogLevel.VERBOSE, () -> String.valueOf(VALID_FROM.plusMonths(3).getDayOfYear())); StepVerifier.create(response3) .assertNext(roomResult -> { @@ -121,10 +130,10 @@ public void createRoomFullCycleWithOutResponseStep(HttpClient httpClient) { StepVerifier.create(response1) .assertNext(roomResult -> { - assertTrue(roomResult.getRoomId() != null); - assertTrue(roomResult.getCreatedAt() != null); - assertTrue(roomResult.getValidFrom() != null); - assertTrue(roomResult.getValidUntil() != null); + assertNotNull(roomResult.getRoomId()); + assertNotNull(roomResult.getCreatedAt()); + assertNotNull(roomResult.getValidFrom()); + assertNotNull(roomResult.getValidUntil()); assertTrue(roomResult.isPstnDialOutEnabled()); }).verifyComplete(); @@ -139,7 +148,7 @@ public void createRoomFullCycleWithOutResponseStep(HttpClient httpClient) { StepVerifier.create(response3) .assertNext(result3 -> { - assertEquals(true, result3.getValidUntil().toEpochSecond() > result3.getValidFrom().toEpochSecond()); + assertTrue(result3.getValidUntil().toEpochSecond() > result3.getValidFrom().toEpochSecond()); assertTrue(result3.isPstnDialOutEnabled()); }).verifyComplete(); @@ -168,10 +177,10 @@ public void createRoomWithNoAttributes(HttpClient httpClient) { StepVerifier.create(response1) .assertNext(roomResult -> { - assertTrue(roomResult.getRoomId() != null); - assertTrue(roomResult.getCreatedAt() != null); - assertTrue(roomResult.getValidFrom() != null); - assertTrue(roomResult.getValidUntil() != null); + assertNotNull(roomResult.getRoomId()); + assertNotNull(roomResult.getCreatedAt()); + assertNotNull(roomResult.getValidFrom()); + assertNotNull(roomResult.getValidUntil()); assertFalse(roomResult.isPstnDialOutEnabled()); }).verifyComplete(); @@ -210,10 +219,10 @@ public void createRoomWithOnlyParticipantAttributes(HttpClient httpClient) { StepVerifier.create(response1) .assertNext(roomResult -> { - assertTrue(roomResult.getRoomId() != null); - assertTrue(roomResult.getCreatedAt() != null); - assertTrue(roomResult.getValidFrom() != null); - assertTrue(roomResult.getValidUntil() != null); + assertNotNull(roomResult.getRoomId()); + assertNotNull(roomResult.getCreatedAt()); + assertNotNull(roomResult.getValidFrom()); + assertNotNull(roomResult.getValidUntil()); assertTrue(roomResult.isPstnDialOutEnabled()); }).verifyComplete(); @@ -241,10 +250,10 @@ public void createRoomWithOnlyPstnEnabledAttribute(HttpClient httpClient) { StepVerifier.create(response1) .assertNext(roomResult -> { - assertTrue(roomResult.getRoomId() != null); - assertTrue(roomResult.getCreatedAt() != null); - assertTrue(roomResult.getValidFrom() != null); - assertTrue(roomResult.getValidUntil() != null); + assertNotNull(roomResult.getRoomId()); + assertNotNull(roomResult.getCreatedAt()); + assertNotNull(roomResult.getValidFrom()); + assertNotNull(roomResult.getValidUntil()); assertTrue(roomResult.isPstnDialOutEnabled()); }).verifyComplete(); @@ -566,10 +575,10 @@ public void addUpdateAndRemoveParticipantsOperationsWithFullFlow(HttpClient http StepVerifier.create(createCommunicationRoom) .assertNext(roomResult -> { - assertTrue(roomResult.getRoomId() != null); - assertTrue(roomResult.getCreatedAt() != null); - assertTrue(roomResult.getValidFrom() != null); - assertTrue(roomResult.getValidUntil() != null); + assertNotNull(roomResult.getRoomId()); + assertNotNull(roomResult.getCreatedAt()); + assertNotNull(roomResult.getValidFrom()); + assertNotNull(roomResult.getValidUntil()); assertTrue(roomResult.isPstnDialOutEnabled()); }).verifyComplete(); @@ -627,7 +636,7 @@ public void addUpdateAndRemoveParticipantsOperationsWithFullFlow(HttpClient http StepVerifier.create(updateParticipantResponse) .assertNext(result -> { - assertEquals(true, result instanceof AddOrUpdateParticipantsResult); + assertInstanceOf(AddOrUpdateParticipantsResult.class, result); }) .verifyComplete(); @@ -680,7 +689,7 @@ public void addUpdateAndRemoveParticipantsOperationsWithFullFlow(HttpClient http StepVerifier.create(removeParticipantResponse2) .assertNext(result -> { - assertEquals(true, result instanceof RemoveParticipantsResult); + assertInstanceOf(RemoveParticipantsResult.class, result); }) .verifyComplete(); @@ -716,10 +725,10 @@ public void addParticipantsOperationWithOutResponse(HttpClient httpClient) { StepVerifier.create(createCommunicationRoom) .assertNext(roomResult -> { - assertTrue(roomResult.getRoomId() != null); - assertTrue(roomResult.getCreatedAt() != null); - assertTrue(roomResult.getValidFrom() != null); - assertTrue(roomResult.getValidUntil() != null); + assertNotNull(roomResult.getRoomId()); + assertNotNull(roomResult.getCreatedAt()); + assertNotNull(roomResult.getValidFrom()); + assertNotNull(roomResult.getValidUntil()); assertTrue(roomResult.isPstnDialOutEnabled()); }).verifyComplete(); @@ -772,10 +781,10 @@ public void addUpdateInvalidParticipants(HttpClient httpClient) { StepVerifier.create(createCommunicationRoom) .assertNext(roomResult -> { - assertEquals(true, roomResult.getRoomId() != null); - assertEquals(true, roomResult.getCreatedAt() != null); - assertEquals(true, roomResult.getValidFrom() != null); - assertEquals(true, roomResult.getValidUntil() != null); + assertNotNull(roomResult.getRoomId()); + assertNotNull(roomResult.getCreatedAt()); + assertNotNull(roomResult.getValidFrom()); + assertNotNull(roomResult.getValidUntil()); }).verifyComplete(); String roomId = createCommunicationRoom.block().getRoomId(); @@ -822,10 +831,10 @@ public void listRoomTestFirstRoomIsNotNullThenDeleteRoomWithOutResponse(HttpClie StepVerifier.create(createCommunicationRoom) .assertNext(roomResult -> { - assertEquals(true, roomResult.getRoomId() != null); - assertEquals(true, roomResult.getCreatedAt() != null); - assertEquals(true, roomResult.getValidFrom() != null); - assertEquals(true, roomResult.getValidUntil() != null); + assertNotNull(roomResult.getRoomId()); + assertNotNull(roomResult.getCreatedAt()); + assertNotNull(roomResult.getValidFrom()); + assertNotNull(roomResult.getValidUntil()); }).verifyComplete(); String roomId = createCommunicationRoom.block().getRoomId(); @@ -835,10 +844,10 @@ public void listRoomTestFirstRoomIsNotNullThenDeleteRoomWithOutResponse(HttpClie StepVerifier.create(listRoomResponse.take(1)) .assertNext(room -> { - assertEquals(true, room.getRoomId() != null); - assertEquals(true, room.getCreatedAt() != null); - assertEquals(true, room.getValidFrom() != null); - assertEquals(true, room.getValidUntil() != null); + assertNotNull(room.getRoomId()); + assertNotNull(room.getCreatedAt()); + assertNotNull(room.getValidFrom()); + assertNotNull(room.getValidUntil()); }) .expectComplete() .verify(); diff --git a/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsTestBase.java b/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsTestBase.java index c78a43f7207b..d845723cd19b 100644 --- a/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsTestBase.java +++ b/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsTestBase.java @@ -5,10 +5,14 @@ import com.azure.communication.common.implementation.CommunicationConnectionString; import com.azure.communication.identity.CommunicationIdentityClientBuilder; -import com.azure.communication.rooms.models.*; +import com.azure.communication.rooms.models.CommunicationRoom; +import com.azure.communication.rooms.models.RoomParticipant; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; import com.azure.core.test.TestMode; import com.azure.core.test.TestProxyTestBase; import com.azure.core.test.models.BodilessMatcher; @@ -16,18 +20,17 @@ import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; +import reactor.core.publisher.Mono; import java.time.OffsetDateTime; import java.util.Arrays; -import java.util.Locale; -import reactor.core.publisher.Mono; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import static org.junit.jupiter.api.Assertions.*; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class RoomsTestBase extends TestProxyTestBase { - protected static final TestMode TEST_MODE = initializeTestMode(); + private static final ClientLogger LOGGER = new ClientLogger(RoomsTestBase.class); protected static final String CONNECTION_STRING = Configuration.getGlobalConfiguration().get( "COMMUNICATION_CONNECTION_STRING_ROOMS", @@ -112,23 +115,6 @@ protected void configureTestMode(RoomsClientBuilder builder) { } } - private static TestMode initializeTestMode() { - ClientLogger logger = new ClientLogger(RoomsTestBase.class); - String azureTestMode = Configuration.getGlobalConfiguration().get("AZURE_TEST_MODE"); - if (azureTestMode != null) { - System.out.println("azureTestMode: " + azureTestMode); - try { - return TestMode.valueOf(azureTestMode.toUpperCase(Locale.US)); - } catch (IllegalArgumentException var3) { - logger.error("Could not parse '{}' into TestEnum. Using 'Playback' mode.", azureTestMode); - return TestMode.PLAYBACK; - } - } else { - logger.info("Environment variable '{}' has not been set yet. Using 'Playback' mode.", "AZURE_TEST_MODE"); - return TestMode.PLAYBACK; - } - } - protected RoomsClientBuilder addLoggingPolicy(RoomsClientBuilder builder, String testName) { return builder.addPolicy((context, next) -> logHeaders(testName, next)); } @@ -153,8 +139,8 @@ private Mono logHeaders(String testName, HttpPipelineNextPolicy ne final HttpResponse bufferedResponse = httpResponse.buffer(); // Should sanitize printed reponse url - System.out.println("MS-CV header for " + testName + " request " + bufferedResponse.getRequest().getUrl() - + ": " + bufferedResponse.getHeaderValue("MS-CV")); + LOGGER.log(LogLevel.VERBOSE, () -> "MS-CV header for " + testName + " request " + + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV")); return Mono.just(bufferedResponse); }); } diff --git a/sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsTestBase.java b/sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsTestBase.java index fdffac7a5479..bbfcda8cc29f 100644 --- a/sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsTestBase.java +++ b/sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsTestBase.java @@ -15,11 +15,15 @@ import com.azure.core.test.models.TestProxySanitizerType; import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import reactor.core.publisher.Mono; import java.util.Arrays; public class SmsTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(SmsTestBase.class); + protected static final String CONNECTION_STRING = Configuration.getGlobalConfiguration() .get("COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING", "endpoint=https://REDACTED.communication.azure.com/;accesskey=QWNjZXNzS2V5"); @@ -95,8 +99,8 @@ private Mono logHeaders(String testName, HttpPipelineNextPolicy ne final HttpResponse bufferedResponse = httpResponse.buffer(); // Should sanitize printed reponse url - System.out.println("MS-CV header for " + testName + " request " - + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV")); + LOGGER.log(LogLevel.VERBOSE, () -> ("MS-CV header for " + testName + " request " + + bufferedResponse.getRequest().getUrl() + ": " + bufferedResponse.getHeaderValue("MS-CV"))); return Mono.just(bufferedResponse); }); } diff --git a/sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerClientTestBase.java b/sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerClientTestBase.java index c91b8d5c6cf1..d9c220dd946f 100644 --- a/sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerClientTestBase.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerClientTestBase.java @@ -18,6 +18,8 @@ import com.azure.core.test.models.TestProxySanitizer; import com.azure.core.test.models.TestProxySanitizerType; import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.identity.DefaultAzureCredentialBuilder; import com.azure.security.confidentialledger.certificate.ConfidentialLedgerCertificateClient; import com.azure.security.confidentialledger.certificate.ConfidentialLedgerCertificateClientBuilder; @@ -39,6 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; class ConfidentialLedgerClientTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(ConfidentialLedgerClientTestBase.class); protected static final String TRANSACTION_ID = "transactionId"; protected static final String COLLECTION_ID = "collectionId"; @@ -82,7 +85,7 @@ protected void beforeTest() { try { jsonNode = mapper.readTree(identityResponse.toBytes()); } catch (IOException ex) { - System.out.println("Caught IO exception " + ex); + LOGGER.log(LogLevel.VERBOSE, () -> "Caught IO exception", ex); Assertions.fail(); } @@ -104,7 +107,7 @@ protected void beforeTest() { reactorClient = reactor.netty.http.client.HttpClient.create() .secure(sslContextSpec -> sslContextSpec.sslContext(sslContext)); } catch (SSLException ex) { - System.out.println("Caught SSL exception " + ex); + LOGGER.log(LogLevel.VERBOSE, () -> "Caught SSL exception", ex); Assertions.fail(); } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/TestUtils.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/TestUtils.java index d844c0558d86..839f886a4b87 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/TestUtils.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/TestUtils.java @@ -125,7 +125,6 @@ static TokenCredential getCredentialByAuthority(TestMode testMode, String author static void importImage(TestMode mode, String repository, List tags) { try { importImage(mode, REGISTRY_NAME, repository, tags, REGISTRY_ENDPOINT); - Thread.sleep(SLEEP_TIME_IN_MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } @@ -190,6 +189,8 @@ static void importImage(TestMode mode, String registryName, String repository, L Thread.sleep(SLEEP_TIME_IN_MILLISECONDS); } } while (++index < 3); + + Thread.sleep(SLEEP_TIME_IN_MILLISECONDS); } private static OciImageManifest createManifest() { diff --git a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/implementation/JdkHttpUtils.java b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/implementation/JdkHttpUtils.java index 85ae06b2f5a3..bc9a29d746c2 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/implementation/JdkHttpUtils.java +++ b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/implementation/JdkHttpUtils.java @@ -3,6 +3,7 @@ package com.azure.core.http.jdk.httpclient.implementation; import com.azure.core.http.HttpHeaders; +import com.azure.core.implementation.util.HttpHeadersAccessHelper; import com.azure.core.util.CoreUtils; import java.nio.ByteBuffer; @@ -25,13 +26,14 @@ public final class JdkHttpUtils { * @param headers the JDK Http headers * @return the azure-core Http headers */ - @SuppressWarnings("deprecation") public static HttpHeaders fromJdkHttpHeaders(java.net.http.HttpHeaders headers) { final HttpHeaders httpHeaders = new HttpHeaders((int) (headers.map().size() / 0.75F)); for (Map.Entry> kvp : headers.map().entrySet()) { if (!CoreUtils.isNullOrEmpty(kvp.getValue())) { - httpHeaders.set(kvp.getKey(), kvp.getValue()); + // JDK HttpClient parses headers to lower case, use the access helper to bypass lowercasing the header + // name (or in this case, just checking that the header name is lowercased). + HttpHeadersAccessHelper.setInternal(httpHeaders, kvp.getKey(), kvp.getKey(), kvp.getValue()); } } diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/NettyAsyncHttpResponseBase.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/NettyAsyncHttpResponseBase.java index 5346aeb2948a..6621a80eea46 100644 --- a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/NettyAsyncHttpResponseBase.java +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/NettyAsyncHttpResponseBase.java @@ -7,10 +7,13 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; +import com.azure.core.implementation.util.HttpHeadersAccessHelper; +import io.netty.util.AsciiString; import reactor.netty.http.client.HttpClientResponse; import java.util.Iterator; import java.util.Map; +import java.util.Objects; /** * Base response class for Reactor Netty with implementations for response metadata. @@ -40,8 +43,19 @@ public abstract class NettyAsyncHttpResponseBase extends HttpResponse { while (nettyHeadersIterator.hasNext()) { Map.Entry next = nettyHeadersIterator.next(); // Value may be null and that needs to be guarded but key should never be null. - CharSequence value = next.getValue(); - this.headers.add(next.getKey().toString(), (value == null) ? null : value.toString()); + String value = Objects.toString(next.getValue(), null); + CharSequence key = next.getKey(); + + // Check for the header name being a Netty AsciiString as it has optimizations around lowercasing. + if (key instanceof AsciiString) { + // Hook into optimizations exposed through shared implementation to speed up the conversion. + AsciiString asciiString = (AsciiString) key; + HttpHeadersAccessHelper.addInternal(headers, asciiString.toLowerCase().toString(), + asciiString.toString(), value); + } else { + // If it isn't an AsciiString, then fallback to the shared, albeit, slower path. + this.headers.add(key.toString(), value); + } } } else { this.headers = new NettyToAzureCoreHttpHeadersWrapper(nettyHeaders); diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/Utility.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/Utility.java index 33a18a4fe343..670e41710e34 100644 --- a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/Utility.java +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/Utility.java @@ -51,10 +51,9 @@ public final class Utility { * @return A newly allocated {@link ByteBuffer} containing the copied bytes. */ public static ByteBuffer deepCopyBuffer(ByteBuf byteBuf) { - ByteBuffer buffer = ByteBuffer.allocate(byteBuf.readableBytes()); - byteBuf.readBytes(buffer); - buffer.rewind(); - return buffer; + byte[] bytes = new byte[byteBuf.readableBytes()]; + byteBuf.getBytes(byteBuf.readerIndex(), bytes); + return ByteBuffer.wrap(bytes); } /** diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/polling/LROPollerTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/polling/LROPollerTests.java index d20086bf9d0c..031ed96e6cd0 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/polling/LROPollerTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/polling/LROPollerTests.java @@ -22,6 +22,8 @@ import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; @@ -61,6 +63,7 @@ @SuppressWarnings("unchecked") public class LROPollerTests { + private static final ClientLogger LOGGER = new ClientLogger(LROPollerTests.class); private static final SerializerAdapter SERIALIZER = SerializerFactory.createDefaultManagementSerializerAdapter(); @@ -678,8 +681,12 @@ public void lroRetryAfter() { long nanoTime = System.nanoTime(); - FooWithProvisioningState result = lroFlux.doOnNext(response -> System.out.printf("[%s] status %s%n", - OffsetDateTime.now(), response.getStatus().toString())).blockLast().getFinalResult().block(); + FooWithProvisioningState result = lroFlux + .doOnNext(response -> LOGGER.log(LogLevel.VERBOSE, + () -> String.format("[%s] status %s%n", OffsetDateTime.now(), response.getStatus()))) + .blockLast() + .getFinalResult() + .block(); Assertions.assertNotNull(result); Duration pollingDuration = Duration.ofNanos(System.nanoTime() - nanoTime); @@ -879,7 +886,8 @@ public com.github.tomakehurst.wiremock.http.Response transform(Request request, .build(); } if (request.getMethod().isOneOf(RequestMethod.PUT)) { - System.out.printf("[%s] PUT status %s%n", OffsetDateTime.now(), "IN_PROGRESS"); + LOGGER.log(LogLevel.VERBOSE, + () -> String.format("[%s] PUT status %s%n", OffsetDateTime.now(), "IN_PROGRESS")); return new com.github.tomakehurst.wiremock.http.Response.Builder() .headers(serverConfigure.additionalHeaders) .body(toJson(new FooWithProvisioningState("IN_PROGRESS"))) @@ -888,13 +896,15 @@ public com.github.tomakehurst.wiremock.http.Response transform(Request request, if (request.getMethod().isOneOf(RequestMethod.GET)) { getCallCount[0]++; if (getCallCount[0] < serverConfigure.pollingCountTillSuccess) { - System.out.printf("[%s] GET status %s%n", OffsetDateTime.now(), "IN_PROGRESS"); + LOGGER.log(LogLevel.VERBOSE, + () -> String.format("[%s] GET status %s%n", OffsetDateTime.now(), "IN_PROGRESS")); return new com.github.tomakehurst.wiremock.http.Response.Builder() .headers(serverConfigure.additionalHeaders) .body(toJson(new FooWithProvisioningState("IN_PROGRESS"))) .build(); } else if (getCallCount[0] == serverConfigure.pollingCountTillSuccess) { - System.out.printf("[%s] GET status %s%n", OffsetDateTime.now(), "SUCCEEDED"); + LOGGER.log(LogLevel.VERBOSE, + () -> String.format("[%s] GET status %s%n", OffsetDateTime.now(), "SUCCEEDED")); return new com.github.tomakehurst.wiremock.http.Response.Builder() .body(toJson(new FooWithProvisioningState("SUCCEEDED", UUID.randomUUID().toString()))) .build(); diff --git a/sdk/core/azure-core/spotbugs-exclude.xml b/sdk/core/azure-core/spotbugs-exclude.xml index 4fd09a2c2551..2ffee6a08a69 100644 --- a/sdk/core/azure-core/spotbugs-exclude.xml +++ b/sdk/core/azure-core/spotbugs-exclude.xml @@ -449,4 +449,10 @@ + + + + + + diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java index b42992287c1a..c52fa19e5cbd 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java @@ -33,7 +33,22 @@ public class HttpHeaders implements Iterable { private final Map headers; static { - HttpHeadersAccessHelper.setAccessor(headers -> headers.headers); + HttpHeadersAccessHelper.setAccessor(new HttpHeadersAccessHelper.HttpHeadersAccessor() { + @Override + public Map getRawHeaderMap(HttpHeaders headers) { + return headers.headers; + } + + @Override + public void addInternal(HttpHeaders headers, String formattedName, String name, String value) { + headers.addInternal(formattedName, name, value); + } + + @Override + public void setInternal(HttpHeaders headers, String formattedName, String name, List values) { + headers.setInternal(formattedName, name, values); + } + }); } /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/BearerTokenAuthenticationPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/BearerTokenAuthenticationPolicy.java index 615f231971c3..b37eb2c46b7f 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/BearerTokenAuthenticationPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/BearerTokenAuthenticationPolicy.java @@ -123,16 +123,11 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN return authorizeRequest(context).then(Mono.defer(next::process)).flatMap(httpResponse -> { String authHeader = httpResponse.getHeaderValue(HttpHeaderName.WWW_AUTHENTICATE); if (httpResponse.getStatusCode() == 401 && authHeader != null) { - return authorizeRequestOnChallenge(context, httpResponse).flatMap(retry -> { - if (retry) { - // Both Netty and OkHttp expect the requestBody to be closed after the response has been read. - // Failure to do so results in memory leak. - // In case of StreamResponse (or other scenarios where we do not eagerly read the response) - // the response body may not be consumed. - // This can cause potential leaks in the scenarios like above, where the policy - // may intercept the response and it may never be read. - // Forcing the read here - so that the memory can be released. - return httpResponse.getBody().ignoreElements().then(nextPolicy.process()); + return authorizeRequestOnChallenge(context, httpResponse).flatMap(authorized -> { + if (authorized) { + // body needs to be closed or read to the end to release the connection + httpResponse.close(); + return nextPolicy.process(); } else { return Mono.just(httpResponse); } @@ -155,13 +150,8 @@ public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNex String authHeader = httpResponse.getHeaderValue(HttpHeaderName.WWW_AUTHENTICATE); if (httpResponse.getStatusCode() == 401 && authHeader != null) { if (authorizeRequestOnChallengeSync(context, httpResponse)) { - // Both Netty and OkHttp expect the requestBody to be closed after the response has been read. - // Failure to do so results in memory leak. - // In case of StreamResponse (or other scenarios where we do not eagerly read the response) - // the response body may not be consumed. - // This can cause potential leaks in the scenarios like above, where the policy - // may intercept the response and it may never be read. - // Forcing the read here - so that the memory can be released. + // body needs to be closed or read to the end to release the connection + httpResponse.close(); return nextPolicy.processSync(); } else { return httpResponse; diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java index fcc969e5216f..d0758d6b7d5d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java @@ -89,7 +89,6 @@ private Mono attemptRedirect(final HttpPipelineCallContext context return next.clone().process().flatMap(httpResponse -> { if (redirectStrategy.shouldAttemptRedirect(context, httpResponse, redirectAttempt, attemptedRedirectUrls)) { - HttpRequest redirectRequestCopy = createRedirectRequest(httpResponse); return attemptRedirect(context, next, redirectRequestCopy, redirectAttempt + 1, attemptedRedirectUrls); } else { @@ -111,7 +110,6 @@ private HttpResponse attemptRedirectSync(final HttpPipelineCallContext context, HttpResponse httpResponse = next.clone().processSync(); if (redirectStrategy.shouldAttemptRedirect(context, httpResponse, redirectAttempt, attemptedRedirectUrls)) { - HttpRequest redirectRequestCopy = createRedirectRequest(httpResponse); return attemptRedirectSync(context, next, redirectRequestCopy, redirectAttempt + 1, attemptedRedirectUrls); } else { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RestProxy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RestProxy.java index 6e3c8d9a611e..de36dac2045e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RestProxy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RestProxy.java @@ -82,8 +82,6 @@ public Mono send(HttpRequest request, Context contextData) { @Override public Object invoke(Object proxy, final Method method, Object[] args) { - RestProxyUtils.validateResumeOperationIsNotPresent(method); - // Note: request options need to be evaluated here, as it is a public class with package private methods. // Evaluating here allows the package private methods to be invoked here for downstream use. final SwaggerMethodParser methodParser = getMethodParser(method); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/AsyncRestProxy.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/AsyncRestProxy.java index a09db64f1d79..2548bec2a64f 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/AsyncRestProxy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/AsyncRestProxy.java @@ -75,8 +75,6 @@ Mono send(HttpRequest request, Context contextData) { @SuppressWarnings({ "try", "unused" }) public Object invoke(Object proxy, Method method, RequestOptions options, EnumSet errorOptions, Consumer requestCallback, SwaggerMethodParser methodParser, HttpRequest request, Context context) { - RestProxyUtils.validateResumeOperationIsNotPresent(method); - context = startTracingSpan(methodParser, context); // If there is 'RequestOptions' apply its request callback operations before validating the body. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java index af018bfc0d95..67f4ea40662e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java @@ -98,8 +98,6 @@ public RestProxyBase(HttpPipeline httpPipeline, SerializerAdapter serializer, */ public final Object invoke(Object proxy, Method method, RequestOptions options, EnumSet errorOptions, Consumer requestCallback, SwaggerMethodParser methodParser, boolean isAsync, Object[] args) { - RestProxyUtils.validateResumeOperationIsNotPresent(method); - try { HttpRequest request = createHttpRequest(methodParser, serializer, isAsync, args); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/SwaggerMethodParser.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/SwaggerMethodParser.java index 7401e138f985..94f1674f3348 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/SwaggerMethodParser.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/SwaggerMethodParser.java @@ -285,6 +285,8 @@ public SwaggerMethodParser(Method swaggerMethod) { this.responseEagerlyRead = isResponseEagerlyRead(unwrappedReturnType); this.ignoreResponseBody = isResponseBodyIgnored(unwrappedReturnType); this.spanName = interfaceParser.getServiceName() + "." + swaggerMethod.getName(); + + RestProxyUtils.validateResumeOperationIsNotPresent(swaggerMethod); } /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/HttpHeadersAccessHelper.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/HttpHeadersAccessHelper.java index 304f082277fa..bbf6c87e2250 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/HttpHeadersAccessHelper.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/HttpHeadersAccessHelper.java @@ -5,6 +5,8 @@ import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; +import java.util.List; +import java.util.Locale; import java.util.Map; /** @@ -24,6 +26,34 @@ public interface HttpHeadersAccessor { * @return The raw header map. */ Map getRawHeaderMap(HttpHeaders headers); + + /** + * Adds a header value to the backing map in {@link HttpHeaders}. + *

+ * This bypasses using {@link HttpHeaders#add(String, String)} which uses {@link String#toLowerCase(Locale)}, + * which may be slower than options available by implementing HTTP stacks (such as Netty which has an ASCII + * string class which has optimizations around lowercasing due to ASCII constraints). + * + * @param headers The {@link HttpHeaders} to add the header to. + * @param formattedName The lower-cased header name. + * @param name The original header name. + * @param value The header value. + */ + void addInternal(HttpHeaders headers, String formattedName, String name, String value); + + /** + * Sets a header value to the backing map in {@link HttpHeaders}. + *

+ * This bypasses using {@link HttpHeaders#set(String, List)} which uses {@link String#toLowerCase(Locale)}, + * which may be slower than options available by implementing HTTP stacks (such as JDK HttpClient where all + * response header names are already lowercased). + * + * @param headers The {@link HttpHeaders} to set the header to. + * @param formattedName The lower-cased header name. + * @param name The original header name. + * @param values The header values. + */ + void setInternal(HttpHeaders headers, String formattedName, String name, List values); } /** @@ -36,6 +66,38 @@ public static Map getRawHeaderMap(HttpHeaders headers) { return accessor.getRawHeaderMap(headers); } + /** + * Adds a header value to the backing map in {@link HttpHeaders}. + *

+ * This bypasses using {@link HttpHeaders#add(String, String)} which uses {@link String#toLowerCase(Locale)}, + * which may be slower than options available by implementing HTTP stacks (such as Netty which has an ASCII + * string class which has optimizations around lowercasing due to ASCII constraints). + * + * @param headers The {@link HttpHeaders} to add the header to. + * @param formattedName The lower-cased header name. + * @param name The original header name. + * @param value The header value. + */ + public static void addInternal(HttpHeaders headers, String formattedName, String name, String value) { + accessor.addInternal(headers, formattedName, name, value); + } + + /** + * Sets a header value to the backing map in {@link HttpHeaders}. + *

+ * This bypasses using {@link HttpHeaders#set(String, List)} which uses {@link String#toLowerCase(Locale)}, + * which may be slower than options available by implementing HTTP stacks (such as JDK HttpClient where all + * response header names are already lowercased). + * + * @param headers The {@link HttpHeaders} to set the header to. + * @param formattedName The lower-cased header name. + * @param name The original header name. + * @param values The header values. + */ + public static void setInternal(HttpHeaders headers, String formattedName, String name, List values) { + accessor.setInternal(headers, formattedName, name, values); + } + /** * Sets the {@link HttpHeadersAccessor}. * diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/serializer/SerializerEncoding.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/serializer/SerializerEncoding.java index 4d4bf4985d5f..c8207428a790 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/serializer/SerializerEncoding.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/serializer/SerializerEncoding.java @@ -9,9 +9,6 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.logging.LogLevel; -import java.util.Map; -import java.util.TreeMap; - /** * Supported serialization encoding formats. */ @@ -32,20 +29,6 @@ public enum SerializerEncoding { TEXT; private static final ClientLogger LOGGER = new ClientLogger(SerializerEncoding.class); - private static final Map SUPPORTED_MIME_TYPES; - - static { - // Encodings and suffixes from: https://tools.ietf.org/html/rfc6838 - SUPPORTED_MIME_TYPES = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - SUPPORTED_MIME_TYPES.put("text/xml", XML); - SUPPORTED_MIME_TYPES.put("application/xml", XML); - SUPPORTED_MIME_TYPES.put("application/json", JSON); - SUPPORTED_MIME_TYPES.put("text/css", TEXT); - SUPPORTED_MIME_TYPES.put("text/csv", TEXT); - SUPPORTED_MIME_TYPES.put("text/html", TEXT); - SUPPORTED_MIME_TYPES.put("text/javascript", TEXT); - SUPPORTED_MIME_TYPES.put("text/plain", TEXT); - } /** * Determines the serializer encoding to use based on the Content-Type header. @@ -63,7 +46,7 @@ public static SerializerEncoding fromHeaders(HttpHeaders headers) { int contentTypeEnd = mimeContentType.indexOf(';'); String contentType = (contentTypeEnd == -1) ? mimeContentType : mimeContentType.substring(0, contentTypeEnd); - final SerializerEncoding encoding = SUPPORTED_MIME_TYPES.get(contentType); + SerializerEncoding encoding = checkForKnownEncoding(contentType); if (encoding != null) { return encoding; } @@ -97,4 +80,43 @@ public static SerializerEncoding fromHeaders(HttpHeaders headers) { return JSON; } + + /* + * There is a limited set of serialization encodings that are known ahead of time. Instead of using a TreeMap with + * a case-insensitive comparator, use an optimized search specifically for the known encodings. + */ + private static SerializerEncoding checkForKnownEncoding(String contentType) { + int length = contentType.length(); + + // Check the length of the content type first as it is a quick check. + if (length != 8 && length != 9 && length != 10 && length != 15 && length != 16) { + return null; + } + + if ("text/".regionMatches(true, 0, contentType, 0, 5)) { + if (length == 8) { + if ("xml".regionMatches(true, 0, contentType, 5, 3)) { + return XML; + } else if ("csv".regionMatches(true, 0, contentType, 5, 3)) { + return TEXT; + } else if ("css".regionMatches(true, 0, contentType, 5, 3)) { + return TEXT; + } + } else if (length == 9 && "html".regionMatches(true, 0, contentType, 5, 4)) { + return TEXT; + } else if (length == 10 && "plain".regionMatches(true, 0, contentType, 5, 5)) { + return TEXT; + } else if (length == 15 && "javascript".regionMatches(true, 0, contentType, 5, 10)) { + return TEXT; + } + } else if ("application/".regionMatches(true, 0, contentType, 0, 12)) { + if (length == 16 && "json".regionMatches(true, 0, contentType, 12, 4)) { + return JSON; + } else if (length == 15 && "xml".regionMatches(true, 0, contentType, 12, 3)) { + return XML; + } + } + + return null; + } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/PolicyConsumesResponseBodyTest.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/PolicyConsumesResponseBodyTest.java new file mode 100644 index 000000000000..06573971f1f9 --- /dev/null +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/PolicyConsumesResponseBodyTest.java @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.policy; + +import com.azure.core.SyncAsyncExtension; +import com.azure.core.SyncAsyncTest; +import com.azure.core.credential.AccessToken; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.*; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.channels.AsynchronousByteChannel; +import java.nio.channels.WritableByteChannel; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; + +import static com.azure.core.http.HttpHeaderName.*; +import static org.junit.jupiter.api.Assertions.*; + +public class PolicyConsumesResponseBodyTest { + + private static final TokenCredential NOOP_CREDENTIAL + = request -> Mono.just(new AccessToken("token", OffsetDateTime.MAX)); + + @ParameterizedTest + @ValueSource(booleans = { true, false }) + public void testResponseClosureOn401Sync(boolean authorizeOnChallenge) { + AtomicInteger tryCount = new AtomicInteger(0); + + AtomicReference response401 = new AtomicReference<>(); + HttpPipeline pipeline + = new HttpPipelineBuilder().policies(new BearerPolicyImpl(authorizeOnChallenge, NOOP_CREDENTIAL, "scope")) + .httpClient(new TestHttpClient(r -> { + if (tryCount.getAndIncrement() == 0) { + TestHttpResponse r401 = createWithSyncBody(r, 401, 424242); + r401.headers.set(WWW_AUTHENTICATE, "Bearer"); + response401.set(r401); + return r401; + } + return createWithSyncBody(r, 200, 42); + })) + .build(); + + HttpResponse response = pipeline.sendSync(new HttpRequest(HttpMethod.GET, "https://fake"), Context.NONE); + assertEquals(authorizeOnChallenge ? 200 : 401, response.getStatusCode()); + assertEquals(authorizeOnChallenge ? 2 : 1, tryCount.get()); + + if (authorizeOnChallenge) { + assertTrue(response401.get().isConsumedOrClosed()); + } + assertInstanceOf(TestHttpResponse.class, response); + assertFalse(((TestHttpResponse) response).isConsumedOrClosed()); + } + + @ParameterizedTest + @ValueSource(booleans = { true, false }) + public void testResponseClosureOn401Async(boolean authorizeOnChallenge) { + AtomicInteger tryCount = new AtomicInteger(0); + + AtomicReference response401 = new AtomicReference<>(); + HttpPipeline pipeline + = new HttpPipelineBuilder().policies(new BearerPolicyImpl(authorizeOnChallenge, NOOP_CREDENTIAL, "scope")) + .httpClient(new TestHttpClient(r -> { + if (tryCount.getAndIncrement() == 0) { + TestHttpResponse r401 = createWithAsyncBody(r, 401, 424242); + r401.headers.set(WWW_AUTHENTICATE, "Bearer"); + response401.set(r401); + return r401; + } + return createWithAsyncBody(r, 200, 42); + })) + .build(); + + HttpResponse response = pipeline.send(new HttpRequest(HttpMethod.GET, "https://fake")).block(); + assertEquals(authorizeOnChallenge ? 200 : 401, response.getStatusCode()); + assertEquals(authorizeOnChallenge ? 2 : 1, tryCount.get()); + + if (authorizeOnChallenge) { + assertTrue(response401.get().isConsumedOrClosed()); + } + + assertInstanceOf(TestHttpResponse.class, response); + assertFalse(((TestHttpResponse) response).isConsumedOrClosed()); + } + + @SyncAsyncTest + public void testResponseClosureOn401AndException() throws Exception { + AtomicInteger tryCount = new AtomicInteger(0); + + AtomicReference responseException = new AtomicReference<>(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new BearerPolicyImpl(true, NOOP_CREDENTIAL, "scope")) + .httpClient(new TestHttpClient(r -> { + if (tryCount.getAndIncrement() == 0) { + TestHttpResponse r401 + = createWithAsyncBodyAndException(r, 401, 424242, new IOException("Fake exception")); + r401.headers.set(WWW_AUTHENTICATE, "Bearer"); + responseException.set(r401); + return r401; + } + return createWithSyncBody(r, 200, 42); + })) + .build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, "https://fake"); + HttpResponse response = SyncAsyncExtension.execute(() -> pipeline.sendSync(request, Context.NONE), + () -> pipeline.send(request).block()); + + assertEquals(200, response.getStatusCode()); + + assertEquals(2, tryCount.get()); + assertTrue(responseException.get().isConsumedOrClosed()); + assertInstanceOf(TestHttpResponse.class, response); + assertFalse(((TestHttpResponse) response).isConsumedOrClosed()); + } + + @SyncAsyncTest + public void testResponseClosureOn302() throws Exception { + AtomicInteger tryCount = new AtomicInteger(0); + + AtomicReference response302 = new AtomicReference<>(); + HttpPipeline pipeline + = new HttpPipelineBuilder().policies(new RedirectPolicy()).httpClient(new TestHttpClient(r -> { + if (tryCount.getAndIncrement() == 0) { + TestHttpResponse r302 = createWithAsyncBody(r, 302, 424242); + r302.headers.set(LOCATION, "https://fake"); + response302.set(r302); + return r302; + } + return createWithAsyncBody(r, 200, 42); + })).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, "https://fake"); + HttpResponse response = SyncAsyncExtension.execute(() -> pipeline.sendSync(request, Context.NONE), + () -> pipeline.send(request).block()); + + assertEquals(200, response.getStatusCode()); + + assertEquals(2, tryCount.get()); + assertTrue(response302.get().isConsumedOrClosed()); + assertInstanceOf(TestHttpResponse.class, response); + assertFalse(((TestHttpResponse) response).isConsumedOrClosed()); + } + + @SyncAsyncTest + public void testResponseClosureOn302AndException() throws Exception { + AtomicInteger tryCount = new AtomicInteger(0); + + AtomicReference responseException = new AtomicReference<>(); + HttpPipeline pipeline + = new HttpPipelineBuilder().policies(new RedirectPolicy()).httpClient(new TestHttpClient(r -> { + if (tryCount.getAndIncrement() == 0) { + TestHttpResponse rEx + = createWithAsyncBodyAndException(r, 302, 424242, new IOException("Fake exception")); + rEx.headers.set(LOCATION, "https://fake"); + responseException.set(rEx); + return rEx; + } + return createWithSyncBody(r, 200, 42); + })).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, "https://fake"); + HttpResponse response = SyncAsyncExtension.execute(() -> pipeline.sendSync(request, Context.NONE), + () -> pipeline.send(request).block()); + + assertEquals(200, response.getStatusCode()); + + assertEquals(2, tryCount.get()); + assertTrue(responseException.get().isConsumedOrClosed()); + assertInstanceOf(TestHttpResponse.class, response); + assertFalse(((TestHttpResponse) response).isConsumedOrClosed()); + } + + @SyncAsyncTest + public void testResponseClosureOn503() throws Exception { + AtomicInteger tryCount = new AtomicInteger(0); + + AtomicReference response503 = new AtomicReference<>(); + HttpPipeline pipeline + = new HttpPipelineBuilder().policies(new RetryPolicy()).httpClient(new TestHttpClient(r -> { + if (tryCount.getAndIncrement() == 0) { + response503.set(createWithSyncBody(r, 503, 424242)); + return response503.get(); + } + return createWithSyncBody(r, 200, 42); + })).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, "https://fake"); + HttpResponse response = SyncAsyncExtension.execute(() -> pipeline.sendSync(request, Context.NONE), + () -> pipeline.send(request).block()); + + assertEquals(200, response.getStatusCode()); + + assertEquals(2, tryCount.get()); + assertTrue(response503.get().isConsumedOrClosed()); + assertInstanceOf(TestHttpResponse.class, response); + assertFalse(((TestHttpResponse) response).isConsumedOrClosed()); + } + + @SyncAsyncTest + public void testResponseClosureOn503AndException() throws Exception { + AtomicInteger tryCount = new AtomicInteger(0); + + AtomicReference responseException = new AtomicReference<>(); + HttpPipeline pipeline + = new HttpPipelineBuilder().policies(new RetryPolicy()).httpClient(new TestHttpClient(r -> { + if (tryCount.getAndIncrement() == 0) { + TestHttpResponse rEx + = createWithAsyncBodyAndException(r, 503, 424242, new IOException("Fake exception")); + responseException.set(rEx); + return rEx; + } + return createWithSyncBody(r, 200, 42); + })).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, "https://fake"); + HttpResponse response = SyncAsyncExtension.execute(() -> pipeline.sendSync(request, Context.NONE), + () -> pipeline.send(request).block()); + + assertEquals(200, response.getStatusCode()); + + assertEquals(2, tryCount.get()); + assertTrue(responseException.get().isConsumedOrClosed()); + assertInstanceOf(TestHttpResponse.class, response); + assertFalse(((TestHttpResponse) response).isConsumedOrClosed()); + } + + private TestHttpResponse createWithSyncBody(HttpRequest request, int statusCode, int contentLength) { + HttpHeaders headers = new HttpHeaders().set(CONTENT_LENGTH, Integer.toString(contentLength)); + return new TestHttpResponse(request, statusCode, headers, new ByteArrayInputStream(new byte[contentLength])); + } + + private TestHttpResponse createWithAsyncBody(HttpRequest request, int statusCode, int contentLength) { + HttpHeaders headers = new HttpHeaders().set(CONTENT_LENGTH, Integer.toString(contentLength)); + return new TestHttpResponse(request, statusCode, headers, Flux.create(s -> { + for (int remaining = contentLength; remaining > 0; remaining -= 10) { + byte[] bytes = new byte[Math.min(10, remaining)]; + s.next(ByteBuffer.wrap(bytes)); + } + s.complete(); + })); + } + + private TestHttpResponse createWithAsyncBodyAndException(HttpRequest request, int statusCode, int contentLength, + Exception exception) { + HttpHeaders headers = new HttpHeaders().set(CONTENT_LENGTH, Integer.toString(contentLength)); + return new TestHttpResponse(request, statusCode, headers, Flux.create(s -> { + byte[] bytes = new byte[Math.min(10, contentLength)]; + s.next(ByteBuffer.wrap(bytes)); + s.error(exception); + })); + } + + private class BearerPolicyImpl extends BearerTokenAuthenticationPolicy { + private final boolean authorize; + + BearerPolicyImpl(boolean authorize, TokenCredential credential, String... scopes) { + super(credential, scopes); + this.authorize = authorize; + } + + @Override + public boolean authorizeRequestOnChallengeSync(HttpPipelineCallContext context, HttpResponse response) { + return authorize; + } + + @Override + public Mono authorizeRequestOnChallenge(HttpPipelineCallContext context, HttpResponse response) { + return Mono.just(authorize); + } + } + + private static class TestHttpClient implements HttpClient { + private final Function responseProvider; + + TestHttpClient(Function responseProvider) { + this.responseProvider = responseProvider; + } + + @Override + public Mono send(HttpRequest request) { + return Mono.just(responseProvider.apply(request)); + } + + @Override + public HttpResponse sendSync(HttpRequest request, Context context) { + return responseProvider.apply(request); + } + } + + public class TestHttpResponse extends HttpResponse { + + private final int statusCode; + + private final HttpHeaders headers; + + private final Flux bodyFlux; + private final ByteArrayInputStream bodyStream; + private boolean closed = false; + private boolean consumed = false; + + public TestHttpResponse(HttpRequest request, int statusCode, HttpHeaders headers, Flux body) { + super(request); + this.statusCode = statusCode; + this.headers = headers; + this.bodyFlux = body.doFinally(__ -> consumed = true); + this.bodyStream = null; + } + + public TestHttpResponse(HttpRequest request, int statusCode, HttpHeaders headers, ByteArrayInputStream body) { + super(request); + this.statusCode = statusCode; + this.headers = headers; + this.bodyStream = body; + this.bodyFlux = null; + } + + public boolean isConsumedOrClosed() { + return closed || (bodyStream != null ? bodyStream.available() == 0 : consumed); + } + + @Override + public int getStatusCode() { + return statusCode; + } + + @Override + @Deprecated + public String getHeaderValue(String name) { + return headers.getValue(name); + } + + @Override + public String getHeaderValue(HttpHeaderName headerName) { + return headers.getValue(headerName); + } + + @Override + public HttpHeaders getHeaders() { + return this.headers; + } + + @Override + public Mono getBodyAsByteArray() { + if (bodyStream != null) { + return Mono.just(BinaryData.fromStream(bodyStream).toBytes()); + } else { + return FluxUtil.collectBytesInByteBufferStream(bodyFlux); + } + } + + @Override + public Flux getBody() { + if (bodyStream != null) { + return FluxUtil.toFluxByteBuffer(bodyStream); + } else { + return bodyFlux; + } + } + + @Override + public Mono getBodyAsString() { + return getBodyAsString(StandardCharsets.UTF_8); + } + + @Override + public Mono getBodyAsString(Charset charset) { + return getBodyAsByteArray().map(bytes -> new String(bytes, charset)); + } + + @Override + public BinaryData getBodyAsBinaryData() { + if (bodyStream != null) { + return BinaryData.fromStream(bodyStream); + } else { + return BinaryData.fromFlux(bodyFlux).block(); + } + } + + @Override + public Mono getBodyAsInputStream() { + if (bodyStream != null) { + return Mono.just(bodyStream); + } else { + return getBodyAsByteArray().map(ByteArrayInputStream::new); + } + } + + @Override + public HttpResponse buffer() { + return new MockHttpResponse(getRequest(), getStatusCode(), getHeaders(), getBodyAsBinaryData().toBytes()); + } + + @Override + public Mono writeBodyToAsync(AsynchronousByteChannel channel) { + return FluxUtil.writeToAsynchronousByteChannel(getBody(), channel); + } + + @Override + public void writeBodyTo(WritableByteChannel channel) throws IOException { + FluxUtil.writeToWritableByteChannel(getBody(), channel).block(); + } + + @Override + public void close() { + this.closed = true; + if (bodyStream != null) { + try { + bodyStream.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + } +} diff --git a/sdk/cosmos/azure-cosmos-kafka-connect/pom.xml b/sdk/cosmos/azure-cosmos-kafka-connect/pom.xml index ae5e2dfef8f8..627124a3d33d 100644 --- a/sdk/cosmos/azure-cosmos-kafka-connect/pom.xml +++ b/sdk/cosmos/azure-cosmos-kafka-connect/pom.xml @@ -101,7 +101,7 @@ Licensed under the MIT License. com.azure azure-cosmos-test - 1.0.0-beta.7 + 1.0.0-beta.8 test diff --git a/sdk/cosmos/azure-cosmos-test/CHANGELOG.md b/sdk/cosmos/azure-cosmos-test/CHANGELOG.md index bb5bbe06a853..42e76a6c34c0 100644 --- a/sdk/cosmos/azure-cosmos-test/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-test/CHANGELOG.md @@ -1,5 +1,14 @@ ## Release History +### 1.0.0-beta.8 (Unreleased) + +#### Features Added + +#### Breaking Changes + +#### Bugs Fixed +* Fixed an issue where `FaultInjectionRule` can not apply on partition level when using `Gateway` Mode and non-session consistency - See [40005](https://github.com/Azure/azure-sdk-for-java/pull/40005) + ### 1.0.0-beta.7 (2024-05-03) #### Bugs Fixed diff --git a/sdk/cosmos/azure-cosmos-test/pom.xml b/sdk/cosmos/azure-cosmos-test/pom.xml index cb2d32eb7ac6..7e5429c2cf40 100644 --- a/sdk/cosmos/azure-cosmos-test/pom.xml +++ b/sdk/cosmos/azure-cosmos-test/pom.xml @@ -13,7 +13,7 @@ Licensed under the MIT License. com.azure azure-cosmos-test - 1.0.0-beta.7 + 1.0.0-beta.8 Microsoft Azure Java Cosmos Test Library This package contains core fault injection types for Azure Java Cosmos client. jar diff --git a/sdk/cosmos/azure-cosmos-tests/pom.xml b/sdk/cosmos/azure-cosmos-tests/pom.xml index b55fefbf13ea..cecbe9dc1fd9 100644 --- a/sdk/cosmos/azure-cosmos-tests/pom.xml +++ b/sdk/cosmos/azure-cosmos-tests/pom.xml @@ -104,7 +104,7 @@ Licensed under the MIT License. com.azure azure-cosmos-test - 1.0.0-beta.7 + 1.0.0-beta.8 commons-io diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 28c11dc76f12..686ee7b6b8e2 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -4,6 +4,8 @@ #### Features Added +* Added support for non-streaming OrderBy query and a query feature `NonStreamingOrderBy` to support Vector Search queries. - See [PR 39897](https://github.com/Azure/azure-sdk-for-java/pull/39897/) + #### Breaking Changes #### Bugs Fixed diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java index da368de5360d..c643379b2fe6 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java @@ -166,6 +166,13 @@ public class Configs { public static final String MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED = "COSMOS.MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED"; private static final int DEFAULT_MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED = 1; + private static final String MAX_ITEM_SIZE_FOR_VECTOR_SEARCH = "COSMOS.MAX_ITEM_SIZE_FOR_VECTOR_SEARCH"; + private static final int DEFAULT_MAX_ITEM_SIZE_FOR_VECTOR_SEARCH = 50000; + + private static final String MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED = "COSMOS.MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED"; + + private static final boolean DEFAULT_MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED = true; + public static final int MIN_MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED = 1; public static final String TCP_CONNECTION_ACQUISITION_TIMEOUT_IN_MS = "COSMOS.TCP_CONNECTION_ACQUISITION_TIMEOUT_IN_MS"; @@ -484,6 +491,14 @@ public static int getMaxRetriesInLocalRegionWhenRemoteRegionPreferred() { MIN_MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED); } + public static int getMaxItemSizeForVectorSearch() { + return getJVMConfigAsInt(MAX_ITEM_SIZE_FOR_VECTOR_SEARCH, DEFAULT_MAX_ITEM_SIZE_FOR_VECTOR_SEARCH); + } + + public static boolean getMaxItemSizeForVectorSearchEnabled() { + return getJVMConfigAsBoolean(MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED, DEFAULT_MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED); + } + public static Duration getMinRetryTimeInLocalRegionWhenRemoteRegionPreferred() { return Duration.ofMillis(Math.max( diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java index 4dc62089acc5..c70ded3a906f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java @@ -25,6 +25,7 @@ public final class CosmosQueryRequestOptionsImpl extends CosmosQueryRequestOptio private boolean queryPlanRetrievalDisallowed; private boolean emptyPageDiagnosticsEnabled; private String queryName; + private Integer maxItemSizeForVectorSearch; private List cancelledRequestDiagnosticsTracker = new ArrayList<>(); /** @@ -62,6 +63,7 @@ public CosmosQueryRequestOptionsImpl(CosmosQueryRequestOptionsImpl options) { this.queryName = options.queryName; this.feedRange = options.feedRange; this.cancelledRequestDiagnosticsTracker = options.cancelledRequestDiagnosticsTracker; + this.maxItemSizeForVectorSearch = options.maxItemSizeForVectorSearch; } /** @@ -196,6 +198,26 @@ public CosmosQueryRequestOptionsImpl setMaxItemCount(Integer maxItemCount) { return this; } + /** + * Gets the maximum item size to fetch during non-streaming order by queries. + * + * @return the max number of items for vector search. + */ + public Integer getMaxItemSizeForVectorSearch() { + return maxItemSizeForVectorSearch; + } + + /** + * Sets the maximum item size to fetch during non-streaming order by queries. + * + * @param maxItemSizeForVectorSearch the max number of items for vector search. + * return the CosmosQueryRequestOptions. + */ + public CosmosQueryRequestOptionsImpl setMaxItemSizeForVectorSearch(Integer maxItemSizeForVectorSearch) { + this.maxItemSizeForVectorSearch = maxItemSizeForVectorSearch; + return this; + } + /** * Gets the request continuation token. * diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java index a13cfc65348d..7a530816856b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java @@ -4,9 +4,11 @@ import com.azure.cosmos.BridgeInternal; import com.azure.cosmos.implementation.BadRequestException; +import com.azure.cosmos.implementation.Configs; import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.DiagnosticsClientContext; import com.azure.cosmos.implementation.DocumentCollection; +import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.PartitionKeyRange; @@ -239,7 +241,8 @@ private static boolean canCacheQuery(QueryInfo queryInfo) { && !queryInfo.hasTop() && !queryInfo.hasOffset() && !queryInfo.hasDCount() - && !queryInfo.hasOrderBy(); + && !queryInfo.hasOrderBy() + && !queryInfo.hasNonStreamingOrderBy(); } private static boolean isScopedToSinglePartition(CosmosQueryRequestOptions cosmosQueryRequestOptions) { @@ -358,6 +361,37 @@ public static Flux> createSpecia boolean getLazyFeedResponse = queryInfo.hasTop(); + // We need to compute the optimal initial age size for non-streaming order-by queries + if (queryInfo.hasNonStreamingOrderBy() && Configs.getMaxItemSizeForVectorSearchEnabled()) { + // Validate the TOP or LIMIT for non-streaming order-by queries + if (!queryInfo.hasTop() && !queryInfo.hasLimit() && queryInfo.getTop() < 0 && queryInfo.getLimit() < 0) { + throw new NonStreamingOrderByBadRequestException(HttpConstants.StatusCodes.BADREQUEST, + "Executing a vector search query without TOP or LIMIT can consume a large number of RUs" + + "very fast and have long runtimes. Please ensure you are using one of the above two filters" + + "with you vector search query."); + } + // Validate the size of TOP or LIMIT against MaxItemSizeForVectorSearch + int maxLimit = Math.max(queryInfo.hasTop() ? queryInfo.getTop() : 0, + queryInfo.hasLimit() ? queryInfo.getLimit() : 0); + int maxItemSizeForVectorSearch = Math.max(Configs.getMaxItemSizeForVectorSearch(), + ModelBridgeInternal.getMaxItemSizeForVectorSearchFromQueryRequestOptions(cosmosQueryRequestOptions)); + if (maxLimit > maxItemSizeForVectorSearch) { + throw new NonStreamingOrderByBadRequestException(HttpConstants.StatusCodes.BADREQUEST, + "Executing a vector search query with TOP or LIMIT larger than the maxItemSizeForVectorSearch " + + "is not allowed"); + } + // Set initialPageSize based on the smallest of TOP or LIMIT + if (queryInfo.hasTop() || queryInfo.hasLimit()) { + int pageSizeWithTopOrLimit = Math.min(queryInfo.hasTop() ? queryInfo.getTop() : Integer.MAX_VALUE, + queryInfo.hasLimit() ? queryInfo.getLimit() : Integer.MAX_VALUE); + if (initialPageSize > 0) { + initialPageSize = Math.min(pageSizeWithTopOrLimit, initialPageSize); + } else { + initialPageSize = pageSizeWithTopOrLimit; + } + } + } + // We need to compute the optimal initial page size for order-by queries if (queryInfo.hasOrderBy()) { int top; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByBadRequestException.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByBadRequestException.java new file mode 100644 index 000000000000..4b3b41fbc675 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByBadRequestException.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.cosmos.implementation.query; + +import com.azure.cosmos.CosmosException; + +public class NonStreamingOrderByBadRequestException extends CosmosException { + + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance of the NonStreamingOrderByBadRequestException class. + * + * @param statusCode the http status code of the response. + * @param errorMessage the error message. + */ + public NonStreamingOrderByBadRequestException(int statusCode, String errorMessage) { + super(statusCode, errorMessage); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentProducer.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentProducer.java new file mode 100644 index 000000000000..c64ef5d1fbda --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentProducer.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.implementation.query; + +import com.azure.cosmos.implementation.Document; +import com.azure.cosmos.implementation.DocumentClientRetryPolicy; +import com.azure.cosmos.implementation.RxDocumentServiceRequest; +import com.azure.cosmos.implementation.feedranges.FeedRangeEpkImpl; +import com.azure.cosmos.implementation.query.orderbyquery.OrderbyRowComparer; +import com.azure.cosmos.models.CosmosQueryRequestOptions; +import com.azure.cosmos.models.FeedResponse; +import reactor.core.publisher.Mono; + +import java.util.UUID; +import java.util.function.Function; +import java.util.function.Supplier; + +public class NonStreamingOrderByDocumentProducer extends DocumentProducer { + private final OrderbyRowComparer consumeComparer; + + NonStreamingOrderByDocumentProducer( + OrderbyRowComparer consumeComparer, + IDocumentQueryClient client, + String collectionResourceId, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + TriFunction createRequestFunc, + Function>> executeRequestFunc, + FeedRangeEpkImpl feedRange, + String collectionLink, + Supplier createRetryPolicyFunc, + Class resourceType, + UUID correlatedActivityId, + int initialPageSize, + String initialContinuationToken, + int top, + Supplier operationContextTextProvider) { + super(client, collectionResourceId, cosmosQueryRequestOptions, createRequestFunc, executeRequestFunc, + collectionLink, createRetryPolicyFunc, resourceType, correlatedActivityId, initialPageSize, + initialContinuationToken, top, feedRange, operationContextTextProvider); + this.consumeComparer = consumeComparer; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java new file mode 100644 index 000000000000..89a8a3065443 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.implementation.query; + +import com.azure.cosmos.BridgeInternal; +import com.azure.cosmos.CosmosException; +import com.azure.cosmos.implementation.ClientSideRequestStatistics; +import com.azure.cosmos.implementation.DiagnosticsClientContext; +import com.azure.cosmos.implementation.Document; +import com.azure.cosmos.implementation.DocumentClientRetryPolicy; +import com.azure.cosmos.implementation.DocumentCollection; +import com.azure.cosmos.implementation.HttpConstants; +import com.azure.cosmos.implementation.ImplementationBridgeHelpers; +import com.azure.cosmos.implementation.QueryMetrics; +import com.azure.cosmos.implementation.RequestChargeTracker; +import com.azure.cosmos.implementation.ResourceType; +import com.azure.cosmos.implementation.RxDocumentServiceRequest; +import com.azure.cosmos.implementation.Utils; +import com.azure.cosmos.implementation.feedranges.FeedRangeEpkImpl; +import com.azure.cosmos.implementation.query.orderbyquery.OrderByRowResult; +import com.azure.cosmos.implementation.query.orderbyquery.OrderbyRowComparer; +import com.azure.cosmos.models.CosmosQueryRequestOptions; +import com.azure.cosmos.models.FeedResponse; +import com.azure.cosmos.models.ModelBridgeInternal; +import com.azure.cosmos.models.SqlQuerySpec; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +public class NonStreamingOrderByDocumentQueryExecutionContext + extends ParallelDocumentQueryExecutionContextBase { + + private final static + ImplementationBridgeHelpers.CosmosDiagnosticsHelper.CosmosDiagnosticsAccessor diagnosticsAccessor = + ImplementationBridgeHelpers.CosmosDiagnosticsHelper.getCosmosDiagnosticsAccessor(); + + private static final ImplementationBridgeHelpers.FeedResponseHelper.FeedResponseAccessor feedResponseAccessor = + ImplementationBridgeHelpers.FeedResponseHelper.getFeedResponseAccessor(); + + private final static String FormatPlaceHolder = "{documentdb-formattableorderbyquery-filter}"; + private final static String True = "true"; + + private final OrderbyRowComparer consumeComparer; + private final RequestChargeTracker tracker; + private final ConcurrentMap queryMetricMap; + private final Collection clientSideRequestStatistics; + private Flux> orderByObservable; + + private int maxPageSizePerPartition; + + public NonStreamingOrderByDocumentQueryExecutionContext( + DiagnosticsClientContext diagnosticsClientContext, + IDocumentQueryClient client, + ResourceType resourceTypeEnum, + SqlQuerySpec query, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + String resourceLink, + String rewrittenQuery, + OrderbyRowComparer consumeComparer, + UUID correlatedActivityId, + boolean hasSelectValue, + final AtomicBoolean isQueryCancelledOnTimeout) { + super(diagnosticsClientContext, client, resourceTypeEnum, Document.class, query, cosmosQueryRequestOptions, + resourceLink, rewrittenQuery, correlatedActivityId, hasSelectValue, isQueryCancelledOnTimeout); + this.consumeComparer = consumeComparer; + this.tracker = new RequestChargeTracker(); + this.queryMetricMap = new ConcurrentHashMap<>(); + this.clientSideRequestStatistics = ConcurrentHashMap.newKeySet(); + } + + public static Flux> createAsync( + DiagnosticsClientContext diagnosticsClientContext, + IDocumentQueryClient client, + PipelinedDocumentQueryParams initParams, + DocumentCollection collection) { + + QueryInfo queryInfo = initParams.getQueryInfo(); + + NonStreamingOrderByDocumentQueryExecutionContext context = new NonStreamingOrderByDocumentQueryExecutionContext( + diagnosticsClientContext, + client, + initParams.getResourceTypeEnum(), + initParams.getQuery(), + initParams.getCosmosQueryRequestOptions(), + initParams.getResourceLink(), + initParams.getQueryInfo().getRewrittenQuery(), + new OrderbyRowComparer<>(queryInfo.getOrderBy()), + initParams.getCorrelatedActivityId(), + queryInfo.hasSelectValue(), + initParams.isQueryCancelledOnTimeout()); + + context.setTop(initParams.getTop()); + + try { + context.initialize( + initParams.getFeedRanges(), + initParams.getQueryInfo().getOrderBy(), + initParams.getQueryInfo().getOrderByExpressions(), + initParams.getInitialPageSize(), + collection); + + return Flux.just(context); + } catch (CosmosException dce) { + return Flux.error(dce); + } + } + + private void initialize( + List feedRanges, List sortOrders, + Collection orderByExpressions, + int initialPageSize, + DocumentCollection collection) throws CosmosException { + // Since the continuation token will always be null, + // we don't need to handle any initialization based on continuationToken. + // We can directly initialize without any consideration for continuationToken. + super.initialize(collection, + feedRanges.stream().collect(Collectors.toMap( + feedRangeEpk -> feedRangeEpk, + feedRangeEpk -> null)), + initialPageSize, + new SqlQuerySpec(querySpec.getQueryText().replace(FormatPlaceHolder, True), + querySpec.getParameters())); + + orderByObservable = NonStreamingOrderByUtils.nonStreamingOrderedMerge( + consumeComparer, + tracker, + documentProducers, + initialPageSize, + queryMetricMap, + clientSideRequestStatistics); + } + + @Override + protected NonStreamingOrderByDocumentProducer createDocumentProducer( + String collectionRid, + String continuationToken, + int initialPageSize, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + SqlQuerySpec querySpecForInit, + Map commonRequestHeaders, + TriFunction createRequestFunc, + Function>> executeFunc, + Supplier createRetryPolicyFunc, + FeedRangeEpkImpl feedRange) { + return new NonStreamingOrderByDocumentProducer( + consumeComparer, + client, + collectionRid, + cosmosQueryRequestOptions, + createRequestFunc, + executeFunc, + feedRange, + collectionRid, + createRetryPolicyFunc, + Document.class, + correlatedActivityId, + maxPageSizePerPartition, + continuationToken, + top, + this.getOperationContextTextProvider()); + } + + @Override + public Flux> drainAsync(int maxPageSize) { + return this.orderByObservable.transformDeferred(new ItemToPageTransformer(tracker, + maxPageSize, + this.queryMetricMap, + this.clientSideRequestStatistics)); + } + + @Override + public Flux> executeAsync() { + return drainAsync(ModelBridgeInternal.getMaxItemCountFromQueryRequestOptions(cosmosQueryRequestOptions)); + } + + private static class ItemToPageTransformer implements + Function>, Flux>> { + private final static int DEFAULT_PAGE_SIZE = 100; + private final RequestChargeTracker tracker; + private final int maxPageSize; + private final ConcurrentMap queryMetricMap; + private final Collection clientSideRequestStatistics; + + public ItemToPageTransformer(RequestChargeTracker tracker, + int maxPageSize, + ConcurrentMap queryMetricsMap, + Collection clientSideRequestStatistics) { + this.tracker = tracker; + this.maxPageSize = maxPageSize > 0 ? maxPageSize : DEFAULT_PAGE_SIZE; + this.queryMetricMap = queryMetricsMap; + this.clientSideRequestStatistics = clientSideRequestStatistics; + } + + private static Map headerResponse(double requestCharge) { + return Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, String.valueOf(requestCharge)); + } + + @Override + public Flux> apply(Flux> source) { + return source + .window(maxPageSize).map(Flux::collectList) + .flatMap(resultListObs -> resultListObs, 1) + .map(orderByRowResults -> { + // construct a page from result with request charge + FeedResponse> feedResponse = feedResponseAccessor.createFeedResponse( + orderByRowResults, + headerResponse(tracker.getAndResetCharge()), + null); + if (!queryMetricMap.isEmpty()) { + for (Map.Entry entry : queryMetricMap.entrySet()) { + BridgeInternal.putQueryMetricsIntoMap(feedResponse, + entry.getKey(), + entry.getValue()); + } + } + return feedResponse; + }) + .concatWith(Flux.defer(() -> { + return Flux.just(feedResponseAccessor.createFeedResponse(Utils.immutableListOf(), + null, null)); + })) + .map(feedOfOrderByRowResults -> { + List unwrappedResults = new ArrayList<>(); + for (OrderByRowResult orderByRowResult : feedOfOrderByRowResults.getResults()) { + unwrappedResults.add(orderByRowResult.getPayload()); + } + FeedResponse feedResponse = BridgeInternal.createFeedResponseWithQueryMetrics(unwrappedResults, + feedOfOrderByRowResults.getResponseHeaders(), + BridgeInternal.queryMetricsFromFeedResponse(feedOfOrderByRowResults), + ModelBridgeInternal.getQueryPlanDiagnosticsContext(feedOfOrderByRowResults), + false, + false, feedOfOrderByRowResults.getCosmosDiagnostics()); + diagnosticsAccessor.addClientSideDiagnosticsToFeed( + feedResponse.getCosmosDiagnostics(), clientSideRequestStatistics); + return feedResponse; + }).switchIfEmpty(Flux.defer(() -> { + // create an empty page if there is no result + FeedResponse frp = BridgeInternal.createFeedResponseWithQueryMetrics(Utils.immutableListOf(), + headerResponse( + tracker.getAndResetCharge()), + queryMetricMap, + null, + false, + false, + null); + diagnosticsAccessor.addClientSideDiagnosticsToFeed( + frp.getCosmosDiagnostics(), clientSideRequestStatistics); + return Flux.just(frp); + })); + } + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java new file mode 100644 index 000000000000..1b4191e26413 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.cosmos.implementation.query; + +import com.azure.cosmos.BridgeInternal; +import com.azure.cosmos.implementation.ClientSideRequestStatistics; +import com.azure.cosmos.implementation.Configs; +import com.azure.cosmos.implementation.Document; +import com.azure.cosmos.implementation.ImplementationBridgeHelpers; +import com.azure.cosmos.implementation.QueryMetrics; +import com.azure.cosmos.implementation.RequestChargeTracker; +import com.azure.cosmos.implementation.Resource; +import com.azure.cosmos.implementation.query.orderbyquery.OrderByRowResult; +import com.azure.cosmos.implementation.query.orderbyquery.OrderbyRowComparer; +import reactor.core.publisher.Flux; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.concurrent.PriorityBlockingQueue; +import java.util.function.Function; + +public class NonStreamingOrderByUtils { + private final static + ImplementationBridgeHelpers.CosmosDiagnosticsHelper.CosmosDiagnosticsAccessor diagnosticsAccessor = + ImplementationBridgeHelpers.CosmosDiagnosticsHelper.getCosmosDiagnosticsAccessor(); + + public static Flux> nonStreamingOrderedMerge(OrderbyRowComparer consumeComparer, + RequestChargeTracker tracker, + List> documentProducers, + int initialPageSize, + Map queryMetricsMap, + Collection clientSideRequestStatistics) { + @SuppressWarnings("unchecked") + Flux>[] fluxes = documentProducers + .subList(0, documentProducers.size()) + .stream() + .map(producer -> + toNonStreamingOrderByQueryResultObservable(producer, tracker, queryMetricsMap, initialPageSize, + consumeComparer, clientSideRequestStatistics)) + .toArray(Flux[]::new); + return Flux.mergeComparingDelayError(1,consumeComparer, fluxes); + } + + private static Flux> toNonStreamingOrderByQueryResultObservable(DocumentProducer producer, + RequestChargeTracker tracker, + Map queryMetricsMap, + int initialPageSize, + OrderbyRowComparer consumeComparer, + Collection clientSideRequestStatisticsList) { + return producer + .produceAsync() + .transformDeferred(new NonStreamingOrderByUtils.PageToItemTransformer(tracker, queryMetricsMap, initialPageSize, + consumeComparer, clientSideRequestStatisticsList)); + } + + private static class PageToItemTransformer implements + Function.DocumentProducerFeedResponse>, Flux>> { + private final RequestChargeTracker tracker; + private final Map queryMetricsMap; + private final Integer initialPageSize; + private final OrderbyRowComparer consumeComparer; + private final Collection clientSideRequestStatistics; + + private PageToItemTransformer(RequestChargeTracker tracker, Map queryMetricsMap, + Integer initialPageSize, OrderbyRowComparer consumeComparer, + Collection clientSideRequestStatistics) { + this.tracker = tracker; + this.queryMetricsMap = queryMetricsMap; + this.initialPageSize = initialPageSize; + this.consumeComparer = consumeComparer; + this.clientSideRequestStatistics = clientSideRequestStatistics; + } + + @Override + public Flux> apply(Flux.DocumentProducerFeedResponse> source) { + PriorityBlockingQueue> priorityQueue = new PriorityBlockingQueue<>(initialPageSize, consumeComparer); + + return source.flatMap(documentProducerFeedResponse -> { + clientSideRequestStatistics.addAll( + diagnosticsAccessor.getClientSideRequestStatisticsForQueryPipelineAggregations(documentProducerFeedResponse + .pageResult.getCosmosDiagnostics())); + + QueryMetrics.mergeQueryMetricsMap(queryMetricsMap, + BridgeInternal.queryMetricsFromFeedResponse(documentProducerFeedResponse.pageResult)); + List results = documentProducerFeedResponse.pageResult.getResults(); + results.forEach(r -> { + OrderByRowResult orderByRowResult = new OrderByRowResult( + r.toJson(), + documentProducerFeedResponse.sourceFeedRange, + null); + if (Configs.getMaxItemSizeForVectorSearchEnabled()) { + if (priorityQueue.size() < initialPageSize) { + priorityQueue.add(orderByRowResult); + } else { + priorityQueue.add(orderByRowResult); + priorityQueue.poll(); + } + } else { + priorityQueue.add(orderByRowResult); + } + + }); + tracker.addCharge(documentProducerFeedResponse.pageResult.getRequestCharge()); + // Returning an empty Flux since we are only processing and managing state here + return Flux.empty(); + }, 1) + .thenMany(Flux.defer(() -> Flux.fromIterable(priorityQueue))); + } + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java index 020b8633d2be..6ed30d3a7fbe 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java @@ -106,7 +106,8 @@ public static Flux> createAsync( || queryInfo.hasAggregates() || queryInfo.hasGroupBy() || queryInfo.hasDCount() - || queryInfo.hasDistinct()), + || queryInfo.hasDistinct() + || queryInfo.hasNonStreamingOrderBy()), initParams.isQueryCancelledOnTimeout()); context.setTop(initParams.getTop()); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java index 7b6104271762..a6ea9fc2d5f6 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java @@ -15,6 +15,8 @@ import java.util.function.BiFunction; +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + /** * While this class is public, but it is not part of our published public APIs. * This is meant to be internally used only by our sdk. @@ -53,12 +55,17 @@ private static BiFunction, Flux { CosmosQueryRequestOptions orderByCosmosQueryRequestOptions = qryOptAccessor.clone(requestOptions); - ModelBridgeInternal.setQueryRequestOptionsContinuationToken(orderByCosmosQueryRequestOptions, continuationToken); - qryOptAccessor.getImpl(orderByCosmosQueryRequestOptions).setCustomItemSerializer(null); - - documentQueryParams.setCosmosQueryRequestOptions(orderByCosmosQueryRequestOptions); - - return OrderByDocumentQueryExecutionContext.createAsync(diagnosticsClientContext, client, documentQueryParams, collection); + if (queryInfo.hasNonStreamingOrderBy()) { + checkNotNull(continuationToken, "Can not use a continuation token for a vector search query "); + qryOptAccessor.getImpl(orderByCosmosQueryRequestOptions).setCustomItemSerializer(null); + documentQueryParams.setCosmosQueryRequestOptions(orderByCosmosQueryRequestOptions); + return NonStreamingOrderByDocumentQueryExecutionContext.createAsync(diagnosticsClientContext, client, documentQueryParams, collection); + } else { + ModelBridgeInternal.setQueryRequestOptionsContinuationToken(orderByCosmosQueryRequestOptions, continuationToken); + qryOptAccessor.getImpl(orderByCosmosQueryRequestOptions).setCustomItemSerializer(null); + documentQueryParams.setCosmosQueryRequestOptions(orderByCosmosQueryRequestOptions); + return OrderByDocumentQueryExecutionContext.createAsync(diagnosticsClientContext, client, documentQueryParams, collection); + } }; } else { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java index c7f67711fabd..6c3fa2827216 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java @@ -137,7 +137,7 @@ public Flux> executeAsync() { } private static QueryInfo validateQueryInfo(QueryInfo queryInfo) { - if (queryInfo.hasOrderBy() || queryInfo.hasAggregates() || queryInfo.hasGroupBy()) { + if (queryInfo.hasOrderBy() || queryInfo.hasAggregates() || queryInfo.hasGroupBy() || queryInfo.hasNonStreamingOrderBy()) { // Any query with order by, aggregates or group by needs to go through the Document query pipeline throw new IllegalStateException("This query must not use the simple query pipeline."); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContextBase.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContextBase.java index 232f942b8590..39c6c27efad8 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContextBase.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContextBase.java @@ -63,7 +63,8 @@ public static Flux> createAsync( || queryInfo.hasAggregates() || queryInfo.hasGroupBy() || queryInfo.hasDCount() - || queryInfo.hasDistinct()) { + || queryInfo.hasDistinct() + || queryInfo.hasNonStreamingOrderBy()) { return PipelinedDocumentQueryExecutionContext.createAsyncCore( diagnosticsClientContext, diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryFeature.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryFeature.java index ce2b4865767c..1dd3e5928b92 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryFeature.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryFeature.java @@ -14,5 +14,6 @@ public enum QueryFeature { OrderBy, Top, NonValueAggregate, - DCount + DCount, + NonStreamingOrderBy } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryInfo.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryInfo.java index 65efb92c3325..48870a5ae52d 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryInfo.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryInfo.java @@ -36,6 +36,7 @@ public final class QueryInfo extends JsonSerializable { private DistinctQueryType distinctQueryType; private QueryPlanDiagnosticsContext queryPlanDiagnosticsContext; private DCountInfo dCountInfo; + private boolean nonStreamingOrderBy; public QueryInfo() { } @@ -160,6 +161,11 @@ public boolean hasGroupBy() { return groupByExpressions != null && !groupByExpressions.isEmpty(); } + public boolean hasNonStreamingOrderBy() { + this.nonStreamingOrderBy = Boolean.TRUE.equals(super.getBoolean("hasNonStreamingOrderBy")); + return this.nonStreamingOrderBy; + } + public Map getGroupByAliasToAggregateType(){ Map groupByAliasToAggregateMap; groupByAliasToAggregateMap = super.getMap("groupByAliasToAggregateType"); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java index ce91ff2029e9..83f82dbde363 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java @@ -43,7 +43,8 @@ class QueryPlanRetriever { QueryFeature.GroupBy.name() + ", " + QueryFeature.Top.name() + ", " + QueryFeature.DCount.name() + ", " + - QueryFeature.NonValueAggregate.name(); + QueryFeature.NonValueAggregate.name() + ", " + + QueryFeature.NonStreamingOrderBy.name(); static Mono getQueryPlanThroughGatewayAsync(DiagnosticsClientContext diagnosticsClientContext, IDocumentQueryClient queryClient, diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java index c9bf3909fd5d..309fb87a8b22 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java @@ -256,6 +256,15 @@ CosmosQueryRequestOptions setMaxItemCount(Integer maxItemCount) { return this; } + /** + * Gets the maximum item size to fetch during non-streaming order by queries. + * + * @return the max number of items for vector search. + */ + public Integer getMaxItemSizeForVectorSearch() { + return this.actualRequestOptions.getMaxItemSizeForVectorSearch(); + } + /** * Gets the request continuation token. * diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java index 4931c9b3b1b0..e814cc16681b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java @@ -544,6 +544,11 @@ public static Integer getMaxItemCountFromQueryRequestOptions(CosmosQueryRequestO return options.getMaxItemCount(); } + @Warning(value = INTERNAL_USE_ONLY_WARNING) + public static Integer getMaxItemSizeForVectorSearchFromQueryRequestOptions(CosmosQueryRequestOptions options) { + return options.getMaxItemSizeForVectorSearch(); + } + @Warning(value = INTERNAL_USE_ONLY_WARNING) public static String getRequestContinuationFromQueryRequestOptions(CosmosQueryRequestOptions options) { return options.getRequestContinuation(); diff --git a/sdk/digitaltwins/azure-digitaltwins-core/src/test/java/com/azure/digitaltwins/core/DigitalTwinsTestBase.java b/sdk/digitaltwins/azure-digitaltwins-core/src/test/java/com/azure/digitaltwins/core/DigitalTwinsTestBase.java index 3009b8a4fcbf..2cbbb0aad9f6 100644 --- a/sdk/digitaltwins/azure-digitaltwins-core/src/test/java/com/azure/digitaltwins/core/DigitalTwinsTestBase.java +++ b/sdk/digitaltwins/azure-digitaltwins-core/src/test/java/com/azure/digitaltwins/core/DigitalTwinsTestBase.java @@ -10,7 +10,6 @@ import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.test.TestMode; import com.azure.core.test.TestProxyTestBase; import com.azure.core.test.models.CustomMatcher; import com.azure.core.util.Configuration; @@ -141,9 +140,7 @@ static T deserializeJsonString(String rawJsonString, Class clazz) throws } void waitIfLive(int waitTimeInSeconds) throws InterruptedException { - if (this.getTestMode() == TestMode.LIVE || this.getTestMode() == TestMode.RECORD) { - Thread.sleep(waitTimeInSeconds * 1000); - } + sleepIfRunningAgainstService(waitTimeInSeconds * 1000L); } void waitIfLive() throws InterruptedException { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataAggregatorTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataAggregatorTest.java index c50f9d4b94a6..86101a67af93 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataAggregatorTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataAggregatorTest.java @@ -5,6 +5,8 @@ import com.azure.core.amqp.exception.AmqpErrorCondition; import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.EventHubBufferedProducerAsyncClient.BufferedProducerClientOptions; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -29,6 +31,8 @@ import static org.mockito.Mockito.when; public class EventDataAggregatorTest { + private static final ClientLogger LOGGER = new ClientLogger(EventDataAggregatorTest.class); + private static final String NAMESPACE = "test.namespace"; private static final String PARTITION_ID = "test-id"; @@ -175,7 +179,7 @@ public void pushesBatchAfterMaxTime() { case 1: return batch2; default: - System.out.println("Invoked get batch for the xth time:" + current); + LOGGER.log(LogLevel.VERBOSE, () -> "Invoked get batch for the xth time:" + current); return batch3; } }; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubBufferedPartitionProducerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubBufferedPartitionProducerTest.java index 5ea403598f74..f7714375106c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubBufferedPartitionProducerTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubBufferedPartitionProducerTest.java @@ -5,6 +5,8 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.EventHubBufferedProducerAsyncClient.BufferedProducerClientOptions; import com.azure.messaging.eventhubs.models.CreateBatchOptions; import com.azure.messaging.eventhubs.models.SendBatchFailedContext; @@ -49,6 +51,8 @@ */ @Isolated public class EventHubBufferedPartitionProducerTest { + private static final ClientLogger LOGGER = new ClientLogger(EventHubBufferedPartitionProducerTest.class); + private static final String PARTITION_ID = "10"; private static final String NAMESPACE = "test-eventhubs-namespace"; private static final String EVENT_HUB_NAME = "test-hub"; @@ -312,7 +316,7 @@ public void getBufferedEventCounts() throws InterruptedException { final BufferedProducerClientOptions options = new BufferedProducerClientOptions(); options.setMaxWaitTime(Duration.ofSeconds(5)); options.setSendSucceededContext(context -> { - System.out.println("Batch received."); + LOGGER.log(LogLevel.VERBOSE, () -> "Batch received."); holder.onSucceed(context); success.countDown(); }); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubBufferedProducerAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubBufferedProducerAsyncClientIntegrationTest.java index 33de24fb11ff..d117c200ee0d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubBufferedProducerAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubBufferedProducerAsyncClientIntegrationTest.java @@ -4,6 +4,7 @@ package com.azure.messaging.eventhubs; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.models.SendBatchSucceededContext; import com.azure.messaging.eventhubs.models.SendOptions; import org.junit.jupiter.api.Tag; @@ -196,9 +197,9 @@ public void publishWithPartitionKeys() throws InterruptedException { }); return Mono.delay(Duration.ofSeconds(delay)).then(producer.enqueueEvent(eventData, sendOptions) - .doFinally(signal -> { - System.out.printf("\t[%s] %s Published event.%n", expectedPartitionId, formatter.format(Instant.now())); - })); + .doFinally(signal -> logger.log(LogLevel.VERBOSE, + () -> String.format("\t[%s] %s Published event.%n", expectedPartitionId, + formatter.format(Instant.now()))))); }).collect(Collectors.toList()); // Waiting for at least maxWaitTime because events will get published by then. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java index 8b9bdaa665eb..06a1e658e7e7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java @@ -24,6 +24,7 @@ import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.tracing.SpanKind; import com.azure.core.util.tracing.StartSpanOptions; import com.azure.core.util.tracing.Tracer; @@ -960,9 +961,9 @@ private void assertStartOptions(StartSpanOptions startOpts) { } private void assertPartition(String partitionId, PartitionEvent event) { - System.out.println("Event received: " + event.getPartitionContext().getPartitionId()); + LOGGER.log(LogLevel.VERBOSE, () -> "Event received: " + event.getPartitionContext().getPartitionId()); final Object value = event.getData().getProperties().get(PARTITION_ID_HEADER); - Assertions.assertTrue(value instanceof String); + Assertions.assertInstanceOf(String.class, value); Assertions.assertEquals(partitionId, value); Assertions.assertEquals(partitionId, event.getPartitionContext().getPartitionId()); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientTest.java index 2843c5f92bd9..214592630966 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientTest.java @@ -15,6 +15,8 @@ import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; import com.azure.core.util.IterableStream; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.implementation.ClientConstants; import com.azure.messaging.eventhubs.implementation.EventHubAmqpConnection; import com.azure.messaging.eventhubs.implementation.EventHubConnectionProcessor; @@ -64,6 +66,8 @@ import static org.mockito.Mockito.when; public class EventHubConsumerClientTest { + private static final ClientLogger LOGGER = new ClientLogger(EventHubConsumerClientTest.class); + private static final ClientOptions CLIENT_OPTIONS = new ClientOptions(); private static final String PAYLOAD = "hello"; private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8); @@ -131,10 +135,10 @@ AmqpTransportType.AMQP_WEB_SOCKETS, new AmqpRetryOptions(), ProxyOptions.SYSTEM_ when(connection.createReceiveLink(any(), argThat(name -> name.endsWith(PARTITION_ID)), any(EventPosition.class), any(ReceiveOptions.class), anyString())).thenReturn( Mono.fromCallable(() -> { - System.out.println("Returning first link"); + LOGGER.log(LogLevel.VERBOSE, () -> "Returning first link"); return amqpReceiveLink; }), Mono.fromCallable(() -> { - System.out.println("Returning second link"); + LOGGER.log(LogLevel.VERBOSE, () -> "Returning second link"); return amqpReceiveLink2; })); @@ -291,11 +295,11 @@ public void receivesMultipleTimes() { final IterableStream receive2 = consumer.receiveFromPartition(PARTITION_ID, secondReceive, EventPosition.earliest()); // Assert - System.out.println("First receive."); + LOGGER.log(LogLevel.VERBOSE, () -> "First receive."); final Map firstActual = receive.stream() .collect(Collectors.toMap(EventHubConsumerClientTest::getPositionId, Function.identity())); - System.out.println("Second receive."); + LOGGER.log(LogLevel.VERBOSE, () -> "Second receive."); final Map secondActual = receive2.stream() .collect(Collectors.toMap(EventHubConsumerClientTest::getPositionId, Function.identity())); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java index bc8d559f26c5..8943cbb8204a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java @@ -5,6 +5,7 @@ import com.azure.core.util.IterableStream; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.models.EventPosition; import com.azure.messaging.eventhubs.models.PartitionEvent; import com.azure.messaging.eventhubs.models.SendOptions; @@ -59,7 +60,7 @@ protected void beforeTest() { for (Map.Entry entry : integrationTestData.entrySet()) { testData = entry.getValue(); - System.out.printf("Getting entry for: %s%n", testData.getPartitionId()); + logger.log(LogLevel.VERBOSE, () -> "Getting entry for: " + testData.getPartitionId()); break; } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientBuilderTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientBuilderTest.java index 6399a399f8e3..467b2a27e703 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientBuilderTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorClientBuilderTest.java @@ -8,6 +8,8 @@ import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; import com.azure.core.util.TracingOptions; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.implementation.ClientConstants; import com.azure.messaging.eventhubs.models.CloseContext; import com.azure.messaging.eventhubs.models.ErrorContext; @@ -35,6 +37,7 @@ * Unit tests for {@link EventProcessorClientBuilder}. */ public class EventProcessorClientBuilderTest { + private static final ClientLogger LOGGER = new ClientLogger(EventProcessorClientBuilderTest.class); private static final String NAMESPACE_NAME = "dummyNamespaceName"; private static final String DEFAULT_DOMAIN_NAME = Configuration.getGlobalConfiguration() @@ -68,13 +71,14 @@ public void testEventProcessorBuilderMissingProperties() { EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() .checkpointStore(new SampleCheckpointStore()) .processEvent(eventContext -> { - System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + LOGGER.log(LogLevel.VERBOSE, () -> "Partition id = " + + eventContext.getPartitionContext().getPartitionId() + " and sequence number of event = " + + eventContext.getEventData().getSequenceNumber()); }) .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition %s, %s%n", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error occurred in partition processor for partition %s, %s%n", + errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable())); }) .buildEventProcessorClient(); }); @@ -86,13 +90,14 @@ public void testEventProcessorBuilderWithProcessEvent() { .connectionString(CORRECT_CONNECTION_STRING) .consumerGroup("consumer-group") .processEvent(eventContext -> { - System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + LOGGER.log(LogLevel.VERBOSE, () -> "Partition id = " + + eventContext.getPartitionContext().getPartitionId() + " and sequence number of event = " + + eventContext.getEventData().getSequenceNumber()); }) .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition %s, %s%n", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error occurred in partition processor for partition %s, %s%n", + errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable())); }) .checkpointStore(new SampleCheckpointStore()) .buildEventProcessorClient(); @@ -107,21 +112,21 @@ public void testEventProcessorBuilderWithBothSingleAndBatchConsumers() { .checkpointStore(new SampleCheckpointStore()) .consumerGroup("consumer-group") .processEvent(eventContext -> { - System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); + LOGGER.log(LogLevel.VERBOSE, () -> ("Partition id = " + + eventContext.getPartitionContext().getPartitionId() + " and sequence number of event = " + + eventContext.getEventData().getSequenceNumber())); }) .processEventBatch(eventBatchContext -> { eventBatchContext.getEvents().forEach(event -> { - System.out - .println( - "Partition id = " + eventBatchContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + event.getSequenceNumber()); + LOGGER.log(LogLevel.VERBOSE, () -> "Partition id = " + + eventBatchContext.getPartitionContext().getPartitionId() + + " and sequence number of event = " + event.getSequenceNumber()); }); }, 5, Duration.ofSeconds(1)) .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition %s, %s%n", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error occurred in partition processor for partition %s, %s%n", + errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable())); }) .buildEventProcessorClient(); }); @@ -134,9 +139,9 @@ public void testEventProcessorBuilderWithNoProcessEventConsumer() { .checkpointStore(new SampleCheckpointStore()) .consumerGroup("consumer-group") .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition %s, %s%n", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error occurred in partition processor for partition %s, %s%n", + errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable())); }) .buildEventProcessorClient(); }); @@ -149,15 +154,15 @@ public void testEventProcessorBuilderWithProcessEventBatch() { .consumerGroup("consumer-group") .processEventBatch(eventBatchContext -> { eventBatchContext.getEvents().forEach(event -> { - System.out - .println("Partition id = " + eventBatchContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + event.getSequenceNumber()); + LOGGER.log(LogLevel.VERBOSE, () -> ("Partition id = " + + eventBatchContext.getPartitionContext().getPartitionId() + " and sequence number of event = " + + event.getSequenceNumber())); }); }, 5, Duration.ofSeconds(1)) .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition %s, %s%n", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error occurred in partition processor for partition %s, %s%n", + errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable())); }) .checkpointStore(new SampleCheckpointStore()) .buildEventProcessorClient(); @@ -174,15 +179,15 @@ public void initialOffsetProviderSetMoreThanOne() { .consumerGroup("consumer-group") .processEventBatch(eventBatchContext -> { eventBatchContext.getEvents().forEach(event -> { - System.out - .println("Partition id = " + eventBatchContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + event.getSequenceNumber()); + LOGGER.log(LogLevel.VERBOSE, () -> "Partition id = " + + eventBatchContext.getPartitionContext().getPartitionId() + " and sequence number of event = " + + event.getSequenceNumber()); }); }, 5, Duration.ofSeconds(1)) .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition %s, %s%n", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error occurred in partition processor for partition %s, %s%n", + errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable())); }) .checkpointStore(new SampleCheckpointStore()); @@ -215,15 +220,15 @@ public void initialEventPositionProvider() { .consumerGroup("consumer-group") .processEventBatch(eventBatchContext -> { eventBatchContext.getEvents().forEach(event -> { - System.out - .println("Partition id = " + eventBatchContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + event.getSequenceNumber()); + LOGGER.log(LogLevel.VERBOSE, () -> "Partition id = " + + eventBatchContext.getPartitionContext().getPartitionId() + " and sequence number of event = " + + event.getSequenceNumber()); }); }, 5, Duration.ofSeconds(1)) .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition %s, %s%n", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error occurred in partition processor for partition %s, %s%n", + errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable())); }) .checkpointStore(new SampleCheckpointStore()) .initialPartitionEventPosition(eventPositionFunction) @@ -257,15 +262,15 @@ public void initialEventPositionMap() { .consumerGroup("consumer-group") .processEventBatch(eventBatchContext -> { eventBatchContext.getEvents().forEach(event -> { - System.out - .println("Partition id = " + eventBatchContext.getPartitionContext().getPartitionId() + " and " - + "sequence number of event = " + event.getSequenceNumber()); + LOGGER.log(LogLevel.VERBOSE, () -> "Partition id = " + + eventBatchContext.getPartitionContext().getPartitionId() + " and sequence number of event = " + + event.getSequenceNumber()); }); }, 5, Duration.ofSeconds(1)) .processError(errorContext -> { - System.out.printf("Error occurred in partition processor for partition %s, %s%n", - errorContext.getPartitionContext().getPartitionId(), - errorContext.getThrowable()); + LOGGER.log(LogLevel.VERBOSE, () -> String.format( + "Error occurred in partition processor for partition %s, %s%n", + errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable())); }) .checkpointStore(new SampleCheckpointStore()) .initialPartitionEventPosition(eventPositionMap) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java index ed526061a5a0..40acadca38c1 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java @@ -16,6 +16,7 @@ import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.identity.ClientSecretCredential; import com.azure.identity.ClientSecretCredentialBuilder; import com.azure.messaging.eventhubs.models.SendOptions; @@ -59,6 +60,8 @@ * Test base for running integration tests. */ public abstract class IntegrationTestBase extends TestBase { + private static final ClientLogger LOGGER = new ClientLogger(IntegrationTestBase.class); + // The number of partitions we create in test-resources.json. // Partitions 0 and 1 are used for consume-only operations. 2, 3, and 4 are used to publish or consume events. protected static final int NUMBER_OF_PARTITIONS = 5; @@ -193,7 +196,7 @@ static String getConnectionString(boolean withSas) { } return String.format(connectionStringWithSasAndEntityFormat, endpoint, signatureValue, entityPath); } catch (Exception e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Error while getting connection string", e); } } return connectionString; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/LongRunningTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/LongRunningTest.java index 79e8dc03672c..d1b6c899d297 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/LongRunningTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/LongRunningTest.java @@ -4,6 +4,7 @@ package com.azure.messaging.eventhubs; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.models.CreateBatchOptions; import com.azure.messaging.eventhubs.models.EventPosition; import org.junit.jupiter.api.Disabled; @@ -70,17 +71,12 @@ void twoConsumersAndSender() throws InterruptedException { return producer.send(batch).thenReturn(Instant.now()); })) - .subscribe(instant -> { - System.out.println("Sent batch at: " + instant); - }, error -> { - logger.error("Error sending batch: ", error); - }, () -> { - logger.info("Complete."); - })); + .subscribe(instant -> logger.log(LogLevel.VERBOSE, () -> "Sent batch at: " + instant), + error -> logger.error("Error sending batch: ", error), () -> logger.info("Complete."))); - System.out.println("Sleeping while performing work."); + logger.log(LogLevel.VERBOSE, () -> "Sleeping while performing work."); TimeUnit.MINUTES.sleep(duration.toMinutes()); - System.out.println("Complete."); + logger.log(LogLevel.VERBOSE, () -> "Complete."); } @Disabled("Testing idle clients. Connections are timed out at 30 mins.") @@ -90,7 +86,7 @@ void idleConnection() throws InterruptedException { .connectionString(getConnectionString()) .buildAsyncProducerClient()) { for (int i = 0; i < 4; i++) { - System.out.println("Iteration: " + i); + logger.verbose("Iteration: " + i); toClose(idleProducer.createBatch().flatMap(batch -> { IntStream.range(0, 3).mapToObj(number -> new EventData("Number : " + number)) @@ -102,17 +98,12 @@ void idleConnection() throws InterruptedException { }); return idleProducer.send(batch).thenReturn(Instant.now()); - }).subscribe(instant -> { - System.out.println("Sent batch at: " + instant); - }, error -> { - logger.error("Error sending batch: ", error); - }, () -> { - logger.info("Complete."); - })); - - System.out.println("Sleeping 40 mins."); + }).subscribe(instant -> logger.log(LogLevel.VERBOSE, () -> "Sent batch at: " + instant), + error -> logger.error("Error sending batch: ", error), () -> logger.info("Complete."))); + + logger.log(LogLevel.VERBOSE, () -> "Sleeping 40 mins."); TimeUnit.MINUTES.sleep(40); - System.out.println("Complete."); + logger.log(LogLevel.VERBOSE, () -> "Complete."); } } } @@ -125,14 +116,14 @@ void idleSendLinks() throws InterruptedException { .buildAsyncProducerClient()) { for (int i = 0; i < 4; i++) { - System.out.println("Iteration: " + i); + logger.verbose("Iteration: " + i); toClose(idleProducer.getEventHubProperties().subscribe(properties -> { - System.out.printf("[%s]: ids[%s]. Received: %s%n", + logger.log(LogLevel.VERBOSE, () -> String.format("[%s]: ids[%s]. Received: %s%n", properties.getName(), String.join(",", properties.getPartitionIds()), - Instant.now()); - }, error -> System.err.println("Error receiving ids: " + error))); + Instant.now())); + }, error -> logger.log(LogLevel.VERBOSE, () -> "Error receiving ids", error))); toClose(idleProducer.createBatch().flatMap(batch -> { IntStream.range(0, 3).mapToObj(number -> new EventData("Number : " + number)) @@ -144,13 +135,12 @@ void idleSendLinks() throws InterruptedException { }); return idleProducer.send(batch).thenReturn(Instant.now()); - }).subscribe(instant -> { - System.out.println("Sent batch at: " + instant); - }, error -> System.err.println("Error sending batch: " + error))); + }).subscribe(instant -> logger.log(LogLevel.VERBOSE, () -> "Sent batch at: " + instant), + error -> logger.log(LogLevel.VERBOSE, () -> "Error sending batch", error))); - System.out.println("Sleeping 15 mins."); + logger.log(LogLevel.VERBOSE, () -> "Sleeping 15 mins."); TimeUnit.MINUTES.sleep(15); - System.out.println("Completed sleep."); + logger.log(LogLevel.VERBOSE, () -> "Completed sleep."); } } } @@ -173,12 +163,9 @@ void worksAfterReconnection() throws InterruptedException { toClose(Flux.interval(Duration.ofSeconds(1)) .flatMap(position -> client.getPartitionIds().collectList()) .subscribe(partitionIds -> { - System.out.printf("Ids %s: {%s}%n", Instant.now(), String.join(",", partitionIds)); - }, error -> { - logger.error("Error fetching info.", error); - }, () -> { - logger.info("Complete."); - })); + logger.log(LogLevel.VERBOSE, + () -> String.format("Ids %s: {%s}%n", Instant.now(), String.join(",", partitionIds))); + }, error -> logger.error("Error fetching info.", error), () -> logger.info("Complete."))); toClose(Flux.interval(Duration.ofSeconds(5)) .flatMap(position -> producer.createBatch(options).flatMap(batch -> { IntStream.range(0, 3).mapToObj(number -> new EventData("Position" + position + ": " + number)) @@ -191,16 +178,11 @@ void worksAfterReconnection() throws InterruptedException { return producer.send(batch).thenReturn(Instant.now()); })) - .subscribe(instant -> { - System.out.println("---- Sent batch at: " + instant); - }, error -> { - logger.error("---- Error sending batch: ", error); - }, () -> { - logger.info("---- Complete."); - })); + .subscribe(instant -> logger.log(LogLevel.VERBOSE, () -> "---- Sent batch at: " + instant), + error -> logger.error("---- Error sending batch: ", error), () -> logger.info("---- Complete."))); - System.out.println("Sleeping while performing work."); + logger.log(LogLevel.VERBOSE, () -> "Sleeping while performing work."); TimeUnit.MINUTES.sleep(30); - System.out.println("Complete."); + logger.log(LogLevel.VERBOSE, () -> "Complete."); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancerTest.java index 1fa96bf7fdc9..5d277e366132 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancerTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionBasedLoadBalancerTest.java @@ -4,6 +4,7 @@ package com.azure.messaging.eventhubs; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.implementation.PartitionProcessor; import com.azure.messaging.eventhubs.implementation.instrumentation.EventHubsTracer; import com.azure.messaging.eventhubs.models.ErrorContext; @@ -17,7 +18,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInfo; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; @@ -109,8 +109,7 @@ public class PartitionBasedLoadBalancerTest { private final EventProcessorClientOptions processorOptions = new EventProcessorClientOptions(); @BeforeEach - public void setup(TestInfo testInfo) { - System.out.println("Running " + testInfo.getDisplayName()); + public void setup() { toClose = new ArrayList<>(); mockCloseable = MockitoAnnotations.openMocks(this); @@ -142,7 +141,7 @@ public void teardown() throws Exception { try { closeable.close(); } catch (IOException error) { - error.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Error closing resource.", error); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySelectorTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySelectorTest.java index 9562eac39f4e..c43bebc11c50 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySelectorTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySelectorTest.java @@ -6,6 +6,7 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.AmqpTransportType; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.models.EventPosition; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; @@ -27,6 +28,8 @@ @Tag(TestUtils.INTEGRATION) class ProxySelectorTest extends IntegrationTestBase { + private static final ClientLogger LOGGER = new ClientLogger(ProxySelectorTest.class); + private static final int PROXY_PORT = 8899; private static final InetSocketAddress SIMPLE_PROXY_ADDRESS = new InetSocketAddress("localhost", PROXY_PORT); private ProxySelector defaultProxySelector; @@ -73,7 +76,7 @@ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { .expectErrorSatisfies(error -> { // The message can vary because it is returned from proton-j, so we don't want to compare against that. // This is a transient error from ExceptionUtil.java: line 67. - System.out.println("Error: " + error); + LOGGER.log(LogLevel.VERBOSE, () -> "Error", error); }) .verify(TIMEOUT); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessorTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessorTest.java index c731b8bea014..b7acff2826e5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessorTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessorTest.java @@ -10,6 +10,8 @@ import com.azure.core.amqp.exception.AmqpErrorContext; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.implementation.AmqpReceiveLink; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.implementation.instrumentation.EventHubsConsumerInstrumentation; import org.apache.qpid.proton.message.Message; import org.junit.jupiter.api.AfterEach; @@ -49,6 +51,8 @@ import static org.mockito.Mockito.when; class AmqpReceiveLinkProcessorTest { + private static final ClientLogger LOGGER = new ClientLogger(AmqpReceiveLinkProcessorTest.class); + private static final int PREFETCH = 5; private static final EventHubsConsumerInstrumentation DEFAULT_INSTRUMENTATION = new EventHubsConsumerInstrumentation(null, null, "hostname", "hubname", "$Default", false); @@ -190,9 +194,9 @@ void respectsBackpressureLessThanMinimum() { // Act processor.subscribe( - e -> System.out.println("message: " + e), + e -> LOGGER.log(LogLevel.VERBOSE, () -> "message: " + e), Assertions::fail, - () -> System.out.println("Complete."), + () -> LOGGER.log(LogLevel.VERBOSE, () -> "Complete."), s -> s.request(backpressure)); // Assert @@ -554,7 +558,7 @@ void onlyRequestsWhenCreditsLessThanPrefetch() { assertNotNull(integerSupplier); // Invoking this once. Should return a value and notify that there are no credits left on the link. final int messages = integerSupplier.get(); - System.out.println("Messages: " + messages); + LOGGER.log(LogLevel.VERBOSE, () -> "Messages: " + messages); }) .expectNoEvent(Duration.ofSeconds(1)) .thenRequest(nextRequest) diff --git a/sdk/healthinsights/azure-health-insights-radiologyinsights/README.md b/sdk/healthinsights/azure-health-insights-radiologyinsights/README.md index 13782c80c116..bb5249bfbb72 100644 --- a/sdk/healthinsights/azure-health-insights-radiologyinsights/README.md +++ b/sdk/healthinsights/azure-health-insights-radiologyinsights/README.md @@ -121,7 +121,7 @@ private static List createPatientRecords() { // Use LocalDate to set Date patientDetails.setBirthDate(LocalDate.of(1959, 11, 11)); - + patientRecord.setInfo(patientDetails); Encounter encounter = new Encounter("encounterid1"); @@ -151,7 +151,7 @@ private static List createPatientRecords() { patientDocument.setSpecialtyType(SpecialtyType.RADIOLOGY); DocumentAdministrativeMetadata adminMetadata = new DocumentAdministrativeMetadata(); - FhirR4Extendible orderedProcedure = new FhirR4Extendible(); + OrderedProcedure orderedProcedure = new OrderedProcedure(); FhirR4CodeableConcept procedureCode = new FhirR4CodeableConcept(); FhirR4Coding procedureCoding = new FhirR4Coding(); @@ -240,8 +240,8 @@ Display critical result inferences from the example request results. ```java com.azure.health.insights.radiologyinsights.displayresults List patientResults = radiologyInsightsResult.getPatientResults(); for (RadiologyInsightsPatientResult patientResult : patientResults) { - List inferences = patientResult.getInferences(); - for (FhirR4Extendible1 inference : inferences) { + List inferences = patientResult.getInferences(); + for (RadiologyInsightsInference inference : inferences) { if (inference instanceof CriticalResultInference) { CriticalResultInference criticalResultInference = (CriticalResultInference) inference; String description = criticalResultInference.getResult().getDescription(); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java index 176841ed1efa..393a22f5e03f 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java @@ -9,6 +9,8 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.http.AssertingHttpClientBuilder; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.SyncPoller; @@ -68,6 +70,8 @@ import static org.junit.jupiter.api.Assertions.fail; public class CertificateClientTest extends CertificateClientTestBase { + private static final ClientLogger LOGGER = new ClientLogger(CertificateClientTest.class); + private CertificateClient certificateClient; @Override @@ -975,7 +979,7 @@ private void pollOnCertificatePurge(String certificateName) { } } - System.err.printf("Deleted Key %s was not purged \n", certificateName); + LOGGER.log(LogLevel.VERBOSE, () -> "Deleted Certificate " + certificateName + " was not purged"); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java index 3012b65ad5d2..3cb7feb45efa 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java @@ -7,6 +7,8 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; import com.azure.core.test.TestMode; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.PollerFlux; import com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient; @@ -41,6 +43,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class KeyAsyncClientTest extends KeyClientTestBase { + private static final ClientLogger LOGGER = new ClientLogger(KeyAsyncClientTest.class); protected KeyAsyncClient keyAsyncClient; @Override @@ -838,7 +841,7 @@ private void pollOnKeyPurge(String keyName) { } } - System.err.printf("Deleted Key %s was not purged \n", keyName); + LOGGER.log(LogLevel.VERBOSE, () -> "Deleted Key " + keyName + " was not purged"); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java index 10ace970322b..ae77209705b3 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java @@ -7,6 +7,8 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; import com.azure.core.test.TestMode; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.polling.SyncPoller; import com.azure.security.keyvault.keys.cryptography.CryptographyClient; import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; @@ -40,6 +42,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class KeyClientTest extends KeyClientTestBase { + private static final ClientLogger LOGGER = new ClientLogger(KeyClientTest.class); + protected KeyClient keyClient; @Override @@ -751,6 +755,6 @@ private void pollOnKeyPurge(String keyName) { } } - System.err.printf("Deleted Key %s was not purged \n", keyName); + LOGGER.log(LogLevel.VERBOSE, () -> "Deleted Key " + keyName + " was not purged"); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java index 419c079e7854..01e37bb6cdac 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java @@ -4,6 +4,8 @@ package com.azure.security.keyvault.keys.cryptography; import com.azure.core.http.HttpClient; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.security.keyvault.keys.KeyClient; import com.azure.security.keyvault.keys.cryptography.models.EncryptParameters; import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; @@ -40,6 +42,8 @@ import static org.junit.jupiter.api.Assertions.fail; public class CryptographyClientTest extends CryptographyClientTestBase { + private static final ClientLogger LOGGER = new ClientLogger(CryptographyClientTest.class); + private KeyClient client; @Override @@ -349,7 +353,7 @@ public void signDataVerifyEcLocal() { } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException e) { // Could not generate a KeyPair from the given JsonWebKey. // It's likely this happened for key curve secp256k1, which is not supported on Java 16+. - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Failed to generate key pair from JsonWebKey.", e); return; } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java index 91e7ed3f2276..3aecf85da493 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java @@ -15,6 +15,7 @@ import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Configuration; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.identity.ClientSecretCredentialBuilder; import com.azure.security.keyvault.keys.KeyClientBuilder; import com.azure.security.keyvault.keys.KeyServiceVersion; @@ -52,6 +53,8 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals; public abstract class CryptographyClientTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(CryptographyClientTestBase.class); + protected boolean isHsmEnabled = false; protected boolean runManagedHsmTest = false; @@ -338,10 +341,6 @@ public String getEndpoint() { } public void sleep(long millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException e) { - e.printStackTrace(); - } + sleepIfRunningAgainstService(millis); } } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java b/sdk/keyvault/azure-security-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java index 155f022e979a..63fffc5dffbe 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java @@ -7,6 +7,8 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; import com.azure.core.test.http.AssertingHttpClientBuilder; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.PollerFlux; import com.azure.security.keyvault.secrets.implementation.KeyVaultCredentialPolicy; @@ -29,6 +31,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class SecretAsyncClientTest extends SecretClientTestBase { + private static final ClientLogger LOGGER = new ClientLogger(SecretAsyncClientTest.class); + private SecretAsyncClient secretAsyncClient; @Override @@ -574,6 +578,6 @@ private void pollOnSecretPurge(String secretName) { } } - System.err.printf("Deleted Secret %s was not purged \n", secretName); + LOGGER.log(LogLevel.VERBOSE, () -> "Deleted Secret " + secretName + " was not purged"); } } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java b/sdk/keyvault/azure-security-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java index 0e8309f0b9ce..4e43e1a38cb8 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java @@ -7,6 +7,8 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; import com.azure.core.test.http.AssertingHttpClientBuilder; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.polling.SyncPoller; import com.azure.security.keyvault.secrets.implementation.KeyVaultCredentialPolicy; import com.azure.security.keyvault.secrets.implementation.models.KeyVaultErrorException; @@ -27,6 +29,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class SecretClientTest extends SecretClientTestBase { + private static final ClientLogger LOGGER = new ClientLogger(SecretClientTest.class); + private SecretClient secretClient; @Override @@ -494,6 +498,6 @@ private void pollOnSecretPurge(String secretName) { } } - System.err.printf("Deleted Secret %s was not purged \n", secretName); + LOGGER.log(LogLevel.VERBOSE, () -> "Deleted Secret " + secretName + " was not purged"); } } diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index dff6a0b2c37d..3b0edf0a9a2b 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -171,7 +171,7 @@ "type": "string", "defaultValue": "core.windows.net", "metadata": { - "description": "The url suffix to use when accessing the storage data plane." + "description": "The url suffix to use when accessing the storage data plane." } } }, @@ -486,45 +486,11 @@ "azPowerShellVersion": "5.0", "timeout": "PT30M", "arguments": "[format(' -vaultName {0} -certificateName {1} -subjectName {2}', variables('kvName'), parameters('certificateName'), parameters('subjectName'))]", - "scriptContent": " - param( - [string] [Parameter(Mandatory=$true)] $vaultName, - [string] [Parameter(Mandatory=$true)] $certificateName, - [string] [Parameter(Mandatory=$true)] $subjectName - ) - - $ErrorActionPreference = 'Stop' - $DeploymentScriptOutputs = @{} - - $policy = New-AzKeyVaultCertificatePolicy -SubjectName $subjectName -IssuerName Self -ValidityInMonths 12 -Verbose - - Add-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy -Verbose - - $newCert = Get-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName - - $tries = 0 - do { - Write-Host 'Waiting for certificate creation completion...' - Start-Sleep -Seconds 10 - $operation = Get-AzKeyVaultCertificateOperation -VaultName $vaultName -Name $certificateName - $tries++ - - if ($operation.Status -eq 'failed') { - throw 'Creating certificate $certificateName in vault $vaultName failed with error $($operation.ErrorMessage)' + "scriptContent": "param([string] [Parameter(Mandatory=$true)] $vaultName, [string] [Parameter(Mandatory=$true)] $certificateName, [string] [Parameter(Mandatory=$true)] $subjectName)\n\n$ErrorActionPreference = 'Stop'\n$DeploymentScriptOutputs = @{}\n$policy = New-AzKeyVaultCertificatePolicy -SubjectName $subjectName -IssuerName Self -ValidityInMonths 12 -Verbose\n\nAdd-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy -Verbose\n\n$newCert = Get-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName\n$tries = 0\n\ndo {\n Write-Host 'Waiting for certificate creation completion...'\n Start-Sleep -Seconds 10\n $operation = Get-AzKeyVaultCertificateOperation -VaultName $vaultName -Name $certificateName\n $tries++\n\n if ($operation.Status -eq 'failed') {\n throw 'Creating certificate $certificateName in vault $vaultName failed with error $($operation.ErrorMessage)'\n }\n\n if ($tries -gt 120) {\n throw 'Timed out waiting for creation of certificate $certificateName in vault $vaultName'\n }\n} while ($operation.Status -ne 'completed')\n\n$DeploymentScriptOutputs['certThumbprint'] = $newCert.Thumbprint\n$newCert | Out-String\n", + "cleanupPreference": "OnSuccess", + "retentionInterval": "P1D" } - - if ($tries -gt 120) { - throw 'Timed out waiting for creation of certificate $certificateName in vault $vaultName' - } - } while ($operation.Status -ne 'completed') - - $DeploymentScriptOutputs['certThumbprint'] = $newCert.Thumbprint - $newCert | Out-String - ", - "cleanupPreference": "OnSuccess", - "retentionInterval": "P1D" } - } ], "outputs": { "AZURE_KEYVAULT_ENDPOINT": { @@ -565,8 +531,8 @@ "value": "[parameters('testApplicationOid')]" }, "KEYVAULT_STORAGE_ENDPOINT_SUFFIX": { - "type": "string", - "value": "[parameters('storageEndpointSuffix')]" + "type": "string", + "value": "[parameters('storageEndpointSuffix')]" }, "BLOB_STORAGE_ACCOUNT_NAME": { "type": "string", diff --git a/sdk/monitor/azure-monitor-ingestion/src/test/java/com/azure/monitor/ingestion/LogsIngestionTestBase.java b/sdk/monitor/azure-monitor-ingestion/src/test/java/com/azure/monitor/ingestion/LogsIngestionTestBase.java index eda79ce1ec45..fca9777060ae 100644 --- a/sdk/monitor/azure-monitor-ingestion/src/test/java/com/azure/monitor/ingestion/LogsIngestionTestBase.java +++ b/sdk/monitor/azure-monitor-ingestion/src/test/java/com/azure/monitor/ingestion/LogsIngestionTestBase.java @@ -19,6 +19,8 @@ import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.BinaryData; import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.serializer.JsonSerializerProviders; import com.azure.core.util.serializer.TypeReference; import com.azure.identity.DefaultAzureCredentialBuilder; @@ -43,6 +45,8 @@ * Base test class for logs ingestion client tests. */ public abstract class LogsIngestionTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(LogsIngestionTestBase.class); + protected LogsIngestionClientBuilder clientBuilder; protected String dataCollectionEndpoint; protected String dataCollectionRuleId; @@ -210,7 +214,7 @@ private static byte[] unzipRequestBody(BinaryData bodyAsBinaryData) { outputStream.close(); return outputStream.toByteArray(); } catch (IOException exception) { - System.out.println("Failed to unzip data"); + LOGGER.log(LogLevel.VERBOSE, () -> "Failed to unzip data"); } return null; } diff --git a/sdk/monitor/azure-monitor-ingestion/src/test/java/com/azure/monitor/ingestion/implementation/UtilsTest.java b/sdk/monitor/azure-monitor-ingestion/src/test/java/com/azure/monitor/ingestion/implementation/UtilsTest.java index db75340d1d7a..afc99a8bb5ab 100644 --- a/sdk/monitor/azure-monitor-ingestion/src/test/java/com/azure/monitor/ingestion/implementation/UtilsTest.java +++ b/sdk/monitor/azure-monitor-ingestion/src/test/java/com/azure/monitor/ingestion/implementation/UtilsTest.java @@ -5,7 +5,6 @@ import org.junit.jupiter.api.Test; -import java.time.Instant; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -17,7 +16,6 @@ import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -31,13 +29,11 @@ public void shutdownHookTerminatesPool() throws InterruptedException, ExecutionE Stream stream = IntStream.of(100, 4000) .boxed() .parallel() - .map(i -> task(i)); + .map(this::task); Future> tasks = threadPool.submit(() -> stream.collect(Collectors.toList())); - long start = Instant.now().toEpochMilli(); hook.run(); - assertEquals(timeoutSec * 1000, Instant.now().toEpochMilli() - start, 1000); assertTrue(threadPool.isShutdown()); assertTrue(threadPool.isTerminated()); diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java index 42bcfafe9f1a..b69e5f9dd886 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java @@ -45,22 +45,22 @@ public class MetricDataMapper { private static final ClientLogger logger = new ClientLogger(MetricDataMapper.class); + private static final Set OTEL_UNSTABLE_METRICS_TO_EXCLUDE = new HashSet<>(); + private static final String OTEL_INSTRUMENTATION_NAME_PREFIX = "io.opentelemetry"; private static final Set OTEL_PRE_AGGREGATED_STANDARD_METRIC_NAMES = new HashSet<>(4); - private static final List EXCLUDED_METRIC_NAMES = new ArrayList<>(); public static final AttributeKey APPLICATIONINSIGHTS_INTERNAL_METRIC_NAME = AttributeKey.stringKey("applicationinsights.internal.metric_name"); private final BiConsumer telemetryInitializer; private final boolean captureHttpServer4xxAsError; static { - EXCLUDED_METRIC_NAMES.add("http.server.active_requests"); // Servlet - EXCLUDED_METRIC_NAMES.add("http.server.response.size"); - EXCLUDED_METRIC_NAMES.add("http.client.response.size"); + // HTTP unstable metrics to be excluded via Otel auto instrumentation + OTEL_UNSTABLE_METRICS_TO_EXCLUDE.add("rpc.client.duration"); + OTEL_UNSTABLE_METRICS_TO_EXCLUDE.add("rpc.server.duration"); + // Application Insights pre-aggregated standard metrics OTEL_PRE_AGGREGATED_STANDARD_METRIC_NAMES.add("http.server.request.duration"); OTEL_PRE_AGGREGATED_STANDARD_METRIC_NAMES.add("http.client.request.duration"); - OTEL_PRE_AGGREGATED_STANDARD_METRIC_NAMES.add("http.server.duration"); // pre-stable HTTP semconv - OTEL_PRE_AGGREGATED_STANDARD_METRIC_NAMES.add("http.client.duration"); // pre-stable HTTP semconv OTEL_PRE_AGGREGATED_STANDARD_METRIC_NAMES.add("rpc.client.duration"); OTEL_PRE_AGGREGATED_STANDARD_METRIC_NAMES.add("rpc.server.duration"); } @@ -73,10 +73,6 @@ public MetricDataMapper( } public void map(MetricData metricData, Consumer consumer) { - if (EXCLUDED_METRIC_NAMES.contains(metricData.getName())) { - return; - } - MetricDataType type = metricData.getType(); if (type == DOUBLE_SUM || type == DOUBLE_GAUGE @@ -85,11 +81,20 @@ public void map(MetricData metricData, Consumer consumer) { || type == HISTOGRAM) { boolean isPreAggregatedStandardMetric = OTEL_PRE_AGGREGATED_STANDARD_METRIC_NAMES.contains(metricData.getName()); - List telemetryItemList = - convertOtelMetricToAzureMonitorMetric(metricData, isPreAggregatedStandardMetric); - for (TelemetryItem telemetryItem : telemetryItemList) { - consumer.accept(telemetryItem); + if (isPreAggregatedStandardMetric) { + List preAggregatedStandardMetrics = + convertOtelMetricToAzureMonitorMetric(metricData, true); + preAggregatedStandardMetrics.forEach(consumer::accept); + } + + // DO NOT emit unstable metrics from the OpenTelemetry auto instrumentation libraries + // custom metrics are always emitted + if (OTEL_UNSTABLE_METRICS_TO_EXCLUDE.contains(metricData.getName()) + && metricData.getInstrumentationScopeInfo().getName().startsWith(OTEL_INSTRUMENTATION_NAME_PREFIX)) { + return; } + List stableOtelMetrics = convertOtelMetricToAzureMonitorMetric(metricData, false); + stableOtelMetrics.forEach(consumer::accept); } else { logger.warning("metric data type {} is not supported yet.", metricData.getType()); } diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/heartbeat/DefaultHeartBeatPropertyProvider.java b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/heartbeat/DefaultHeartBeatPropertyProvider.java index 2a0c259da7fc..8d3c424251c7 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/heartbeat/DefaultHeartBeatPropertyProvider.java +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/heartbeat/DefaultHeartBeatPropertyProvider.java @@ -23,7 +23,7 @@ public class DefaultHeartBeatPropertyProvider implements HeartBeatPayloadProvide /** * Collection holding default properties for this default provider. */ - private final Set defaultFields; + final Set defaultFields; /** * Random GUID that would help in analysis when app has stopped and restarted. Each restart will diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/test/java/com/azure/monitor/opentelemetry/exporter/implementation/heartbeat/HeartbeatTests.java b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/test/java/com/azure/monitor/opentelemetry/exporter/implementation/heartbeat/HeartbeatTests.java index a08c30811c66..45d3676a11fd 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/test/java/com/azure/monitor/opentelemetry/exporter/implementation/heartbeat/HeartbeatTests.java +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/test/java/com/azure/monitor/opentelemetry/exporter/implementation/heartbeat/HeartbeatTests.java @@ -6,13 +6,8 @@ import com.azure.monitor.opentelemetry.exporter.implementation.models.MetricsData; import com.azure.monitor.opentelemetry.exporter.implementation.models.TelemetryItem; import org.junit.jupiter.api.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.stubbing.Answer; -import java.lang.reflect.Field; import java.util.List; -import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.function.Consumer; @@ -20,9 +15,8 @@ import static org.assertj.core.api.Assertions.assertThat; class HeartbeatTests { - - @Mock - private Consumer> telemetryItemsConsumer; + // Dummy consumer that does nothing. + private final Consumer> telemetryItemsConsumer = ignored -> {}; @Test void heartBeatPayloadContainsDataByDefault() throws InterruptedException { @@ -80,30 +74,24 @@ void heartbeatMetricCountsForAllFailures() { } @Test - void sentHeartbeatContainsExpectedDefaultFields() throws Exception { - HeartbeatExporter mockProvider = Mockito.mock(HeartbeatExporter.class); + void sentHeartbeatContainsExpectedDefaultFields() { ConcurrentMap props = new ConcurrentHashMap<>(); - Mockito.when( - mockProvider.addHeartBeatProperty( - Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean())) - .then( - (Answer) - invocation -> { - props.put( - invocation.getArgument(0, String.class), - invocation.getArgument(1, String.class)); - return true; - }); + + HeartbeatExporter mockProvider = new HeartbeatExporter(60, (b, r) -> { + }, telemetryItemsConsumer) { + @Override + public boolean addHeartBeatProperty(String propertyName, String propertyValue, boolean isHealthy) { + props.put(propertyName, propertyValue); + return true; + } + }; + DefaultHeartBeatPropertyProvider defaultProvider = new DefaultHeartBeatPropertyProvider(); HeartbeatDefaultPayload.populateDefaultPayload(mockProvider).run(); - Field field = defaultProvider.getClass().getDeclaredField("defaultFields"); - field.setAccessible(true); - @SuppressWarnings("unchecked") - Set defaultFields = (Set) field.get(defaultProvider); - for (String fieldName : defaultFields) { + for (String fieldName : defaultProvider.defaultFields) { assertThat(props.containsKey(fieldName)).isTrue(); - assertThat(props.get(fieldName).length() > 0).isTrue(); + assertThat(!props.get(fieldName).isEmpty()).isTrue(); } } @@ -119,15 +107,11 @@ void heartBeatProviderDoesNotAllowDuplicateProperties() { } @Test - void cannotAddUnknownDefaultProperty() throws Exception { + void cannotAddUnknownDefaultProperty() { DefaultHeartBeatPropertyProvider base = new DefaultHeartBeatPropertyProvider(); String testKey = "testKey"; - Field field = base.getClass().getDeclaredField("defaultFields"); - field.setAccessible(true); - @SuppressWarnings("unchecked") - Set defaultFields = (Set) field.get(base); - defaultFields.add(testKey); + base.defaultFields.add(testKey); HeartbeatExporter provider = new HeartbeatExporter(60, (b, r) -> { }, telemetryItemsConsumer); diff --git a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureFunctionsSyncTests.java b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureFunctionsSyncTests.java index 993a2317dab3..d13c415ca607 100644 --- a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureFunctionsSyncTests.java +++ b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureFunctionsSyncTests.java @@ -52,11 +52,7 @@ public void parallelFunctionCallTest(HttpClient httpClient, AssistantsServiceVer // Poll the run do { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); run = client.getRun(assistantThread.getId(), run.getId()); } while (run.getStatus() == RunStatus.QUEUED || run.getStatus() == RunStatus.IN_PROGRESS); diff --git a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRetrievalSyncTest.java b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRetrievalSyncTest.java index 372aef1d8711..e0b8132b6ee1 100644 --- a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRetrievalSyncTest.java +++ b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRetrievalSyncTest.java @@ -58,11 +58,7 @@ public void basicRetrieval(HttpClient httpClient, AssistantsServiceVersion servi ThreadRun run = client.createRun(thread, assistant); do { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); run = client.getRun(thread.getId(), run.getId()); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); diff --git a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRunThreadAsyncTest.java b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRunThreadAsyncTest.java index c303e758c988..0c41110a5607 100644 --- a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRunThreadAsyncTest.java +++ b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRunThreadAsyncTest.java @@ -69,11 +69,7 @@ public void submitMessageAndRun(HttpClient httpClient, AssistantsServiceVersion .verifyComplete(); run = runReference.get(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -136,11 +132,7 @@ public void submitMessageAndRunWithResponse(HttpClient httpClient, AssistantsSer .verifyComplete(); run = runReference.get(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -196,11 +188,7 @@ public void createThreadAndRun(HttpClient httpClient, AssistantsServiceVersion s .verifyComplete(); run = runReference.get(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -261,11 +249,7 @@ public void createThreadAndRunWithResponse(HttpClient httpClient, AssistantsServ .verifyComplete(); run = runReference.get(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -394,11 +378,7 @@ public void listAndGetRunSteps(HttpClient httpClient, AssistantsServiceVersion s runReference.set(threadRun); }) .verifyComplete(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); run = runReference.get(); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); diff --git a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRunThreadSyncTest.java b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRunThreadSyncTest.java index ce08fa777d93..5ea7a4570741 100644 --- a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRunThreadSyncTest.java +++ b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/AzureRunThreadSyncTest.java @@ -50,11 +50,7 @@ public void submitMessageAndRun(HttpClient httpClient, AssistantsServiceVersion // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -94,11 +90,7 @@ public void submitMessageAndRunWithResponse(HttpClient httpClient, AssistantsSer // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -134,11 +126,7 @@ public void createThreadAndRun(HttpClient httpClient, AssistantsServiceVersion s // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -176,11 +164,7 @@ public void createThreadAndRunWithResponse(HttpClient httpClient, AssistantsServ // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -283,11 +267,7 @@ public void listAndGetRunSteps(HttpClient httpClient, AssistantsServiceVersion s // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); diff --git a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/FunctionsSyncTests.java b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/FunctionsSyncTests.java index 50182c461a08..231da68f7344 100644 --- a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/FunctionsSyncTests.java +++ b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/FunctionsSyncTests.java @@ -52,11 +52,7 @@ public void parallelFunctionCallTest(HttpClient httpClient, AssistantsServiceVer // Poll the run do { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); run = client.getRun(assistantThread.getId(), run.getId()); } while (run.getStatus() == RunStatus.QUEUED || run.getStatus() == RunStatus.IN_PROGRESS); diff --git a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RetrievalSyncTest.java b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RetrievalSyncTest.java index e9ad5a5fd64f..3ab9b625ba3e 100644 --- a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RetrievalSyncTest.java +++ b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RetrievalSyncTest.java @@ -56,11 +56,7 @@ public void basicRetrieval(HttpClient httpClient, AssistantsServiceVersion servi ThreadRun run = client.createRun(thread, assistant); do { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); run = client.getRun(thread.getId(), run.getId()); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); diff --git a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RunThreadAsyncTest.java b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RunThreadAsyncTest.java index 035e80e9a8ff..fc56f839db04 100644 --- a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RunThreadAsyncTest.java +++ b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RunThreadAsyncTest.java @@ -69,11 +69,7 @@ public void submitMessageAndRun(HttpClient httpClient, AssistantsServiceVersion .verifyComplete(); run = runReference.get(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -138,11 +134,7 @@ public void submitMessageAndRunWithResponse(HttpClient httpClient, AssistantsSer .verifyComplete(); run = runReference.get(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -198,11 +190,7 @@ public void createThreadAndRun(HttpClient httpClient, AssistantsServiceVersion s .verifyComplete(); run = runReference.get(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -263,11 +251,7 @@ public void createThreadAndRunWithResponse(HttpClient httpClient, AssistantsServ .verifyComplete(); run = runReference.get(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -396,11 +380,7 @@ public void listAndGetRunSteps(HttpClient httpClient, AssistantsServiceVersion s runReference.set(threadRun); }) .verifyComplete(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); run = runReference.get(); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); diff --git a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RunThreadSyncTest.java b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RunThreadSyncTest.java index 294165e1d156..1cf4ddf547b3 100644 --- a/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RunThreadSyncTest.java +++ b/sdk/openai/azure-ai-openai-assistants/src/test/java/com/azure/ai/openai/assistants/RunThreadSyncTest.java @@ -50,11 +50,7 @@ public void submitMessageAndRun(HttpClient httpClient, AssistantsServiceVersion // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -94,11 +90,7 @@ public void submitMessageAndRunWithResponse(HttpClient httpClient, AssistantsSer // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -133,11 +125,7 @@ public void createThreadAndRun(HttpClient httpClient, AssistantsServiceVersion s // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -175,11 +163,7 @@ public void createThreadAndRunWithResponse(HttpClient httpClient, AssistantsServ // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); @@ -281,11 +265,7 @@ public void listAndGetRunSteps(HttpClient httpClient, AssistantsServiceVersion s // Wait on Run and poll the Run in a loop do { run = client.getRun(run.getThreadId(), run.getId()); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + sleepIfRunningAgainstService(500); } while (run.getStatus() == RunStatus.IN_PROGRESS || run.getStatus() == RunStatus.QUEUED); assertSame(RunStatus.COMPLETED, run.getStatus()); diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionCallPreset.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionCallPreset.java index f2ca84984c34..0cb1ab118f36 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionCallPreset.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionCallPreset.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.openai.implementation.models; import com.azure.core.annotation.Generated; @@ -13,6 +12,7 @@ * operation. */ public final class FunctionCallPreset extends ExpandableStringEnum { + /** * Specifies that the model may either use any of the functions provided in this chat completions request or * instead return a standard chat completions response as if no functions were provided. @@ -29,7 +29,7 @@ public final class FunctionCallPreset extends ExpandableStringEnum "Subscription id: " + getSubscriptionId()); + LOGGER.log(LogLevel.VERBOSE, () -> "Resource group: " + getResourceGroup()); + LOGGER.log(LogLevel.VERBOSE, () -> "Workspace: " + getWorkspaceName()); + LOGGER.log(LogLevel.VERBOSE, () -> "Location: " + getLocation()); + LOGGER.log(LogLevel.VERBOSE, () -> "Endpoint: " + getEndpoint()); + LOGGER.log(LogLevel.VERBOSE, () -> "Test mode: " + getTestMode()); QuantumClientBuilder builder = new QuantumClientBuilder(); diff --git a/sdk/resourcemanager/azure-resourcemanager-appplatform/src/test/java/com/azure/resourcemanager/appplatform/AppPlatformTest.java b/sdk/resourcemanager/azure-resourcemanager-appplatform/src/test/java/com/azure/resourcemanager/appplatform/AppPlatformTest.java index e296384651bd..812417c877c2 100644 --- a/sdk/resourcemanager/azure-resourcemanager-appplatform/src/test/java/com/azure/resourcemanager/appplatform/AppPlatformTest.java +++ b/sdk/resourcemanager/azure-resourcemanager-appplatform/src/test/java/com/azure/resourcemanager/appplatform/AppPlatformTest.java @@ -10,6 +10,8 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.appservice.AppServiceManager; import com.azure.resourcemanager.dns.DnsZoneManager; import com.azure.resourcemanager.keyvault.KeyVaultManager; @@ -33,6 +35,8 @@ import java.util.List; public class AppPlatformTest extends ResourceManagerTestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(AppPlatformTest.class); + protected AppPlatformManager appPlatformManager; protected AppServiceManager appServiceManager; protected DnsZoneManager dnsZoneManager; @@ -85,10 +89,10 @@ protected boolean checkRedirect(String url) throws IOException { if (connection.getResponseCode() / 100 == 3) { return true; } - System.out.printf("Do request to %s with response code %d%n", url, connection.getResponseCode()); + LOGGER.verbose("Do request to {} with response code {}", url, connection.getResponseCode()); } } catch (Exception e) { - System.err.printf("Do request to %s with error %s%n", url, e.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> "Do request to " + url + " with error", e); } finally { connection.disconnect(); } @@ -103,13 +107,13 @@ protected boolean requestSuccess(String url) throws Exception { try { connection.connect(); if (connection.getResponseCode() == 200) { - System.out.printf("Request to %s succeeded%n", url); + LOGGER.log(LogLevel.VERBOSE, () -> "Request to " + url + " succeeded"); connection.getInputStream().close(); return true; } - System.out.printf("Do request to %s with response code %d%n", url, connection.getResponseCode()); + LOGGER.verbose("Do request to {} with response code {}", url, connection.getResponseCode()); } catch (Exception e) { - System.err.printf("Do request to %s with error %s%n", url, e.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> "Do request to " + url + " with error", e); } finally { connection.disconnect(); } diff --git a/sdk/resourcemanager/azure-resourcemanager-appservice/src/test/java/com/azure/resourcemanager/appservice/OneDeployTests.java b/sdk/resourcemanager/azure-resourcemanager-appservice/src/test/java/com/azure/resourcemanager/appservice/OneDeployTests.java index 1d86fb736472..066f8aaf5346 100644 --- a/sdk/resourcemanager/azure-resourcemanager-appservice/src/test/java/com/azure/resourcemanager/appservice/OneDeployTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-appservice/src/test/java/com/azure/resourcemanager/appservice/OneDeployTests.java @@ -96,7 +96,7 @@ public void canPushDeployJar() throws Exception { Assertions.assertNotNull(deploymentId); // stream logs - webApp1.streamApplicationLogsAsync().subscribeOn(Schedulers.single()).subscribe(System.out::println); + webApp1.streamApplicationLogsAsync().subscribeOn(Schedulers.single()).subscribe(LOGGER::verbose); waitForRuntimeSuccess(webApp1, deploymentId); diff --git a/sdk/resourcemanager/azure-resourcemanager-authorization/src/test/java/com/azure/resourcemanager/authorization/implementation/RetryTests.java b/sdk/resourcemanager/azure-resourcemanager-authorization/src/test/java/com/azure/resourcemanager/authorization/implementation/RetryTests.java index fdb1ce8debff..3e50a823425b 100644 --- a/sdk/resourcemanager/azure-resourcemanager-authorization/src/test/java/com/azure/resourcemanager/authorization/implementation/RetryTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-authorization/src/test/java/com/azure/resourcemanager/authorization/implementation/RetryTests.java @@ -6,6 +6,8 @@ import com.azure.core.http.HttpResponse; import com.azure.core.management.exception.ManagementError; import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils; import com.azure.resourcemanager.test.utils.TestDelayProvider; import org.junit.jupiter.api.Assertions; @@ -19,6 +21,7 @@ import java.util.concurrent.atomic.AtomicInteger; public class RetryTests { + private static final ClientLogger LOGGER = new ClientLogger(RetryTests.class); @Test public void testRetryForGraph() { @@ -33,9 +36,8 @@ public void testRetryForGraph() { RetryBackoffSpec retry = RetryUtils.backoffRetryFor404ResourceNotFound(); AtomicInteger retryCount = new AtomicInteger(0); - retry = retry.doAfterRetry(ignored -> { - System.out.println("retry " + retryCount.incrementAndGet() + ", at " + OffsetDateTime.now()); - }); + retry = retry.doAfterRetry(ignored -> LOGGER.log(LogLevel.VERBOSE, + () -> "retry " + retryCount.incrementAndGet() + ", at " + OffsetDateTime.now())); // pass without retry Mono monoSuccess = Mono.just("foo"); @@ -106,9 +108,8 @@ public void testRetryForAuthorization() { RetryBackoffSpec retry = RetryUtils.backoffRetryFor400PrincipalNotFound(); AtomicInteger retryCount = new AtomicInteger(0); - retry = retry.doAfterRetry(ignored -> { - System.out.println("retry " + retryCount.incrementAndGet() + ", at " + OffsetDateTime.now()); - }); + retry = retry.doAfterRetry(ignored -> LOGGER.log(LogLevel.VERBOSE, + () -> "retry " + retryCount.incrementAndGet() + ", at " + OffsetDateTime.now())); // 400 with PrincipalNotFound, retry till pass AtomicInteger errorCount = new AtomicInteger(0); diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineImageOperationsTests.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineImageOperationsTests.java index 770a9dbbf94c..c6cead94f558 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineImageOperationsTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineImageOperationsTests.java @@ -4,6 +4,8 @@ package com.azure.resourcemanager.compute; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.compute.models.DataDiskImage; import com.azure.resourcemanager.compute.models.VirtualMachineImage; import com.azure.resourcemanager.compute.models.VirtualMachineOffer; @@ -14,6 +16,8 @@ import org.junit.jupiter.api.Test; public class VirtualMachineImageOperationsTests extends ComputeManagementTest { + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineImageOperationsTests.class); + @Test public void canListVirtualMachineImages() throws Exception { /* @@ -37,7 +41,7 @@ public void canListVirtualMachineImages() throws Exception { for (VirtualMachineOffer offer : canonicalPublisher.offers().list()) { for (VirtualMachineSku sku : offer.skus().list()) { for (VirtualMachineImage image : sku.images().list()) { - System.out.println(image.version()); + LOGGER.log(LogLevel.VERBOSE, image::version); firstVMImage = image; break; } diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineManagedDiskOperationsTests.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineManagedDiskOperationsTests.java index e514f890fea4..d8e3d7ae823a 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineManagedDiskOperationsTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineManagedDiskOperationsTests.java @@ -4,6 +4,8 @@ package com.azure.resourcemanager.compute; import com.azure.core.http.HttpPipeline; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.compute.models.AvailabilitySet; import com.azure.resourcemanager.compute.models.AvailabilitySetSkuTypes; import com.azure.resourcemanager.compute.models.CachingTypes; @@ -28,6 +30,8 @@ import org.junit.jupiter.api.Test; public class VirtualMachineManagedDiskOperationsTests extends ComputeManagementTest { + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineManagedDiskOperationsTests.class); + private String rgName = ""; private Region region = Region.US_EAST; private KnownLinuxVirtualMachineImage linuxImage = KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS; @@ -314,7 +318,7 @@ public void canCreateVirtualMachineFromCustomImageWithManagedDisks() { .withSize(VirtualMachineSizeTypes.fromString("Standard_D4a_v4")) .withOSDiskCaching(CachingTypes.READ_WRITE) .create(); - System.out.println("Waiting for some time before de-provision"); + LOGGER.log(LogLevel.VERBOSE, () -> "Waiting for some time before de-provision"); sleep(60 * 1000); // Wait for some time to ensure vm is publicly accessible deprovisionAgentInLinuxVM(virtualMachine1); diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineOperationsTests.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineOperationsTests.java index f6acacb5f6b4..6dbbc6ab4f03 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineOperationsTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineOperationsTests.java @@ -13,6 +13,8 @@ import com.azure.core.test.annotation.DoNotRecord; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollResponse; import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner; @@ -82,6 +84,8 @@ import java.util.concurrent.atomic.AtomicInteger; public class VirtualMachineOperationsTests extends ComputeManagementTest { + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineOperationsTests.class); + private String rgName = ""; private String rgName2 = ""; private final Region region = Region.US_EAST; @@ -731,7 +735,7 @@ public void canStreamParallelCreatedVirtualMachinesAndRelatedResources() throws createdResource -> { if (createdResource instanceof Resource) { Resource resource = (Resource) createdResource; - System.out.println("Created: " + resource.id()); + LOGGER.log(LogLevel.VERBOSE, () -> "Created: " + resource.id()); if (resource instanceof VirtualMachine) { VirtualMachine virtualMachine = (VirtualMachine) resource; Assertions.assertTrue(virtualMachineNames.contains(virtualMachine.name())); diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineRelatedResourcesDeletionTests.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineRelatedResourcesDeletionTests.java index aaf5daeb295a..0f72c477a604 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineRelatedResourcesDeletionTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/VirtualMachineRelatedResourcesDeletionTests.java @@ -6,6 +6,8 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.exception.ManagementException; import com.azure.core.test.annotation.DoNotRecord; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.compute.models.AvailabilitySet; import com.azure.resourcemanager.compute.models.KnownLinuxVirtualMachineImage; import com.azure.resourcemanager.compute.models.VirtualMachine; @@ -31,6 +33,7 @@ import reactor.core.publisher.Mono; public class VirtualMachineRelatedResourcesDeletionTests extends ComputeManagementTest { + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineRelatedResourcesDeletionTests.class); private String rgName = ""; @@ -166,7 +169,7 @@ public void canDeleteRelatedResourcesFromFailedParallelVMCreations() { createdResource -> { if (createdResource instanceof Resource) { Resource resource = (Resource) createdResource; - System.out.println("Created: " + resource.id()); + LOGGER.log(LogLevel.VERBOSE, () -> "Created: " + resource.id()); if (resource instanceof VirtualMachine) { VirtualMachine virtualMachine = (VirtualMachine) resource; @@ -220,22 +223,23 @@ public void canDeleteRelatedResourcesFromFailedParallelVMCreations() { // Show any errors for (Throwable error : errors) { - System.out.println("\n### ERROR ###\n"); + LOGGER.log(LogLevel.VERBOSE, () -> "\n### ERROR ###\n"); if (error instanceof ManagementException) { ManagementException ce = (ManagementException) error; - System.out.println("CLOUD EXCEPTION: " + ce.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> "CLOUD EXCEPTION: " + ce.getMessage()); } else { - error.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Only expected ManagementExceptions", error); } } - System.out.println("Number of failed/cleaned up VM creations: " + vmNonNicResourceDefinitions.size()); + LOGGER.log(LogLevel.VERBOSE, + () -> "Number of failed/cleaned up VM creations: " + vmNonNicResourceDefinitions.size()); // Verifications final int successfulVMCount = desiredVMCount - vmNonNicResourceDefinitions.size(); final int actualVMCount = TestUtilities.getSize(computeManager.virtualMachines().listByResourceGroup(resourceGroupName)); - System.out.println("Number of actual successful VMs: " + actualVMCount); + LOGGER.log(LogLevel.VERBOSE, () -> "Number of actual successful VMs: " + actualVMCount); Assertions.assertEquals(successfulVMCount, actualVMCount); final int actualNicCount = diff --git a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/java/com/azure/resourcemanager/containerservice/KubernetesClustersTests.java b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/java/com/azure/resourcemanager/containerservice/KubernetesClustersTests.java index f7a3930a4ef3..66b802421cb9 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/java/com/azure/resourcemanager/containerservice/KubernetesClustersTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/java/com/azure/resourcemanager/containerservice/KubernetesClustersTests.java @@ -7,6 +7,8 @@ import com.azure.core.http.policy.AddHeadersFromContextPolicy; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.containerservice.models.AgentPool; import com.azure.resourcemanager.containerservice.models.AgentPoolData; import com.azure.resourcemanager.containerservice.models.AgentPoolMode; @@ -48,6 +50,8 @@ import java.util.stream.Collectors; public class KubernetesClustersTests extends ContainerServiceManagementTest { + private static final ClientLogger LOGGER = new ClientLogger(KubernetesClustersTests.class); + private static final String SSH_KEY = sshPublicKey(); @Test @@ -256,7 +260,8 @@ public void canAutoScaleKubernetesCluster() { .create(); // print config - System.out.println(new String(kubernetesCluster.adminKubeConfigContent(), StandardCharsets.UTF_8)); + LOGGER.log(LogLevel.VERBOSE, + () -> new String(kubernetesCluster.adminKubeConfigContent(), StandardCharsets.UTF_8)); Assertions.assertEquals(Code.RUNNING, kubernetesCluster.powerState().code()); @@ -335,7 +340,8 @@ public void canCreateClusterWithSpotVM() { .create(); // print config - System.out.println(new String(kubernetesCluster.adminKubeConfigContent(), StandardCharsets.UTF_8)); + LOGGER.log(LogLevel.VERBOSE, + () -> new String(kubernetesCluster.adminKubeConfigContent(), StandardCharsets.UTF_8)); KubernetesClusterAgentPool agentPoolProfile = kubernetesCluster.agentPools().get(agentPoolName); Assertions.assertTrue(agentPoolProfile.virtualMachinePriority() == null || agentPoolProfile.virtualMachinePriority() == ScaleSetPriority.REGULAR); diff --git a/sdk/resourcemanager/azure-resourcemanager-monitor/src/test/java/com/azure/resourcemanager/monitor/MonitorActivityAndMetricsTests.java b/sdk/resourcemanager/azure-resourcemanager-monitor/src/test/java/com/azure/resourcemanager/monitor/MonitorActivityAndMetricsTests.java index 83d9d1561a15..dee1fa063b69 100644 --- a/sdk/resourcemanager/azure-resourcemanager-monitor/src/test/java/com/azure/resourcemanager/monitor/MonitorActivityAndMetricsTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-monitor/src/test/java/com/azure/resourcemanager/monitor/MonitorActivityAndMetricsTests.java @@ -9,6 +9,8 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.management.profile.AzureProfile; import com.azure.core.test.annotation.DoNotRecord; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.compute.models.VirtualMachine; import com.azure.resourcemanager.monitor.models.EventData; import com.azure.resourcemanager.monitor.models.EventDataPropertyName; @@ -24,6 +26,8 @@ import java.time.OffsetDateTime; public class MonitorActivityAndMetricsTests extends MonitorManagementTest { + private static final ClientLogger LOGGER = new ClientLogger(MonitorActivityAndMetricsTests.class); + private String rgName = ""; @Override protected void initializeClients(HttpPipeline httpPipeline, AzureProfile profile) { @@ -49,7 +53,7 @@ public void canListEventsAndMetrics() { "10.0.0.0/28"); OffsetDateTime now = OffsetDateTime.now(); - System.out.println("record timestamp: " + now); + LOGGER.log(LogLevel.VERBOSE, () -> "record timestamp: " + now); OffsetDateTime recordDateTime = now.minusDays(40); @@ -143,7 +147,7 @@ public void canListEventsAndMetricsWithWhiteSpaceInResourceId() { SqlElasticPool pool = ensureElasticPoolWithWhiteSpace(region, rgName); OffsetDateTime now = OffsetDateTime.now(); - System.out.println("record timestamp: " + now); + LOGGER.log(LogLevel.VERBOSE, () -> "record timestamp: " + now); OffsetDateTime recordDateTime = now.minusDays(40); diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/DeploymentsTests.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/DeploymentsTests.java index d81b0ab2e248..a4c355636f15 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/DeploymentsTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/DeploymentsTests.java @@ -10,6 +10,8 @@ import com.azure.core.management.exception.ManagementError; import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollResponse; import com.azure.resourcemanager.test.utils.TestUtilities; @@ -38,6 +40,8 @@ import java.util.stream.Collectors; public class DeploymentsTests extends ResourceManagementTest { + private static final ClientLogger LOGGER = new ClientLogger(DeploymentsTests.class); + private ResourceGroups resourceGroups; private ResourceGroup resourceGroup; @@ -446,7 +450,7 @@ public void canDeployVirtualNetworkWithContext() { try { String correlationRequestId = generateRandomUuid(); - System.out.println("x-ms-correlation-request-id: " + correlationRequestId); + LOGGER.log(LogLevel.VERBOSE, () -> "x-ms-correlation-request-id: " + correlationRequestId); Context context = new Context( AddHeadersFromContextPolicy.AZURE_REQUEST_HTTP_HEADERS_KEY, new HttpHeaders().set("x-ms-correlation-request-id", correlationRequestId)); diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/BreadSliceImpl.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/BreadSliceImpl.java index 4ce5407d2550..e2d2e643964b 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/BreadSliceImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/BreadSliceImpl.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager.resources.fluentcore.dag; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.model.Creatable; import com.azure.resourcemanager.resources.fluentcore.model.Executable; import com.azure.resourcemanager.resources.fluentcore.model.implementation.ExecutableImpl; @@ -14,6 +16,8 @@ * Implementation for IBreadSlice. */ public class BreadSliceImpl extends ExecutableImpl implements IBreadSlice { + private static final ClientLogger LOGGER = new ClientLogger(BreadSliceImpl.class); + private final String name; public BreadSliceImpl(String name) { @@ -23,7 +27,7 @@ public BreadSliceImpl(String name) { @Override public Mono executeWorkAsync() { - System.out.println("Bread(" + this.name + ")::executeWorkAsync() [Getting slice from store]"); + LOGGER.log(LogLevel.VERBOSE, () -> "Bread(" + this.name + ")::executeWorkAsync() [Getting slice from store]"); return Mono.just(this) .delayElement(Duration.ofMillis(250)) .map(breadSlice -> breadSlice); diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/DAGErrorTests.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/DAGErrorTests.java index 6d8b11398cb9..4df71ac7a2c5 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/DAGErrorTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/DAGErrorTests.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager.resources.fluentcore.dag; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; @@ -14,6 +16,8 @@ import java.util.TreeSet; public class DAGErrorTests { + private static final ClientLogger LOGGER = new ClientLogger(DAGErrorTests.class); + @Test public void testTerminateOnInProgressTaskCompletion() { // Terminate on error strategy used in this task group is @@ -107,20 +111,19 @@ public void testTerminateOnInProgressTaskCompletion() { .withTerminateOnErrorStrategy(TaskGroupTerminateOnErrorStrategy.TERMINATE_ON_IN_PROGRESS_TASKS_COMPLETION); IPancake rootPancake = pancakeFtg.invokeAsync(context).map(indexable -> { IPancake pancake = (IPancake) indexable; - System.out.println("map.onNext: " + pancake.name()); + LOGGER.log(LogLevel.VERBOSE, () -> "map.onNext: " + pancake.name()); seen.add(pancake.name()); return pancake; - }) - .onErrorResume(throwable -> { - System.out.println("map.onErrorResumeNext: " + throwable); - exceptions.add(throwable); - return Mono.empty(); - }).blockLast(); + }).onErrorResume(throwable -> { + LOGGER.log(LogLevel.VERBOSE, () -> "map.onErrorResumeNext: ", throwable); + exceptions.add(throwable); + return Mono.empty(); + }).blockLast(); expectedToSee.removeAll(seen); Assertions.assertTrue(expectedToSee.isEmpty()); Assertions.assertEquals(exceptions.size(), 1); - Assertions.assertTrue(exceptions.get(0) instanceof RuntimeException); + Assertions.assertInstanceOf(RuntimeException.class, exceptions.get(0)); RuntimeException runtimeException = (RuntimeException) exceptions.get(0); Assertions.assertTrue(runtimeException.getMessage().equalsIgnoreCase("B")); } @@ -227,20 +230,19 @@ public void testTerminateOnHittingLcaTask() { IPasta rootPasta = pastaFtg.invokeAsync(context).map(indexable -> { IPasta pasta = (IPasta) indexable; - System.out.println("map.onNext: " + pasta.name()); + LOGGER.log(LogLevel.VERBOSE, () -> "map.onNext: " + pasta.name()); seen.add(pasta.name()); return pasta; - }) - .onErrorResume(throwable -> { - System.out.println("map.onErrorResumeNext: " + throwable); - exceptions.add(throwable); - return Mono.empty(); - }).blockLast(); + }).onErrorResume(throwable -> { + LOGGER.log(LogLevel.VERBOSE, () -> "map.onErrorResumeNext: ", throwable); + exceptions.add(throwable); + return Mono.empty(); + }).blockLast(); expectedToSee.removeAll(seen); Assertions.assertTrue(expectedToSee.isEmpty()); Assertions.assertEquals(exceptions.size(), 1); - Assertions.assertTrue(exceptions.get(0) instanceof RuntimeException); + Assertions.assertInstanceOf(RuntimeException.class, exceptions.get(0)); RuntimeException runtimeException = (RuntimeException) exceptions.get(0); Assertions.assertTrue(runtimeException.getMessage().equalsIgnoreCase("B")); } @@ -344,11 +346,11 @@ public void testCompositeError() { IPancake rootPancake = pancakeFtg.invokeAsync(context).map(indexable -> { IPancake pancake = (IPancake) indexable; String name = pancake.name(); - System.out.println("map.onNext:" + name); + LOGGER.log(LogLevel.VERBOSE, () -> "map.onNext:" + name); seen.add(name); return pancake; }).onErrorResume(throwable -> { - System.out.println("map.onErrorResumeNext:" + throwable); + LOGGER.log(LogLevel.VERBOSE, () -> "map.onErrorResumeNext:", throwable); exceptions.add(throwable); return Mono.empty(); }).blockLast(); @@ -356,7 +358,7 @@ public void testCompositeError() { expectedToSee.removeAll(seen); Assertions.assertTrue(expectedToSee.isEmpty()); Assertions.assertEquals(exceptions.size(), 1); - Assertions.assertTrue(exceptions.get(0) instanceof RuntimeException); + Assertions.assertInstanceOf(RuntimeException.class, exceptions.get(0)); RuntimeException compositeException = (RuntimeException) exceptions.get(0); Assertions.assertEquals(compositeException.getSuppressed().length, 2); for (Throwable throwable : compositeException.getSuppressed()) { @@ -462,10 +464,10 @@ public void testErrorOnRoot() { IPancake rootPancake = pancakeFtg.invokeAsync(context).map(indexable -> { IPancake pancake = (IPancake) indexable; seen.add(pancake.name()); - System.out.println("map.onNext:" + pancake.name()); + LOGGER.log(LogLevel.VERBOSE, () -> "map.onNext:" + pancake.name()); return pancake; }).onErrorResume(throwable -> { - System.out.println("map.onErrorResumeNext:" + throwable); + LOGGER.log(LogLevel.VERBOSE, () -> "map.onErrorResumeNext:", throwable); exceptions.add(throwable); return Mono.empty(); }).blockLast(); @@ -473,7 +475,7 @@ public void testErrorOnRoot() { expectedToSee.removeAll(seen); Assertions.assertTrue(expectedToSee.isEmpty()); Assertions.assertEquals(exceptions.size(), 1); - Assertions.assertTrue(exceptions.get(0) instanceof RuntimeException); + Assertions.assertInstanceOf(RuntimeException.class, exceptions.get(0)); RuntimeException runtimeException = (RuntimeException) exceptions.get(0); Assertions.assertTrue(runtimeException.getMessage().equalsIgnoreCase("F")); } diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/DAGraphTests.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/DAGraphTests.java index f2a9814a8c92..ba6710befa36 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/DAGraphTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/DAGraphTests.java @@ -15,7 +15,7 @@ public class DAGraphTests { @Test public void testDAGraphGetNext() { - /** + /* * |-------->[D]------>[B]-----------[A] * | ^ ^ * | | | @@ -85,7 +85,7 @@ public void testDAGraphGetNext() { @Test public void testGraphDependency() { - /** + /* * |-------->[D]------>[B]---------->[A] * | ^ ^ * | | | @@ -148,7 +148,7 @@ public void testGraphDeadLockDetection() { boolean dlDetected; // ---------------------------------------------------- - /** + /* * [A] <-----------> [A] */ dlDetected = false; @@ -161,7 +161,7 @@ public void testGraphDeadLockDetection() { Assertions.assertTrue(dlDetected, "Expected exception is not thrown"); // ---------------------------------------------------- - /** + /* * [A] -----------> [B] * ^ ^ * | | @@ -184,7 +184,7 @@ public void testGraphDeadLockDetection() { Assertions.assertTrue(dlDetected, "Expected exception is not thrown"); // ---------------------------------------------------- - /** + /* * [2] ------------> [1] * ^ | * ----------------| | @@ -211,7 +211,7 @@ public void testGraphNodeTableBubblingUp() { // ---------------------------------------------------- // Graph-1 - /** + /* * [B] -----------> [A] * ^ ^ * | | @@ -232,7 +232,7 @@ public void testGraphNodeTableBubblingUp() { // ---------------------------------------------------- // Graph-2 - /** + /* * [E] ---> [D] ---> G * ^ * | @@ -252,7 +252,7 @@ public void testGraphNodeTableBubblingUp() { // ---------------------------------------------------- // Graph-3 - /** + /* * [J] ---> [H] ---> I */ @@ -276,7 +276,7 @@ public void testGraphNodeTableBubblingUp() { DAGraph graph4Root1 = graph2Root; // graphF DAGraph graph4Root2 = graph3Root; // graphJ - /** + /* * [B] -----------> [A] * ^ ^ * | | @@ -373,7 +373,7 @@ public void testGraphNodeTableBubblingUp() { // ---------------------------------------------------- // Graph-1 - /** + /* * [L] -----------> [K] * ^ ^ * | | @@ -395,7 +395,7 @@ public void testGraphNodeTableBubblingUp() { // graphA.addDependencyGraph(graphL); - /** + /* * |---------> [L] -----------> [K] * | ^ ^ * | | | @@ -462,17 +462,15 @@ public void testGraphNodeTableBubblingUp() { private DAGraph createGraph(String resourceName) { ItemHolder node = new ItemHolder(resourceName, "data" + resourceName); - DAGraph graph = new DAGraph<>(node); - return graph; + return new DAGraph<>(node); } private void assertExactMatch(Set set, String[] values) { - HashSet s = new HashSet<>(); - s.addAll(set); + HashSet s = new HashSet<>(set); - s.removeAll(Arrays.asList(values)); - if (s.size() != 0) { - Assertions.assertTrue(false, "Content of set " + set + " does not match with provided array " + Arrays.asList(values)); + Arrays.asList(values).forEach(s::remove); + if (!s.isEmpty()) { + Assertions.fail("Content of set " + set + " does not match with provided array " + Arrays.asList(values)); } } } diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/OrderImpl.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/OrderImpl.java index 81f498b22ec2..d4ac227fff7c 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/OrderImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/OrderImpl.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager.resources.fluentcore.dag; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.model.implementation.CreatableUpdatableImpl; import reactor.core.publisher.Mono; @@ -14,6 +16,8 @@ public class OrderImpl extends CreatableUpdatableImpl implements IOrder { + private static final ClientLogger LOGGER = new ClientLogger(OrderImpl.class); + /** * Creates SandwichImpl. * @@ -26,7 +30,7 @@ protected OrderImpl(String name, OrderInner innerObject) { @Override public Mono createResourceAsync() { - System.out.println("Order(" + this.name() + ")::createResourceAsync() [Creating order]"); + LOGGER.log(LogLevel.VERBOSE, () -> "Order(" + this.name() + ")::createResourceAsync() [Creating order]"); return Mono.just(this) .delayElement(Duration.ofMillis(250)) .map(sandwich -> sandwich); diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PanCakeImpl.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PanCakeImpl.java index c1c13ddb0f92..743ff9dac62b 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PanCakeImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PanCakeImpl.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager.resources.fluentcore.dag; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.model.Creatable; import com.azure.resourcemanager.resources.fluentcore.model.implementation.CreatableUpdatableImpl; import com.azure.resourcemanager.resources.fluentcore.model.implementation.CreateUpdateTask; @@ -19,6 +21,8 @@ class PancakeImpl extends CreatableUpdatableImpl implements IPancake { + private static final ClientLogger LOGGER = new ClientLogger(PancakeImpl.class); + final List> delayedPancakes; final long eventDelayInMilliseconds; final Throwable errorToThrow; @@ -73,19 +77,19 @@ public void beforeGroupCreateOrUpdate() { this.addDependency(pancake); } int newCount = this.taskGroup().getNode(this.key()).dependencyKeys().size(); - System.out.println("Pancake(" + this.name() + ")::beforeGroupCreateOrUpdate() 'delayedSize':" + this.delayedPancakes.size() - + " 'dependency count [old, new]': [" + oldCount + "," + newCount + "]"); + LOGGER.log(LogLevel.VERBOSE, () -> "Pancake(" + this.name() + ")::beforeGroupCreateOrUpdate() 'delayedSize':" + + this.delayedPancakes.size() + " 'dependency count [old, new]': [" + oldCount + "," + newCount + "]"); } @Override public Mono createResourceAsync() { if (this.errorToThrow == null) { - System.out.println("Pancake(" + this.name() + ")::createResourceAsync() 'onNext()'"); + LOGGER.log(LogLevel.VERBOSE, () -> "Pancake(" + this.name() + ")::createResourceAsync() 'onNext()'"); return Mono.just(this) .delayElement(Duration.ofMillis(this.eventDelayInMilliseconds)) .map(pancake -> pancake); } else { - System.out.println("Pancake(" + this.name() + ")::createResourceAsync() 'onError()'"); + LOGGER.log(LogLevel.VERBOSE, () -> "Pancake(" + this.name() + ")::createResourceAsync() 'onError()'"); return Mono.just(this) .delayElement(Duration.ofMillis(this.eventDelayInMilliseconds)) .flatMap(pancake -> toErrorMono(errorToThrow)); diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PastaImpl.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PastaImpl.java index 92c73ad79bd6..f38f7f9ebd70 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PastaImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PastaImpl.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager.resources.fluentcore.dag; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.model.Creatable; import com.azure.resourcemanager.resources.fluentcore.model.implementation.CreatableUpdatableImpl; import com.azure.resourcemanager.resources.fluentcore.model.implementation.CreateUpdateTask; @@ -19,6 +21,8 @@ class PastaImpl extends CreatableUpdatableImpl implements IPasta { + private static final ClientLogger LOGGER = new ClientLogger(PastaImpl.class); + final List> delayedPastas; final long eventDelayInMilliseconds; final Throwable errorToThrow; @@ -74,19 +78,19 @@ public void beforeGroupCreateOrUpdate() { this.addDependency(pancake); } int newCount = this.taskGroup().getNode(this.key()).dependencyKeys().size(); - System.out.println("Pasta(" + this.name() + ")::beforeGroupCreateOrUpdate() 'delayedSize':" + this.delayedPastas.size() - + " 'dependency count [old, new]': [" + oldCount + "," + newCount + "]"); + LOGGER.log(LogLevel.VERBOSE, () -> "Pasta(" + this.name() + ")::beforeGroupCreateOrUpdate() 'delayedSize':" + + this.delayedPastas.size() + " 'dependency count [old, new]': [" + oldCount + "," + newCount + "]"); } @Override public Mono createResourceAsync() { if (this.errorToThrow == null) { - System.out.println("Pasta(" + this.name() + ")::createResourceAsync() 'onNext()'"); + LOGGER.log(LogLevel.VERBOSE, () -> "Pasta(" + this.name() + ")::createResourceAsync() 'onNext()'"); return Mono.just(this) .delayElement(Duration.ofMillis(this.eventDelayInMilliseconds)) .map(pasta -> pasta); } else { - System.out.println("Pasta(" + this.name() + ")::createResourceAsync() 'onError()'"); + LOGGER.log(LogLevel.VERBOSE, () -> "Pasta(" + this.name() + ")::createResourceAsync() 'onError()'"); return Mono.just(this) .delayElement(Duration.ofMillis(this.eventDelayInMilliseconds)) .flatMap(pasta -> toErrorObservable(errorToThrow)); diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PizzaImpl.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PizzaImpl.java index 761d0b600040..dc72b43c093f 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PizzaImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/PizzaImpl.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager.resources.fluentcore.dag; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.model.Creatable; import com.azure.resourcemanager.resources.fluentcore.model.implementation.CreatableUpdatableImpl; import com.azure.resourcemanager.resources.fluentcore.model.implementation.CreateUpdateTask; @@ -19,6 +21,8 @@ class PizzaImpl extends CreatableUpdatableImpl implements IPizza { + private static final ClientLogger LOGGER = new ClientLogger(PizzaImpl.class); + final List> delayedPizzas; boolean prepareCalled = false; @@ -61,13 +65,13 @@ public void beforeGroupCreateOrUpdate() { this.addDependency(pizza); } int newCount = this.taskGroup().getNode(this.key()).dependencyKeys().size(); - System.out.println("Pizza(" + this.name() + ")::beforeGroupCreateOrUpdate() 'delayedSize':" + this.delayedPizzas.size() - + " 'dependency count [old, new]': [" + oldCount + "," + newCount + "]"); + LOGGER.log(LogLevel.VERBOSE, () -> "Pizza(" + this.name() + ")::beforeGroupCreateOrUpdate() 'delayedSize':" + + this.delayedPizzas.size() + " 'dependency count [old, new]': [" + oldCount + "," + newCount + "]"); } @Override public Mono createResourceAsync() { - System.out.println("Pizza(" + this.name() + ")::createResourceAsync()"); + LOGGER.log(LogLevel.VERBOSE, () -> "Pizza(" + this.name() + ")::createResourceAsync()"); return Mono.just(this) .delayElement(Duration.ofMillis(250)) .map(pizza -> pizza); diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/ProxyTaskGroupTests.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/ProxyTaskGroupTests.java index c55b04569380..58fd15b5786e 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/ProxyTaskGroupTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/ProxyTaskGroupTests.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager.resources.fluentcore.dag; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.model.Indexable; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -19,6 +21,7 @@ import java.util.concurrent.CountDownLatch; public class ProxyTaskGroupTests { + private static final ClientLogger LOGGER = new ClientLogger(ProxyTaskGroupTests.class); @Test public void testSampleTaskGroupSanity() { @@ -539,7 +542,7 @@ public void testTaskGroupInvocationShouldInvokePostRunDependentTaskGroup() { group1.invokeAsync(group1.newInvocationContext()) - .subscribe(indexable -> System.out.println(indexable.key())); + .subscribe(indexable -> LOGGER.log(LogLevel.VERBOSE, indexable::key)); } @Test diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/SandwichImpl.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/SandwichImpl.java index 3b6a26bf6a3a..419086bfe47c 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/SandwichImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/fluentcore/dag/SandwichImpl.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager.resources.fluentcore.dag; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.model.Executable; import com.azure.resourcemanager.resources.fluentcore.model.implementation.CreatableUpdatableImpl; import reactor.core.publisher.Mono; @@ -15,6 +17,8 @@ public class SandwichImpl extends CreatableUpdatableImpl implements ISandwich { + private static final ClientLogger LOGGER = new ClientLogger(SandwichImpl.class); + /** * Creates SandwichImpl. * @@ -34,7 +38,7 @@ public ISandwich withBreadSliceFromStore(Executable breadFetcher) { @Override public Mono createResourceAsync() { - System.out.println("Sandwich(" + this.name() + ")::createResourceAsync() [Creating sandwich]"); + LOGGER.log(LogLevel.VERBOSE, () -> "Sandwich(" + this.name() + ")::createResourceAsync() [Creating sandwich]"); return Mono.just(this) .delayElement(Duration.ofMillis(250)) .map(sandwich -> sandwich); diff --git a/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml b/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml index 708b387ded37..bcfbeb0aaa34 100644 --- a/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml @@ -124,12 +124,12 @@ com.azure azure-messaging-servicebus - 7.16.0 + 7.17.0 io.fabric8 kubernetes-client - 5.12.3 + 6.12.1 com.microsoft.sqlserver @@ -195,7 +195,7 @@ org.apache.httpcomponents:httpclient:[4.5.14] - io.fabric8:kubernetes-client:[5.12.3] + io.fabric8:kubernetes-client:[6.12.1] com.jcraft:jsch:[0.1.55] org.slf4j:slf4j-simple:[1.7.36] com.google.guava:guava:[33.1.0-jre] diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/ApplicationGatewayTests.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/ApplicationGatewayTests.java index f47cf9a846e4..b481cdee7727 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/ApplicationGatewayTests.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/ApplicationGatewayTests.java @@ -9,6 +9,8 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.compute.models.KnownLinuxVirtualMachineImage; import com.azure.resourcemanager.compute.models.VirtualMachine; import com.azure.resourcemanager.network.models.ApplicationGateway; @@ -46,6 +48,8 @@ import org.junit.jupiter.api.Test; public class ApplicationGatewayTests extends ResourceManagerTestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(ApplicationGatewayTests.class); + private AzureResourceManager azureResourceManager; @Override @@ -228,7 +232,7 @@ public void testAppGatewayBackendHealthCheck() throws Exception { } } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, () -> info.toString()); // Verify app gateway Assertions.assertEquals(2, appGateway.backends().size()); @@ -247,8 +251,8 @@ public void testAppGatewayBackendHealthCheck() throws Exception { ApplicationGatewayBackendHealth backendHealth1 = backendHealths.get(backend1.name()); Assertions.assertNotNull(backendHealth1); Assertions.assertNotNull(backendHealth1.backend()); - for (int i = 0; i < ipAddresses.length; i++) { - Assertions.assertTrue(backend1.containsIPAddress(ipAddresses[i])); + for (String ipAddress : ipAddresses) { + Assertions.assertTrue(backend1.containsIPAddress(ipAddress)); } // Verify second backend (NIC based) diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/AzureResourceManagerTests.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/AzureResourceManagerTests.java index 6f128a12344d..dcab933c7130 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/AzureResourceManagerTests.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/AzureResourceManagerTests.java @@ -9,10 +9,14 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Region; import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.profile.AzureProfile; import com.azure.core.test.annotation.DoNotRecord; import com.azure.core.test.models.TestProxySanitizer; import com.azure.core.test.models.TestProxySanitizerType; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.authorization.models.BuiltInRole; import com.azure.resourcemanager.compute.models.CachingTypes; import com.azure.resourcemanager.compute.models.Disk; @@ -49,27 +53,33 @@ import com.azure.resourcemanager.network.models.Subnet; import com.azure.resourcemanager.network.models.Topology; import com.azure.resourcemanager.network.models.VerificationIPFlow; -import com.azure.resourcemanager.resources.fluentcore.model.CreatedResources; -import com.azure.resourcemanager.resources.models.LockLevel; -import com.azure.resourcemanager.resources.models.ManagementLock; -import com.azure.resourcemanager.resources.models.ResourceGroup; -import com.azure.resourcemanager.storage.models.StorageAccountSkuType; -import com.azure.resourcemanager.test.utils.TestUtilities; import com.azure.resourcemanager.resources.fluentcore.arm.CountryIsoCode; -import com.azure.core.management.Region; import com.azure.resourcemanager.resources.fluentcore.model.Creatable; -import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resources.fluentcore.model.CreatedResources; import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider; import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils; import com.azure.resourcemanager.resources.models.Deployment; import com.azure.resourcemanager.resources.models.DeploymentMode; import com.azure.resourcemanager.resources.models.GenericResource; import com.azure.resourcemanager.resources.models.Location; +import com.azure.resourcemanager.resources.models.LockLevel; +import com.azure.resourcemanager.resources.models.ManagementLock; import com.azure.resourcemanager.resources.models.RegionCategory; import com.azure.resourcemanager.resources.models.RegionType; +import com.azure.resourcemanager.resources.models.ResourceGroup; import com.azure.resourcemanager.resources.models.Subscription; import com.azure.resourcemanager.storage.models.StorageAccount; -import java.io.IOException; +import com.azure.resourcemanager.storage.models.StorageAccountSkuType; +import com.azure.resourcemanager.test.ResourceManagerTestProxyTestBase; +import com.azure.resourcemanager.test.utils.TestDelayProvider; +import com.azure.resourcemanager.test.utils.TestIdentifierProvider; +import com.azure.resourcemanager.test.utils.TestUtilities; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import reactor.core.scheduler.Schedulers; + import java.text.MessageFormat; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -84,16 +94,9 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import com.azure.resourcemanager.test.ResourceManagerTestProxyTestBase; -import com.azure.resourcemanager.test.utils.TestDelayProvider; -import com.azure.resourcemanager.test.utils.TestIdentifierProvider; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Flux; -import reactor.core.scheduler.Schedulers; - public class AzureResourceManagerTests extends ResourceManagerTestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(AzureResourceManagerTests.class); + private AzureResourceManager azureResourceManager; public AzureResourceManagerTests() { @@ -138,7 +141,6 @@ protected void cleanUpResources() { /** * Stress-tests the resilience of ExpandableEnum to multi-threaded access * - * @throws Exception */ @Test public void testExpandableEnum() throws Exception { @@ -223,17 +225,17 @@ public void run() { // Verify country ISO codes Collection countryIsoCodes = CountryIsoCode.values(); - System.out.println("\n## Country ISO codes: " + countryIsoCodes.size()); + LOGGER.log(LogLevel.VERBOSE, () -> "\n## Country ISO codes: " + countryIsoCodes.size()); for (CountryIsoCode value : countryIsoCodes) { - System.out.println(value.toString()); + LOGGER.log(LogLevel.VERBOSE, value::toString); } Assertions.assertEquals(257, countryIsoCodes.size()); // Verify power states Collection powerStates = PowerState.values(); - System.out.println("\n## Power states: " + powerStates.size()); + LOGGER.log(LogLevel.VERBOSE, () -> "\n## Power states: " + powerStates.size()); for (PowerState value : powerStates) { - System.out.println(value.toString()); + LOGGER.log(LogLevel.VERBOSE, value::toString); } Assertions.assertEquals(27, powerStates.size()); } @@ -245,15 +247,13 @@ public void run() { /** * Tests ARM template deployments. * - * @throws IOException - * @throws ManagementException */ @DoNotRecord(skipInPlayback = true) // response contains token in hostpoolToken @Test - public void testDeployments() throws Exception { + public void testDeployments() { String testId = azureResourceManager.deployments().manager().resourceManager().internalContext().randomResourceName("", 8); PagedIterable deployments = azureResourceManager.deployments().list(); - System.out.println("Deployments: " + TestUtilities.getSize(deployments)); + LOGGER.log(LogLevel.VERBOSE, () -> "Deployments: " + TestUtilities.getSize(deployments)); Deployment deployment = azureResourceManager .deployments() @@ -263,7 +263,7 @@ public void testDeployments() throws Exception { .withParametersLink(PARAMETERS_URI, CONTENT_VERSION) .withMode(DeploymentMode.COMPLETE) .create(); - System.out.println("Created deployment: " + deployment.correlationId()); + LOGGER.log(LogLevel.VERBOSE, () -> "Created deployment: " + deployment.correlationId()); azureResourceManager.resourceGroups().beginDeleteByName("rg" + testId); } @@ -271,10 +271,9 @@ public void testDeployments() throws Exception { /** * Tests basic generic resources retrieval. * - * @throws Exception */ @Test - public void testGenericResources() throws Exception { + public void testGenericResources() { // Create some resources NetworkSecurityGroup nsg = azureResourceManager @@ -312,10 +311,9 @@ public void testGenericResources() throws Exception { * Tests management locks. * NOTE: This requires the service principal to have an Owner role on the subscription * - * @throws Exception */ @Test - public void testManagementLocks() throws Exception { + public void testManagementLocks() { // Prepare a VM final String password = ResourceManagerTestProxyTestBase.password(); final String rgName = generateRandomResourceName("rg", 15); @@ -487,14 +485,14 @@ public void testManagementLocks() throws Exception { Assertions.assertNotNull(locksGroup); int locksAllCount = TestUtilities.getSize(locksSubscription); - System.out.println("All locks: " + locksAllCount); + LOGGER.log(LogLevel.VERBOSE, () -> "All locks: " + locksAllCount); Assertions.assertTrue(6 <= locksAllCount); int locksGroupCount = TestUtilities.getSize(locksGroup); - System.out.println("Group locks: " + locksGroupCount); + LOGGER.log(LogLevel.VERBOSE, () -> "Group locks: " + locksGroupCount); Assertions.assertEquals(6, locksGroupCount); } catch (Exception ex) { - ex.printStackTrace(System.out); + LOGGER.log(LogLevel.VERBOSE, () -> "Error occurred", ex); } finally { if (resourceGroup != null) { if (lockGroup != null) { @@ -524,21 +522,19 @@ public void testManagementLocks() throws Exception { /** * Tests VM images. * - * @throws IOException - * @throws ManagementException */ @DoNotRecord(skipInPlayback = true) @Test - public void testVMImages() throws ManagementException, IOException { + public void testVMImages() throws ManagementException { PagedIterable publishers = azureResourceManager.virtualMachineImages().publishers().listByRegion(Region.US_WEST); Assertions.assertTrue(TestUtilities.getSize(publishers) > 0); for (VirtualMachinePublisher p : publishers.stream().limit(5).toArray(VirtualMachinePublisher[]::new)) { - System.out.println(String.format("Publisher name: %s, region: %s", p.name(), p.region())); + LOGGER.log(LogLevel.VERBOSE, () -> "Publisher name: " + p.name() + ", region: " + p.region()); for (VirtualMachineOffer o : p.offers().list().stream().limit(5).toArray(VirtualMachineOffer[]::new)) { - System.out.println(String.format("\tOffer name: %s", o.name())); + LOGGER.log(LogLevel.VERBOSE, () -> "\tOffer name: " + o.name()); for (VirtualMachineSku s : o.skus().list().stream().limit(5).toArray(VirtualMachineSku[]::new)) { - System.out.println(String.format("\t\tSku name: %s", s.name())); + LOGGER.log(LogLevel.VERBOSE, () -> "\t\tSku name: " + s.name()); } } } @@ -552,7 +548,6 @@ public void testVMImages() throws ManagementException, IOException { /** * Tests the network security group implementation. * - * @throws Exception */ @Test public void testNetworkSecurityGroups() throws Exception { @@ -562,7 +557,6 @@ public void testNetworkSecurityGroups() throws Exception { /** * Tests the inbound NAT rule support in load balancers. * - * @throws Exception */ @DoNotRecord(skipInPlayback = true) // TODO(weidxu) @Test @@ -574,7 +568,6 @@ public void testLoadBalancersNatRules() throws Exception { /** * Tests the inbound NAT pool support in load balancers. * - * @throws Exception */ @DoNotRecord(skipInPlayback = true) // TODO(weidxu) @Test @@ -586,7 +579,6 @@ public void testLoadBalancersNatPools() throws Exception { /** * Tests the minimum Internet-facing load balancer with a load balancing rule only * - * @throws Exception */ @Test public void testLoadBalancersInternetMinimum() throws Exception { @@ -597,7 +589,6 @@ public void testLoadBalancersInternetMinimum() throws Exception { /** * Tests the minimum Internet-facing load balancer with a NAT rule only * - * @throws Exception */ @Test public void testLoadBalancersNatOnly() throws Exception { @@ -608,7 +599,6 @@ public void testLoadBalancersNatOnly() throws Exception { /** * Tests the minimum internal load balancer. * - * @throws Exception */ @Test public void testLoadBalancersInternalMinimum() throws Exception { @@ -619,7 +609,6 @@ public void testLoadBalancersInternalMinimum() throws Exception { /** * Tests the internal load balancer with availability zone. * - * @throws Exception */ @Test @Disabled("Though valid scenario, NRP is failing") @@ -629,7 +618,7 @@ public void testLoadBalancersInternalWithAvailabilityZone() throws Exception { } @Test - public void testManagedDiskVMUpdate() throws Exception { + public void testManagedDiskVMUpdate() { ResourceManagerUtils.InternalRuntimeContext context = azureResourceManager.disks().manager().resourceManager().internalContext(); final String rgName = context.randomResourceName("rg", 13); final String linuxVM2Name = context.randomResourceName("vm" + "-", 10); @@ -661,7 +650,6 @@ public void testManagedDiskVMUpdate() throws Exception { /** * Tests the public IP address implementation. * - * @throws Exception */ @Test public void testPublicIPAddresses() throws Exception { @@ -671,7 +659,6 @@ public void testPublicIPAddresses() throws Exception { /** * Tests the public IP address implementation. * - * @throws Exception */ @Test public void testPublicIPPrefixes() throws Exception { @@ -681,7 +668,6 @@ public void testPublicIPPrefixes() throws Exception { /** * Tests the availability set implementation. * - * @throws Exception */ @Test public void testAvailabilitySets() throws Exception { @@ -691,7 +677,6 @@ public void testAvailabilitySets() throws Exception { /** * Tests the virtual network implementation. * - * @throws Exception */ @Test public void testNetworks() throws Exception { @@ -701,7 +686,6 @@ public void testNetworks() throws Exception { /** * Tests virtual network peering * - * @throws Exception */ @Test public void testNetworkWithAccessFromServiceToSubnet() throws Exception { @@ -711,7 +695,6 @@ public void testNetworkWithAccessFromServiceToSubnet() throws Exception { /** * Tests virtual network peering * - * @throws Exception */ @Test public void testNetworkPeerings() throws Exception { @@ -721,7 +704,6 @@ public void testNetworkPeerings() throws Exception { /** * Tests virtual network with DDoS protection plan * - * @throws Exception */ @Test public void testDdosAndVmProtection() throws Exception { @@ -731,7 +713,6 @@ public void testDdosAndVmProtection() throws Exception { /** * Tests updateTags for virtual network. * - * @throws Exception */ @Test public void testNetworkUpdateTags() throws Exception { @@ -741,7 +722,6 @@ public void testNetworkUpdateTags() throws Exception { /** * Tests route tables. * - * @throws Exception */ @Test public void testRouteTables() throws Exception { @@ -752,16 +732,16 @@ public void testRouteTables() throws Exception { @Test public void testRegions() { // Show built-in regions - System.out.println("Built-in regions list:"); + LOGGER.log(LogLevel.VERBOSE, () -> "Built-in regions list:"); int regionsCount = Region.values().size(); for (Region region : Region.values()) { - System.out.println("Name: " + region.name() + ", Label: " + region.label()); + LOGGER.log(LogLevel.VERBOSE, () -> "Name: " + region.name() + ", Label: " + region.label()); } // Look up built-in region Region region = Region.fromName("westus"); - Assertions.assertTrue(region == Region.US_WEST); + Assertions.assertSame(region, Region.US_WEST); // Add a region Region region2 = Region.fromName("madeUpRegion"); @@ -775,7 +755,6 @@ public void testRegions() { /** * Tests the network interface implementation. * - * @throws Exception */ @Test public void testNetworkInterfaces() throws Exception { @@ -785,7 +764,6 @@ public void testNetworkInterfaces() throws Exception { /** * Tests the network watcher implementation. * - * @throws Exception */ @Test public void testNetworkWatchers() throws Exception { @@ -859,7 +837,7 @@ public void testNetworkWatcherFunctions() throws Exception { .withRetentionPolicyDays(5) .withRetentionPolicyEnabled() .apply(); - Assertions.assertEquals(true, flowLogSettings.enabled()); + Assertions.assertTrue(flowLogSettings.enabled()); Assertions.assertEquals(5, flowLogSettings.retentionDays()); Assertions.assertEquals(storageAccount.id(), flowLogSettings.storageId()); @@ -945,7 +923,6 @@ public void testNetworkWatcherFunctions() throws Exception { /** * Tests the local network gateway implementation. * - * @throws Exception */ @DoNotRecord(skipInPlayback = true) // TODO(weidxu) @Test @@ -956,7 +933,6 @@ public void testLocalNetworkGateways() throws Exception { /** * Tests the express route circuit implementation. * - * @throws Exception */ @Test @Disabled("Failed to provision ExpressRoute circuit as the service provider does not have sufficient capacity at this location.") @@ -967,7 +943,6 @@ public void testExpressRouteCircuits() throws Exception { /** * Tests the express route circuit peerings implementation. * - * @throws Exception */ @Test @Disabled("Failed to provision ExpressRoute circuit as the service provider does not have sufficient capacity at this location.") @@ -979,7 +954,6 @@ public void testExpressRouteCircuitPeering() throws Exception { /** * Tests virtual machines. * - * @throws Exception */ @Test @Disabled("osDiskSize is returned as 127 instead of 128 - known service bug") @@ -992,7 +966,6 @@ public void testVirtualMachines() throws Exception { /** * Tests the virtual machine data disk implementation. * - * @throws Exception */ @Test public void testVirtualMachineDataDisk() throws Exception { @@ -1002,7 +975,6 @@ public void testVirtualMachineDataDisk() throws Exception { /** * Tests the virtual machine network interface implementation. * - * @throws Exception */ @Test public void testVirtualMachineNics() throws Exception { @@ -1012,7 +984,6 @@ public void testVirtualMachineNics() throws Exception { /** * Tests virtual machine support for SSH. * - * @throws Exception */ @Test public void testVirtualMachineSSh() throws Exception { @@ -1022,7 +993,6 @@ public void testVirtualMachineSSh() throws Exception { /** * Tests virtual machine sizes. * - * @throws Exception */ @Test public void testVirtualMachineSizes() throws Exception { @@ -1049,10 +1019,9 @@ public void testVirtualMachineSyncPoller() throws Exception { /** * Tests subscription listing. * - * @throws Exception */ @Test - public void listSubscriptions() throws Exception { + public void listSubscriptions() { Assertions.assertTrue(0 < TestUtilities.getSize(azureResourceManager.subscriptions().list())); Subscription subscription = azureResourceManager.getCurrentSubscription(); Assertions.assertNotNull(subscription); @@ -1064,10 +1033,9 @@ public void listSubscriptions() throws Exception { /** * Tests location listing. * - * @throws Exception */ @Test - public void listLocations() throws Exception { + public void listLocations() { Subscription subscription = azureResourceManager.getCurrentSubscription(); Assertions.assertNotNull(subscription); for (Location location : subscription.listLocations()) { @@ -1085,27 +1053,25 @@ public void listLocations() throws Exception { /** * Tests resource group listing. * - * @throws Exception */ @Test - public void listResourceGroups() throws Exception { + public void listResourceGroups() { int groupCount = TestUtilities.getSize(azureResourceManager.resourceGroups().list()); - System.out.println(String.format("Group count: %s", groupCount)); + LOGGER.log(LogLevel.VERBOSE, () -> "Group count: " + groupCount); Assertions.assertTrue(0 < groupCount); } /** * Tests storage account listing. * - * @throws Exception */ @Test - public void listStorageAccounts() throws Exception { + public void listStorageAccounts() { Assertions.assertTrue(0 < TestUtilities.getSize(azureResourceManager.storageAccounts().list())); } @Test - public void createStorageAccount() throws Exception { + public void createStorageAccount() { String storageAccountName = generateRandomResourceName("testsa", 12); StorageAccount storageAccount = azureResourceManager @@ -1175,7 +1141,7 @@ public void testContainerInstanceWithPublicIpAddressWithSystemAssignedMsi() thro } @Test - public void testContainerInstanceWithPublicIpAddressWithUserAssignedMsi() throws Exception { + public void testContainerInstanceWithPublicIpAddressWithUserAssignedMsi() { final String cgName = generateRandomResourceName("aci", 10); final String rgName = generateRandomResourceName("rgaci", 10); String identityName1 = generateRandomResourceName("msi-id", 15); @@ -1198,7 +1164,7 @@ public void testContainerInstanceWithPublicIpAddressWithUserAssignedMsi() throws .withExistingResourceGroup(rgName) .withAccessToCurrentResourceGroup(BuiltInRole.CONTRIBUTOR); - List dnsServers = new ArrayList(); + List dnsServers = new ArrayList<>(); dnsServers.add("dnsServer1"); ContainerGroup containerGroup = azureResourceManager @@ -1283,14 +1249,14 @@ public void testContainerInstanceWithPublicIpAddressWithUserAssignedMsi() throws List containerGroupList = azureResourceManager.containerGroups().listByResourceGroup(rgName).stream().collect(Collectors.toList()); - Assertions.assertTrue(containerGroupList.size() > 0); + Assertions.assertFalse(containerGroupList.isEmpty()); containerGroup.refresh(); Set containerGroupOperations = azureResourceManager.containerGroups().listOperations().stream().collect(Collectors.toSet()); // Number of supported operation can change hence don't assert with a predefined number. - Assertions.assertTrue(containerGroupOperations.size() > 0); + Assertions.assertFalse(containerGroupOperations.isEmpty()); } @Test @@ -1386,7 +1352,7 @@ public void generateMissingRegion() { } } - Assertions.assertTrue(sb.length() == 0, sb.toString()); + Assertions.assertEquals(0, sb.length(), sb.toString()); } private static Region findByLabelOrName(String labelOrName) { diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/PrivateLinkTests.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/PrivateLinkTests.java index 882ce2ab1b5f..a5f66e2472fe 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/PrivateLinkTests.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/PrivateLinkTests.java @@ -12,8 +12,8 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.management.Region; import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.appservice.models.PricingTier; import com.azure.resourcemanager.appservice.models.RuntimeStack; import com.azure.resourcemanager.appservice.models.WebApp; @@ -50,17 +50,14 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import java.io.File; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.stream.Collectors; public class PrivateLinkTests extends ResourceManagerTestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkTests.class); private AzureResourceManager azureResourceManager; private String rgName; @@ -122,7 +119,7 @@ public void testPrivateEndpoint() { // String pecName2 = generateRandomResourceName("pec", 10); String saDomainName = saName + ".blob.core.windows.net"; - System.out.println("storage account domain name: " + saDomainName); + LOGGER.log(LogLevel.VERBOSE, () -> "storage account domain name: " + saDomainName); StorageAccount storageAccount = azureResourceManager.storageAccounts().define(saName) .withRegion(region) @@ -228,7 +225,7 @@ public void testPrivateEndpoint() { Assertions.assertEquals("Approved", privateEndpoint.privateLinkServiceConnections().get(pecName).state().status()); String saPrivateIp = privateEndpoint.customDnsConfigurations().get(0).ipAddresses().get(0); - System.out.println("storage account private ip: " + saPrivateIp); + LOGGER.log(LogLevel.VERBOSE, () -> "storage account private ip: " + saPrivateIp); // verify list List privateEndpoints = azureResourceManager.privateEndpoints().listByResourceGroup(rgName).stream().collect(Collectors.toList()); @@ -248,7 +245,7 @@ public void testPrivateEndpointE2E() { String vmName = generateRandomResourceName("vm", 10); String saDomainName = saName + ".blob.core.windows.net"; - System.out.println("storage account domain name: " + saDomainName); + LOGGER.log(LogLevel.VERBOSE, () -> "storage account domain name: " + saDomainName); StorageAccount storageAccount = azureResourceManager.storageAccounts().define(saName) .withRegion(region) @@ -289,7 +286,7 @@ public void testPrivateEndpointE2E() { Assertions.assertEquals("Approved", privateEndpoint.privateLinkServiceConnections().get(pecName).state().status()); String saPrivateIp = privateEndpoint.customDnsConfigurations().get(0).ipAddresses().get(0); - System.out.println("storage account private ip: " + saPrivateIp); + LOGGER.log(LogLevel.VERBOSE, () -> "storage account private ip: " + saPrivateIp); VirtualMachine virtualMachine = null; if (validateOnVirtualMachine) { @@ -310,7 +307,7 @@ public void testPrivateEndpointE2E() { // verify private endpoint not yet works RunCommandResult commandResult = virtualMachine.runShellScript(Collections.singletonList("nslookup " + saDomainName), null); for (InstanceViewStatus status : commandResult.value()) { - System.out.println(status.message()); + LOGGER.log(LogLevel.VERBOSE, () -> status.message()); } Assertions.assertFalse(commandResult.value().stream().anyMatch(status -> status.message().contains(saPrivateIp))); } @@ -335,7 +332,7 @@ public void testPrivateEndpointE2E() { // verify private endpoint works RunCommandResult commandResult = virtualMachine.runShellScript(Collections.singletonList("nslookup " + saDomainName), null); for (InstanceViewStatus status : commandResult.value()) { - System.out.println(status.message()); + LOGGER.log(LogLevel.VERBOSE, () -> status.message()); } Assertions.assertTrue(commandResult.value().stream().anyMatch(status -> status.message().contains(saPrivateIp))); } @@ -560,11 +557,4 @@ private parseAuthFile(String authFilename) throws Exception { - String content = new String(Files.readAllBytes(new File(authFilename).toPath()), StandardCharsets.UTF_8).trim(); - HashMap auth = new HashMap<>(); - auth = new JacksonAdapter().deserialize(content, auth.getClass(), SerializerEncoding.JSON); - return auth; - } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestApplicationGateway.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestApplicationGateway.java index 7bc709c81960..190280a546eb 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestApplicationGateway.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestApplicationGateway.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.ApplicationGateway; import com.azure.resourcemanager.network.models.ApplicationGatewayAuthenticationCertificate; import com.azure.resourcemanager.network.models.ApplicationGatewayBackend; @@ -39,6 +41,8 @@ /** Test of application gateway management. */ public class TestApplicationGateway { + private static final ClientLogger LOGGER = new ClientLogger(TestApplicationGateway.class); + String testId = ""; static final Region REGION = Region.US_WEST; String groupName = ""; @@ -381,9 +385,8 @@ public class PrivateComplex extends TestTemplate "Uncaught exception", ex); } }; @@ -519,7 +522,7 @@ public void run() { .withInstanceCount(2) .create(); } catch (IOException e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Error creating application gateway", e); } } }); @@ -843,9 +846,8 @@ public class PublicComplex extends TestTemplate "Uncaught exception", ex); } }; @@ -962,7 +964,7 @@ public void run() { .withHttp2() .create(); } catch (IOException e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Uncaught exception", e); } } }); @@ -978,7 +980,7 @@ public void run() { ApplicationGateway appGateway = resources.getById(resourceId); Assertions.assertNotNull(appGateway); Assertions.assertTrue(appGateway.isPublic()); - Assertions.assertTrue(!appGateway.isPrivate()); + Assertions.assertFalse(appGateway.isPrivate()); Assertions.assertEquals(ApplicationGatewayTier.STANDARD, appGateway.tier()); Assertions.assertEquals(ApplicationGatewaySkuName.STANDARD_MEDIUM, appGateway.size()); Assertions.assertEquals(2, appGateway.instanceCount()); @@ -997,7 +999,7 @@ public void run() { Assertions.assertEquals(0, appGateway.privateFrontends().size()); ApplicationGatewayFrontend frontend = appGateway.publicFrontends().values().iterator().next(); Assertions.assertTrue(frontend.isPublic()); - Assertions.assertTrue(!frontend.isPrivate()); + Assertions.assertFalse(frontend.isPrivate()); // Verify listeners Assertions.assertEquals(3, appGateway.listeners().size()); @@ -1099,7 +1101,7 @@ public void run() { Assertions.assertEquals(2, appGateway.disabledSslProtocols().size()); Assertions.assertTrue(appGateway.disabledSslProtocols().contains(ApplicationGatewaySslProtocol.TLSV1_0)); Assertions.assertTrue(appGateway.disabledSslProtocols().contains(ApplicationGatewaySslProtocol.TLSV1_1)); - Assertions.assertTrue(!appGateway.disabledSslProtocols().contains(ApplicationGatewaySslProtocol.TLSV1_2)); + Assertions.assertFalse(appGateway.disabledSslProtocols().contains(ApplicationGatewaySslProtocol.TLSV1_2)); return appGateway; } @@ -1148,8 +1150,8 @@ public ApplicationGateway updateResource(final ApplicationGateway resource) thro // Get the resource created so far Assertions.assertTrue(resource.tags().containsKey("tag1")); - Assertions.assertTrue(resource.size().equals(ApplicationGatewaySkuName.STANDARD_SMALL)); - Assertions.assertTrue(resource.instanceCount() == 1); + Assertions.assertEquals(resource.size(), ApplicationGatewaySkuName.STANDARD_SMALL); + Assertions.assertEquals(1, resource.instanceCount()); Assertions.assertFalse(resource.isHttp2Enabled()); // Verify listeners @@ -1157,10 +1159,10 @@ public ApplicationGateway updateResource(final ApplicationGateway resource) thro Assertions.assertTrue("www.contoso.com".equalsIgnoreCase(listener.hostname())); // Verify request routing rules - Assertions.assertTrue(resource.requestRoutingRules().size() == rulesCount - 1); - Assertions.assertTrue(!resource.requestRoutingRules().containsKey("rule9000")); + Assertions.assertEquals(resource.requestRoutingRules().size(), rulesCount - 1); + Assertions.assertFalse(resource.requestRoutingRules().containsKey("rule9000")); ApplicationGatewayRequestRoutingRule rule = resource.requestRoutingRules().get("rule443"); - Assertions.assertTrue(rule != null); + Assertions.assertNotNull(rule); Assertions.assertTrue("listener1".equalsIgnoreCase(rule.listener().name())); // Verify probes @@ -1233,7 +1235,7 @@ public void run() { .attach() .create(); } catch (IOException e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Error occurred", e); } } }); @@ -1246,48 +1248,48 @@ public void run() { // Get the resource as created so far String resourceId = createResourceId(resources.manager().subscriptionId()); ApplicationGateway appGateway = resources.manager().applicationGateways().getById(resourceId); - Assertions.assertTrue(appGateway != null); - Assertions.assertTrue(ApplicationGatewayTier.STANDARD.equals(appGateway.tier())); - Assertions.assertTrue(ApplicationGatewaySkuName.STANDARD_SMALL.equals(appGateway.size())); - Assertions.assertTrue(appGateway.instanceCount() == 1); + Assertions.assertNotNull(appGateway); + Assertions.assertEquals(ApplicationGatewayTier.STANDARD, appGateway.tier()); + Assertions.assertEquals(ApplicationGatewaySkuName.STANDARD_SMALL, appGateway.size()); + Assertions.assertEquals(1, appGateway.instanceCount()); // Verify frontend ports - Assertions.assertTrue(appGateway.frontendPorts().size() == 1); - Assertions.assertTrue(appGateway.frontendPortNameFromNumber(443) != null); + Assertions.assertEquals(1, appGateway.frontendPorts().size()); + Assertions.assertNotNull(appGateway.frontendPortNameFromNumber(443)); // Verify frontends - Assertions.assertTrue(!appGateway.isPrivate()); + Assertions.assertFalse(appGateway.isPrivate()); Assertions.assertTrue(appGateway.isPublic()); - Assertions.assertTrue(appGateway.frontends().size() == 1); + Assertions.assertEquals(1, appGateway.frontends().size()); // Verify listeners - Assertions.assertTrue(appGateway.listeners().size() == 1); - Assertions.assertTrue(appGateway.listenerByPortNumber(443) != null); + Assertions.assertEquals(1, appGateway.listeners().size()); + Assertions.assertNotNull(appGateway.listenerByPortNumber(443)); // Verify backends - Assertions.assertTrue(appGateway.backends().size() == 1); + Assertions.assertEquals(1, appGateway.backends().size()); // Verify backend HTTP configs - Assertions.assertTrue(appGateway.backendHttpConfigurations().size() == 1); + Assertions.assertEquals(1, appGateway.backendHttpConfigurations().size()); // Verify rules - Assertions.assertTrue(appGateway.requestRoutingRules().size() == 1); + Assertions.assertEquals(1, appGateway.requestRoutingRules().size()); ApplicationGatewayRequestRoutingRule rule = appGateway.requestRoutingRules().get("rule1"); - Assertions.assertTrue(rule != null); - Assertions.assertTrue(rule.frontendPort() == 443); - Assertions.assertTrue(ApplicationGatewayProtocol.HTTPS.equals(rule.frontendProtocol())); - Assertions.assertTrue(rule.listener() != null); - Assertions.assertTrue(rule.listener().frontend() != null); + Assertions.assertNotNull(rule); + Assertions.assertEquals(443, rule.frontendPort()); + Assertions.assertEquals(ApplicationGatewayProtocol.HTTPS, rule.frontendProtocol()); + Assertions.assertNotNull(rule.listener()); + Assertions.assertNotNull(rule.listener().frontend()); Assertions.assertTrue(rule.listener().frontend().isPublic()); - Assertions.assertTrue(!rule.listener().frontend().isPrivate()); - Assertions.assertTrue(rule.backendPort() == 8080); - Assertions.assertTrue(rule.sslCertificate() != null); - Assertions.assertTrue(rule.backendAddresses().size() == 2); + Assertions.assertFalse(rule.listener().frontend().isPrivate()); + Assertions.assertEquals(8080, rule.backendPort()); + Assertions.assertNotNull(rule.sslCertificate()); + Assertions.assertEquals(2, rule.backendAddresses().size()); Assertions.assertTrue(rule.backend().containsIPAddress("11.1.1.1")); Assertions.assertTrue(rule.backend().containsIPAddress("11.1.1.2")); // Verify certificates - Assertions.assertTrue(appGateway.sslCertificates().size() == 1); + Assertions.assertEquals(1, appGateway.sslCertificates().size()); return appGateway; } @@ -1324,47 +1326,47 @@ public ApplicationGateway updateResource(final ApplicationGateway resource) thro Assertions.assertTrue(resource.tags().containsKey("tag1")); Assertions.assertTrue(resource.tags().containsKey("tag2")); - Assertions.assertTrue(ApplicationGatewaySkuName.STANDARD_MEDIUM.equals(resource.size())); - Assertions.assertTrue(resource.instanceCount() == 2); + Assertions.assertEquals(ApplicationGatewaySkuName.STANDARD_MEDIUM, resource.size()); + Assertions.assertEquals(2, resource.instanceCount()); // Verify frontend ports - Assertions.assertTrue(resource.frontendPorts().size() == 2); - Assertions.assertTrue(resource.frontendPortNameFromNumber(80) != null); + Assertions.assertEquals(2, resource.frontendPorts().size()); + Assertions.assertNotNull(resource.frontendPortNameFromNumber(80)); // Verify listeners - Assertions.assertTrue(resource.listeners().size() == 2); + Assertions.assertEquals(2, resource.listeners().size()); ApplicationGatewayListener listener = resource.listeners().get("listener2"); - Assertions.assertTrue(listener != null); - Assertions.assertTrue(!listener.frontend().isPrivate()); + Assertions.assertNotNull(listener); + Assertions.assertFalse(listener.frontend().isPrivate()); Assertions.assertTrue(listener.frontend().isPublic()); - Assertions.assertTrue(listener.frontendPortNumber() == 80); - Assertions.assertTrue(ApplicationGatewayProtocol.HTTP.equals(listener.protocol())); - Assertions.assertTrue(listener.sslCertificate() == null); + Assertions.assertEquals(80, listener.frontendPortNumber()); + Assertions.assertEquals(ApplicationGatewayProtocol.HTTP, listener.protocol()); + Assertions.assertNull(listener.sslCertificate()); // Verify backends - Assertions.assertTrue(resource.backends().size() == 2); + Assertions.assertEquals(2, resource.backends().size()); ApplicationGatewayBackend backend = resource.backends().get("backend2"); - Assertions.assertTrue(backend != null); - Assertions.assertTrue(backend.addresses().size() == 1); + Assertions.assertNotNull(backend); + Assertions.assertEquals(1, backend.addresses().size()); Assertions.assertTrue(backend.containsIPAddress("11.1.1.3")); // Verify HTTP configs - Assertions.assertTrue(resource.backendHttpConfigurations().size() == 2); + Assertions.assertEquals(2, resource.backendHttpConfigurations().size()); ApplicationGatewayBackendHttpConfiguration config = resource.backendHttpConfigurations().get("config2"); - Assertions.assertTrue(config != null); + Assertions.assertNotNull(config); Assertions.assertTrue(config.cookieBasedAffinity()); - Assertions.assertTrue(config.port() == 8081); - Assertions.assertTrue(config.requestTimeout() == 33); + Assertions.assertEquals(8081, config.port()); + Assertions.assertEquals(33, config.requestTimeout()); // Verify request routing rules - Assertions.assertTrue(resource.requestRoutingRules().size() == 2); + Assertions.assertEquals(2, resource.requestRoutingRules().size()); ApplicationGatewayRequestRoutingRule rule = resource.requestRoutingRules().get("rule2"); - Assertions.assertTrue(rule != null); - Assertions.assertTrue(rule.listener() != null); - Assertions.assertTrue("listener2".equals(rule.listener().name())); - Assertions.assertTrue(rule.backendHttpConfiguration() != null); + Assertions.assertNotNull(rule); + Assertions.assertNotNull(rule.listener()); + Assertions.assertEquals("listener2", rule.listener().name()); + Assertions.assertNotNull(rule.backendHttpConfiguration()); Assertions.assertTrue("config2".equalsIgnoreCase(rule.backendHttpConfiguration().name())); - Assertions.assertTrue(rule.backend() != null); + Assertions.assertNotNull(rule.backend()); Assertions.assertTrue("backend2".equalsIgnoreCase(rule.backend().name())); return resource; @@ -1372,10 +1374,10 @@ public ApplicationGateway updateResource(final ApplicationGateway resource) thro } // Create VNet for the app gateway - private Map ensurePIPs(PublicIpAddresses pips) throws Exception { + private Map ensurePIPs(PublicIpAddresses pips) { List> creatablePips = new ArrayList<>(); - for (int i = 0; i < pipNames.length; i++) { - creatablePips.add(pips.define(pipNames[i]).withRegion(REGION).withNewResourceGroup(groupName)); + for (String pipName : pipNames) { + creatablePips.add(pips.define(pipName).withRegion(REGION).withNewResourceGroup(groupName)); } return pips.create(creatablePips); @@ -1497,7 +1499,7 @@ static void printAppGateway(ApplicationGateway resource) { .append(httpConfig.path()); if (httpConfig.probe() != null) { - info.append("\n\t\t\tProbe: " + httpConfig.probe().name()); + info.append("\n\t\t\tProbe: ").append(httpConfig.probe().name()); } info.append("\n\t\tIs probe enabled? ").append(httpConfig.isProbeEnabled()); } @@ -1653,6 +1655,6 @@ static void printAppGateway(ApplicationGateway resource) { info.append(listener.name()); } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, () -> info.toString()); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestCdn.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestCdn.java index 79d98ea846f2..e896eea3d65c 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestCdn.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestCdn.java @@ -4,6 +4,8 @@ package com.azure.resourcemanager; import com.azure.core.management.Region; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.cdn.models.CdnEndpoint; import com.azure.resourcemanager.cdn.models.CdnProfile; import com.azure.resourcemanager.cdn.models.CdnProfiles; @@ -24,6 +26,8 @@ * Test of CDN management. */ public class TestCdn extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestCdn.class); + @Override public CdnProfile createResource(CdnProfiles profiles) throws Exception { final Region region = Region.US_EAST; @@ -50,7 +54,7 @@ public CdnProfile createResource(CdnProfiles profiles) throws Exception { .attach() .create(); - Assertions.assertTrue(cdnProfile.sku().name().equals(SkuName.STANDARD_VERIZON)); + Assertions.assertEquals(cdnProfile.sku().name(), SkuName.STANDARD_VERIZON); Assertions.assertNotNull(cdnProfile.endpoints()); Assertions.assertEquals(1, cdnProfile.endpoints().size()); CdnEndpoint endpoint = cdnProfile.endpoints().get(cdnEndpointName); @@ -165,6 +169,6 @@ public void print(CdnProfile profile) { } } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestContainerInstanceWithPublicIpAddressWithSystemAssignedMSI.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestContainerInstanceWithPublicIpAddressWithSystemAssignedMSI.java index 435a4212f531..f5349b048003 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestContainerInstanceWithPublicIpAddressWithSystemAssignedMSI.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestContainerInstanceWithPublicIpAddressWithSystemAssignedMSI.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.authorization.models.BuiltInRole; import com.azure.resourcemanager.containerinstance.models.Container; import com.azure.resourcemanager.containerinstance.models.ContainerGroup; @@ -24,6 +26,8 @@ public class TestContainerInstanceWithPublicIpAddressWithSystemAssignedMSI extends TestTemplate { + private static final ClientLogger LOGGER + = new ClientLogger(TestContainerInstanceWithPublicIpAddressWithSystemAssignedMSI.class); @Override public ContainerGroup createResource(ContainerGroups containerGroups) throws Exception { @@ -104,13 +108,13 @@ public ContainerGroup createResource(ContainerGroups containerGroups) throws Exc List containerGroupList = containerGroups.listByResourceGroup(rgName).stream().collect(Collectors.toList()); - Assertions.assertTrue(containerGroupList.size() > 0); + Assertions.assertFalse(containerGroupList.isEmpty()); containerGroup.refresh(); Set containerGroupOperations = containerGroups.listOperations().stream().collect(Collectors.toSet()); // Number of supported operation can change hence don't assert with a predefined number. - Assertions.assertTrue(containerGroupOperations.size() > 0); + Assertions.assertFalse(containerGroupOperations.isEmpty()); return containerGroup; } @@ -211,6 +215,6 @@ public void print(ContainerGroup resource) { } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestDns.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestDns.java index 21b959dda73b..e6ea71a52362 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestDns.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestDns.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.dns.models.ARecordSet; import com.azure.resourcemanager.dns.models.AaaaRecordSet; import com.azure.resourcemanager.dns.models.CnameRecordSet; @@ -34,6 +36,8 @@ import static com.azure.resourcemanager.dns.models.RecordType.TXT; public class TestDns extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestDns.class); + @Override public DnsZone createResource(DnsZones dnsZones) throws Exception { final Region region = Region.US_EAST; @@ -92,8 +96,8 @@ public DnsZone createResource(DnsZones dnsZones) throws Exception { // Check Dns zone properties Assertions.assertTrue(dnsZone.name().startsWith(topLevelDomain)); - Assertions.assertTrue(dnsZone.nameServers().size() > 0); // Default '@' name servers - Assertions.assertTrue(dnsZone.tags().size() == 2); + Assertions.assertFalse(dnsZone.nameServers().isEmpty()); // Default '@' name servers + Assertions.assertEquals(2, dnsZone.tags().size()); // Check SOA record - external child resource (created by default) SoaRecordSet soaRecordSet = dnsZone.getSoaRecordSet(); @@ -106,23 +110,23 @@ public DnsZone createResource(DnsZones dnsZones) throws Exception { // Check A records PagedIterable aRecordSets = dnsZone.aRecordSets().list(); - Assertions.assertTrue(aRecordSets.stream().count() == 1); - Assertions.assertTrue(aRecordSets.iterator().next().timeToLive() == 7200); + Assertions.assertEquals(1, aRecordSets.stream().count()); + Assertions.assertEquals(7200, aRecordSets.iterator().next().timeToLive()); // Check AAAA records PagedIterable aaaaRecordSets = dnsZone.aaaaRecordSets().list(); - Assertions.assertTrue(aaaaRecordSets.stream().count() == 1); + Assertions.assertEquals(1, aaaaRecordSets.stream().count()); Assertions.assertTrue(aaaaRecordSets.iterator().next().name().startsWith("www")); - Assertions.assertTrue(aaaaRecordSets.iterator().next().ipv6Addresses().size() == 2); + Assertions.assertEquals(2, aaaaRecordSets.iterator().next().ipv6Addresses().size()); // Check MX records PagedIterable mxRecordSets = dnsZone.mxRecordSets().list(); - Assertions.assertTrue(mxRecordSets.stream().count() == 1); + Assertions.assertEquals(1, mxRecordSets.stream().count()); MxRecordSet mxRecordSet = mxRecordSets.iterator().next(); Assertions.assertNotNull(mxRecordSet); Assertions.assertTrue(mxRecordSet.name().startsWith("email")); - Assertions.assertTrue(mxRecordSet.metadata().size() == 2); - Assertions.assertTrue(mxRecordSet.records().size() == 2); + Assertions.assertEquals(2, mxRecordSet.metadata().size()); + Assertions.assertEquals(2, mxRecordSet.records().size()); for (MxRecord mxRecord : mxRecordSet.records()) { Assertions.assertTrue(mxRecord.exchange().startsWith("mail.contoso-mail-exchange1.com") || mxRecord.exchange().startsWith("mail.contoso-mail-exchange2.com")); @@ -132,23 +136,23 @@ public DnsZone createResource(DnsZones dnsZones) throws Exception { // Check NS records PagedIterable nsRecordSets = dnsZone.nsRecordSets().list(); - Assertions.assertTrue(nsRecordSets.stream().count() == 2); // One created above with name 'partners' + the default '@' + Assertions.assertEquals(2, nsRecordSets.stream().count()); // One created above with name 'partners' + the default '@' // Check TXT records PagedIterable txtRecordSets = dnsZone.txtRecordSets().list(); - Assertions.assertTrue(txtRecordSets.stream().count() == 2); + Assertions.assertEquals(2, txtRecordSets.stream().count()); // Check SRV records PagedIterable srvRecordSets = dnsZone.srvRecordSets().list(); - Assertions.assertTrue(srvRecordSets.stream().count() == 1); + Assertions.assertEquals(1, srvRecordSets.stream().count()); // Check PTR records PagedIterable ptrRecordSets = dnsZone.ptrRecordSets().list(); - Assertions.assertTrue(ptrRecordSets.stream().count() == 2); + Assertions.assertEquals(2, ptrRecordSets.stream().count()); // Check CNAME records PagedIterable cnameRecordSets = dnsZone.cNameRecordSets().list(); - Assertions.assertTrue(cnameRecordSets.stream().count() == 2); + Assertions.assertEquals(2, cnameRecordSets.stream().count()); // Check Generic record set listing PagedIterable recordSets = dnsZone.listRecordSets(); @@ -214,15 +218,15 @@ public DnsZone createResource(DnsZones dnsZones) throws Exception { Assertions.assertNotNull(recordSet); } } - Assertions.assertTrue(typeToCount.get(SOA) == 1); - Assertions.assertTrue(typeToCount.get(RecordType.A) == 1); - Assertions.assertTrue(typeToCount.get(AAAA) == 1); - Assertions.assertTrue(typeToCount.get(MX) == 1); - Assertions.assertTrue(typeToCount.get(NS) == 2); - Assertions.assertTrue(typeToCount.get(TXT) == 2); - Assertions.assertTrue(typeToCount.get(SRV) == 1); - Assertions.assertTrue(typeToCount.get(PTR) == 2); - Assertions.assertTrue(typeToCount.get(RecordType.CNAME) == 2); + Assertions.assertEquals(1, (int) typeToCount.get(SOA)); + Assertions.assertEquals(1, (int) typeToCount.get(RecordType.A)); + Assertions.assertEquals(1, (int) typeToCount.get(AAAA)); + Assertions.assertEquals(1, (int) typeToCount.get(MX)); + Assertions.assertEquals(2, (int) typeToCount.get(NS)); + Assertions.assertEquals(2, (int) typeToCount.get(TXT)); + Assertions.assertEquals(1, (int) typeToCount.get(SRV)); + Assertions.assertEquals(2, (int) typeToCount.get(PTR)); + Assertions.assertEquals(2, (int) typeToCount.get(RecordType.CNAME)); return dnsZone; } @@ -269,7 +273,7 @@ public DnsZone updateResource(DnsZone dnsZone) throws Exception { // Check NS records PagedIterable nsRecordSets = dnsZone.nsRecordSets().list(); - Assertions.assertTrue(nsRecordSets.stream().count() == 2); // One created above with name 'partners' + the default '@' + Assertions.assertEquals(2, nsRecordSets.stream().count()); // One created above with name 'partners' + the default '@' for (NsRecordSet nsRecordSet : nsRecordSets) { Assertions.assertTrue(nsRecordSet.name().startsWith("partners") || nsRecordSet.name().startsWith("@")); if (nsRecordSet.name().startsWith("partners")) { @@ -291,9 +295,9 @@ public DnsZone updateResource(DnsZone dnsZone) throws Exception { // Check SRV records PagedIterable srvRecordSets = dnsZone.srvRecordSets().list(); - Assertions.assertTrue(srvRecordSets.stream().count() == 1); + Assertions.assertEquals(1, srvRecordSets.stream().count()); SrvRecordSet srvRecordSet = srvRecordSets.iterator().next(); - Assertions.assertTrue(srvRecordSet.records().size() == 4); + Assertions.assertEquals(4, srvRecordSet.records().size()); for (SrvRecord srvRecord : srvRecordSet.records()) { Assertions.assertFalse(srvRecord.target().startsWith("bigbox.contoso-service.com")); } @@ -304,11 +308,11 @@ public DnsZone updateResource(DnsZone dnsZone) throws Exception { SoaRecord soaRecord = soaRecordSet.record(); Assertions.assertNotNull(soaRecord); Assertions.assertEquals(soaRecord.minimumTtl(), Long.valueOf(600)); - Assertions.assertTrue(soaRecordSet.timeToLive() == 7200); + Assertions.assertEquals(7200, soaRecordSet.timeToLive()); // Check MX records PagedIterable mxRecordSets = dnsZone.mxRecordSets().list(); - Assertions.assertTrue(mxRecordSets.stream().count() == 2); + Assertions.assertEquals(2, mxRecordSets.stream().count()); dnsZone.update() .updateMXRecordSet("email") @@ -320,11 +324,11 @@ public DnsZone updateResource(DnsZone dnsZone) throws Exception { .withTag("d", "dd") .apply(); - Assertions.assertTrue(dnsZone.tags().size() == 3); + Assertions.assertEquals(3, dnsZone.tags().size()); // Check "mail" MX record MxRecordSet mxRecordSet = dnsZone.mxRecordSets().getByName("email"); - Assertions.assertTrue(mxRecordSet.records().size() == 1); - Assertions.assertTrue(mxRecordSet.metadata().size() == 3); + Assertions.assertEquals(1, mxRecordSet.records().size()); + Assertions.assertEquals(3, mxRecordSet.metadata().size()); Assertions.assertTrue(mxRecordSet.records().get(0).exchange().startsWith("mail.contoso-mail-exchange1.com")); return dnsZone; @@ -452,11 +456,11 @@ public void print(DnsZone dnsZone) { .append("\n\t\tTTL (seconds): ").append(txtRecordSet.timeToLive()) .append("\n\t\tRecords: "); for (TxtRecord txtRecord : txtRecordSet.records()) { - if (txtRecord.value().size() > 0) { + if (!txtRecord.value().isEmpty()) { info.append("\n\t\t\tValue: ").append(txtRecord.value().get(0)); } } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, () -> info.toString()); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestExpressRouteCircuit.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestExpressRouteCircuit.java index 8226a805d24f..6c0edc1c2499 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestExpressRouteCircuit.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestExpressRouteCircuit.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.ExpressRouteCircuit; import com.azure.resourcemanager.network.models.ExpressRouteCircuitSkuType; import com.azure.resourcemanager.network.models.ExpressRouteCircuits; @@ -13,6 +15,8 @@ /** Tests Express Route Circuit. */ public class TestExpressRouteCircuit { + private static final ClientLogger LOGGER = new ClientLogger(TestExpressRouteCircuit.class); + private String testId = ""; private static final Region REGION = Region.ASIA_SOUTHEAST; private String circuitName; @@ -54,7 +58,7 @@ public ExpressRouteCircuit updateResource(ExpressRouteCircuit resource) throws E .apply(); resource.refresh(); Assertions.assertTrue(resource.tags().containsKey("tag2")); - Assertions.assertTrue(!resource.tags().containsKey("tag1")); + Assertions.assertFalse(resource.tags().containsKey("tag1")); Assertions.assertEquals(Integer.valueOf(200), resource.serviceProviderProperties().bandwidthInMbps()); Assertions.assertEquals(ExpressRouteCircuitSkuType.PREMIUM_UNLIMITEDDATA, resource.sku()); @@ -131,18 +135,8 @@ public void print(ExpressRouteCircuit resource) { } private static void printExpressRouteCircuit(ExpressRouteCircuit resource) { - StringBuilder info = new StringBuilder(); - info - .append("Express Route Circuit: ") - .append(resource.id()) - .append("\n\tName: ") - .append(resource.name()) - .append("\n\tResource group: ") - .append(resource.resourceGroupName()) - .append("\n\tRegion: ") - .append(resource.regionName()) - .append("\n\tTags: ") - .append(resource.tags()); - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, () -> "Express Route Circuit: " + resource.id() + "\n\tName: " + resource.name() + + "\n\tResource group: " + resource.resourceGroupName() + "\n\tRegion: " + resource.regionName() + + "\n\tTags: " + resource.tags()); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestLoadBalancer.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestLoadBalancer.java index 867de9bf56c5..5683b621229c 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestLoadBalancer.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestLoadBalancer.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.compute.models.AvailabilitySet; import com.azure.resourcemanager.compute.models.AvailabilitySetSkuTypes; import com.azure.resourcemanager.compute.models.KnownLinuxVirtualMachineImage; @@ -45,6 +47,8 @@ /** Test of load balancer management. */ public class TestLoadBalancer { + private static final ClientLogger LOGGER = new ClientLogger(TestLoadBalancer.class); + String testId = ""; Region region = Region.US_WEST; String groupName = ""; @@ -367,10 +371,10 @@ public LoadBalancer updateResource(LoadBalancer resource) throws Exception { // Remove the NIC associations nic1.update().withoutLoadBalancerBackends().withoutLoadBalancerInboundNatRules().apply(); - Assertions.assertTrue(nic1.primaryIPConfiguration().listAssociatedLoadBalancerBackends().size() == 0); + Assertions.assertEquals(0, nic1.primaryIPConfiguration().listAssociatedLoadBalancerBackends().size()); nic2.update().withoutLoadBalancerBackends().withoutLoadBalancerInboundNatRules().apply(); - Assertions.assertTrue(nic2.primaryIPConfiguration().listAssociatedLoadBalancerBackends().size() == 0); + Assertions.assertEquals(0, nic2.primaryIPConfiguration().listAssociatedLoadBalancerBackends().size()); // Update the load balancer ensurePIPs(resource.manager().publicIpAddresses()); @@ -542,7 +546,7 @@ public LoadBalancer updateResource(LoadBalancer resource) throws Exception { // Verify backends Assertions.assertTrue(resource.backends().containsKey("backend2")); - Assertions.assertTrue(!resource.backends().containsKey(backend.name())); + Assertions.assertFalse(resource.backends().containsKey(backend.name())); // Verify NAT rules Assertions.assertTrue(resource.inboundNatRules().isEmpty()); @@ -705,7 +709,7 @@ public LoadBalancer updateResource(LoadBalancer resource) throws Exception { // Verify backends Assertions.assertEquals(1, resource.backends().size()); Assertions.assertTrue(resource.backends().containsKey("backend2")); - Assertions.assertTrue(!resource.backends().containsKey(backend.name())); + Assertions.assertFalse(resource.backends().containsKey(backend.name())); // Verify load balancing rules lbRule = resource.loadBalancingRules().get("lbrule1"); @@ -1023,23 +1027,18 @@ public LoadBalancer updateResource(LoadBalancer resource) throws Exception { } // Create VNet for the LB - private Map ensurePIPs(PublicIpAddresses pips) throws Exception { + private Map ensurePIPs(PublicIpAddresses pips) { List> creatablePips = new ArrayList<>(); - for (int i = 0; i < pipNames.length; i++) { - creatablePips - .add( - pips - .define(pipNames[i]) - .withRegion(region) - .withNewResourceGroup(groupName) - .withLeafDomainLabel(pipNames[i])); + for (String pipName : pipNames) { + creatablePips.add( + pips.define(pipName).withRegion(region).withNewResourceGroup(groupName).withLeafDomainLabel(pipName)); } return pips.create(creatablePips); } // Ensure VMs for the LB - private VirtualMachine[] ensureVMs(Networks networks, ComputeManager computeManager, int count) throws Exception { + private VirtualMachine[] ensureVMs(Networks networks, ComputeManager computeManager, int count) { // Create a network for the VMs Network network = networks @@ -1311,9 +1310,9 @@ static void printLB(LoadBalancer resource) { // Show assigned load balancing rules info .append("\n\t\t\tReferenced load balancing rules: ") - .append(new ArrayList(backend.loadBalancingRules().keySet())); + .append(new ArrayList<>(backend.loadBalancingRules().keySet())); } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestLocalNetworkGateway.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestLocalNetworkGateway.java index c8bf6a47f705..952f5b94bd8a 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestLocalNetworkGateway.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestLocalNetworkGateway.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.LocalNetworkGateway; import com.azure.resourcemanager.network.models.LocalNetworkGateways; import com.azure.core.management.Region; @@ -10,6 +12,8 @@ /** Tests Local Network Gateway. */ public class TestLocalNetworkGateway extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestLocalNetworkGateway.class); + private String testId = ""; private static final Region REGION = Region.US_NORTH_CENTRAL; private String groupName; @@ -51,7 +55,7 @@ public LocalNetworkGateway updateResource(LocalNetworkGateway gateway) throws Ex Assertions.assertFalse(gateway.addressSpaces().contains("192.168.3.0/24")); Assertions.assertEquals("40.71.184.216", gateway.ipAddress()); Assertions.assertTrue(gateway.tags().containsKey("tag2")); - Assertions.assertTrue(!gateway.tags().containsKey("tag1")); + Assertions.assertFalse(gateway.tags().containsKey("tag1")); gateway.updateTags().withoutTag("tag2").withTag("tag3", "value3").applyTags(); Assertions.assertFalse(gateway.tags().containsKey("tag2")); Assertions.assertEquals("value3", gateway.tags().get("tag3")); @@ -75,10 +79,10 @@ public void print(LocalNetworkGateway gateway) { if (!gateway.addressSpaces().isEmpty()) { info.append("\n\tAddress spaces:"); for (String addressSpace : gateway.addressSpaces()) { - info.append("\n\t\t" + addressSpace); + info.append("\n\t\t").append(addressSpace); } } info.append("\n\tTags: ").append(gateway.tags()); - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNSG.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNSG.java index 912d39298b15..233d88f9c0ac 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNSG.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNSG.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.ApplicationSecurityGroup; import com.azure.resourcemanager.network.models.NetworkInterface; import com.azure.resourcemanager.network.models.NetworkSecurityGroup; @@ -17,6 +19,8 @@ /** Test for network security group CRUD. */ public class TestNSG extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestNSG.class); + @Override public NetworkSecurityGroup createResource(NetworkSecurityGroups nsgs) throws Exception { String postFix = nsgs.manager().resourceManager().internalContext().randomResourceName("", 8); @@ -61,7 +65,7 @@ public NetworkSecurityGroup createResource(NetworkSecurityGroups nsgs) throws Ex .createAsync(); resourceStream - .doOnSuccess((_ignore) -> System.out.print("completed")); + .doOnSuccess((_ignore) -> LOGGER.log(LogLevel.VERBOSE, () -> "completed")); NetworkSecurityGroup nsg = resourceStream.block(); @@ -80,8 +84,8 @@ public NetworkSecurityGroup createResource(NetworkSecurityGroups nsgs) throws Ex nsg.refresh(); // Verify - Assertions.assertTrue(nsg.region().equals(region)); - Assertions.assertTrue(nsg.securityRules().size() == 2); + Assertions.assertEquals(nsg.region(), region); + Assertions.assertEquals(2, nsg.securityRules().size()); // Confirm NIC association Assertions.assertEquals(1, nsg.networkInterfaceIds().size()); @@ -191,7 +195,7 @@ public static void printNSG(NetworkSecurityGroup resource) { // Output associated subnets info.append("\n\tAssociated subnets: "); List subnets = resource.listAssociatedSubnets(); - if (subnets == null || subnets.size() == 0) { + if (subnets == null || subnets.isEmpty()) { info.append("(None)"); } else { for (Subnet subnet : subnets) { @@ -203,7 +207,7 @@ public static void printNSG(NetworkSecurityGroup resource) { } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } @Override diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetwork.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetwork.java index 9cba6692de9f..61e2ca7f1120 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetwork.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetwork.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.Network; import com.azure.resourcemanager.network.models.NetworkPeering; import com.azure.resourcemanager.network.models.NetworkPeeringGatewayUse; @@ -23,6 +25,8 @@ /** Test of virtual network management. */ public class TestNetwork { + private static final ClientLogger LOGGER = new ClientLogger(TestNetwork.class); + /** Test of network with subnets. */ public class WithSubnets extends TestTemplate { @Override @@ -484,13 +488,13 @@ public static void printNetwork(Network resource) { // Output services with access Map> services = subnet.servicesWithAccess(); - if (services.size() > 0) { + if (!services.isEmpty()) { info.append("\n\tServices with access"); for (Map.Entry> service : services.entrySet()) { - info - .append("\n\t\tService: ") + info.append("\n\t\tService: ") .append(service.getKey()) - .append(" Regions: " + service.getValue() + ""); + .append(" Regions: ") + .append(service.getValue()); } } } @@ -512,6 +516,6 @@ public static void printNetwork(Network resource) { .append(peering.gatewayUse()); } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetworkInterface.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetworkInterface.java index e06d10395e17..49a9451b3333 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetworkInterface.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetworkInterface.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.LoadBalancerBackend; import com.azure.resourcemanager.network.models.LoadBalancerInboundNatRule; import com.azure.resourcemanager.network.models.Network; @@ -15,6 +17,8 @@ import org.junit.jupiter.api.Assertions; public class TestNetworkInterface extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestNetworkInterface.class); + @Override public NetworkInterface createResource(NetworkInterfaces networkInterfaces) throws Exception { @@ -199,7 +203,7 @@ public static void printNic(NetworkInterface resource) { } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } @Override diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetworkWatcher.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetworkWatcher.java index 1897af7112fa..27fe629849b1 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetworkWatcher.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestNetworkWatcher.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.compute.models.KnownLinuxVirtualMachineImage; import com.azure.resourcemanager.compute.models.VirtualMachine; import com.azure.resourcemanager.compute.models.VirtualMachineSizeTypes; @@ -28,6 +30,8 @@ /** Tests Network Watcher. */ public class TestNetworkWatcher extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestNetworkWatcher.class); + private String testId = ""; private static final Region REGION = Region.EUROPE_NORTH; private String groupName; @@ -169,19 +173,9 @@ StorageAccount ensureStorageAccount(StorageAccounts storageAccounts) { @Override public void print(NetworkWatcher nw) { - StringBuilder info = new StringBuilder(); - info - .append("Network Watcher: ") - .append(nw.id()) - .append("\n\tName: ") - .append(nw.name()) - .append("\n\tResource group: ") - .append(nw.resourceGroupName()) - .append("\n\tRegion: ") - .append(nw.regionName()) - .append("\n\tTags: ") - .append(nw.tags()); - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, () -> "Network Watcher: " + nw.id() + "\n\tName: " + nw.name() + + "\n\tResource group: " + nw.resourceGroupName() + "\n\tRegion: " + nw.regionName() + "\n\tTags: " + + nw.tags()); } public String groupName() { diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPrivateDns.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPrivateDns.java index c31fdd62a87e..01ae80cd352f 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPrivateDns.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPrivateDns.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.privatedns.models.ARecordSet; import com.azure.resourcemanager.privatedns.models.AaaaRecordSet; import com.azure.resourcemanager.privatedns.models.CnameRecordSet; @@ -32,6 +34,8 @@ import static com.azure.resourcemanager.privatedns.models.RecordType.TXT; public class TestPrivateDns extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestPrivateDns.class); + @Override public PrivateDnsZone createResource(PrivateDnsZones resources) throws Exception { final Region region = Region.US_EAST; @@ -84,7 +88,7 @@ public PrivateDnsZone createResource(PrivateDnsZones resources) throws Exception // Check Dns zone properties Assertions.assertTrue(resource.name().startsWith(topLevelDomain)); - Assertions.assertTrue(resource.tags().size() == 2); + Assertions.assertEquals(2, resource.tags().size()); // Check SOA record - external child resource (created by default) SoaRecordSet soaRecordSet = resource.getSoaRecordSet(); @@ -97,23 +101,23 @@ public PrivateDnsZone createResource(PrivateDnsZones resources) throws Exception // Check A records PagedIterable aRecordSets = resource.aRecordSets().list(); - Assertions.assertTrue(aRecordSets.stream().count() == 1); - Assertions.assertTrue(aRecordSets.iterator().next().timeToLive() == 7200); + Assertions.assertEquals(1, aRecordSets.stream().count()); + Assertions.assertEquals(7200, aRecordSets.iterator().next().timeToLive()); // Check AAAA records PagedIterable aaaaRecordSets = resource.aaaaRecordSets().list(); - Assertions.assertTrue(aaaaRecordSets.stream().count() == 1); + Assertions.assertEquals(1, aaaaRecordSets.stream().count()); Assertions.assertTrue(aaaaRecordSets.iterator().next().name().startsWith("www")); - Assertions.assertTrue(aaaaRecordSets.iterator().next().ipv6Addresses().size() == 2); + Assertions.assertEquals(2, aaaaRecordSets.iterator().next().ipv6Addresses().size()); // Check MX records PagedIterable mxRecordSets = resource.mxRecordSets().list(); - Assertions.assertTrue(mxRecordSets.stream().count() == 1); + Assertions.assertEquals(1, mxRecordSets.stream().count()); MxRecordSet mxRecordSet = mxRecordSets.iterator().next(); Assertions.assertNotNull(mxRecordSet); Assertions.assertTrue(mxRecordSet.name().startsWith("email")); - Assertions.assertTrue(mxRecordSet.metadata().size() == 2); - Assertions.assertTrue(mxRecordSet.records().size() == 2); + Assertions.assertEquals(2, mxRecordSet.metadata().size()); + Assertions.assertEquals(2, mxRecordSet.records().size()); for (MxRecord mxRecord : mxRecordSet.records()) { Assertions.assertTrue(mxRecord.exchange().startsWith("mail.contoso-mail-exchange1.com") || mxRecord.exchange().startsWith("mail.contoso-mail-exchange2.com")); @@ -123,19 +127,19 @@ public PrivateDnsZone createResource(PrivateDnsZones resources) throws Exception // Check TXT records PagedIterable txtRecordSets = resource.txtRecordSets().list(); - Assertions.assertTrue(txtRecordSets.stream().count() == 2); + Assertions.assertEquals(2, txtRecordSets.stream().count()); // Check SRV records PagedIterable srvRecordSets = resource.srvRecordSets().list(); - Assertions.assertTrue(srvRecordSets.stream().count() == 1); + Assertions.assertEquals(1, srvRecordSets.stream().count()); // Check PTR records PagedIterable ptrRecordSets = resource.ptrRecordSets().list(); - Assertions.assertTrue(ptrRecordSets.stream().count() == 2); + Assertions.assertEquals(2, ptrRecordSets.stream().count()); // Check CNAME records PagedIterable cnameRecordSets = resource.cnameRecordSets().list(); - Assertions.assertTrue(cnameRecordSets.stream().count() == 2); + Assertions.assertEquals(2, cnameRecordSets.stream().count()); // Check Generic record set listing PagedIterable recordSets = resource.listRecordSets(); @@ -195,14 +199,14 @@ public PrivateDnsZone createResource(PrivateDnsZones resources) throws Exception Assertions.assertNotNull(recordSet); } } - Assertions.assertTrue(typeToCount.get(SOA) == 1); - Assertions.assertTrue(typeToCount.get(RecordType.A) == 1); - Assertions.assertTrue(typeToCount.get(AAAA) == 1); - Assertions.assertTrue(typeToCount.get(MX) == 1); - Assertions.assertTrue(typeToCount.get(TXT) == 2); - Assertions.assertTrue(typeToCount.get(SRV) == 1); - Assertions.assertTrue(typeToCount.get(PTR) == 2); - Assertions.assertTrue(typeToCount.get(RecordType.CNAME) == 2); + Assertions.assertEquals(1, (int) typeToCount.get(SOA)); + Assertions.assertEquals(1, (int) typeToCount.get(RecordType.A)); + Assertions.assertEquals(1, (int) typeToCount.get(AAAA)); + Assertions.assertEquals(1, (int) typeToCount.get(MX)); + Assertions.assertEquals(2, (int) typeToCount.get(TXT)); + Assertions.assertEquals(1, (int) typeToCount.get(SRV)); + Assertions.assertEquals(2, (int) typeToCount.get(PTR)); + Assertions.assertEquals(2, (int) typeToCount.get(RecordType.CNAME)); return resource; } @@ -254,9 +258,9 @@ public PrivateDnsZone updateResource(PrivateDnsZone resource) throws Exception { // Check SRV records PagedIterable srvRecordSets = resource.srvRecordSets().list(); - Assertions.assertTrue(srvRecordSets.stream().count() == 1); + Assertions.assertEquals(1, srvRecordSets.stream().count()); SrvRecordSet srvRecordSet = srvRecordSets.iterator().next(); - Assertions.assertTrue(srvRecordSet.records().size() == 4); + Assertions.assertEquals(4, srvRecordSet.records().size()); for (SrvRecord srvRecord : srvRecordSet.records()) { Assertions.assertFalse(srvRecord.target().startsWith("bigbox.contoso-service.com")); } @@ -267,11 +271,11 @@ public PrivateDnsZone updateResource(PrivateDnsZone resource) throws Exception { SoaRecord soaRecord = soaRecordSet.record(); Assertions.assertNotNull(soaRecord); Assertions.assertEquals(soaRecord.minimumTtl(), Long.valueOf(600)); - Assertions.assertTrue(soaRecordSet.timeToLive() == 7200); + Assertions.assertEquals(7200, soaRecordSet.timeToLive()); // Check MX records PagedIterable mxRecordSets = resource.mxRecordSets().list(); - Assertions.assertTrue(mxRecordSets.stream().count() == 2); + Assertions.assertEquals(2, mxRecordSets.stream().count()); resource.update() .updateMxRecordSet("email") @@ -283,11 +287,11 @@ public PrivateDnsZone updateResource(PrivateDnsZone resource) throws Exception { .withTag("d", "dd") .apply(); - Assertions.assertTrue(resource.tags().size() == 3); + Assertions.assertEquals(3, resource.tags().size()); // Check "mail" MX record MxRecordSet mxRecordSet = resource.mxRecordSets().getByName("email"); - Assertions.assertTrue(mxRecordSet.records().size() == 1); - Assertions.assertTrue(mxRecordSet.metadata().size() == 3); + Assertions.assertEquals(1, mxRecordSet.records().size()); + Assertions.assertEquals(3, mxRecordSet.metadata().size()); Assertions.assertTrue(mxRecordSet.records().get(0).exchange().startsWith("mail.contoso-mail-exchange1.com")); return resource; @@ -399,11 +403,11 @@ public void print(PrivateDnsZone resource) { .append("\n\t\tTTL (seconds): ").append(txtRecordSet.timeToLive()) .append("\n\t\tRecords: "); for (TxtRecord txtRecord : txtRecordSet.records()) { - if (txtRecord.value().size() > 0) { + if (!txtRecord.value().isEmpty()) { info.append("\n\t\t\tValue: ").append(txtRecord.value().get(0)); } } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPublicIPAddress.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPublicIPAddress.java index 0d0b58b9436d..bcea20410bed 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPublicIPAddress.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPublicIPAddress.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.LoadBalancer; import com.azure.resourcemanager.network.models.LoadBalancerPublicFrontend; import com.azure.resourcemanager.network.models.NetworkInterface; @@ -13,6 +15,8 @@ /** Tests public IPs. */ public class TestPublicIPAddress extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestPublicIPAddress.class); + @Override public PublicIpAddress createResource(PublicIpAddresses pips) throws Exception { final String newPipName = pips.manager().resourceManager().internalContext().randomResourceName("pip", 10); @@ -44,7 +48,7 @@ public PublicIpAddress updateResource(PublicIpAddress resource) throws Exception .withTag("tag2", "value2") .apply(); Assertions.assertTrue(resource.leafDomainLabel().equalsIgnoreCase(updatedDnsName)); - Assertions.assertTrue(resource.idleTimeoutInMinutes() == updatedIdleTimeout); + Assertions.assertEquals(updatedIdleTimeout, resource.idleTimeoutInMinutes()); Assertions.assertEquals("value2", resource.tags().get("tag2")); resource.updateTags().withoutTag("tag1").withTag("tag3", "value3").applyTags(); @@ -114,6 +118,6 @@ public static void printPIP(PublicIpAddress resource) { info.append("(None)"); } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPublicIPPrefix.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPublicIPPrefix.java index 645230b91671..c0d30fe6f0bb 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPublicIPPrefix.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestPublicIPPrefix.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.IpVersion; import com.azure.resourcemanager.network.models.PublicIpPrefix; import com.azure.resourcemanager.network.models.PublicIpPrefixSku; @@ -13,6 +15,8 @@ /** Tests public Prefixes. */ public class TestPublicIPPrefix extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestPublicIPPrefix.class); + @Override public PublicIpPrefix createResource(PublicIpPrefixes pips) throws Exception { final String newPipName = pips.manager().resourceManager().internalContext().randomResourceName("pip", 10); @@ -26,7 +30,7 @@ public PublicIpPrefix createResource(PublicIpPrefixes pips) throws Exception { Assertions.assertEquals(pip.prefixLength(), (Integer) 28); Assertions.assertEquals(pip.sku().name().toString(), "Standard"); - Assertions.assertTrue(pip.publicIpAddressVersion() == IpVersion.IPV4); + Assertions.assertSame(pip.publicIpAddressVersion(), IpVersion.IPV4); return pip; } @@ -67,6 +71,6 @@ public static void printPIP(PublicIpPrefix resource) { info.append("(None)"); } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestRedis.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestRedis.java index 6bdc52bdad11..e2030b9d1324 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestRedis.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestRedis.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.redis.models.RedisCache; import com.azure.resourcemanager.redis.models.RedisCaches; import com.azure.core.management.Region; @@ -10,6 +12,8 @@ import reactor.core.publisher.Mono; public class TestRedis extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestRedis.class); + @Override public RedisCache createResource(RedisCaches resources) throws Exception { final String redisName = resources.manager().resourceManager().internalContext().randomResourceName("redis", 10); @@ -43,6 +47,6 @@ public RedisCache updateResource(RedisCache resource) throws Exception { @Override public void print(RedisCache resource) { - System.out.println("Redis Cache: " + resource.id() + ", Name: " + resource.name()); + LOGGER.log(LogLevel.VERBOSE, () -> "Redis Cache: " + resource.id() + ", Name: " + resource.name()); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestRouteTables.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestRouteTables.java index 551f63d06731..1ea70731a0ea 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestRouteTables.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestRouteTables.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.Route; import com.azure.resourcemanager.network.models.RouteNextHopType; import com.azure.resourcemanager.network.models.RouteTable; @@ -15,6 +17,8 @@ /** Test of virtual network management. */ public class TestRouteTables { + private static final ClientLogger LOGGER = new ClientLogger(TestRouteTables.class); + private String route1Name = "route1"; private String route2Name = "route2"; private String routeAddedName = "route3"; @@ -58,13 +62,13 @@ public RouteTable createResource(RouteTables routeTables) throws Exception { Route route1 = routeTable.routes().get(route1Name); Assertions.assertTrue(route1.destinationAddressPrefix().equalsIgnoreCase(route1AddressPrefix)); Assertions.assertTrue(route1.nextHopIpAddress().equalsIgnoreCase(virtualApplianceIp)); - Assertions.assertTrue(route1.nextHopType().equals(RouteNextHopType.VIRTUAL_APPLIANCE)); + Assertions.assertEquals(route1.nextHopType(), RouteNextHopType.VIRTUAL_APPLIANCE); Assertions.assertTrue(routeTable.routes().containsKey(route2Name)); Route route2 = routeTable.routes().get(route2Name); Assertions.assertTrue(route2.destinationAddressPrefix().equalsIgnoreCase(route2AddressPrefix)); - Assertions.assertTrue(route2.nextHopIpAddress() == null); - Assertions.assertTrue(route2.nextHopType().equals(hopType)); + Assertions.assertNull(route2.nextHopIpAddress()); + Assertions.assertEquals(route2.nextHopType(), hopType); Assertions.assertTrue(routeTable.isBgpRoutePropagationDisabled()); @@ -83,7 +87,7 @@ public RouteTable createResource(RouteTables routeTables) throws Exception { .create(); List subnets = routeTable.refresh().listAssociatedSubnets(); - Assertions.assertTrue(subnets.size() == 1); + Assertions.assertEquals(1, subnets.size()); Assertions.assertTrue(subnets.get(0).routeTableId().equalsIgnoreCase(routeTable.id())); return routeTable; } @@ -110,7 +114,7 @@ public RouteTable updateResource(RouteTable routeTable) throws Exception { Assertions.assertTrue(routeTable.tags().containsKey("tag1")); Assertions.assertTrue(routeTable.tags().containsKey("tag2")); - Assertions.assertTrue(!routeTable.routes().containsKey(route1Name)); + Assertions.assertFalse(routeTable.routes().containsKey(route1Name)); Assertions.assertTrue(routeTable.routes().containsKey(route2Name)); Assertions.assertTrue(routeTable.routes().containsKey(routeAddedName)); Assertions.assertFalse(routeTable.isBgpRoutePropagationDisabled()); @@ -126,7 +130,7 @@ public RouteTable updateResource(RouteTable routeTable) throws Exception { .apply(); List subnets = routeTable.refresh().listAssociatedSubnets(); - Assertions.assertTrue(subnets.size() == 0); + Assertions.assertEquals(0, subnets.size()); routeTable.updateTags().withoutTag("tag1").withTag("tag3", "value3").applyTags(); Assertions.assertFalse(routeTable.tags().containsKey("tag1")); @@ -189,6 +193,6 @@ public static void printRouteTable(RouteTable resource) { .append(subnet.routeTableId()); } info.append("\n\tDisable BGP route propagation: ").append(resource.isBgpRoutePropagationDisabled()); - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestSearchService.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestSearchService.java index d7cda788cbb8..ef6b4a52d942 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestSearchService.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestSearchService.java @@ -5,6 +5,8 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.management.Region; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.search.models.AdminKeyKind; import com.azure.resourcemanager.search.models.AdminKeys; import com.azure.resourcemanager.search.models.QueryKey; @@ -15,6 +17,7 @@ import org.junit.jupiter.api.Assertions; public class TestSearchService { + private static final ClientLogger LOGGER = new ClientLogger(TestSearchService.class); /** * Search service test. @@ -61,7 +64,7 @@ public SearchService updateResource(SearchService resource) throws Exception { .withPartitionCount(1) .apply(); Assertions.assertTrue(resource.tags().containsKey("tag2")); - Assertions.assertTrue(!resource.tags().containsKey("tag1")); + Assertions.assertFalse(resource.tags().containsKey("tag1")); Assertions.assertEquals(1, resource.replicaCount()); Assertions.assertEquals(1, resource.partitionCount()); Assertions.assertEquals(2, TestUtilities.getSize(resource.listQueryKeys())); @@ -117,7 +120,7 @@ public SearchService updateResource(SearchService resource) throws Exception { .withoutTag("tag1") .apply(); Assertions.assertTrue(resource.tags().containsKey("tag2")); - Assertions.assertTrue(!resource.tags().containsKey("tag1")); + Assertions.assertFalse(resource.tags().containsKey("tag1")); return resource; } @@ -158,7 +161,7 @@ public SearchService updateResource(SearchService resource) throws Exception { .withoutTag("tag1") .apply(); Assertions.assertTrue(resource.tags().containsKey("tag2")); - Assertions.assertTrue(!resource.tags().containsKey("tag1")); + Assertions.assertFalse(resource.tags().containsKey("tag1")); return resource; } @@ -202,7 +205,7 @@ public SearchService updateResource(SearchService resource) throws Exception { .withoutTag("tag1") .apply(); Assertions.assertTrue(resource.tags().containsKey("tag2")); - Assertions.assertTrue(!resource.tags().containsKey("tag1")); + Assertions.assertFalse(resource.tags().containsKey("tag1")); Assertions.assertEquals(SkuName.STANDARD, resource.sku().name()); Assertions.assertEquals(1, resource.replicaCount()); Assertions.assertEquals(1, resource.partitionCount()); @@ -247,7 +250,7 @@ public static void print(SearchService resource, String header) { stringBuilder.append("\n\t Key value: ").append(queryKey.key()); } - System.out.println(stringBuilder); + LOGGER.log(LogLevel.VERBOSE, stringBuilder::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestTemplate.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestTemplate.java index bb847d6b08d6..0f0035d66adc 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestTemplate.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestTemplate.java @@ -4,6 +4,8 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.resources.fluentcore.arm.Manager; import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsGettingById; import com.azure.resourcemanager.resources.fluentcore.arm.collection.SupportsGettingByResourceGroup; @@ -23,12 +25,13 @@ * @param Top level resource type * @param Type representing the collection of the top level resources */ -public abstract class TestTemplate< - ResourceT extends GroupableResource, ?>, +public abstract class TestTemplate, ?>, CollectionT extends SupportsListing & SupportsGettingByResourceGroup & SupportsDeletingById & SupportsGettingById & HasManager> { + private static final ClientLogger LOGGER = new ClientLogger(TestTemplate.class); + private ResourceT resource; private CollectionT collection; private ResourceGroups resourceGroups; @@ -64,7 +67,7 @@ protected TestTemplate() { public int verifyListing() throws ManagementException, IOException { PagedIterable resources = this.collection.list(); for (ResourceT r : resources) { - System.out.println("resource id: " + r.id()); + LOGGER.log(LogLevel.VERBOSE, () -> "resource id: " + r.id()); } return TestUtilities.getSize(resources); } @@ -118,7 +121,7 @@ public void runTest(CollectionT collection, ResourceGroups resourceGroups) throw // Verify creation this.resource = createResource(collection); - System.out.println("\n------------\nAfter creation:\n"); + LOGGER.log(LogLevel.VERBOSE, () -> "\n------------\nAfter creation:\n"); print(this.resource); // Verify listing @@ -127,7 +130,7 @@ public void runTest(CollectionT collection, ResourceGroups resourceGroups) throw // Verify getting this.resource = verifyGetting(); Assertions.assertNotNull(this.resource); - System.out.println("\n------------\nRetrieved resource:\n"); + LOGGER.log(LogLevel.VERBOSE, () -> "\n------------\nRetrieved resource:\n"); print(this.resource); boolean failedUpdate = false; @@ -136,11 +139,11 @@ public void runTest(CollectionT collection, ResourceGroups resourceGroups) throw try { this.resource = updateResource(this.resource); Assertions.assertNotNull(this.resource); - System.out.println("\n------------\nUpdated resource:\n"); + LOGGER.log(LogLevel.VERBOSE, () -> "\n------------\nUpdated resource:\n"); message = "Print failed"; print(this.resource); } catch (Exception e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Update failed", e); failedUpdate = true; } @@ -150,7 +153,7 @@ public void runTest(CollectionT collection, ResourceGroups resourceGroups) throw message = "Delete failed"; verifyDeleting(); } catch (Exception e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Delete failed", e); failedDelete = true; } Assertions.assertFalse(failedUpdate, message); diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestTrafficManager.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestTrafficManager.java index f0d9816d8828..71dc35953141 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestTrafficManager.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestTrafficManager.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.models.PublicIpAddress; import com.azure.resourcemanager.network.models.PublicIpAddresses; import com.azure.core.management.Region; @@ -19,6 +21,7 @@ /** Test of traffic manager management. */ public class TestTrafficManager extends TestTemplate { + private static final ClientLogger LOGGER = new ClientLogger(TestTrafficManager.class); private final PublicIpAddresses publicIpAddresses; @@ -405,6 +408,6 @@ public void print(TrafficManagerProfile profile) { .append(endpoint.routingWeight()); } } - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestUtils.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestUtils.java index 85091cc9ec6b..d9a0908fb063 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestUtils.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestUtils.java @@ -4,12 +4,16 @@ package com.azure.resourcemanager; import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.compute.models.DataDisk; import com.azure.resourcemanager.compute.models.VirtualMachine; import com.azure.resourcemanager.resources.models.ManagementLock; /** Test utilities. */ public final class TestUtils { + private static final ClientLogger LOGGER = new ClientLogger(TestUtils.class); + private TestUtils() { } @@ -22,11 +26,11 @@ public static boolean isRecordMode() { } public static void print(ManagementLock lock) { - StringBuffer info = new StringBuffer(); + StringBuilder info = new StringBuilder(); info.append("\nLock ID: ").append(lock.id()) .append("\nLocked resource ID: ").append(lock.lockedResourceId()) .append("\nLevel: ").append(lock.level()); - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } /** @@ -120,26 +124,9 @@ public static void print(VirtualMachine resource) { networkProfile.append("\n\t\tId:").append(networkInterfaceId); } - System - .out - .println( - new StringBuilder() - .append("Virtual Machine: ") - .append(resource.id()) - .append("Name: ") - .append(resource.name()) - .append("\n\tResource group: ") - .append(resource.resourceGroupName()) - .append("\n\tRegion: ") - .append(resource.region()) - .append("\n\tTags: ") - .append(resource.tags()) - .append("\n\tHardwareProfile: ") - .append("\n\t\tSize: ") - .append(resource.size()) - .append(storageProfile) - .append(osProfile) - .append(networkProfile) - .toString()); + LOGGER.log(LogLevel.VERBOSE, () -> "Virtual Machine: " + resource.id() + "Name: " + resource.name() + + "\n\tResource group: " + resource.resourceGroupName() + "\n\tRegion: " + resource.region() + "\n\tTags: " + + resource.tags() + "\n\tHardwareProfile: " + "\n\t\tSize: " + resource.size() + storageProfile + osProfile + + networkProfile); } } diff --git a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestVirtualNetworkGateway.java b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestVirtualNetworkGateway.java index b2f9099c59d8..68448d74db77 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestVirtualNetworkGateway.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/test/java/com/azure/resourcemanager/TestVirtualNetworkGateway.java @@ -3,6 +3,8 @@ package com.azure.resourcemanager; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.resourcemanager.network.NetworkManager; import com.azure.resourcemanager.network.models.LocalNetworkGateway; import com.azure.resourcemanager.network.models.Network; @@ -27,6 +29,8 @@ /** Tests Virtual Network Gateway. */ public class TestVirtualNetworkGateway { + private static final ClientLogger LOGGER = new ClientLogger(TestVirtualNetworkGateway.class); + private String testId = ""; private Region region = Region.US_NORTH_CENTRAL; private String groupName; @@ -324,7 +328,7 @@ certificateName, new File(getClass().getClassLoader().getResource(certificateNam // contains credential in the profile string String profile = vngw1.generateVpnProfile(); - System.out.println(profile); + LOGGER.log(LogLevel.VERBOSE, () -> profile); return vngw1; } @@ -359,6 +363,6 @@ static void printVirtualNetworkGateway(VirtualNetworkGateway gateway) { .append(gateway.regionName()) .append("\n\tTags: ") .append(gateway.tags()); - System.out.println(info.toString()); + LOGGER.log(LogLevel.VERBOSE, info::toString); } } diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index 6eb9e26cea40..c48fcced8334 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 11.7.0-beta.3 (Unreleased) +## 11.7.0-beta.4 (Unreleased) ### Features Added @@ -10,6 +10,27 @@ ### Other Changes +## 11.7.0-beta.3 (2024-05-07) + +### Features Added + +- Added support for `Byte[]` and `List` in `FieldBuilder` +- Added support for `HybridSearch` +- Index models added: `AIServicesVisionParameters`, `AIServicesVisionVectorizer`, `AIStudioModelCatalogName`, + `AzureMachineLearningParameters`, `AzureMachineLearningVectorizer`, `AzureOpenAIModelName`, `VectorEncodingFormat`, + `VisionVectorizeSkill` +- Search models added: `HybridCountAndFacetMode`, `HybridSearch`, `SearchScoreThreshold`, `VectorSimilarityThreshold`, + `VectorThreshold`, `VectorThresholdKind`, `VectorizableImageBinaryQuery`, `VectorizableImageUrlQuery` + +### Other Changes + +- Sample added for creating a vector fields index with reduced dimensions. + +#### Dependency Updates + +- Upgraded `azure-core` from `1.48.0` to version `1.49.0`. +- Upgraded `azure-core-http-netty` from `1.14.2` to version `1.15.0`. +- Upgraded `azure-core-serializer-json-jackson` from `1.4.11` to version `1.4.12`. ## 11.6.4 (2024-04-23) diff --git a/sdk/search/azure-search-documents/README.md b/sdk/search/azure-search-documents/README.md index be283cdbff32..c54420328ded 100644 --- a/sdk/search/azure-search-documents/README.md +++ b/sdk/search/azure-search-documents/README.md @@ -75,7 +75,7 @@ add the direct dependency to your project as follows. com.azure azure-search-documents - 11.7.0-beta.2 + 11.7.0-beta.3 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/search/azure-search-documents/pom.xml b/sdk/search/azure-search-documents/pom.xml index 974db62b9f51..55d68a917965 100644 --- a/sdk/search/azure-search-documents/pom.xml +++ b/sdk/search/azure-search-documents/pom.xml @@ -16,7 +16,7 @@ com.azure azure-search-documents - 11.7.0-beta.3 + 11.7.0-beta.4 jar @@ -103,6 +103,11 @@ 1.12.1 test + + com.azure + azure-ai-openai + 1.0.0-beta.8 + org.junit.jupiter junit-jupiter-api diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/FieldBuilder.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/FieldBuilder.java index 47680fb5bf86..27b62030f428 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/FieldBuilder.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/FieldBuilder.java @@ -54,6 +54,7 @@ public final class FieldBuilder { private static final int MAX_DEPTH = 10000; private static final Map SUPPORTED_NONE_PARAMETERIZED_TYPE = new HashMap<>(); private static final Set UNSUPPORTED_TYPES = new HashSet<>(); + private static final Set UNSUPPORTED_SERVICE_TYPES = new HashSet<>(); private static final SearchFieldDataType COLLECTION_STRING = SearchFieldDataType.collection(SearchFieldDataType.STRING); @@ -83,6 +84,7 @@ public final class FieldBuilder { SUPPORTED_NONE_PARAMETERIZED_TYPE.put(Byte.class, SearchFieldDataType.SBYTE); SUPPORTED_NONE_PARAMETERIZED_TYPE.put(short.class, SearchFieldDataType.INT16); SUPPORTED_NONE_PARAMETERIZED_TYPE.put(Short.class, SearchFieldDataType.INT16); + UNSUPPORTED_SERVICE_TYPES.add(SearchFieldDataType.BYTE); } /** diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AMLParameters.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningParameters.java similarity index 79% rename from sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AMLParameters.java rename to sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningParameters.java index bce09e0d1505..a27e14a17c3f 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AMLParameters.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningParameters.java @@ -19,7 +19,7 @@ * Specifies the properties for connecting to an AML vectorizer. */ @Fluent -public final class AMLParameters implements JsonSerializable { +public final class AzureMachineLearningParameters implements JsonSerializable { /* * (Required for no authentication or key authentication) The scoring URI of the AML service to which the JSON * payload will be sent. Only the https URI scheme is allowed. @@ -55,11 +55,11 @@ public final class AMLParameters implements JsonSerializable { private AIStudioModelCatalogName modelName; /** - * Creates an instance of AMLParameters class. + * Creates an instance of AzureMachineLearningParameters class. * * @param scoringUri the scoringUri value to set. */ - public AMLParameters(String scoringUri) { + public AzureMachineLearningParameters(String scoringUri) { this.scoringUri = scoringUri; } @@ -86,9 +86,9 @@ public String getAuthenticationKey() { * Set the authenticationKey property: (Required for key authentication) The key for the AML service. * * @param authenticationKey the authenticationKey value to set. - * @return the AMLParameters object itself. + * @return the AzureMachineLearningParameters object itself. */ - public AMLParameters setAuthenticationKey(String authenticationKey) { + public AzureMachineLearningParameters setAuthenticationKey(String authenticationKey) { this.authenticationKey = authenticationKey; return this; } @@ -110,9 +110,9 @@ public String getResourceId() { * subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace-name}/services/{service_name}. * * @param resourceId the resourceId value to set. - * @return the AMLParameters object itself. + * @return the AzureMachineLearningParameters object itself. */ - public AMLParameters setResourceId(String resourceId) { + public AzureMachineLearningParameters setResourceId(String resourceId) { this.resourceId = resourceId; return this; } @@ -132,9 +132,9 @@ public Duration getTimeout() { * call. * * @param timeout the timeout value to set. - * @return the AMLParameters object itself. + * @return the AzureMachineLearningParameters object itself. */ - public AMLParameters setTimeout(Duration timeout) { + public AzureMachineLearningParameters setTimeout(Duration timeout) { this.timeout = timeout; return this; } @@ -152,9 +152,9 @@ public String getRegion() { * Set the region property: (Optional for token authentication). The region the AML service is deployed in. * * @param region the region value to set. - * @return the AMLParameters object itself. + * @return the AzureMachineLearningParameters object itself. */ - public AMLParameters setRegion(String region) { + public AzureMachineLearningParameters setRegion(String region) { this.region = region; return this; } @@ -174,9 +174,9 @@ public AIStudioModelCatalogName getModelName() { * the provided endpoint. * * @param modelName the modelName value to set. - * @return the AMLParameters object itself. + * @return the AzureMachineLearningParameters object itself. */ - public AMLParameters setModelName(AIStudioModelCatalogName modelName) { + public AzureMachineLearningParameters setModelName(AIStudioModelCatalogName modelName) { this.modelName = modelName; return this; } @@ -194,15 +194,15 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of AMLParameters from the JsonReader. + * Reads an instance of AzureMachineLearningParameters from the JsonReader. * * @param jsonReader The JsonReader being read. - * @return An instance of AMLParameters if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. + * @return An instance of AzureMachineLearningParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the AMLParameters. + * @throws IOException If an error occurs while reading the AzureMachineLearningParameters. */ - public static AMLParameters fromJson(JsonReader jsonReader) throws IOException { + public static AzureMachineLearningParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { boolean scoringUriFound = false; String scoringUri = null; @@ -233,14 +233,15 @@ public static AMLParameters fromJson(JsonReader jsonReader) throws IOException { } } if (scoringUriFound) { - AMLParameters deserializedAMLParameters = new AMLParameters(scoringUri); - deserializedAMLParameters.authenticationKey = authenticationKey; - deserializedAMLParameters.resourceId = resourceId; - deserializedAMLParameters.timeout = timeout; - deserializedAMLParameters.region = region; - deserializedAMLParameters.modelName = modelName; - - return deserializedAMLParameters; + AzureMachineLearningParameters deserializedAzureMachineLearningParameters + = new AzureMachineLearningParameters(scoringUri); + deserializedAzureMachineLearningParameters.authenticationKey = authenticationKey; + deserializedAzureMachineLearningParameters.resourceId = resourceId; + deserializedAzureMachineLearningParameters.timeout = timeout; + deserializedAzureMachineLearningParameters.region = region; + deserializedAzureMachineLearningParameters.modelName = modelName; + + return deserializedAzureMachineLearningParameters; } throw new IllegalStateException("Missing required property: uri"); }); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AMLVectorizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningVectorizer.java similarity index 69% rename from sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AMLVectorizer.java rename to sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningVectorizer.java index 505a34a8d926..301ad886d438 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AMLVectorizer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/AzureMachineLearningVectorizer.java @@ -17,18 +17,18 @@ * vector embedding of a query string. */ @Fluent -public final class AMLVectorizer extends VectorSearchVectorizer { +public final class AzureMachineLearningVectorizer extends VectorSearchVectorizer { /* * Specifies the properties of the AML vectorizer. */ - private AMLParameters aMLParameters; + private AzureMachineLearningParameters aMLParameters; /** - * Creates an instance of AMLVectorizer class. + * Creates an instance of AzureMachineLearningVectorizer class. * * @param name the name value to set. */ - public AMLVectorizer(String name) { + public AzureMachineLearningVectorizer(String name) { super(name); } @@ -37,7 +37,7 @@ public AMLVectorizer(String name) { * * @return the aMLParameters value. */ - public AMLParameters getAMLParameters() { + public AzureMachineLearningParameters getAMLParameters() { return this.aMLParameters; } @@ -45,9 +45,9 @@ public AMLParameters getAMLParameters() { * Set the aMLParameters property: Specifies the properties of the AML vectorizer. * * @param aMLParameters the aMLParameters value to set. - * @return the AMLVectorizer object itself. + * @return the AzureMachineLearningVectorizer object itself. */ - public AMLVectorizer setAMLParameters(AMLParameters aMLParameters) { + public AzureMachineLearningVectorizer setAMLParameters(AzureMachineLearningParameters aMLParameters) { this.aMLParameters = aMLParameters; return this; } @@ -63,20 +63,20 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of AMLVectorizer from the JsonReader. + * Reads an instance of AzureMachineLearningVectorizer from the JsonReader. * * @param jsonReader The JsonReader being read. - * @return An instance of AMLVectorizer if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. + * @return An instance of AzureMachineLearningVectorizer if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties or the * polymorphic discriminator. - * @throws IOException If an error occurs while reading the AMLVectorizer. + * @throws IOException If an error occurs while reading the AzureMachineLearningVectorizer. */ - public static AMLVectorizer fromJson(JsonReader jsonReader) throws IOException { + public static AzureMachineLearningVectorizer fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { boolean nameFound = false; String name = null; - AMLParameters aMLParameters = null; + AzureMachineLearningParameters aMLParameters = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); @@ -92,16 +92,17 @@ public static AMLVectorizer fromJson(JsonReader jsonReader) throws IOException { name = reader.getString(); nameFound = true; } else if ("amlParameters".equals(fieldName)) { - aMLParameters = AMLParameters.fromJson(reader); + aMLParameters = AzureMachineLearningParameters.fromJson(reader); } else { reader.skipChildren(); } } if (nameFound) { - AMLVectorizer deserializedAMLVectorizer = new AMLVectorizer(name); - deserializedAMLVectorizer.aMLParameters = aMLParameters; + AzureMachineLearningVectorizer deserializedAzureMachineLearningVectorizer + = new AzureMachineLearningVectorizer(name); + deserializedAzureMachineLearningVectorizer.aMLParameters = aMLParameters; - return deserializedAMLVectorizer; + return deserializedAzureMachineLearningVectorizer; } throw new IllegalStateException("Missing required property: name"); }); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchServiceLimits.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchServiceLimits.java index 1a7bd1686be1..dd77354f1469 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchServiceLimits.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchServiceLimits.java @@ -52,7 +52,7 @@ public SearchServiceLimits() { /** * Get the maxFieldsPerIndex property: The maximum allowed fields per index. - * + * * @return the maxFieldsPerIndex value. */ public Integer getMaxFieldsPerIndex() { @@ -61,7 +61,7 @@ public Integer getMaxFieldsPerIndex() { /** * Set the maxFieldsPerIndex property: The maximum allowed fields per index. - * + * * @param maxFieldsPerIndex the maxFieldsPerIndex value to set. * @return the SearchServiceLimits object itself. */ @@ -73,7 +73,7 @@ public SearchServiceLimits setMaxFieldsPerIndex(Integer maxFieldsPerIndex) { /** * Get the maxFieldNestingDepthPerIndex property: The maximum depth which you can nest sub-fields in an index, * including the top-level complex field. For example, a/b/c has a nesting depth of 3. - * + * * @return the maxFieldNestingDepthPerIndex value. */ public Integer getMaxFieldNestingDepthPerIndex() { @@ -83,7 +83,7 @@ public Integer getMaxFieldNestingDepthPerIndex() { /** * Set the maxFieldNestingDepthPerIndex property: The maximum depth which you can nest sub-fields in an index, * including the top-level complex field. For example, a/b/c has a nesting depth of 3. - * + * * @param maxFieldNestingDepthPerIndex the maxFieldNestingDepthPerIndex value to set. * @return the SearchServiceLimits object itself. */ @@ -95,7 +95,7 @@ public SearchServiceLimits setMaxFieldNestingDepthPerIndex(Integer maxFieldNesti /** * Get the maxComplexCollectionFieldsPerIndex property: The maximum number of fields of type * Collection(Edm.ComplexType) allowed in an index. - * + * * @return the maxComplexCollectionFieldsPerIndex value. */ public Integer getMaxComplexCollectionFieldsPerIndex() { @@ -105,7 +105,7 @@ public Integer getMaxComplexCollectionFieldsPerIndex() { /** * Set the maxComplexCollectionFieldsPerIndex property: The maximum number of fields of type * Collection(Edm.ComplexType) allowed in an index. - * + * * @param maxComplexCollectionFieldsPerIndex the maxComplexCollectionFieldsPerIndex value to set. * @return the SearchServiceLimits object itself. */ @@ -117,7 +117,7 @@ public SearchServiceLimits setMaxComplexCollectionFieldsPerIndex(Integer maxComp /** * Get the maxComplexObjectsInCollectionsPerDocument property: The maximum number of objects in complex collections * allowed per document. - * + * * @return the maxComplexObjectsInCollectionsPerDocument value. */ public Integer getMaxComplexObjectsInCollectionsPerDocument() { @@ -127,7 +127,7 @@ public Integer getMaxComplexObjectsInCollectionsPerDocument() { /** * Set the maxComplexObjectsInCollectionsPerDocument property: The maximum number of objects in complex collections * allowed per document. - * + * * @param maxComplexObjectsInCollectionsPerDocument the maxComplexObjectsInCollectionsPerDocument value to set. * @return the SearchServiceLimits object itself. */ @@ -139,7 +139,7 @@ public Integer getMaxComplexObjectsInCollectionsPerDocument() { /** * Get the maxStoragePerIndexInBytes property: The maximum amount of storage in bytes allowed per index. - * + * * @return the maxStoragePerIndexInBytes value. */ public Long getMaxStoragePerIndexInBytes() { @@ -148,7 +148,7 @@ public Long getMaxStoragePerIndexInBytes() { /** * Set the maxStoragePerIndexInBytes property: The maximum amount of storage in bytes allowed per index. - * + * * @param maxStoragePerIndexInBytes the maxStoragePerIndexInBytes value to set. * @return the SearchServiceLimits object itself. */ @@ -165,13 +165,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeNumberField("maxComplexCollectionFieldsPerIndex", this.maxComplexCollectionFieldsPerIndex); jsonWriter.writeNumberField("maxComplexObjectsInCollectionsPerDocument", this.maxComplexObjectsInCollectionsPerDocument); - jsonWriter.writeNumberField("maxStoragePerIndexInBytes", this.maxStoragePerIndexInBytes); + jsonWriter.writeNumberField("maxStoragePerIndex", this.maxStoragePerIndexInBytes); return jsonWriter.writeEndObject(); } /** * Reads an instance of SearchServiceLimits from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of SearchServiceLimits if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -195,7 +195,7 @@ public static SearchServiceLimits fromJson(JsonReader jsonReader) throws IOExcep } else if ("maxComplexObjectsInCollectionsPerDocument".equals(fieldName)) { deserializedSearchServiceLimits.maxComplexObjectsInCollectionsPerDocument = reader.getNullable(JsonReader::getInt); - } else if ("maxStoragePerIndexInBytes".equals(fieldName)) { + } else if ("maxStoragePerIndex".equals(fieldName)) { deserializedSearchServiceLimits.maxStoragePerIndexInBytes = reader.getNullable(JsonReader::getLong); } else { reader.skipChildren(); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/VectorSearchVectorizer.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/VectorSearchVectorizer.java index 092234212721..a7b7fd0717e3 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/VectorSearchVectorizer.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/VectorSearchVectorizer.java @@ -25,7 +25,7 @@ public class VectorSearchVectorizer implements JsonSerializable com.azure azure-search-documents - 11.7.0-beta.2 + 11.7.0-beta.3 ``` [//]: # ({x-version-update-end}) @@ -97,6 +97,7 @@ The following sections provide several code snippets covering some of the most c - [Setting customer x-ms-client-request-id per API call](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/PerCallRequestIdExample.java) - [Index vector fields and perform vector search](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/VectorSearchExample.java). - [Rewrite Request URL to replace OData URL syntax with standard syntax](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchRequestUrlRewriterPolicy.java) +- [Vector search using reduced embeddings](https://github.com/Azure/azure-sdk-for-java/blob/40261403b3a75aa56a3eeaf18c2ba0fd071c87a6/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/VectorSearchReducedEmbeddings.java) ## Troubleshooting Troubleshooting steps can be found [here][SDK_README_TROUBLESHOOTING]. diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/VectorSearchReducedEmbeddings.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/VectorSearchReducedEmbeddings.java new file mode 100644 index 000000000000..e48b5cbf382c --- /dev/null +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/VectorSearchReducedEmbeddings.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.search.documents; + +import com.azure.ai.openai.OpenAIClient; +import com.azure.ai.openai.OpenAIClientBuilder; +import com.azure.ai.openai.models.Embeddings; +import com.azure.ai.openai.models.EmbeddingsOptions; +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.credential.KeyCredential; +import com.azure.core.util.Configuration; +import com.azure.core.util.Context; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.search.documents.indexes.SearchIndexClient; +import com.azure.search.documents.indexes.SearchIndexClientBuilder; +import com.azure.search.documents.indexes.SearchableField; +import com.azure.search.documents.indexes.SimpleField; +import com.azure.search.documents.indexes.models.AzureOpenAIModelName; +import com.azure.search.documents.indexes.models.AzureOpenAIParameters; +import com.azure.search.documents.indexes.models.AzureOpenAIVectorizer; +import com.azure.search.documents.indexes.models.HnswAlgorithmConfiguration; +import com.azure.search.documents.indexes.models.IndexDocumentsBatch; +import com.azure.search.documents.indexes.models.SearchField; +import com.azure.search.documents.indexes.models.SearchFieldDataType; +import com.azure.search.documents.indexes.models.SearchIndex; +import com.azure.search.documents.indexes.models.VectorSearch; +import com.azure.search.documents.indexes.models.VectorSearchProfile; +import com.azure.search.documents.models.SearchOptions; +import com.azure.search.documents.models.SearchResult; +import com.azure.search.documents.models.VectorSearchOptions; +import com.azure.search.documents.models.VectorizableTextQuery; +import com.azure.search.documents.util.SearchPagedIterable; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * This sample demonstrates how to create a vector fields index with reduced dimensions, upload reduced embeddings into + * the index, and query the documents. To accomplish this, you can utilize Azure OpenAI embedding models: a smaller and + * highly efficient {@code text-embedding-3-small} model or a larger and more powerful {@code text-embedding-3-large} + * model. These models are significantly more efficient and require less storage space. + */ +public class VectorSearchReducedEmbeddings { + public static void main(String[] args) { + SearchIndex vectorIndex = defineVectorIndex(); + + // After creating an instance of the 'SearchIndex',we need to instantiate the 'SearchIndexClient' and call the + // 'createIndex' method to create the search index. + createVectorIndex(vectorIndex); + + // Now, we can instantiate the 'SearchClient' and upload the documents to the 'Hotel' index we created earlier. + SearchClient searchClient = new SearchClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("SEARCH_ENDPOINT")) + .indexName("hotel") + .credential(new AzureKeyCredential(Configuration.getGlobalConfiguration().get("SEARCH_API_KEY"))) + .buildClient(); + + // Next, we will create sample hotel documents. The vector field requires submitting text input to an embedding + // model that converts human-readable text into a vector representation. To convert a text query string provided + // by a user into a vector representation, your application should utilize an embedding library that offers this + // functionality. + indexDocuments(searchClient, getHotelDocuments()); + + // When using 'VectorizableTextQuery', the query for a vector field should be the text that will be vectorized + // based on the 'Vectorizer' configuration in order to perform a vector search. + // + // Let's query the index and make sure everything works as implemented. You can also refer to + // https://learn.microsoft.com/azure/search/vector-search-how-to-query for more information on querying vector + // data. + } + + /** + * Let's consider the example of a 'Hotel'. First, we need to create an index for storing hotel information. In this + * index, we will define vector fields called 'DescriptionVector' and 'CategoryVector'. To configure the vector + * field, you need to provide the model dimensions, which indicate the size of the embeddings generated for this + * field. You can pass reduced dimensions and the name of the vector search profile that specifies the algorithm + * configuration, along with 'Vectorizer'. + *

+ * In order to get the reduced embeddings using either the {@code text-embedding-3-small} or + * {@code text-embedding-3-large} models, it is necessary to include the 'Dimensions' parameter. This parameter + * configures the desired number of dimensions for the output vector. Therefore, for {@link AzureOpenAIVectorizer}, + * we will retrieve the 'VectorSearchDimensions' that is already specified in the corresponding index field + * definition. However, to ensure that dimensions are only passed along in the vectorizer for a model that supports + * it, we need to pass a required property named 'ModelName'. This property enables the service to determine which + * model we are using, and dimensions will only be passed along when it is for a known supported model name. + *

+ * We will create an instace of {@code SearchIndex} and define 'Hotel' fields. + */ + public static SearchIndex defineVectorIndex() { + String vectorSearchProfileName = "my-vector-profile"; + String vectorSearchHnswConfig = "my-hnsw-vector-config"; + String deploymentId = "my-text-embedding-3-small"; + int modelDimensions = 256; // Here's the reduced model dimensions + String indexName = "hotel"; + return new SearchIndex(indexName).setFields(new SearchField("HotelId", SearchFieldDataType.STRING).setKey(true) + .setFilterable(true) + .setSortable(true) + .setFacetable(true), new SearchField("HotelName", SearchFieldDataType.STRING).setSearchable(true) + .setFilterable(true) + .setSortable(true), + new SearchField("Description", SearchFieldDataType.STRING).setSearchable(true).setFilterable(true), + new SearchField("DescriptionVector", + SearchFieldDataType.collection(SearchFieldDataType.SINGLE)).setSearchable(true) + .setFilterable(true) + .setVectorSearchDimensions(modelDimensions) + .setVectorSearchProfileName(vectorSearchProfileName), + new SearchField("Category", SearchFieldDataType.STRING).setSearchable(true) + .setFilterable(true) + .setSortable(true) + .setFacetable(true), + new SearchField("CategoryVector", SearchFieldDataType.collection(SearchFieldDataType.SINGLE)).setSearchable( + true) + .setFilterable(true) + .setVectorSearchDimensions(modelDimensions) + .setVectorSearchProfileName(vectorSearchProfileName)) + .setVectorSearch(new VectorSearch().setProfiles( + new VectorSearchProfile(vectorSearchProfileName, vectorSearchHnswConfig).setVectorizer("openai")) + .setAlgorithms(new HnswAlgorithmConfiguration(vectorSearchHnswConfig)) + .setVectorizers(Collections.singletonList(new AzureOpenAIVectorizer("openai").setAzureOpenAIParameters( + new AzureOpenAIParameters().setResourceUri( + Configuration.getGlobalConfiguration().get("OPENAI_ENDPOINT")) + .setApiKey(Configuration.getGlobalConfiguration().get("OPENAI_KEY")) + .setDeploymentId(deploymentId) + .setModelName(AzureOpenAIModelName.TEXT_EMBEDDING3LARGE))))); + } + + public static void createVectorIndex(SearchIndex vectorIndex) { + // Instantiate the 'SearchIndexClient' and call the 'createIndex' method to create the search index. + String endpoint = Configuration.getGlobalConfiguration().get("SEARCH_ENDPOINT"); + String key = Configuration.getGlobalConfiguration().get("SEARCH_API_KEY"); + AzureKeyCredential credential = new AzureKeyCredential(key); + + SearchIndexClient indexClient = new SearchIndexClientBuilder().endpoint(endpoint) + .credential(credential) + .buildClient(); + + indexClient.createIndex(vectorIndex); + } + + // Simple model type for Hotel + + /** + * Hotel model with an additional field for the vector description. + */ + public static final class VectorHotel implements JsonSerializable { + @SimpleField(isKey = true) + private String hotelId; + @SearchableField(isFilterable = true, isSortable = true, analyzerName = "en.lucene") + private String hotelName; + @SearchableField(analyzerName = "en.lucene") + private String description; + @SearchableField(vectorSearchDimensions = 256, vectorSearchProfileName = "my-vector-profile") + private List descriptionVector; + @SearchableField(isFilterable = true, isFacetable = true, isSortable = true) + private String category; + @SearchableField(vectorSearchDimensions = 256, vectorSearchProfileName = "my-vector-profile") + private List categoryVector; + + public VectorHotel() { + } + + public String getHotelId() { + return hotelId; + } + + public VectorHotel setHotelId(String hotelId) { + this.hotelId = hotelId; + return this; + } + + public String getHotelName() { + return hotelName; + } + + public VectorHotel setHotelName(String hotelName) { + this.hotelName = hotelName; + return this; + } + + public String getDescription() { + return description; + } + + public VectorHotel setDescription(String description) { + this.description = description; + return this; + } + + public List getDescriptionVector() { + return descriptionVector == null ? null : Collections.unmodifiableList(descriptionVector); + } + + public VectorHotel setDescriptionVector(List descriptionVector) { + this.descriptionVector = descriptionVector == null ? null : new ArrayList<>(descriptionVector); + return this; + } + + public String getCategory() { + return category; + } + + public VectorHotel setCategory(String category) { + this.category = category; + return this; + } + + public List getCategoryVector() { + return categoryVector == null ? null : Collections.unmodifiableList(categoryVector); + } + + public VectorHotel setCategoryVector(List categoryVector) { + this.categoryVector = categoryVector == null ? null : new ArrayList<>(categoryVector); + return this; + } + + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + return jsonWriter.writeStartObject() + .writeStringField("HotelId", hotelId) + .writeStringField("HotelName", hotelName) + .writeStringField("Description", description) + .writeArrayField("DescriptionVector", descriptionVector, JsonWriter::writeFloat) + .writeStringField("Category", category) + .writeArrayField("DescriptionVector", categoryVector, JsonWriter::writeFloat) + .writeEndObject(); + } + + public static VectorHotel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VectorHotel vectorHotel = new VectorHotel(); + + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("HotelId".equals(fieldName)) { + vectorHotel.hotelId = reader.getString(); + } else if ("HotelName".equals(fieldName)) { + vectorHotel.hotelName = reader.getString(); + } else if ("Description".equals(fieldName)) { + vectorHotel.description = reader.getString(); + } else if ("DescriptionVector".equals(fieldName)) { + vectorHotel.descriptionVector = reader.readArray(JsonReader::getFloat); + } else if ("Category".equals(fieldName)) { + vectorHotel.category = reader.getString(); + } else if ("CategoryVector".equals(fieldName)) { + vectorHotel.categoryVector = reader.readArray(JsonReader::getFloat); + } else { + reader.skipChildren(); + } + } + + return vectorHotel; + }); + } + } + + /** + * Get Embeddings using {@code azure-ai-openai} library. + *

+ * You can use Azure OpenAI embedding models, {@code text-embedding-3-small} or {@code text-embedding-3-large}, to + * get the reduced embeddings. With these models, you can specify the desired number of dimensions for the output + * vector by passing the 'Dimensions' property. This enables you to customize the output according to your needs. + *

+ * For more details about how to generate embeddings, refer to the + * documentation. + * Here's an example of how you can get embeddings using + * azure-ai-openai + * library. + */ + public static List getEmbeddings(String input) { + // Get embeddings using Azure OpenAI + String endpoint = Configuration.getGlobalConfiguration().get("OPENAI_ENDPOINT"); + String key = Configuration.getGlobalConfiguration().get("OPENAI_API_KEY"); + KeyCredential credential = new KeyCredential(key); + + OpenAIClient openAIClient = new OpenAIClientBuilder() + .endpoint(endpoint) + .credential(credential) + .buildClient(); + EmbeddingsOptions embeddingsOptions = new EmbeddingsOptions(Collections.singletonList(input)) + .setModel("my-text-embedding-3-small") + .setDimensions(256); + + Embeddings embeddings = openAIClient.getEmbeddings("my-text-embedding-3-small", embeddingsOptions); + return embeddings.getData().get(0).getEmbedding(); + } + + public static List getHotelDocuments() { + // In the sample code below, we are using 'getEmbeddings' method mentioned above to get embeddings for the + // vector fields named 'DescriptionVector' and 'CategoryVector'. + return Arrays.asList( + new VectorHotel().setHotelId("1") + .setHotelName("Fancy Stay") + .setDescription("Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a " + + "spa, and a really helpful concierge. The location is perfect -- right downtown, close to " + + "all the tourist attractions. We highly recommend this hotel.") + .setDescriptionVector(getEmbeddings( + "Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a spa, " + + "and a really helpful concierge. The location is perfect -- right downtown, close to all " + + "the tourist attractions. We highly recommend this hotel.")) + .setCategory("Luxury") + .setCategoryVector(getEmbeddings("Luxury")), + new VectorHotel().setHotelId("2") + .setHotelName("Roach Motel") + .setDescription("Cheapest hotel in town. Infact, a motel.") + .setDescriptionVector(getEmbeddings("Cheapest hotel in town. Infact, a motel.")) + .setCategory("Budget") + .setCategoryVector(getEmbeddings("Budget")) + // Add more hotel documents here... + ); + } + + public static void indexDocuments(SearchClient searchClient, List hotelDocuments) { + searchClient.indexDocuments(new IndexDocumentsBatch().addUploadActions(hotelDocuments)); + } + + /** + * In this vector query, the 'VectorQueries' contains the vectorizable text of the query input. The 'Fields' + * property specifies which vector fields are searched. The 'KNearestNeighborsCount' property specifies the number + * of nearest neighbors to return as top hits. + */ + public static void vectorSearch(SearchClient searchClient) { + SearchPagedIterable response = searchClient.search(null, new SearchOptions() + .setVectorSearchOptions(new VectorSearchOptions() + .setQueries(new VectorizableTextQuery("Luxury hotels in town") + .setKNearestNeighborsCount(3) + .setFields("DescriptionVector"))), Context.NONE); + + int count = 0; + System.out.println("Vector Search Results:"); + + for (SearchResult result : response) { + count++; + VectorHotel doc = result.getDocument(VectorHotel.class); + System.out.println(doc.getHotelId() + ": " + doc.getHotelName()); + } + + System.out.println("Total number of search results: " + count); + } +} diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/FieldBuilderTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/FieldBuilderTests.java index 7aad823cce5f..f01ddf6a69b6 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/FieldBuilderTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/indexes/FieldBuilderTests.java @@ -126,7 +126,7 @@ public void ignoredPropertyName() { public void supportedFields() { List fields = SearchIndexClient.buildSearchFields(AllSupportedFields.class, null); - assertEquals(23, fields.size()); + assertEquals(25, fields.size()); Map fieldToDataType = fields.stream() .collect(Collectors.toMap(SearchField::getName, SearchField::getType)); @@ -154,6 +154,9 @@ public void supportedFields() { assertEquals(SearchFieldDataType.INT16, fieldToDataType.get("primitiveShort")); assertEquals(SearchFieldDataType.SBYTE, fieldToDataType.get("nullableByte")); assertEquals(SearchFieldDataType.SBYTE, fieldToDataType.get("primitiveByte")); + assertEquals(SearchFieldDataType.collection(SearchFieldDataType.SBYTE), fieldToDataType.get("byteArray")); + assertEquals(SearchFieldDataType.collection(SearchFieldDataType.SBYTE), fieldToDataType.get("byteList")); + } @SuppressWarnings({"unused", "UseOfObsoleteDateTimeApi"}) @@ -296,6 +299,18 @@ public byte getPrimitiveByte() { public Byte getNullableByte() { return nullableByte; } + + // 24. name = 'byteArray', OData type = COMPLEX + private byte[] byteArray; + public byte[] getByteArray() { + return byteArray; + } + + // 25. name = 'byteList', OData type = COMPLEX + private List byteList; + public List getByteList() { + return byteList; + } } @Test public void validNormalizerField() { diff --git a/sdk/search/azure-search-documents/swagger/README.md b/sdk/search/azure-search-documents/swagger/README.md index 9be65913d502..243c95197879 100644 --- a/sdk/search/azure-search-documents/swagger/README.md +++ b/sdk/search/azure-search-documents/swagger/README.md @@ -216,17 +216,6 @@ directive: return $; ``` -### Rename `maxStoragePerIndex` property to `maxStoragePerIndexInBytes` in ServiceLimits - -``` yaml $(tag) == 'searchservice' -directive: - - from: swagger-document - where: $.definitions.ServiceLimits.properties - transform: > - $.maxStoragePerIndexInBytes = $.maxStoragePerIndex; - delete $.maxStoragePerIndex; -``` - ### Set `hybridSearch` property to be type `HybridSearch` in SearchRequest ``` yaml $(tag) == 'searchindex' @@ -264,6 +253,7 @@ directive: transform: > $.ServiceCounters["x-ms-client-name"] = "SearchServiceCounters"; $.ServiceLimits["x-ms-client-name"] = "SearchServiceLimits"; + $.ServiceLimits.properties.maxStoragePerIndex["x-ms-client-name"] = "maxStoragePerIndexInBytes"; $.ServiceStatistics["x-ms-client-name"] = "SearchServiceStatistics"; ``` @@ -438,3 +428,21 @@ directive: where: $.definitions.VectorQuery.properties.k transform: $["x-ms-client-name"] = "KNearestNeighborsCount"; ``` + +### Rename `AMLVectorizer` to `AzureMachineLearningVectorizer` + +```yaml $(tag) == 'searchservice' +directive: +- from: swagger-document + where: $.definitions.AMLVectorizer + transform: $["x-ms-client-name"] = "AzureMachineLearningVectorizer"; +``` + +### Rename `AMLParameters` to `AzureMachineLearningParameters` + +```yaml $(tag) == 'searchservice' +directive: +- from: swagger-document + where: $.definitions.AMLParameters + transform: $["x-ms-client-name"] = "AzureMachineLearningParameters"; +``` diff --git a/sdk/search/azure-search-perf/pom.xml b/sdk/search/azure-search-perf/pom.xml index 99c82327d705..89de330df1ed 100644 --- a/sdk/search/azure-search-perf/pom.xml +++ b/sdk/search/azure-search-perf/pom.xml @@ -29,7 +29,7 @@ com.azure azure-search-documents - 11.7.0-beta.3 + 11.7.0-beta.4 diff --git a/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml b/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml index 863ce3a617b8..209473483a77 100644 --- a/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml @@ -45,7 +45,7 @@ com.azure azure-messaging-servicebus - 7.17.0-beta.1 + 7.18.0-beta.1 diff --git a/sdk/servicebus/azure-messaging-servicebus-track2-perf/pom.xml b/sdk/servicebus/azure-messaging-servicebus-track2-perf/pom.xml index ddeb33bf3870..d6ac324a524b 100644 --- a/sdk/servicebus/azure-messaging-servicebus-track2-perf/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus-track2-perf/pom.xml @@ -23,7 +23,7 @@ com.azure azure-messaging-servicebus - 7.17.0-beta.1 + 7.18.0-beta.1 com.azure diff --git a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md index 62e74ebff15c..34f6139030e7 100644 --- a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md +++ b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md @@ -1,18 +1,24 @@ # Release History -## 7.17.0-beta.1 (Unreleased) +## 7.18.0-beta.1 (Unreleased) ### Features Added ### Breaking Changes ### Bugs Fixed - - Fixes the session message disposition to use management node as fall back. ([#39913](https://github.com/Azure/azure-sdk-for-java/issues/ 39913)) - Fixes the session processor idle timeout to fall back to RetryOptions::tryTimeout. ([#39993](https://github.com/Azure/azure-sdk-for-java/issues/39993)) ### Other Changes +## 7.17.0 (2024-05-06) + +### Bugs Fixed + +- Fixes the session message disposition to use management node as fall back. ([#39913](https://github.com/Azure/azure-sdk-for-java/issues/39913)) +- Fixes the session processor idle timeout to fall back to RetryOptions::tryTimeout. ([#39993](https://github.com/Azure/azure-sdk-for-java/issues/39993)) + ## 7.16.0 (2024-04-22) ### Features Added diff --git a/sdk/servicebus/azure-messaging-servicebus/README.md b/sdk/servicebus/azure-messaging-servicebus/README.md index 4cd5ddc50248..227abebb2b8d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/README.md +++ b/sdk/servicebus/azure-messaging-servicebus/README.md @@ -69,7 +69,7 @@ add the direct dependency to your project as follows. com.azure azure-messaging-servicebus - 7.16.0 + 7.17.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/servicebus/azure-messaging-servicebus/docs/pom.xml b/sdk/servicebus/azure-messaging-servicebus/docs/pom.xml index 8940a0bd44d0..1a3222098498 100644 --- a/sdk/servicebus/azure-messaging-servicebus/docs/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus/docs/pom.xml @@ -20,7 +20,7 @@ com.azure azure-messaging-servicebus - 7.17.0-beta.1 + 7.18.0-beta.1 diff --git a/sdk/servicebus/azure-messaging-servicebus/pom.xml b/sdk/servicebus/azure-messaging-servicebus/pom.xml index e0687d632fa7..d316d54174b6 100644 --- a/sdk/servicebus/azure-messaging-servicebus/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus/pom.xml @@ -14,7 +14,7 @@ com.azure azure-messaging-servicebus - 7.17.0-beta.1 + 7.18.0-beta.1 Microsoft Azure client library for Service Bus This package contains the Microsoft Azure Service Bus client library https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTrace.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTrace.java index 8649598d6f23..a6908ec0f5ec 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTrace.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTrace.java @@ -60,7 +60,10 @@ protected void hookOnNext(ServiceBusMessageContext message) { return; } - Context span = instrumentation.startProcessInstrumentation("ServiceBus.process", message.getMessage(), Context.NONE); + Context span = instrumentation.startProcessInstrumentation("ServiceBus.process", + message.getMessage().getApplicationProperties(), + message.getMessage().getEnqueuedTime(), + Context.NONE); message.getMessage().setContext(span); AutoCloseable scope = tracer.makeSpanCurrent(span); try { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTraceV2.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTraceV2.java deleted file mode 100644 index 33c9b3021780..000000000000 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTraceV2.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.servicebus; - -import com.azure.messaging.servicebus.implementation.instrumentation.ReceiverKind; -import com.azure.messaging.servicebus.implementation.instrumentation.ServiceBusReceiverInstrumentation; -import org.reactivestreams.Subscription; -import reactor.core.CoreSubscriber; -import reactor.core.publisher.BaseSubscriber; -import reactor.core.publisher.Flux; -import reactor.core.publisher.FluxOperator; - -import java.util.Objects; - -/** - * Flux operator that traces receive and process calls - */ -final class FluxTraceV2 extends FluxOperator { - private final ServiceBusReceiverInstrumentation instrumentation; - - FluxTraceV2(Flux upstream, ServiceBusReceiverInstrumentation instrumentation) { - super(upstream); - this.instrumentation = instrumentation; - } - - @Override - public void subscribe(CoreSubscriber coreSubscriber) { - Objects.requireNonNull(coreSubscriber, "'coreSubscriber' cannot be null."); - - source.subscribe(new TracingSubscriber(coreSubscriber, instrumentation)); - } - - private static class TracingSubscriber extends BaseSubscriber { - - private final CoreSubscriber downstream; - private final ServiceBusReceiverInstrumentation instrumentation; - TracingSubscriber(CoreSubscriber downstream, ServiceBusReceiverInstrumentation instrumentation) { - this.downstream = downstream; - this.instrumentation = instrumentation; - } - - @Override - public reactor.util.context.Context currentContext() { - return downstream.currentContext(); - } - - @Override - protected void hookOnSubscribe(Subscription subscription) { - downstream.onSubscribe(this); - } - - @Override - protected void hookOnNext(ServiceBusReceivedMessage message) { - instrumentation.instrumentProcess(message, ReceiverKind.ASYNC_RECEIVER, msg -> { - downstream.onNext(msg); - return null; - }); - } - - @Override - protected void hookOnError(Throwable throwable) { - downstream.onError(throwable); - } - - @Override - protected void hookOnComplete() { - downstream.onComplete(); - } - } -} diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumer.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumer.java index 280490f15070..fcddd200a436 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumer.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumer.java @@ -49,19 +49,10 @@ class ServiceBusAsyncConsumer implements AutoCloseable { this.linkProcessor = null; this.messageSerializer = messageSerializer; - final boolean useFluxTrace = instrumentation.isEnabled() && instrumentation.isAsyncReceiverInstrumentation(); - if (useFluxTrace) { - // This ServiceBusAsyncConsumer is backing ServiceBusReceiverAsyncClient instance (client has instrumentation is enabled). - final Flux deserialize = messageFlux - .map(message -> this.messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)); - this.processor = new FluxTraceV2(deserialize, instrumentation); - } else { - // This ServiceBusAsyncConsumer is backing either - // 1. a ServiceBusReceiverAsyncClient instance (client has no instrumentation enabled) - // 2. Or a ServiceBusProcessorClient instance (processor client internally deal with instrumentation). - this.processor = messageFlux - .map(message -> this.messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)); - } + // This ServiceBusAsyncConsumer is backing ServiceBusReceiverAsyncClient instance (client has instrumentation is enabled). + final Flux deserialize = messageFlux + .map(message -> this.messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)); + this.processor = TracingFluxOperator.create(deserialize, instrumentation); } /** diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClient.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClient.java index 9cb63ce4a85f..0e7c2205227a 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClient.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClient.java @@ -274,7 +274,7 @@ private Mono acquireSpecificOrNextSession(String session, null, receiverOptions.getMaxLockRenewDuration()); final ServiceBusSingleSessionManager sessionManager = new ServiceBusSingleSessionManager(LOGGER, identifier, - sessionReceiver, receiverOptions.getPrefetchCount(), messageSerializer, connectionCacheWrapper.getRetryOptions()); + sessionReceiver, receiverOptions.getPrefetchCount(), messageSerializer, connectionCacheWrapper.getRetryOptions(), instrumentation); final ReceiverOptions newReceiverOptions = createNamedSessionOptions(receiverOptions.getReceiveMode(), receiverOptions.getPrefetchCount(), receiverOptions.getMaxLockRenewDuration(), diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSingleSessionManager.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSingleSessionManager.java index 702ac378cc5d..cccad6ed8d4d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSingleSessionManager.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSingleSessionManager.java @@ -11,7 +11,9 @@ import com.azure.core.util.logging.LoggingEventBuilder; import com.azure.messaging.servicebus.implementation.DispositionStatus; import com.azure.messaging.servicebus.implementation.MessageUtils; +import com.azure.messaging.servicebus.implementation.instrumentation.ServiceBusReceiverInstrumentation; import org.apache.qpid.proton.amqp.transport.DeliveryState; +import org.apache.qpid.proton.message.Message; import reactor.core.publisher.Flux; import reactor.core.publisher.FluxSink; import reactor.core.publisher.Mono; @@ -34,11 +36,12 @@ final class ServiceBusSingleSessionManager implements IServiceBusSessionManager private final MessageSerializer serializer; private final Duration operationTimeout; private final ServiceBusSessionReactorReceiver sessionReceiver; - private final MessageFlux messageFlux; + private final Flux messageFlux; + private final ServiceBusReceiverInstrumentation instrumentation; ServiceBusSingleSessionManager(ClientLogger logger, String identifier, ServiceBusSessionReactorReceiver sessionReceiver, int prefetch, - MessageSerializer serializer, AmqpRetryOptions retryOptions) { + MessageSerializer serializer, AmqpRetryOptions retryOptions, ServiceBusReceiverInstrumentation instrumentation) { this.logger = Objects.requireNonNull(logger, "logger cannot be null."); this.identifier = identifier; this.sessionReceiver = Objects.requireNonNull(sessionReceiver, "sessionReceiver cannot be null."); @@ -46,7 +49,10 @@ final class ServiceBusSingleSessionManager implements IServiceBusSessionManager Objects.requireNonNull(retryOptions, "retryOptions cannot be null."); this.operationTimeout = retryOptions.getTryTimeout(); final Flux messageFluxUpstream = new SessionReceiverStream(sessionReceiver).flux(); - this.messageFlux = new MessageFlux(messageFluxUpstream, prefetch, CreditFlowMode.RequestDriven, NULL_RETRY_POLICY); + this.instrumentation = Objects.requireNonNull(instrumentation, "instrumentation cannot be null"); + MessageFlux messageFluxLocal = new MessageFlux(messageFluxUpstream, prefetch, CreditFlowMode.RequestDriven, + NULL_RETRY_POLICY); + this.messageFlux = TracingFluxOperator.create(messageFluxLocal, instrumentation); } @Override diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/SessionsMessagePump.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/SessionsMessagePump.java index 2afe6d63cedc..fb3bb5d6e403 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/SessionsMessagePump.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/SessionsMessagePump.java @@ -177,7 +177,7 @@ final class SessionsMessagePump { this.processMessage = Objects.requireNonNull(processMessage, "'processMessage' cannot be null."); this.processError = Objects.requireNonNull(processError, "'processError' cannot be null."); this.onTerminate = Objects.requireNonNull(onTerminate, "'onTerminate' cannot be null."); - this.receiversTracker = new SessionReceiversTracker(logger, maxConcurrentSessions, fullyQualifiedNamespace, entityPath, receiveMode); + this.receiversTracker = new SessionReceiversTracker(logger, maxConcurrentSessions, fullyQualifiedNamespace, entityPath, receiveMode, instrumentation); this.nextSession = new NextSession(pumpId, fullyQualifiedNamespace, entityPath, sessionAcquirer).mono(); } @@ -645,14 +645,16 @@ static final class SessionReceiversTracker { private final String entityPath; private final ServiceBusReceiveMode receiveMode; private final ConcurrentHashMap receivers; + private final ServiceBusReceiverInstrumentation instrumentation; private SessionReceiversTracker(ClientLogger logger, int size, String fullyQualifiedNamespace, String entityPath, - ServiceBusReceiveMode receiveMode) { + ServiceBusReceiveMode receiveMode, ServiceBusReceiverInstrumentation instrumentation) { this.logger = logger; this.fullyQualifiedNamespace = fullyQualifiedNamespace; this.entityPath = entityPath; this.receiveMode = receiveMode; this.receivers = new ConcurrentHashMap<>(size); + this.instrumentation = instrumentation; } private void track(ServiceBusSessionReactorReceiver receiver) { @@ -749,11 +751,14 @@ private Mono updateDisposition(ServiceBusReceivedMessage message, Disposit final ServiceBusSessionReactorReceiver receiver = receivers.get(sessionId); final DeliveryState deliveryState = MessageUtils.getDeliveryState(dispositionStatus, deadLetterReason, deadLetterDescription, propertiesToModify, transactionContext); + + Mono updateDispositionMono; if (receiver != null) { - return receiver.updateDisposition(message.getLockToken(), deliveryState); + updateDispositionMono = receiver.updateDisposition(message.getLockToken(), deliveryState); } else { - return Mono.error(DeliveryNotOnLinkException.noMatchingDelivery(message.getLockToken(), deliveryState)); + updateDispositionMono = Mono.error(DeliveryNotOnLinkException.noMatchingDelivery(message.getLockToken(), deliveryState)); } + return instrumentation.instrumentSettlement(updateDispositionMono, message, message.getContext(), dispositionStatus); } private Mono checkNull(Object options, ServiceBusTransactionContext transactionContext) { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/TracingFluxOperator.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/TracingFluxOperator.java new file mode 100644 index 000000000000..830f52086389 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/TracingFluxOperator.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.servicebus; + +import com.azure.messaging.servicebus.implementation.instrumentation.ReceiverKind; +import com.azure.messaging.servicebus.implementation.instrumentation.ServiceBusReceiverInstrumentation; +import org.apache.qpid.proton.message.Message; +import org.reactivestreams.Subscription; +import reactor.core.CoreSubscriber; +import reactor.core.publisher.BaseSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.FluxOperator; + +import java.util.Objects; +import java.util.function.BiConsumer; +import java.util.function.Function; + +/** + * Flux operator that traces receive and process calls + */ +final class TracingFluxOperator extends BaseSubscriber { + + public static Flux create(Flux upstream, ServiceBusReceiverInstrumentation instrumentation) { + if (!instrumentation.isEnabled() && instrumentation.isAsyncReceiverInstrumentation()) { + return upstream; + } + + return new FluxOperator(upstream) { + @SuppressWarnings("unchecked") + @Override + public void subscribe(CoreSubscriber actual) { + Objects.requireNonNull(actual, "'actual' cannot be null."); + source.subscribe(new TracingFluxOperator(actual, (msg, handler) -> { + if (msg instanceof Message) { + instrumentation.instrumentProcess((Message) msg, ReceiverKind.ASYNC_RECEIVER, + (Function) handler); + } else if (msg instanceof ServiceBusReceivedMessage) { + instrumentation.instrumentProcess((ServiceBusReceivedMessage) msg, ReceiverKind.ASYNC_RECEIVER, + (Function) handler); + } + })); + } + }; + } + + private final CoreSubscriber downstream; + private final BiConsumer> instrumentation; + private TracingFluxOperator(CoreSubscriber downstream, BiConsumer> instrumentation) { + this.downstream = downstream; + this.instrumentation = instrumentation; + } + + @Override + public reactor.util.context.Context currentContext() { + return downstream.currentContext(); + } + + @Override + protected void hookOnSubscribe(Subscription subscription) { + downstream.onSubscribe(this); + } + + @Override + protected void hookOnNext(T message) { + instrumentation.accept(message, msg -> { + downstream.onNext(msg); + return null; + }); + } + + @Override + protected void hookOnError(Throwable throwable) { + downstream.onError(throwable); + } + + @Override + protected void hookOnComplete() { + downstream.onComplete(); + } +} + diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusReceiverInstrumentation.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusReceiverInstrumentation.java index 5cb4616c97bd..cb54adcb41a2 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusReceiverInstrumentation.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusReceiverInstrumentation.java @@ -8,16 +8,25 @@ import com.azure.core.util.tracing.Tracer; import com.azure.messaging.servicebus.ServiceBusReceivedMessage; import com.azure.messaging.servicebus.implementation.DispositionStatus; +import org.apache.qpid.proton.amqp.Symbol; +import org.apache.qpid.proton.message.Message; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Date; +import java.util.Map; import java.util.function.Function; +import static com.azure.core.amqp.AmqpMessageConstant.ENQUEUED_TIME_UTC_ANNOTATION_NAME; + /** * Contains convenience methods to instrument specific calls with traces and metrics. */ public final class ServiceBusReceiverInstrumentation { + private static final Symbol ENQUEUED_TIME_SYMBOL = Symbol.getSymbol(ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue()); private final ServiceBusMeter meter; private final ServiceBusTracer tracer; private final ReceiverKind receiverKind; @@ -67,37 +76,44 @@ public boolean isAsyncReceiverInstrumentation() { * for sync receiver. * Reports consumer lag metric. */ - public Context startProcessInstrumentation(String name, ServiceBusReceivedMessage message, Context parent) { - if (message == null || (!tracer.isEnabled() && !meter.isConsumerLagEnabled())) { + public Context startProcessInstrumentation(String name, Map applicationProperties, + OffsetDateTime enqueuedTime, Context parent) { + if (applicationProperties == null || (!tracer.isEnabled() && !meter.isConsumerLagEnabled())) { return parent; } - Context span = (tracer.isEnabled() && receiverKind != ReceiverKind.SYNC_RECEIVER) ? tracer.startProcessSpan(name, message, parent) : parent; + Context span = (tracer.isEnabled() && receiverKind != ReceiverKind.SYNC_RECEIVER) + ? tracer.startProcessSpan(name, applicationProperties, enqueuedTime, parent) + : parent; // important to record metric after span is started - meter.reportConsumerLag(message.getEnqueuedTime(), span); + meter.reportConsumerLag(enqueuedTime, span); return span; } public void instrumentProcess(ServiceBusReceivedMessage message, ReceiverKind caller, Function handleMessage) { - if (receiverKind != caller) { + if (receiverKind != caller || message == null) { handleMessage.apply(message); return; } - Context span = startProcessInstrumentation("ServiceBus.process", message, Context.NONE); + Context span = startProcessInstrumentation("ServiceBus.process", message.getApplicationProperties(), + message.getEnqueuedTime(), Context.NONE); ContextAccessor.setContext(message, span); - AutoCloseable scope = tracer.makeSpanCurrent(span); - Throwable error = null; - try { - error = handleMessage.apply(message); - } catch (Throwable t) { - error = t; - throw t; - } finally { - tracer.endSpan(error, span, scope); + wrap(span, message, handleMessage); + } + + public void instrumentProcess(Message message, ReceiverKind caller, Function handleMessage) { + if (receiverKind != caller || message == null || message.getApplicationProperties() == null) { + handleMessage.apply(message); + return; } + + Context span = startProcessInstrumentation("ServiceBus.process", message.getApplicationProperties().getValue(), + getEnqueuedTime(message), Context.NONE); + //ContextAccessor.setContext(message, span); + wrap(span, message, handleMessage); } /** @@ -145,4 +161,30 @@ private static String getSettlementSpanName(DispositionStatus status) { return "ServiceBus.unknown"; } } + + private void wrap(Context span, T message, Function handleMessage) { + AutoCloseable scope = tracer.makeSpanCurrent(span); + Throwable error = null; + try { + error = handleMessage.apply(message); + } catch (Throwable t) { + error = t; + throw t; + } finally { + tracer.endSpan(error, span, scope); + } + } + + private OffsetDateTime getEnqueuedTime(Message message) { + if (message.getMessageAnnotations() == null || message.getMessageAnnotations().getValue() == null) { + return null; + } + + Object date = message.getMessageAnnotations().getValue().get(ENQUEUED_TIME_SYMBOL); + if (date instanceof Date) { + return ((Date) date).toInstant().atOffset(ZoneOffset.UTC); + } + + return null; + } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusTracer.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusTracer.java index 4f24630ec75f..532a71a249f0 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusTracer.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusTracer.java @@ -285,13 +285,13 @@ Context startSpanWithLink(String spanName, OperationName operationName, ServiceB /** * Starts span. Used by ServiceBus*Instrumentations. */ - Context startProcessSpan(String spanName, ServiceBusReceivedMessage message, Context parent) { - if (isEnabled() && message != null) { + Context startProcessSpan(String spanName, Map applicationProperties, OffsetDateTime enqueuedTime, Context parent) { + if (isEnabled() && applicationProperties != null) { StartSpanOptions startOptions = createStartOption(SpanKind.CONSUMER, OperationName.PROCESS) - .setRemoteParent(extractContext(message.getApplicationProperties())); + .setRemoteParent(extractContext(applicationProperties)); - if (message.getEnqueuedTime() != null) { - startOptions.setAttribute(MESSAGE_ENQUEUED_TIME_ATTRIBUTE_NAME, message.getEnqueuedTime().toEpochSecond()); + if (enqueuedTime != null) { + startOptions.setAttribute(MESSAGE_ENQUEUED_TIME_ATTRIBUTE_NAME, enqueuedTime.toEpochSecond()); } return tracer.start(spanName, startOptions, parent); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySelectorTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySelectorTest.java index 7047f8138369..1dff7bec6184 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySelectorTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySelectorTest.java @@ -7,6 +7,7 @@ import com.azure.core.amqp.AmqpTransportType; import com.azure.core.util.BinaryData; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -25,6 +26,8 @@ import java.util.concurrent.TimeUnit; public class ProxySelectorTest extends IntegrationTestBase { + private static final ClientLogger LOGGER = new ClientLogger(ProxySelectorTest.class); + private static final int PROXY_PORT = 9002; private static final InetSocketAddress SIMPLE_PROXY_ADDRESS = new InetSocketAddress("localhost", PROXY_PORT); private ProxySelector defaultProxySelector; @@ -78,7 +81,7 @@ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { .expectErrorSatisfies(error -> { // The message can vary because it is returned from proton-j, so we don't want to compare against that. // This is a transient error from ExceptionUtil.java: line 67. - System.out.println("Error: " + error); + LOGGER.log(LogLevel.VERBOSE, () -> "Error", error); }) .verify(TIMEOUT); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ReceiveLinkTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ReceiveLinkTest.java index 033b74509fed..98b6c3f71787 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ReceiveLinkTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ReceiveLinkTest.java @@ -4,6 +4,8 @@ import com.azure.core.amqp.AmqpEndpointState; import com.azure.core.amqp.implementation.AmqpReceiveLink; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import org.junit.jupiter.api.AfterEach; import org.mockito.Mockito; import reactor.core.publisher.Flux; @@ -21,6 +23,8 @@ import static org.mockito.Mockito.when; public class ReceiveLinkTest { + private static final ClientLogger LOGGER = new ClientLogger(ReceiveLinkTest.class); + private final AtomicInteger counter = new AtomicInteger(); private final AmqpReceiveLink[] allLinks = new AmqpReceiveLink[4]; @@ -47,7 +51,7 @@ public void verifyCreation() { when(link2.getLinkName()).thenReturn("link2-name"); when(link2.getEndpointStates()).thenAnswer(invocation -> { - System.out.println("link2-name endpoints"); + LOGGER.log(LogLevel.VERBOSE, () -> "link2-name endpoints"); return Flux.create(sink -> { sink.onRequest(r -> sink.next(AmqpEndpointState.UNINITIALIZED)); @@ -56,7 +60,7 @@ public void verifyCreation() { when(link3.getLinkName()).thenReturn("link3-name"); when(link3.getEndpointStates()).thenAnswer(invocation -> { - System.out.println("link3-name endpoints"); + LOGGER.log(LogLevel.VERBOSE, () -> "link3-name endpoints"); return Flux.create(sink -> { // Emit uninitialized first. After 3 seconds, emit ACTIVE. sink.onRequest(r -> { @@ -88,7 +92,7 @@ private Mono getActiveLink() { }) .retryWhen(Retry.from(retrySignals -> retrySignals.flatMap(signal -> { final Throwable failure = signal.failure(); - System.err.printf(" Retry: %s. Error occurred while waiting: %s%n", signal.totalRetriesInARow(), failure); + LOGGER.verbose(" Retry: {}. Error occurred while waiting: {}", signal.totalRetriesInARow(), failure); if (failure instanceof TimeoutException) { return Mono.delay(Duration.ofSeconds(4)); } else { @@ -100,7 +104,7 @@ private Mono getActiveLink() { private Mono createReceiveLink() { int index = counter.getAndIncrement(); - System.out.println("Index: " + index); + LOGGER.log(LogLevel.VERBOSE, () -> "Index: " + index); if (index < allLinks.length) { return Mono.just(allLinks[index]); } else { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMixClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMixClientIntegrationTest.java index 0b46e7fb5473..9709bc8f7726 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMixClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMixClientIntegrationTest.java @@ -4,6 +4,7 @@ package com.azure.messaging.servicebus; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.servicebus.implementation.MessagingEntityType; import com.azure.messaging.servicebus.models.CompleteOptions; import com.azure.messaging.servicebus.models.ServiceBusReceiveMode; @@ -28,6 +29,8 @@ * Test where various clients are involved for example Sender, Receiver and Processor client. */ public class ServiceBusMixClientIntegrationTest extends IntegrationTestBase { + private static final ClientLogger LOGGER = new ClientLogger(ServiceBusMixClientIntegrationTest.class); + private ServiceBusSenderAsyncClient sender; private ServiceBusReceiverAsyncClient receiver; private final AtomicInteger messagesPending = new AtomicInteger(); @@ -106,7 +109,7 @@ void crossEntityQueueTransaction(boolean isSessionEnabled) throws InterruptedExc receivedMessages.incrementAndGet(); messagesPending.incrementAndGet(); ServiceBusReceivedMessage myMessage = context.getMessage(); - System.out.printf("Processing message. MessageId: %s, Sequence #: %s. Contents: %s %n", myMessage.getMessageId(), + LOGGER.verbose("Processing message. MessageId: {}, Sequence #: {}. Contents: {}", myMessage.getMessageId(), myMessage.getSequenceNumber(), myMessage.getBody()); if (receivedMessages.get() == 1) { @@ -122,12 +125,12 @@ void crossEntityQueueTransaction(boolean isSessionEnabled) throws InterruptedExc }; Consumer processError = context -> { - System.out.printf("Error when receiving messages from namespace: '%s'. Entity: '%s'. Error Source: '%s' %n", + LOGGER.verbose("Error when receiving messages from namespace: '{}'. Entity: '{}'. Error Source: '{}'", context.getFullyQualifiedNamespace(), context.getEntityPath(), context.getErrorSource()); Assertions.fail("Failed processing of message.", context.getException()); if (!(context.getException() instanceof ServiceBusException)) { - System.out.printf("Non-ServiceBusException occurred: %s%n", context.getException()); + LOGGER.log(LogLevel.VERBOSE, () -> "Non-ServiceBusException occurred: " + context.getException()); } }; @@ -150,17 +153,17 @@ void crossEntityQueueTransaction(boolean isSessionEnabled) throws InterruptedExc // Create an instance of the processor through the ServiceBusClientBuilder // Act - System.out.println("Starting the processor"); + LOGGER.log(LogLevel.VERBOSE, () -> "Starting the processor"); processorA.start(); toClose((AutoCloseable) () -> processorA.stop()); // Assert - System.out.println("Listening for 10 seconds..."); + LOGGER.log(LogLevel.VERBOSE, () -> "Listening for 10 seconds..."); if (countdownLatch.await(10, TimeUnit.SECONDS)) { - System.out.println("Completed processing successfully."); + LOGGER.log(LogLevel.VERBOSE, () -> "Completed processing successfully."); Assertions.assertTrue(transactionComplete.get()); } else { - System.out.println("Closing processor."); + LOGGER.log(LogLevel.VERBOSE, () -> "Closing processor."); Assertions.fail("Failed to process message."); } @@ -216,7 +219,7 @@ void crossEntitySubscriptionTransaction(boolean isSessionEnabled) throws Interru receivedMessages.incrementAndGet(); messagesPending.incrementAndGet(); ServiceBusReceivedMessage myMessage = context.getMessage(); - System.out.printf("Processing message. MessageId: %s, Sequence #: %s. Contents: %s %n", myMessage.getMessageId(), + LOGGER.verbose("Processing message. MessageId: {}, Sequence #: {}. Contents: {}", myMessage.getMessageId(), myMessage.getSequenceNumber(), myMessage.getBody()); if (receivedMessages.get() == 1) { @@ -232,12 +235,12 @@ void crossEntitySubscriptionTransaction(boolean isSessionEnabled) throws Interru }; Consumer processError = context -> { - System.out.printf("Error when receiving messages from namespace: '%s'. Entity: '%s'. Error Source: '%s' %n", + LOGGER.verbose("Error when receiving messages from namespace: '{}'. Entity: '{}'. Error Source: '{}'", context.getFullyQualifiedNamespace(), context.getEntityPath(), context.getErrorSource()); Assertions.fail("Failed processing of message.", context.getException()); if (!(context.getException() instanceof ServiceBusException)) { - System.out.printf("Non-ServiceBusException occurred: %s%n", context.getException()); + LOGGER.log(LogLevel.VERBOSE, () -> "Non-ServiceBusException occurred: " + context.getException()); } }; @@ -268,17 +271,17 @@ void crossEntitySubscriptionTransaction(boolean isSessionEnabled) throws Interru // Create an instance of the processor through the ServiceBusClientBuilder // Act - System.out.println("Starting the processor"); + LOGGER.log(LogLevel.VERBOSE, () -> "Starting the processor"); processorA.start(); toClose((AutoCloseable) () -> processorA.stop()); // Assert - System.out.println("Listening for 10 seconds..."); + LOGGER.log(LogLevel.VERBOSE, () -> "Listening for 10 seconds..."); if (countdownLatch.await(10, TimeUnit.SECONDS)) { - System.out.println("Completed processing successfully."); + LOGGER.log(LogLevel.VERBOSE, () -> "Completed processing successfully."); Assertions.assertTrue(transactionComplete.get()); } else { - System.out.println("Closing processor."); + LOGGER.log(LogLevel.VERBOSE, () -> "Closing processor."); Assertions.fail("Failed to process message."); } @@ -361,12 +364,12 @@ void crossEntityQueueTransactionWithReceiverSenderTest(boolean isSessionEnabled) toClose(subscription); // Act - System.out.println("Listening for 10 seconds..."); + LOGGER.log(LogLevel.VERBOSE, () -> "Listening for 10 seconds..."); if (countdownLatch.await(10, TimeUnit.SECONDS)) { - System.out.println("Completed message processing successfully."); + LOGGER.log(LogLevel.VERBOSE, () -> "Completed message processing successfully."); Assertions.assertTrue(transactionComplete.get()); } else { - System.out.println("Some error."); + LOGGER.log(LogLevel.VERBOSE, () -> "Some error."); Assertions.fail("Failed to process message."); } @@ -447,12 +450,12 @@ void crossEntitySubscriptionTransactionWithReceiverSenderTest(boolean isSessionE }).subscribe(); toClose(subscription); // Act - System.out.println("Listening for 10 seconds..."); + LOGGER.log(LogLevel.VERBOSE, () -> "Listening for 10 seconds..."); if (countdownLatch.await(10, TimeUnit.SECONDS)) { - System.out.println("Completed message processing successfully."); + LOGGER.log(LogLevel.VERBOSE, () -> "Completed message processing successfully."); Assertions.assertTrue(transactionComplete.get()); } else { - System.out.println("Some error."); + LOGGER.log(LogLevel.VERBOSE, () -> "Some error."); Assertions.fail("Failed to process message."); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java index 42052a460dc0..4686edf67643 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java @@ -24,6 +24,7 @@ import com.azure.core.util.ClientOptions; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.core.util.tracing.StartSpanOptions; import com.azure.core.util.tracing.Tracer; import com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder; @@ -1317,13 +1318,14 @@ void autoCompleteMessage(boolean isV2) { try { // Act & Assert - StepVerifier.create(receiver2.receiveMessages().take(numberOfEvents).doOnComplete(() -> System.out.println("take complete.."))) + StepVerifier.create(receiver2.receiveMessages().take(numberOfEvents) + .doOnComplete(() -> LOGGER.log(LogLevel.VERBOSE, () -> "take complete.."))) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(numberOfEvents) .expectComplete() .verify(DEFAULT_TIMEOUT); } finally { - System.out.println("CLOSING...."); + LOGGER.log(LogLevel.VERBOSE, () -> "CLOSING...."); receiver2.close(); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientIntegrationTest.java index 2da9dc8d8788..d62e825e3a4d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientIntegrationTest.java @@ -4,6 +4,7 @@ package com.azure.messaging.servicebus; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.servicebus.implementation.MessagingEntityType; import com.azure.messaging.servicebus.models.CreateMessageBatchOptions; import com.azure.messaging.servicebus.models.ServiceBusReceiveMode; @@ -35,6 +36,8 @@ */ @Tag("integration") class ServiceBusSenderAsyncClientIntegrationTest extends IntegrationTestBase { + private static final ClientLogger LOGGER = new ClientLogger(ServiceBusSenderAsyncClientIntegrationTest.class); + private ServiceBusSenderAsyncClient sender; private ServiceBusReceiverAsyncClient receiver; private final AtomicInteger messagesPending = new AtomicInteger(); @@ -358,17 +361,17 @@ void transactionMessageSendAndCompleteTransaction(MessagingEntityType entityType .verify(TIMEOUT); StepVerifier.create(receiver.receiveMessages().take(total)) .assertNext(receivedMessage -> { - System.out.println("1"); + LOGGER.log(LogLevel.VERBOSE, () -> "1"); assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) .assertNext(receivedMessage -> { - System.out.println("2"); + LOGGER.log(LogLevel.VERBOSE, () -> "2"); assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) .assertNext(receivedMessage -> { - System.out.println("3"); + LOGGER.log(LogLevel.VERBOSE, () -> "3"); assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java index 05804738519f..aa93866c66fd 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java @@ -13,6 +13,7 @@ import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.servicebus.implementation.MessagingEntityType; import com.azure.messaging.servicebus.implementation.ServiceBusAmqpConnection; import com.azure.messaging.servicebus.implementation.ServiceBusConnectionProcessor; @@ -382,23 +383,23 @@ void multipleSessions() { } }) .assertNext(context -> { - System.out.println("1"); + LOGGER.log(LogLevel.VERBOSE, () -> "1"); assertMessageEquals(sessionId, receivedMessage, context); }) .assertNext(context -> { - System.out.println("2"); + LOGGER.log(LogLevel.VERBOSE, () -> "2"); assertMessageEquals(sessionId, receivedMessage, context); }) .assertNext(context -> { - System.out.println("3"); + LOGGER.log(LogLevel.VERBOSE, () -> "3"); assertMessageEquals(sessionId, receivedMessage, context); }) .assertNext(context -> { - System.out.println("4"); + LOGGER.log(LogLevel.VERBOSE, () -> "4"); assertMessageEquals(sessionId, receivedMessage, context); }) .assertNext(context -> { - System.out.println("5"); + LOGGER.log(LogLevel.VERBOSE, () -> "5"); assertMessageEquals(sessionId, receivedMessage, context); }) .thenAwait(Duration.ofSeconds(13)) @@ -408,15 +409,15 @@ void multipleSessions() { } }) .assertNext(context -> { - System.out.println("6"); + LOGGER.log(LogLevel.VERBOSE, () -> "6"); assertMessageEquals(sessionId2, receivedMessage2, context); }) .assertNext(context -> { - System.out.println("7"); + LOGGER.log(LogLevel.VERBOSE, () -> "7"); assertMessageEquals(sessionId2, receivedMessage2, context); }) .assertNext(context -> { - System.out.println("8"); + LOGGER.log(LogLevel.VERBOSE, () -> "8"); assertMessageEquals(sessionId2, receivedMessage2, context); }) .thenAwait(Duration.ofSeconds(15)) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TestUtils.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TestUtils.java index 6416b0409ef5..8531bdedeb7a 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TestUtils.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TestUtils.java @@ -8,6 +8,8 @@ import com.azure.core.util.BinaryData; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.servicebus.administration.models.AccessRights; import com.azure.messaging.servicebus.administration.models.AuthorizationRule; import org.apache.qpid.proton.Proton; @@ -46,6 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class TestUtils { + private static final ClientLogger LOGGER = new ClientLogger(TestUtils.class); // System and application properties from the generated test message. static final Instant ENQUEUED_TIME = Instant.ofEpochSecond(1561344661); @@ -145,7 +148,7 @@ public static String getConnectionString(boolean withSas) { } return String.format(connectionStringWithSasAndEntityFormat, endpoint, signatureValue, entityPath); } catch (Exception e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Error while getting connection string", e); } } return connectionString; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java index 7a50929d25f9..6bc5730921d2 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java @@ -592,6 +592,62 @@ public void sendAndProcessNoAutoComplete() throws InterruptedException { assertSettledVsProcessed(completed, processed, 1); } + @Test + public void sendAndProcessSessionNoAutoComplete() throws InterruptedException { + String sessionQueueName = getSessionQueueName(0); + String sessionId = UUID.randomUUID().toString(); + ServiceBusMessage message = new ServiceBusMessage(CONTENTS_BYTES).setSessionId(sessionId); + + OpenTelemetry otel = configureOTel(getFullyQualifiedDomainName(), sessionQueueName); + clientOptions = new ClientOptions().setTracingOptions(new OpenTelemetryTracingOptions().setOpenTelemetry(otel)); + sender = toClose(new ServiceBusClientBuilder() + .connectionString(getConnectionString()) + .clientOptions(clientOptions) + .sender() + .queueName(sessionQueueName) + .buildAsyncClient()); + + StepVerifier.create(sender.sendMessage(message)).expectComplete().verify(TIMEOUT); + + CountDownLatch processFound = new CountDownLatch(2); + spanProcessor.notifyIfCondition(processFound, span -> span.getName().equals("ServiceBus.process") || span.getName().equals("ServiceBus.complete")); + + AtomicReference currentInProcess = new AtomicReference<>(); + AtomicReference receivedMessage = new AtomicReference<>(); + processor = toClose(new ServiceBusClientBuilder() + .connectionString(getConnectionString()) + .clientOptions(clientOptions) + .sessionProcessor() + .maxConcurrentSessions(1) + .queueName(sessionQueueName) + .disableAutoComplete() + .processMessage(mc -> { + currentInProcess.compareAndSet(null, Span.current()); + receivedMessage.compareAndSet(null, mc.getMessage()); + mc.complete(); + }) + .processError(e -> fail("unexpected error", e.getException())) + .buildProcessorClient()); + + toClose((AutoCloseable) () -> processor.stop()); + processor.start(); + assertTrue(processFound.await(20, TimeUnit.SECONDS)); + processor.stop(); + + assertTrue(currentInProcess.get().getSpanContext().isValid()); + List spans = spanProcessor.getEndedSpans(); + + List processed = findSpans(spans, "ServiceBus.process") + .stream().filter(p -> p.equals(currentInProcess.get())).collect(Collectors.toList()); + assertEquals(1, processed.size()); + assertConsumerSpan(processed.get(0), receivedMessage.get(), "ServiceBus.process"); + + List completed = findSpans(spans, "ServiceBus.complete"); + assertEquals(1, completed.size()); + assertClientSpan(completed.get(0), Collections.singletonList(receivedMessage.get()), "ServiceBus.complete", "settle"); + assertSettledVsProcessed(completed, processed, 1); + } + @Test public void sendAndProcessParallel() throws InterruptedException { int messageCount = 10; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessorTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessorTest.java index 3f108c6b6678..66720fb5fd24 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessorTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessorTest.java @@ -7,6 +7,8 @@ import com.azure.core.amqp.exception.AmqpErrorCondition; import com.azure.core.amqp.exception.AmqpErrorContext; import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.message.Message; import org.junit.jupiter.api.AfterEach; @@ -36,6 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; @@ -55,6 +58,8 @@ * Tests for {@link ServiceBusReceiveLinkProcessor}. */ class ServiceBusReceiveLinkProcessorTest { + private static final ClientLogger LOGGER = new ClientLogger(ServiceBusReceiveLinkProcessorTest.class); + private static final int PREFETCH = 5; @Mock private ServiceBusReceiveLink link1; @@ -172,9 +177,9 @@ void respectsBackpressureLessThanMinimum() throws InterruptedException { // Act semaphore.acquire(); processor.subscribe( - e -> System.out.println("message: " + e), + e -> LOGGER.log(LogLevel.VERBOSE, () -> "message: " + e), Assertions::fail, - () -> System.out.println("Complete."), + () -> LOGGER.log(LogLevel.VERBOSE, () -> "Complete."), s -> { s.request(backpressure); semaphore.release(); @@ -262,9 +267,7 @@ void newLinkOnClose() { }) .expectNext(message3) .expectNext(message4) - .then(() -> { - processor.cancel(); - }) + .then(processor::cancel) .verifyComplete(); assertTrue(processor.isTerminated()); @@ -336,12 +339,12 @@ void nonRetryableError() { // Verify that we get the first connection. StepVerifier.create(processor) .then(() -> { - System.out.println("Outputting exception."); + LOGGER.log(LogLevel.VERBOSE, () -> "Outputting exception."); endpointProcessor.error(amqpException); }) .expectErrorSatisfies(error -> { - System.out.println("Asserting exception."); - assertTrue(error instanceof AmqpException); + LOGGER.log(LogLevel.VERBOSE, () -> "Asserting exception."); + assertInstanceOf(AmqpException.class, error); AmqpException exception = (AmqpException) error; assertFalse(exception.isTransient()); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusReceiverInstrumentationTests.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusReceiverInstrumentationTests.java index 46597b57f963..55766945d4e4 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusReceiverInstrumentationTests.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusReceiverInstrumentationTests.java @@ -35,7 +35,7 @@ public void testInstrumentNullMessageNoMeter() { ServiceBusReceiverInstrumentation instrumentation = new ServiceBusReceiverInstrumentation(tracer, null, "fqdn", "entityPath", null, ReceiverKind.ASYNC_RECEIVER); - instrumentation.startProcessInstrumentation("span name", null, Context.NONE); + instrumentation.startProcessInstrumentation("span name", null, null, Context.NONE); instrumentation.instrumentSettlement(Mono.just(1), null, Context.NONE, DispositionStatus.ABANDONED); verify(tracer, never()).start(anyString(), any(StartSpanOptions.class), any(Context.class)); } @@ -48,7 +48,7 @@ public void testInstrumentNullMessageNoTracer() { "fqdn", "entityPath", null, ReceiverKind.ASYNC_RECEIVER); // does not throw - instrumentation.startProcessInstrumentation("span name", null, Context.NONE); + instrumentation.startProcessInstrumentation("span name", null, null, Context.NONE); instrumentation.instrumentSettlement(Mono.just(1), null, Context.NONE, DispositionStatus.ABANDONED); } @@ -58,7 +58,7 @@ public void testInstrumentNullMessageDisabled() { "fqdn", "entityPath", null, ReceiverKind.ASYNC_RECEIVER); // does not throw - instrumentation.startProcessInstrumentation("span name", null, Context.NONE); + instrumentation.startProcessInstrumentation("span name", null, null, Context.NONE); instrumentation.instrumentSettlement(Mono.just(1), null, Context.NONE, DispositionStatus.ABANDONED); } } diff --git a/sdk/spring/CHANGELOG.md b/sdk/spring/CHANGELOG.md index 86a39eb52077..e9cff45da533 100644 --- a/sdk/spring/CHANGELOG.md +++ b/sdk/spring/CHANGELOG.md @@ -1,5 +1,18 @@ # Release History +## 4.18.0 (2024-05-07) +- This release is compatible with Spring Boot 2.5.0-2.5.15, 2.6.0-2.6.15, 2.7.0-2.7.18. (Note: 2.5.x (x>15), 2.6.y (y>15) and 2.7.z (z>18) should be supported, but they aren't tested with this release.) +- This release is compatible with Spring Cloud 2020.0.3-2020.0.6, 2021.0.0-2021.0.9. (Note: 2020.0.x (x>6) and 2021.0.y (y>9) should be supported, but they aren't tested with this release.) + +### Spring Cloud Azure Dependencies (BOM) + +#### Dependency Updates +- Upgrade `azure-sdk-bom` to 1.2.23. + +### Azure Spring Data Cosmos +This section includes changes in `azure-spring-data-cosmos` module. +Please refer to [azure-spring-data-cosmos/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md#3450-2024-05-07) for more details. + ## 5.11.0 (2024-03-29) - This release is compatible with Spring Boot 3.0.0-3.0.13, 3.1.0-3.1.8, 3.2.0-3.2.4. (Note: 3.0.x (x>13), 3.1.y (y>8) and 3.2.z (z>4) should be supported, but they aren't tested with this release.) - This release is compatible with Spring Cloud 2022.0.0-2022.0.5, 2023.0.0-2023.0.0. (Note: 2022.0.x (x>5) and 2023.0.y (y>0) should be supported, but they aren't tested with this release.) diff --git a/sdk/spring/README.md b/sdk/spring/README.md index bcc381424cf4..ad63adfed482 100644 --- a/sdk/spring/README.md +++ b/sdk/spring/README.md @@ -139,7 +139,7 @@ If you’re a Maven user, add our BOM to your pom.xml `` s com.azure.spring spring-cloud-azure-dependencies - 4.17.0 + 4.18.0 pom import diff --git a/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md b/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md index b2e844f18e23..ee1ac98b5886 100644 --- a/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md +++ b/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md @@ -1,16 +1,26 @@ ## Release History -### 3.45.0-beta.1 (Unreleased) +### 3.46.0-beta.1 (Unreleased) #### Features Added -* Exposing the `indexQueryMetrics` to the `CosmosConfig` via the `application.properties` configuration file - See [PR 39433](https://github.com/Azure/azure-sdk-for-java/pull/39433). #### Breaking Changes +#### Bugs Fixed + +#### Other Changes + +### 3.45.0 (2024-05-07) + +#### Features Added +* Exposing the `indexQueryMetrics` to the `CosmosConfig` via the `application.properties` configuration file - See [PR 39433](https://github.com/Azure/azure-sdk-for-java/pull/39433). + #### Bugs Fixed * Fixed all saveAll/insertAll bulk functionality to populated audit data - See [PR 39620](https://github.com/Azure/azure-sdk-for-java/pull/39620). +* Fixed `existsById` API in `ReactiveCosmosTemplate` to return `Mono` containing `False` in case the item does not exist - See [PR 40022](https://github.com/Azure/azure-sdk-for-java/pull/40022) #### Other Changes +* Updated `azure-cosmos` to version `4.58.0`. ### 5.11.0 (2024-03-29) diff --git a/sdk/spring/azure-spring-data-cosmos/README.md b/sdk/spring/azure-spring-data-cosmos/README.md index 2439fec3860e..8d417d0265d6 100644 --- a/sdk/spring/azure-spring-data-cosmos/README.md +++ b/sdk/spring/azure-spring-data-cosmos/README.md @@ -100,7 +100,7 @@ If you are using Maven, add the following dependency. com.azure azure-spring-data-cosmos - 3.44.0 + 3.45.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/spring/azure-spring-data-cosmos/pom.xml b/sdk/spring/azure-spring-data-cosmos/pom.xml index ff5b5d10fe5a..38407fa19e58 100644 --- a/sdk/spring/azure-spring-data-cosmos/pom.xml +++ b/sdk/spring/azure-spring-data-cosmos/pom.xml @@ -12,7 +12,7 @@ com.azure azure-spring-data-cosmos - 3.45.0-beta.1 + 3.46.0-beta.1 jar Spring Data for Azure Cosmos DB SQL API Spring Data for Azure Cosmos DB SQL API diff --git a/sdk/spring/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java b/sdk/spring/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java index b33a473d6b2d..20612e32dc35 100644 --- a/sdk/spring/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java +++ b/sdk/spring/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java @@ -850,7 +850,8 @@ public Mono exists(CosmosQuery query, Class domainType, String conta */ public Mono existsById(Object id, Class domainType, String containerName) { return findById(containerName, id, domainType) - .flatMap(o -> Mono.just(o != null)); + .flatMap(o -> Mono.just(o != null)) + .switchIfEmpty(Mono.just(false)); } /** diff --git a/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java b/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java index 9a5248b2dc24..90f30b632128 100644 --- a/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java +++ b/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java @@ -714,6 +714,26 @@ public void testExists() { Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); } + @Test + public void testNotExists() { + final Criteria criteria = Criteria.getInstance(CriteriaType.IS_EQUAL, "firstName", + Collections.singletonList("randomFirstName"), Part.IgnoreCaseType.NEVER); + final CosmosQuery query = new CosmosQuery(criteria); + final Mono exists = cosmosTemplate.exists(query, Person.class, containerName); + StepVerifier.create(exists).expectNext(false).verifyComplete(); + + // add ignore testing + final Criteria criteriaIgnoreCase = Criteria.getInstance(CriteriaType.IS_EQUAL, "firstName", + Collections.singletonList("randomFirstName".toUpperCase()), Part.IgnoreCaseType.ALWAYS); + final CosmosQuery queryIgnoreCase = new CosmosQuery(criteriaIgnoreCase); + final Mono existsIgnoreCase = cosmosTemplate.exists(queryIgnoreCase, Person.class, containerName); + StepVerifier.create(existsIgnoreCase).expectNext(false).verifyComplete(); + + assertThat(responseDiagnosticsTestUtils.getCosmosDiagnostics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); + Assertions.assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); + } + @Test public void testCount() { final Mono count = cosmosTemplate.count(containerName); diff --git a/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/ReactiveUUIDIdDomainRepositoryIT.java b/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/ReactiveUUIDIdDomainRepositoryIT.java index dd13d14ccf5a..56a1a65418a8 100644 --- a/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/ReactiveUUIDIdDomainRepositoryIT.java +++ b/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/ReactiveUUIDIdDomainRepositoryIT.java @@ -150,6 +150,9 @@ public void testExistsById() { Mono booleanMono = this.repository.existsById(DOMAIN_1.getNumber()); StepVerifier.create(booleanMono).expectNext(true).expectComplete().verify(); + + booleanMono = this.repository.existsById(UUID.randomUUID()); + StepVerifier.create(booleanMono).expectNext(false).expectComplete().verify(); } private static class InvalidDomain { diff --git a/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ReactiveLongIdDomainPartitionPartitionRepositoryIT.java b/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ReactiveLongIdDomainPartitionPartitionRepositoryIT.java index 823b7897bc8f..03bf88ce9359 100644 --- a/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ReactiveLongIdDomainPartitionPartitionRepositoryIT.java +++ b/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/ReactiveLongIdDomainPartitionPartitionRepositoryIT.java @@ -171,6 +171,9 @@ public void testExistsById() { Mono booleanMono = this.repository.existsById(DOMAIN_1.getNumber()); StepVerifier.create(booleanMono).expectNext(true).expectComplete().verify(); + + booleanMono = this.repository.existsById(0L); + StepVerifier.create(booleanMono).expectNext(false).expectComplete().verify(); } @Test diff --git a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/CHANGELOG.md b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml index 1fba53d1705f..25077a86639a 100644 --- a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml +++ b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-actuator-autoconfigure - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Actuator AutoConfigure Spring Cloud Azure Starter Actuator AutoConfigure @@ -43,17 +43,17 @@ com.azure.spring spring-cloud-azure-actuator - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-autoconfigure - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-appconfiguration-config-web - 4.18.0-beta.1 + 4.19.0-beta.1 true diff --git a/sdk/spring/spring-cloud-azure-actuator/CHANGELOG.md b/sdk/spring/spring-cloud-azure-actuator/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-cloud-azure-actuator/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-actuator/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-actuator/pom.xml b/sdk/spring/spring-cloud-azure-actuator/pom.xml index de867f093e46..652a5c62968e 100644 --- a/sdk/spring/spring-cloud-azure-actuator/pom.xml +++ b/sdk/spring/spring-cloud-azure-actuator/pom.xml @@ -17,7 +17,7 @@ com.azure.spring spring-cloud-azure-actuator - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Actuator https://microsoft.github.io/spring-cloud-azure @@ -105,7 +105,7 @@ com.azure.spring spring-cloud-azure-appconfiguration-config-web - 4.18.0-beta.1 + 4.19.0-beta.1 true diff --git a/sdk/spring/spring-cloud-azure-appconfiguration-config-web/CHANGELOG.md b/sdk/spring/spring-cloud-azure-appconfiguration-config-web/CHANGELOG.md index 13b0a6a7f223..3085354f0d80 100644 --- a/sdk/spring/spring-cloud-azure-appconfiguration-config-web/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-appconfiguration-config-web/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-appconfiguration-config-web/pom.xml b/sdk/spring/spring-cloud-azure-appconfiguration-config-web/pom.xml index 5c91d1b8b219..e118e9a0b181 100644 --- a/sdk/spring/spring-cloud-azure-appconfiguration-config-web/pom.xml +++ b/sdk/spring/spring-cloud-azure-appconfiguration-config-web/pom.xml @@ -10,7 +10,7 @@ com.azure.spring spring-cloud-azure-appconfiguration-config-web - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure App Configuration Config Web Integration of Spring Cloud Config and Azure App Configuration Service @@ -24,7 +24,7 @@ com.azure.spring spring-cloud-azure-appconfiguration-config - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot diff --git a/sdk/spring/spring-cloud-azure-appconfiguration-config/CHANGELOG.md b/sdk/spring/spring-cloud-azure-appconfiguration-config/CHANGELOG.md index da680e820d80..ef0518a75b38 100644 --- a/sdk/spring/spring-cloud-azure-appconfiguration-config/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-appconfiguration-config/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml b/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml index 9aca0209389d..2442d649f6aa 100644 --- a/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml +++ b/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml @@ -9,7 +9,7 @@ 4.0.0 com.azure.spring spring-cloud-azure-appconfiguration-config - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure App Configuration Config Integration of Spring Cloud Config and Azure App Configuration Service @@ -63,12 +63,12 @@ com.azure.spring spring-cloud-azure-service - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-autoconfigure - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/TestUtils.java b/sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/TestUtils.java index 1a09cdf8ed1a..e9fe610f0e4c 100644 --- a/sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/TestUtils.java +++ b/sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/TestUtils.java @@ -7,6 +7,8 @@ import java.util.Map; import java.util.Set; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.data.appconfiguration.models.ConfigurationSetting; import com.azure.data.appconfiguration.models.FeatureFlagConfigurationSetting; import com.azure.data.appconfiguration.models.FeatureFlagFilter; @@ -23,6 +25,7 @@ * Utility methods which can be used across different test classes */ public final class TestUtils { + private static final ClientLogger LOGGER = new ClientLogger(TestUtils.class); private static final ObjectMapper MAPPER = new ObjectMapper(); @@ -75,7 +78,7 @@ static FeatureFlagConfigurationSetting createItemFeatureFlag(String prefix, Stri item.addClientFilter(filter); } } catch (JsonProcessingException e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Failed to create FeatureFlagConfigurationSetting.", e); } return item; } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/CHANGELOG.md b/sdk/spring/spring-cloud-azure-autoconfigure/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-autoconfigure/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml b/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml index 6cd733b405b2..da9cd157ee9b 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml +++ b/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-autoconfigure - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure AutoConfigure Spring Cloud Azure AutoConfigure @@ -37,20 +37,20 @@ com.azure.spring spring-cloud-azure-service - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-resourcemanager - 4.18.0-beta.1 + 4.19.0-beta.1 true com.azure.spring spring-cloud-azure-trace-sleuth - 4.18.0-beta.1 + 4.19.0-beta.1 true @@ -59,7 +59,7 @@ com.azure.spring spring-integration-azure-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 true @@ -73,7 +73,7 @@ com.azure.spring spring-integration-azure-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 true @@ -81,7 +81,7 @@ com.azure.spring spring-integration-azure-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 true @@ -111,7 +111,7 @@ com.azure azure-spring-data-cosmos - 3.45.0-beta.1 + 3.46.0-beta.1 true @@ -175,7 +175,7 @@ com.azure azure-messaging-servicebus - 7.16.0 + 7.17.0 true diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/aad/implementation/TestJwks.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/aad/implementation/TestJwks.java index 5dca4d976bd8..99546b479151 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/aad/implementation/TestJwks.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/aad/implementation/TestJwks.java @@ -3,6 +3,8 @@ package com.azure.spring.cloud.autoconfigure.aad.implementation; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.nimbusds.jose.jwk.RSAKey; import com.nimbusds.jose.util.Base64URL; @@ -14,6 +16,7 @@ import java.security.interfaces.RSAPublicKey; public final class TestJwks { + private static final ClientLogger LOGGER = new ClientLogger(TestJwks.class); // @formatter:off public static final RSAKey DEFAULT_RSA_JWK = @@ -38,7 +41,7 @@ public static RSAKey.Builder jwk(RSAPublicKey publicKey, RSAPrivateKey privateKe .x509CertThumbprint(Base64URL.encode(bytes)) .keyID("rsa-jwk-kid"); } catch (CertificateEncodingException | NoSuchAlgorithmException e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Failed to generate thumbprint for certificate.", e); } return null; // @formatter:on diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/aad/implementation/graph/UserPrincipalMicrosoftGraphTests.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/aad/implementation/graph/UserPrincipalMicrosoftGraphTests.java index d49e86657011..98024e7579db 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/aad/implementation/graph/UserPrincipalMicrosoftGraphTests.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/aad/implementation/graph/UserPrincipalMicrosoftGraphTests.java @@ -3,6 +3,8 @@ package com.azure.spring.cloud.autoconfigure.aad.implementation.graph; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.spring.cloud.autoconfigure.aad.filter.UserPrincipal; import com.azure.spring.cloud.autoconfigure.aad.properties.AadAuthenticationProperties; import com.azure.spring.cloud.autoconfigure.aad.properties.AadAuthorizationServerEndpoints; @@ -49,6 +51,7 @@ @TestInstance(TestInstance.Lifecycle.PER_CLASS) class UserPrincipalMicrosoftGraphTests { + private static final ClientLogger LOGGER = new ClientLogger(UserPrincipalMicrosoftGraphTests.class); private static final String MOCK_MICROSOFT_GRAPH_ENDPOINT = "http://localhost:8080/"; @@ -68,7 +71,7 @@ class UserPrincipalMicrosoftGraphTests { }); userGroupsJson = objectMapper.writeValueAsString(json); } catch (IOException e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Failed to load user groups json.", e); userGroupsJson = null; } assertNotNull(userGroupsJson); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/graph/ThreadInterruptedStatusRestoreTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/graph/ThreadInterruptedStatusRestoreTest.java index bd8b448ca437..8ea467b01370 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/graph/ThreadInterruptedStatusRestoreTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/graph/ThreadInterruptedStatusRestoreTest.java @@ -3,6 +3,8 @@ package com.azure.spring.cloud.autoconfigure.implementation.graph; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -10,6 +12,7 @@ import java.util.concurrent.TimeUnit; public class ThreadInterruptedStatusRestoreTest { + private static final ClientLogger LOGGER = new ClientLogger(ThreadInterruptedStatusRestoreTest.class); @Test void testThreadInterruptedRestoreFromAnotherThread() throws InterruptedException { @@ -22,9 +25,9 @@ void testThreadInterruptedRestoreFromAnotherThread() throws InterruptedException testThread.interrupt(); latchForInCatch.await(); - System.out.println(Thread.currentThread().getName() + ": begin assertion"); + LOGGER.log(LogLevel.VERBOSE, () -> Thread.currentThread().getName() + ": begin assertion"); Assertions.assertTrue((testThread).getIsInterrupted()); - System.out.println(Thread.currentThread().getName() + ": end assertion"); + LOGGER.log(LogLevel.VERBOSE, () -> Thread.currentThread().getName() + ": end assertion"); } @Test @@ -38,9 +41,9 @@ void testThreadInterruptedNotRestoreFromAnotherThread() throws InterruptedExcept testThread.interrupt(); latchForInCatch.await(); - System.out.println(Thread.currentThread().getName() + ": begin assertion"); + LOGGER.log(LogLevel.VERBOSE, () -> Thread.currentThread().getName() + ": begin assertion"); Assertions.assertFalse(testThread.getIsInterrupted()); - System.out.println(Thread.currentThread().getName() + ": end assertion"); + LOGGER.log(LogLevel.VERBOSE, () -> Thread.currentThread().getName() + ": end assertion"); } @@ -64,7 +67,8 @@ public void run() { latchForInWhile.countDown(); TimeUnit.SECONDS.sleep(3); } catch (InterruptedException ex) { - System.out.println(Thread.currentThread().getName() + ": current thread was interrupted!"); + LOGGER.log(LogLevel.VERBOSE, + () -> Thread.currentThread().getName() + ": current thread was interrupted!"); if (restore) { Thread.currentThread().interrupt(); } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/jms/AzureServiceBusJmsPropertiesTests.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/jms/AzureServiceBusJmsPropertiesTests.java index e198123d55a9..fff6275c6c85 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/jms/AzureServiceBusJmsPropertiesTests.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/jms/AzureServiceBusJmsPropertiesTests.java @@ -3,6 +3,8 @@ package com.azure.spring.cloud.autoconfigure.jms; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.spring.cloud.autoconfigure.jms.properties.AzureServiceBusJmsProperties; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -17,6 +19,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; class AzureServiceBusJmsPropertiesTests { + private static final ClientLogger LOGGER = new ClientLogger(AzureServiceBusJmsPropertiesTests.class); + static final String CONNECTION_STRING = "Endpoint=sb://host/;SharedAccessKeyName=sasKeyName;" + "SharedAccessKey=sasKey"; @@ -31,7 +35,7 @@ void connectionStringNotValid() { String expectedMessage = "'spring.jms.servicebus.connection-string' should be provided."; String actualMessage = ex.getMessage(); - System.out.println("message:" + actualMessage); + LOGGER.log(LogLevel.VERBOSE, () -> "message:" + actualMessage); assertTrue(actualMessage.contains(expectedMessage)); } @@ -47,7 +51,7 @@ void pricingTierNotValid(String pricingTier) { String expectedMessage = "'spring.jms.servicebus.pricing-tier' is not valid"; String actualMessage = ex.getMessage(); - System.out.println("message:" + actualMessage); + LOGGER.log(LogLevel.VERBOSE, () -> "message:" + actualMessage); assertTrue(actualMessage.contains(expectedMessage)); } diff --git a/sdk/spring/spring-cloud-azure-core/CHANGELOG.md b/sdk/spring/spring-cloud-azure-core/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-cloud-azure-core/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-core/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-core/pom.xml b/sdk/spring/spring-cloud-azure-core/pom.xml index e52f7d5e25ef..3f910bb950f0 100644 --- a/sdk/spring/spring-cloud-azure-core/pom.xml +++ b/sdk/spring/spring-cloud-azure-core/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Core https://microsoft.github.io/spring-cloud-azure diff --git a/sdk/spring/spring-cloud-azure-feature-management-web/CHANGELOG.md b/sdk/spring/spring-cloud-azure-feature-management-web/CHANGELOG.md index cb045c6fcbc4..2fb0c4fca339 100644 --- a/sdk/spring/spring-cloud-azure-feature-management-web/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-feature-management-web/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-feature-management-web/pom.xml b/sdk/spring/spring-cloud-azure-feature-management-web/pom.xml index 5c818caef1e7..60eca8c08ff5 100644 --- a/sdk/spring/spring-cloud-azure-feature-management-web/pom.xml +++ b/sdk/spring/spring-cloud-azure-feature-management-web/pom.xml @@ -9,7 +9,7 @@ com.azure.spring spring-cloud-azure-feature-management-web - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Feature Management Web Adds Feature Management into Spring Web @@ -46,7 +46,7 @@ com.azure.spring spring-cloud-azure-feature-management - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot @@ -65,7 +65,7 @@ - com.azure.spring:spring-cloud-azure-feature-management:[4.18.0-beta.1] + com.azure.spring:spring-cloud-azure-feature-management:[4.19.0-beta.1] javax.servlet:javax.servlet-api:[4.0.1] org.springframework:spring-web:[5.3.32] org.springframework:spring-webmvc:[5.3.32] diff --git a/sdk/spring/spring-cloud-azure-feature-management/CHANGELOG.md b/sdk/spring/spring-cloud-azure-feature-management/CHANGELOG.md index 1473db8045d9..836db6260b31 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-feature-management/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-feature-management/pom.xml b/sdk/spring/spring-cloud-azure-feature-management/pom.xml index 13bed8a8b617..fe740c88b88e 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/pom.xml +++ b/sdk/spring/spring-cloud-azure-feature-management/pom.xml @@ -11,7 +11,7 @@ com.azure.spring spring-cloud-azure-feature-management - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Feature Management Adds Feature Management into Spring diff --git a/sdk/spring/spring-cloud-azure-integration-test-appconfiguration-config/pom.xml b/sdk/spring/spring-cloud-azure-integration-test-appconfiguration-config/pom.xml index caf82424a10a..bf5a689c0fe6 100644 --- a/sdk/spring/spring-cloud-azure-integration-test-appconfiguration-config/pom.xml +++ b/sdk/spring/spring-cloud-azure-integration-test-appconfiguration-config/pom.xml @@ -24,7 +24,7 @@ com.azure.spring spring-cloud-azure-starter-appconfiguration-config - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot diff --git a/sdk/spring/spring-cloud-azure-integration-tests/pom.xml b/sdk/spring/spring-cloud-azure-integration-tests/pom.xml index a27b86269a21..d6bbd8c0b7b4 100644 --- a/sdk/spring/spring-cloud-azure-integration-tests/pom.xml +++ b/sdk/spring/spring-cloud-azure-integration-tests/pom.xml @@ -40,72 +40,72 @@ com.azure.spring spring-cloud-azure-starter-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-servicebus-jms - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-keyvault-secrets - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-storage-blob - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-storage-file-share - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-appconfiguration - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-data-cosmos - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-cosmos - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-stream-binder-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-stream-binder-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-jdbc-mysql - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-redis - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot diff --git a/sdk/spring/spring-cloud-azure-resourcemanager/CHANGELOG.md b/sdk/spring/spring-cloud-azure-resourcemanager/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-cloud-azure-resourcemanager/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-resourcemanager/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-resourcemanager/pom.xml b/sdk/spring/spring-cloud-azure-resourcemanager/pom.xml index 06bbce088766..33ee068b5162 100644 --- a/sdk/spring/spring-cloud-azure-resourcemanager/pom.xml +++ b/sdk/spring/spring-cloud-azure-resourcemanager/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-resourcemanager - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Resource Manager Spring Cloud Azure Resource Manager @@ -37,7 +37,7 @@ com.azure.spring spring-cloud-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-service/CHANGELOG.md b/sdk/spring/spring-cloud-azure-service/CHANGELOG.md index 69bda720e930..aa68b8828d29 100644 --- a/sdk/spring/spring-cloud-azure-service/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-service/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-service/pom.xml b/sdk/spring/spring-cloud-azure-service/pom.xml index 9cc495eb56df..beb2fc5f648a 100644 --- a/sdk/spring/spring-cloud-azure-service/pom.xml +++ b/sdk/spring/spring-cloud-azure-service/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-service - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Service Spring Cloud Azure Service @@ -37,7 +37,7 @@ com.azure.spring spring-cloud-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 @@ -56,7 +56,7 @@ com.azure azure-messaging-servicebus - 7.16.0 + 7.17.0 true diff --git a/sdk/spring/spring-cloud-azure-starter-active-directory-b2c/pom.xml b/sdk/spring/spring-cloud-azure-starter-active-directory-b2c/pom.xml index d54e58f42ac6..d38c8cfca95f 100644 --- a/sdk/spring/spring-cloud-azure-starter-active-directory-b2c/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-active-directory-b2c/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-active-directory-b2c - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Active Directory B2C Spring Cloud Azure Starter Active Directory B2C @@ -87,7 +87,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.security diff --git a/sdk/spring/spring-cloud-azure-starter-active-directory/pom.xml b/sdk/spring/spring-cloud-azure-starter-active-directory/pom.xml index 56822ae1cdcc..65ee7a0c8e1f 100644 --- a/sdk/spring/spring-cloud-azure-starter-active-directory/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-active-directory/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-active-directory - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Active Directory Spring Cloud Azure Starter Active Directory @@ -86,7 +86,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.security diff --git a/sdk/spring/spring-cloud-azure-starter-actuator/pom.xml b/sdk/spring/spring-cloud-azure-starter-actuator/pom.xml index cb56bec792fe..5505e39f13df 100644 --- a/sdk/spring/spring-cloud-azure-starter-actuator/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-actuator/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-actuator - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Actuator Spring Cloud Azure Starter Actuator @@ -88,12 +88,12 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-actuator-autoconfigure - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot diff --git a/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/CHANGELOG.md b/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/CHANGELOG.md index ccd45b959538..c5dbeb34c7a4 100644 --- a/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/README.md b/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/README.md index ab94a09b3945..7d8d1083487d 100644 --- a/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/README.md +++ b/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/README.md @@ -21,7 +21,7 @@ There are two libraries that can be used spring-cloud-azure-appconfiguration-con com.azure.spring spring-cloud-azure-appconfiguration-config - 4.17.0 + 4.18.0 ``` [//]: # ({x-version-update-end}) @@ -33,7 +33,7 @@ or com.azure.spring spring-cloud-azure-appconfiguration-config-web - 4.17.0 + 4.18.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/pom.xml b/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/pom.xml index 46b1a21899c1..539ffd20d827 100644 --- a/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-starter-appconfiguration-config - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter App Configuration Config Spring Cloud Azure Starter App Configuration Config @@ -20,12 +20,12 @@ com.azure.spring spring-cloud-azure-appconfiguration-config-web - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-feature-management-web - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml b/sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml index ef64a2d7aa22..606ca13761c0 100644 --- a/sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-appconfiguration - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter App Configuration Spring Cloud Azure Starter App Configuration @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure diff --git a/sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml b/sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml index 961413466935..77a60f670a47 100644 --- a/sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-cosmos - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Cosmos DB Spring Cloud Azure Starter Cosmos DB @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure diff --git a/sdk/spring/spring-cloud-azure-starter-data-cosmos/pom.xml b/sdk/spring/spring-cloud-azure-starter-data-cosmos/pom.xml index f6d7e5a43353..e347970cb041 100644 --- a/sdk/spring/spring-cloud-azure-starter-data-cosmos/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-data-cosmos/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-data-cosmos - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Data Cosmos DB Spring Cloud Azure Starter Data Cosmos DB @@ -88,12 +88,12 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure azure-spring-data-cosmos - 3.45.0-beta.1 + 3.46.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml b/sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml index f0aa79e39afa..5ea00a9ab071 100644 --- a/sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-eventgrid - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Event Grid Spring Cloud Azure Starter Event Grid @@ -87,7 +87,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml b/sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml index b228381b4c49..8fb9ab784b65 100644 --- a/sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Event Hubs Spring Cloud Azure Starter Event Hubs @@ -87,7 +87,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-integration-eventhubs/pom.xml b/sdk/spring/spring-cloud-azure-starter-integration-eventhubs/pom.xml index 5889b59d7bbf..dfb76b3d5e77 100644 --- a/sdk/spring/spring-cloud-azure-starter-integration-eventhubs/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-integration-eventhubs/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-integration-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Integration Event Hubs Spring Cloud Azure Starter Integration Event Hubs @@ -87,7 +87,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot @@ -97,7 +97,7 @@ com.azure.spring spring-integration-azure-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-integration-servicebus/pom.xml b/sdk/spring/spring-cloud-azure-starter-integration-servicebus/pom.xml index 40d4ea9d1992..a89f23385c88 100644 --- a/sdk/spring/spring-cloud-azure-starter-integration-servicebus/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-integration-servicebus/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-integration-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Integration Service Bus Spring Cloud Azure Starter Integration Service Bus @@ -89,7 +89,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot @@ -99,7 +99,7 @@ com.azure.spring spring-integration-azure-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-integration-storage-queue/pom.xml b/sdk/spring/spring-cloud-azure-starter-integration-storage-queue/pom.xml index f1b5026f436e..2815759582bf 100644 --- a/sdk/spring/spring-cloud-azure-starter-integration-storage-queue/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-integration-storage-queue/pom.xml @@ -10,7 +10,7 @@ com.azure.spring spring-cloud-azure-starter-integration-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Integration Storage Queue Spring Cloud Azure Starter Integration Storage Queue @@ -92,7 +92,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot @@ -102,7 +102,7 @@ com.azure.spring spring-integration-azure-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml b/sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml index 99303b8f7796..374ffc0b6428 100644 --- a/sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-jdbc-mysql - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter JDBC MySQL Spring Cloud Azure Starter for building applications with JDBC and Azure MySQL Services. Support authenticating with Azure AD. @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml b/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml index 1288ef6a3b83..d664aced1b01 100644 --- a/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-jdbc-postgresql - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter JDBC PostgreSQL Spring Cloud Azure Starter for building applications with JDBC and Azure PostgreSQL Services. Support authenticating with Azure AD. @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml b/sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml index 50901ef0a0e5..932ca89d9525 100644 --- a/sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-keyvault-certificates - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Key Vault Certificates Spring Cloud Azure Starter Key Vault Certificates @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure diff --git a/sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml b/sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml index c42bce0cbdc3..7f4d3ad73772 100644 --- a/sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-keyvault-secrets - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Key Vault Secrets Spring Cloud Azure Starter Key Vault Secrets @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure diff --git a/sdk/spring/spring-cloud-azure-starter-keyvault/pom.xml b/sdk/spring/spring-cloud-azure-starter-keyvault/pom.xml index 7d7039b79f76..2dd3581b3608 100644 --- a/sdk/spring/spring-cloud-azure-starter-keyvault/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-keyvault/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-keyvault - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Key Vault Spring Cloud Azure Starter Key Vault @@ -88,12 +88,12 @@ com.azure.spring spring-cloud-azure-starter-keyvault-secrets - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-keyvault-certificates - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-redis/pom.xml b/sdk/spring/spring-cloud-azure-starter-redis/pom.xml index 86c3e3c0dac4..3071c83e6ff6 100644 --- a/sdk/spring/spring-cloud-azure-starter-redis/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-redis/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-redis - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Redis Spring Cloud Azure Starter for building applications with Azure Cache for Redis. Support authenticating with Azure AD. @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml b/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml index 42e4ce22afa9..4377ac30d9ab 100644 --- a/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-servicebus-jms - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Service Bus JMS Spring Cloud Azure Starter Service Bus JMS @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml b/sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml index a02aed3a8427..f8a85eb12491 100644 --- a/sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Service Bus Spring Cloud Azure Starter Service Bus @@ -89,12 +89,12 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure azure-messaging-servicebus - 7.16.0 + 7.17.0 diff --git a/sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml b/sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml index 0999561da331..c858539e614e 100644 --- a/sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-storage-blob - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Storage Blob Spring Cloud Azure Starter Storage Blob @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml b/sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml index b999e6efbfcd..b80cceb41e2c 100644 --- a/sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-storage-file-share - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Storage File Share Spring Cloud Azure Starter Storage File Share @@ -88,7 +88,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml b/sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml index e54fff3cb578..b4d9e29f25cc 100644 --- a/sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml @@ -10,7 +10,7 @@ com.azure.spring spring-cloud-azure-starter-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Storage Queue Spring Cloud Azure Starter Storage Queue @@ -92,7 +92,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure diff --git a/sdk/spring/spring-cloud-azure-starter-storage/pom.xml b/sdk/spring/spring-cloud-azure-starter-storage/pom.xml index 0a41be67fbc9..6d021919c18f 100644 --- a/sdk/spring/spring-cloud-azure-starter-storage/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-storage/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter-storage - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Storage Spring Cloud Azure Starter Storage @@ -88,19 +88,19 @@ com.azure.spring spring-cloud-azure-starter-storage-blob - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-storage-file-share - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-starter-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-stream-eventhubs/pom.xml b/sdk/spring/spring-cloud-azure-starter-stream-eventhubs/pom.xml index d5d5346e8132..85df3f175dbd 100644 --- a/sdk/spring/spring-cloud-azure-starter-stream-eventhubs/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-stream-eventhubs/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-stream-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Stream Event Hubs Spring Cloud Azure Starter Stream Event Hubs @@ -87,7 +87,7 @@ com.azure.spring spring-cloud-azure-stream-binder-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter-stream-servicebus/pom.xml b/sdk/spring/spring-cloud-azure-starter-stream-servicebus/pom.xml index 1239d2472066..12f878f20a34 100644 --- a/sdk/spring/spring-cloud-azure-starter-stream-servicebus/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-stream-servicebus/pom.xml @@ -7,7 +7,7 @@ com.azure.spring spring-cloud-azure-starter-stream-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Stream Service Bus Spring Cloud Azure Starter Stream Service Bus @@ -87,7 +87,7 @@ com.azure.spring spring-cloud-azure-stream-binder-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-starter/pom.xml b/sdk/spring/spring-cloud-azure-starter/pom.xml index 300fc32c33c5..3b5099ac699f 100644 --- a/sdk/spring/spring-cloud-azure-starter/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter/pom.xml @@ -6,7 +6,7 @@ com.azure.spring spring-cloud-azure-starter - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Starter Core starter, including auto-configuration support @@ -93,7 +93,7 @@ com.azure.spring spring-cloud-azure-autoconfigure - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/CHANGELOG.md b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/pom.xml b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/pom.xml index d2d41ac556e2..06aa4554c0e2 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/pom.xml +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-stream-binder-eventhubs-core - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Stream Binder Event Hubs Core Spring Cloud Azure Stream Binder Event Hubs Core @@ -49,7 +49,7 @@ com.azure.spring spring-integration-azure-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/CHANGELOG.md b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml index b3823c56bf5d..45f99b72a6f5 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-stream-binder-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Stream Binder Event Hubs Spring Cloud Azure Stream Binder Event Hubs @@ -37,12 +37,12 @@ com.azure.spring spring-cloud-azure-autoconfigure - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-stream-binder-eventhubs-core - 4.18.0-beta.1 + 4.19.0-beta.1 @@ -60,7 +60,7 @@ com.azure.spring spring-cloud-azure-resourcemanager - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/CHANGELOG.md b/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/CHANGELOG.md index 69bda720e930..aa68b8828d29 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/pom.xml b/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/pom.xml index 3728af289eba..5bf76654c0a3 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/pom.xml +++ b/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-stream-binder-servicebus-core - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Stream Binder Service Bus Core Spring Cloud Azure Stream Binder Service Bus Core @@ -43,12 +43,12 @@ com.azure.spring spring-integration-azure-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure azure-messaging-servicebus - 7.16.0 + 7.17.0 org.springframework.boot diff --git a/sdk/spring/spring-cloud-azure-stream-binder-servicebus/CHANGELOG.md b/sdk/spring/spring-cloud-azure-stream-binder-servicebus/CHANGELOG.md index 69bda720e930..aa68b8828d29 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-servicebus/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-stream-binder-servicebus/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-stream-binder-servicebus/pom.xml b/sdk/spring/spring-cloud-azure-stream-binder-servicebus/pom.xml index 0a7291f28ef9..ca4c6a740960 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-servicebus/pom.xml +++ b/sdk/spring/spring-cloud-azure-stream-binder-servicebus/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-stream-binder-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Stream Binder Service Bus Spring Cloud Azure Stream Binder Service Bus @@ -37,17 +37,17 @@ com.azure.spring spring-cloud-azure-stream-binder-servicebus-core - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-autoconfigure - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-cloud-azure-resourcemanager - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.boot diff --git a/sdk/spring/spring-cloud-azure-trace-sleuth/CHANGELOG.md b/sdk/spring/spring-cloud-azure-trace-sleuth/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-cloud-azure-trace-sleuth/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-trace-sleuth/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml b/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml index 08f755475e38..699990594057 100644 --- a/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml +++ b/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-cloud-azure-trace-sleuth - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Cloud Azure Trace on Sleuth https://microsoft.github.io/spring-cloud-azure @@ -36,7 +36,7 @@ com.azure.spring spring-cloud-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.cloud diff --git a/sdk/spring/spring-integration-azure-core/CHANGELOG.md b/sdk/spring/spring-integration-azure-core/CHANGELOG.md index 69bda720e930..aa68b8828d29 100644 --- a/sdk/spring/spring-integration-azure-core/CHANGELOG.md +++ b/sdk/spring/spring-integration-azure-core/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-integration-azure-core/pom.xml b/sdk/spring/spring-integration-azure-core/pom.xml index 03b52f89ff4e..ce8b62cda41c 100644 --- a/sdk/spring/spring-integration-azure-core/pom.xml +++ b/sdk/spring/spring-integration-azure-core/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-integration-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Integration Azure Core Spring Integration Azure Core @@ -41,7 +41,7 @@ com.azure.spring spring-messaging-azure - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework.integration diff --git a/sdk/spring/spring-integration-azure-eventhubs/CHANGELOG.md b/sdk/spring/spring-integration-azure-eventhubs/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-integration-azure-eventhubs/CHANGELOG.md +++ b/sdk/spring/spring-integration-azure-eventhubs/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-integration-azure-eventhubs/pom.xml b/sdk/spring/spring-integration-azure-eventhubs/pom.xml index 0627077adc40..c4621fa56634 100644 --- a/sdk/spring/spring-integration-azure-eventhubs/pom.xml +++ b/sdk/spring/spring-integration-azure-eventhubs/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-integration-azure-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Integration Azure Event Hubs Spring Integration Azure Event Hubs @@ -37,19 +37,19 @@ com.azure.spring spring-integration-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-integration-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 test-jar test com.azure.spring spring-messaging-azure-eventhubs - 4.18.0-beta.1 + 4.19.0-beta.1 diff --git a/sdk/spring/spring-integration-azure-servicebus/CHANGELOG.md b/sdk/spring/spring-integration-azure-servicebus/CHANGELOG.md index 69bda720e930..aa68b8828d29 100644 --- a/sdk/spring/spring-integration-azure-servicebus/CHANGELOG.md +++ b/sdk/spring/spring-integration-azure-servicebus/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-integration-azure-servicebus/pom.xml b/sdk/spring/spring-integration-azure-servicebus/pom.xml index 55c5376e7452..66287f9ecbd9 100644 --- a/sdk/spring/spring-integration-azure-servicebus/pom.xml +++ b/sdk/spring/spring-integration-azure-servicebus/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-integration-azure-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Integration Azure Service Bus Spring Integration Azure Service Bus @@ -37,24 +37,24 @@ com.azure.spring spring-integration-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-integration-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 test-jar test com.azure.spring spring-messaging-azure-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-messaging-azure-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 test-jar test diff --git a/sdk/spring/spring-integration-azure-storage-queue/CHANGELOG.md b/sdk/spring/spring-integration-azure-storage-queue/CHANGELOG.md index 69bda720e930..aa68b8828d29 100644 --- a/sdk/spring/spring-integration-azure-storage-queue/CHANGELOG.md +++ b/sdk/spring/spring-integration-azure-storage-queue/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-integration-azure-storage-queue/pom.xml b/sdk/spring/spring-integration-azure-storage-queue/pom.xml index 0c10e1f5f03d..c79317e1ffc3 100644 --- a/sdk/spring/spring-integration-azure-storage-queue/pom.xml +++ b/sdk/spring/spring-integration-azure-storage-queue/pom.xml @@ -13,7 +13,7 @@ com.azure.spring spring-integration-azure-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Integration Azure Storage Queue Spring Integration Azure Storage Queue @@ -38,12 +38,12 @@ com.azure.spring spring-integration-azure-core - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-messaging-azure-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 + 4.19.0-beta.1 Spring Messaging Azure Event Hubs Spring Messaging Azure Event Hubs @@ -37,12 +37,12 @@ com.azure.spring spring-messaging-azure - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-messaging-azure - 4.18.0-beta.1 + 4.19.0-beta.1 test-jar test diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplateTests.java b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplateTests.java index 7e931c350b6e..0a6109aa71db 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplateTests.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplateTests.java @@ -5,6 +5,8 @@ import com.azure.core.amqp.exception.AmqpErrorCondition; import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.eventhubs.EventData; import com.azure.messaging.eventhubs.EventDataBatch; import com.azure.messaging.eventhubs.EventHubProducerAsyncClient; @@ -31,6 +33,7 @@ class EventHubsTemplateTests { + private static final ClientLogger LOGGER = new ClientLogger(EventHubsTemplateTests.class); private EventHubProducerAsyncClient mockProducerClient; protected String destination = "event-hub"; @@ -93,9 +96,8 @@ void testSendAsyncForMessagesOneBatchAndSendCompletely() { List> messages = messagesList.stream().map((Function>) GenericMessage::new).collect(Collectors.toList()); - Mono mono = this.eventHubsTemplate.sendAsync(this.destination, messages, null).doOnSuccess(t -> { - System.out.println("do on success:" + t); - }); + Mono mono = this.eventHubsTemplate.sendAsync(this.destination, messages, null) + .doOnSuccess(t -> LOGGER.log(LogLevel.VERBOSE, () -> "do on success:" + t)); StepVerifier.create(mono) .verifyComplete(); @@ -125,12 +127,9 @@ void testSendAsyncForMessagesOneBatchAndSendCompletelyWithException() { List> messages = messagesList.stream().map((Function>) GenericMessage::new).collect(Collectors.toList()); - Mono mono = this.eventHubsTemplate.sendAsync(this.destination, messages, null).doOnError(ex -> { - System.out.println("do on Error"); - ex.printStackTrace(); - }).doOnSuccess(t -> { - System.out.println("do on success:" + t); - }); + Mono mono = this.eventHubsTemplate.sendAsync(this.destination, messages, null) + .doOnError(ex -> LOGGER.log(LogLevel.VERBOSE, () -> "do on Error", ex)) + .doOnSuccess(t -> LOGGER.log(LogLevel.VERBOSE, () -> "do on success:" + t)); StepVerifier.create(mono) .verifyComplete(); verify(this.mockProducerClient, times(1)).send(any(EventDataBatch.class)); @@ -160,12 +159,9 @@ void testSendAsyncForMessagesTwoBatchAndSendCompletelyWithException() { List> messages = messagesList.stream().map((Function>) GenericMessage::new).collect(Collectors.toList()); - Mono mono = this.eventHubsTemplate.sendAsync(this.destination, messages, null).doOnError(ex -> { - System.out.println("do on Error"); - ex.printStackTrace(); - }).doOnSuccess(t -> { - System.out.println("do on success:" + t); - }); + Mono mono = this.eventHubsTemplate.sendAsync(this.destination, messages, null) + .doOnError(ex -> LOGGER.log(LogLevel.VERBOSE, () -> "do on Error", ex)) + .doOnSuccess(t -> LOGGER.log(LogLevel.VERBOSE, () -> "do on success:" + t)); StepVerifier.create(mono) .verifyComplete(); verify(this.mockProducerClient, times(2)).send(any(EventDataBatch.class)); @@ -189,12 +185,9 @@ void testSendAsyncForMessagesWithTheSecondEventTooLargeForOneNewBatch() { List> messages = messagesList.stream().map((Function>) GenericMessage::new).collect(Collectors.toList()); - Mono mono = this.eventHubsTemplate.sendAsync(this.destination, messages, null).doOnError(ex -> { - System.out.println("do on Error" + ex.getMessage()); - ex.printStackTrace(); - }).doOnSuccess(t -> { - System.out.println("do on success:" + t); - }); + Mono mono = this.eventHubsTemplate.sendAsync(this.destination, messages, null) + .doOnError(ex -> LOGGER.log(LogLevel.VERBOSE, () -> "do on Error", ex)) + .doOnSuccess(t -> LOGGER.log(LogLevel.VERBOSE, () -> "do on success:" + t)); StepVerifier.create(mono) .verifyComplete(); verify(this.mockProducerClient, times(2)).send(any(EventDataBatch.class)); diff --git a/sdk/spring/spring-messaging-azure-servicebus/CHANGELOG.md b/sdk/spring/spring-messaging-azure-servicebus/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-messaging-azure-servicebus/CHANGELOG.md +++ b/sdk/spring/spring-messaging-azure-servicebus/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-messaging-azure-servicebus/pom.xml b/sdk/spring/spring-messaging-azure-servicebus/pom.xml index 5a8526bbca21..f0730a03f99b 100644 --- a/sdk/spring/spring-messaging-azure-servicebus/pom.xml +++ b/sdk/spring/spring-messaging-azure-servicebus/pom.xml @@ -13,7 +13,7 @@ com.azure.spring spring-messaging-azure-servicebus - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Messaging Azure Service Bus Spring Messaging Azure Service Bus @@ -38,19 +38,19 @@ com.azure.spring spring-messaging-azure - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-messaging-azure - 4.18.0-beta.1 + 4.19.0-beta.1 test-jar test com.azure azure-messaging-servicebus - 7.16.0 + 7.17.0 com.azure diff --git a/sdk/spring/spring-messaging-azure-storage-queue/CHANGELOG.md b/sdk/spring/spring-messaging-azure-storage-queue/CHANGELOG.md index 69bda720e930..aa68b8828d29 100644 --- a/sdk/spring/spring-messaging-azure-storage-queue/CHANGELOG.md +++ b/sdk/spring/spring-messaging-azure-storage-queue/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-messaging-azure-storage-queue/pom.xml b/sdk/spring/spring-messaging-azure-storage-queue/pom.xml index 8df3a2d0ca0f..55abb82ccc5d 100644 --- a/sdk/spring/spring-messaging-azure-storage-queue/pom.xml +++ b/sdk/spring/spring-messaging-azure-storage-queue/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-messaging-azure-storage-queue - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Messaging Azure Storage Queue Spring Messaging Azure Storage Queue @@ -37,12 +37,12 @@ com.azure.spring spring-messaging-azure - 4.18.0-beta.1 + 4.19.0-beta.1 com.azure.spring spring-messaging-azure - 4.18.0-beta.1 + 4.19.0-beta.1 test-jar test diff --git a/sdk/spring/spring-messaging-azure/CHANGELOG.md b/sdk/spring/spring-messaging-azure/CHANGELOG.md index 465a0ceac20d..1303275c337b 100644 --- a/sdk/spring/spring-messaging-azure/CHANGELOG.md +++ b/sdk/spring/spring-messaging-azure/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 4.18.0 (2024-05-07) + +Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4180-2024-05-07) for more details. + ## 4.17.0 (2024-03-28) Please refer to [spring/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CHANGELOG.md#4170-2024-03-28) for more details. diff --git a/sdk/spring/spring-messaging-azure/pom.xml b/sdk/spring/spring-messaging-azure/pom.xml index c80a9aa147f5..92af809c1f82 100644 --- a/sdk/spring/spring-messaging-azure/pom.xml +++ b/sdk/spring/spring-messaging-azure/pom.xml @@ -12,7 +12,7 @@ com.azure.spring spring-messaging-azure - 4.18.0-beta.1 + 4.19.0-beta.1 Spring Messaging Azure Spring Messaging Azure @@ -37,7 +37,7 @@ com.azure.spring spring-cloud-azure-service - 4.18.0-beta.1 + 4.19.0-beta.1 org.springframework diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java index 0a3e792ec5fb..7fed3d1953bb 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java @@ -13,6 +13,8 @@ import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.UrlBuilder; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.RequestRetryPolicy; import reactor.core.Disposable; @@ -33,6 +35,8 @@ import static java.lang.StrictMath.pow; class RequestRetryTestFactory { + private static final ClientLogger LOGGER = new ClientLogger(RequestRetryTestFactory.class); + static final int RETRY_TEST_SCENARIO_RETRY_UNTIL_SUCCESS = 1; static final int RETRY_TEST_SCENARIO_RETRY_UNTIL_MAX_RETRIES = 2; @@ -219,7 +223,8 @@ public Mono send(HttpRequest request) { } }); while (!disposable.isDisposed()) { - System.out.println("Waiting for Flux to finish to prevent blocking on another thread exception"); + LOGGER.log(LogLevel.VERBOSE, + () -> "Waiting for Flux to finish to prevent blocking on another thread exception"); } if (retryTestDefaultData.compareTo(ByteBuffer.wrap(outputStream.toByteArray())) != 0) { throw new IllegalArgumentException(("Body not reset.")); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTests.java index e0542697dd50..275488bc0ec6 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTests.java @@ -5,6 +5,7 @@ import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.http.HttpResponse; +import com.azure.core.util.logging.LogLevel; import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.RetryPolicyType; import org.junit.jupiter.api.Test; @@ -32,7 +33,7 @@ public class RetryTests extends BlobTestBase { try { retryTestURL = new URL("https://" + RequestRetryTestFactory.RETRY_TEST_PRIMARY_HOST); } catch (MalformedURLException e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Failed to create URL for retry tests.", e); } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/DirectoryApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/DirectoryApiTests.java index 4a9a58e0cd8b..3c795ad37af9 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/DirectoryApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/DirectoryApiTests.java @@ -1647,11 +1647,7 @@ public void createShareWithSmallTimeoutsFailForServiceClient() { return; } catch (Exception e) { // Test failed; wait before retrying - try { - Thread.sleep(retryDelayMillis); - } catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - } + sleepIfRunningAgainstService(retryDelayMillis); } } } diff --git a/sdk/vision/azure-ai-vision-imageanalysis/src/test/java/com/azure/ai/vision/imageanalysis/ImageAnalysisClientTestBase.java b/sdk/vision/azure-ai-vision-imageanalysis/src/test/java/com/azure/ai/vision/imageanalysis/ImageAnalysisClientTestBase.java index 12484368612e..c9179536e7f5 100644 --- a/sdk/vision/azure-ai-vision-imageanalysis/src/test/java/com/azure/ai/vision/imageanalysis/ImageAnalysisClientTestBase.java +++ b/sdk/vision/azure-ai-vision-imageanalysis/src/test/java/com/azure/ai/vision/imageanalysis/ImageAnalysisClientTestBase.java @@ -6,9 +6,11 @@ import java.io.File; import java.util.List; import java.util.Map.Entry; +import java.util.Objects; import com.azure.core.credential.KeyCredential; import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpRequest; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; @@ -26,11 +28,15 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import com.azure.ai.vision.imageanalysis.*; import com.azure.ai.vision.imageanalysis.models.*; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; class ImageAnalysisClientTestBase extends TestProxyTestBase { + private static final ClientLogger LOGGER = new ClientLogger(ImageAnalysisClientTestBase.class); final Boolean printResults = false; // Set to true to print results to console window @@ -64,8 +70,8 @@ private void createClient(String endpointEnvVar, String keyEnvVar, Boolean sync, endpoint = "https://fake-resource-name.cognitiveservices.azure.com"; } - String key = Configuration.getGlobalConfiguration().get(keyEnvVar); // Read real key from environment variable - if (key == null || keyEnvVar == "VISION_KEY_FAKE") { + String key = Configuration.getGlobalConfiguration().get(keyEnvVar); // Read real key from environment variable + if (key == null || Objects.equals(keyEnvVar, "VISION_KEY_FAKE")) { key = "00000000000000000000000000000000"; } @@ -105,7 +111,7 @@ protected void doAnalysis( ImageAnalysisOptions imageAnalysisOptions, // can be null RequestOptions requestOptions) { // can be null - Boolean fromUrl = imageSource.startsWith("http"); + boolean fromUrl = imageSource.startsWith("http"); Boolean genderNeutralCaption = null; List aspectRatios = null; @@ -209,7 +215,7 @@ protected void doAnalysisWithError( int expectedStatusCode, String expectedMessageContains) { - Boolean fromUrl = imageSource.startsWith("http"); + boolean fromUrl = imageSource.startsWith("http"); ImageAnalysisResult result = null; if (sync) { @@ -226,7 +232,7 @@ protected void doAnalysisWithError( options); } } catch (HttpResponseException e) { - System.out.println("Expected exception: " + e.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> "Expected exception: " + e.getMessage()); assertEquals(expectedStatusCode, e.getResponse().getStatusCode()); assertTrue(e.getMessage().contains(expectedMessageContains)); return; @@ -245,15 +251,15 @@ protected void doAnalysisWithError( options).block(); } } catch (HttpResponseException e) { - System.out.println("Expected exception: " + e.getMessage()); + LOGGER.log(LogLevel.VERBOSE, () -> "Expected exception: " + e.getMessage()); assertEquals(expectedStatusCode, e.getResponse().getStatusCode()); assertTrue(e.getMessage().contains(expectedMessageContains)); return; } } - System.out.println("Test should have thrown an exception, but it did not"); - assertTrue(false); + LOGGER.log(LogLevel.VERBOSE, () -> "Test should have thrown an exception, but it did not"); + fail(); } private static void validateAnalysisResult( @@ -372,7 +378,7 @@ private static void validateDenseCaptions(ImageAnalysisResult result) { // Do not include the check below. It's okay to have two identical dense captions since they have different bounding boxes. // assertFalse(otherDenseCaption.getText().equals(denseCaption.getText())); assertFalse( - otherDenseCaption.getBoundingBox().getX() == denseCaption.getBoundingBox().getX() + otherDenseCaption.getBoundingBox().getX() == denseCaption.getBoundingBox().getX() && otherDenseCaption.getBoundingBox().getY() == denseCaption.getBoundingBox().getY() && otherDenseCaption.getBoundingBox().getHeight() == denseCaption.getBoundingBox().getHeight() && otherDenseCaption.getBoundingBox().getWidth() == denseCaption.getBoundingBox().getWidth()); @@ -389,7 +395,7 @@ private static void validateObjects(ObjectsResult objectsResult) { assertNotNull(objectsResult); assertTrue(objectsResult.getValues().size() > 1); - Boolean found1 = false; + boolean found1 = false; for (DetectedObject object : objectsResult.getValues()) { assertNotNull(object); assertNotNull(object.getTags()); @@ -401,7 +407,7 @@ private static void validateObjects(ObjectsResult objectsResult) { assertTrue(tag.getConfidence() > 0.0); assertTrue(tag.getConfidence() < 1.0); // We expect to see this in the list of objects - if (tag.getName().toLowerCase().equals("person")) { + if (tag.getName().equalsIgnoreCase("person")) { found1 = true; } } @@ -431,17 +437,17 @@ private static void validateTags(TagsResult tagsResult) { assertNotNull(tagsResult.getValues()); assertTrue(tagsResult.getValues().size() > 1); - Boolean found1 = false, found2 = false; + boolean found1 = false, found2 = false; for (DetectedTag tag : tagsResult.getValues()) { assertNotNull(tag.getName()); assertFalse(tag.getName().isEmpty()); assertTrue(tag.getConfidence() > 0.0); assertTrue(tag.getConfidence() < 1.0); // We expect to see both of these in the list of tags - if (tag.getName().toLowerCase().equals("person")) { + if (tag.getName().equalsIgnoreCase("person")) { found1 = true; } - if (tag.getName().toLowerCase().equals("laptop")) { + if (tag.getName().equalsIgnoreCase("laptop")) { found2 = true; } } @@ -458,7 +464,7 @@ private static void validateTags(TagsResult tagsResult) { private static void validatePeople(ImageAnalysisResult result) { assertNotNull(result.getPeople()); - assertTrue(result.getPeople().getValues().size() > 0); + assertFalse(result.getPeople().getValues().isEmpty()); for (DetectedPerson person : result.getPeople().getValues()) { assertTrue(person.getConfidence() > 0.0); @@ -487,13 +493,13 @@ private static void validateSmartCrops(ImageAnalysisResult result, List assertNotNull(result.getSmartCrops()); List listCropRegions = result.getSmartCrops().getValues(); if (aspectRatios == null) { - assertTrue(listCropRegions.size() == 1); + assertEquals(1, listCropRegions.size()); assertTrue(listCropRegions.get(0).getAspectRatio() >= 0.5); assertTrue(listCropRegions.get(0).getAspectRatio() <= 2.0); } else { - assertTrue(listCropRegions.size() == aspectRatios.size()); + assertEquals(listCropRegions.size(), aspectRatios.size()); for (int i = 0; i < listCropRegions.size(); i++) { - assertTrue(listCropRegions.get(i).getAspectRatio() == aspectRatios.get(i)); + assertEquals(listCropRegions.get(i).getAspectRatio(), aspectRatios.get(i)); assertTrue(listCropRegions.get(0).getAspectRatio() >= 0.75); assertTrue(listCropRegions.get(0).getAspectRatio() <= 1.8); } @@ -537,20 +543,20 @@ private static void validateRead(ImageAnalysisResult result) { // Do some validations on the first line DetectedTextLine line = lines.get(0); assertNotNull(line); - assertTrue(line.getText().equals("Sample text")); + assertEquals("Sample text", line.getText()); List polygon = line.getBoundingPolygon(); assertNotNull(polygon); assertEquals(4, polygon.size()); - for (int i = 0; i < polygon.size(); i++) { - assertTrue(polygon.get(i).getX() > 0); - assertTrue(polygon.get(i).getY() > 0); + for (ImagePoint imagePoint : polygon) { + assertTrue(imagePoint.getX() > 0); + assertTrue(imagePoint.getY() > 0); } // Do some verifications on the 3rd line line = lines.get(2); assertNotNull(line); - assertTrue(line.getText().equals("123 456")); + assertEquals("123 456", line.getText()); List words = line.getWords(); assertNotNull(words); @@ -558,111 +564,111 @@ private static void validateRead(ImageAnalysisResult result) { DetectedTextWord word = words.get(1); assertNotNull(word); - assertTrue(word.getText().equals("456")); + assertEquals("456", word.getText()); assertTrue(word.getConfidence() > 0.0); assertTrue(word.getConfidence() < 1.0); polygon = word.getBoundingPolygon(); assertNotNull(polygon); assertEquals(4, polygon.size()); - for (int i = 0; i < polygon.size(); i++) { - assertTrue(polygon.get(i).getX() > 0); - assertTrue(polygon.get(i).getY() > 0); + for (ImagePoint imagePoint : polygon) { + assertTrue(imagePoint.getX() > 0); + assertTrue(imagePoint.getY() > 0); } } private static void printHttpRequestAndResponse(Response response) { // Print HTTP request details to console HttpRequest request = response.getRequest(); - System.out.println(" HTTP request method: " + request.getHttpMethod()); - System.out.println(" HTTP request URL: " + request.getUrl()); - System.out.println(" HTTP request headers: "); + LOGGER.log(LogLevel.VERBOSE, () -> " HTTP request method: " + request.getHttpMethod()); + LOGGER.log(LogLevel.VERBOSE, () -> " HTTP request URL: " + request.getUrl()); + LOGGER.log(LogLevel.VERBOSE, () -> " HTTP request headers: "); request.getHeaders().forEach(header -> { - System.out.println(" " + header.getName() + ": " + header.getValue()); + LOGGER.log(LogLevel.VERBOSE, () -> " " + header.getName() + ": " + header.getValue()); }); - if (request.getHeaders().getValue("content-type").contains("application/json")) { - System.out.println(" HTTP request body: " + request.getBodyAsBinaryData().toString()); + if (request.getHeaders().getValue(HttpHeaderName.CONTENT_TYPE).contains("application/json")) { + LOGGER.log(LogLevel.VERBOSE, () -> " HTTP request body: " + request.getBodyAsBinaryData().toString()); } // Print HTTP response details to console - System.out.println(" HTTP response status code: " + response.getStatusCode()); - System.out.println(" HTTP response headers: "); + LOGGER.log(LogLevel.VERBOSE, () -> " HTTP response status code: " + response.getStatusCode()); + LOGGER.log(LogLevel.VERBOSE, () -> " HTTP response headers: "); response.getHeaders().forEach(header -> { - System.out.println(" " + header.getName() + ": " + header.getValue()); + LOGGER.log(LogLevel.VERBOSE, () -> " " + header.getName() + ": " + header.getValue()); }); } private static void printAnalysisResults(String testName, ImageAnalysisResult result) { - System.out.println(" ******************** TEST NAME: " + testName + " ******************** "); + LOGGER.log(LogLevel.VERBOSE, () -> " ******************** TEST NAME: " + testName + " ******************** "); try { - System.out.println(" Image height: " + result.getMetadata().getHeight()); - System.out.println(" Image width: " + result.getMetadata().getWidth()); - System.out.println(" Model version: " + result.getModelVersion()); + LOGGER.log(LogLevel.VERBOSE, () -> " Image height: " + result.getMetadata().getHeight()); + LOGGER.log(LogLevel.VERBOSE, () -> " Image width: " + result.getMetadata().getWidth()); + LOGGER.log(LogLevel.VERBOSE, () -> " Model version: " + result.getModelVersion()); if (result.getCaption() != null) { - System.out.println(" Caption:"); - System.out.println(" \"" + result.getCaption().getText() + "\", Confidence " + LOGGER.log(LogLevel.VERBOSE, () -> " Caption:"); + LOGGER.log(LogLevel.VERBOSE, () -> " \"" + result.getCaption().getText() + "\", Confidence " + String.format("%.4f", result.getCaption().getConfidence())); } if (result.getDenseCaptions() != null) { - System.out.println(" Dense Captions:"); + LOGGER.log(LogLevel.VERBOSE, () -> " Dense Captions:"); for (DenseCaption denseCaption : result.getDenseCaptions().getValues()) { - System.out.println(" \"" + denseCaption.getText() + "\", Bounding box " + LOGGER.log(LogLevel.VERBOSE, () -> " \"" + denseCaption.getText() + "\", Bounding box " + denseCaption.getBoundingBox() + ", Confidence " + String.format("%.4f", denseCaption.getConfidence())); } } if (result.getObjects() != null) { - System.out.println(" Objects:"); + LOGGER.log(LogLevel.VERBOSE, () -> " Objects:"); for (DetectedObject detectedObject : result.getObjects().getValues()) { - System.out.println(" \"" + detectedObject.getTags().get(0).getName() + "\", Bounding box " + LOGGER.log(LogLevel.VERBOSE, () -> " \"" + detectedObject.getTags().get(0).getName() + "\", Bounding box " + detectedObject.getBoundingBox() + ", Confidence " + String.format("%.4f", detectedObject.getTags().get(0).getConfidence())); } } if (result.getTags() != null) { - System.out.println(" Tags:"); + LOGGER.log(LogLevel.VERBOSE, () -> " Tags:"); for (DetectedTag tag : result.getTags().getValues()) { - System.out.println(" \"" + tag.getName() + "\", Confidence " + LOGGER.log(LogLevel.VERBOSE, () -> " \"" + tag.getName() + "\", Confidence " + String.format("%.4f", tag.getConfidence())); } } if (result.getPeople() != null) { - System.out.println(" People:"); + LOGGER.log(LogLevel.VERBOSE, () -> " People:"); for (DetectedPerson person : result.getPeople().getValues()) { - System.out.println(" Bounding box " + person.getBoundingBox() + LOGGER.log(LogLevel.VERBOSE, () -> " Bounding box " + person.getBoundingBox() + ", Confidence " + String.format("%.4f", person.getConfidence())); } } if (result.getSmartCrops() != null) { - System.out.println(" Crop Suggestions:"); + LOGGER.log(LogLevel.VERBOSE, () -> " Crop Suggestions:"); for (CropRegion cropRegion : result.getSmartCrops().getValues()) { - System.out.println(" Aspect ratio " + cropRegion.getAspectRatio() + LOGGER.log(LogLevel.VERBOSE, () -> " Aspect ratio " + cropRegion.getAspectRatio() + ": Bounding box " + cropRegion.getBoundingBox()); } } if (result.getRead() != null) { - System.out.println(" Read:"); + LOGGER.log(LogLevel.VERBOSE, () -> " Read:"); for (DetectedTextLine line : result.getRead().getBlocks().get(0).getLines()) { - System.out.println(" Line: '" + line.getText() + LOGGER.log(LogLevel.VERBOSE, () -> " Line: '" + line.getText() + "', Bounding polygon " + line.getBoundingPolygon()); for (DetectedTextWord word : line.getWords()) { - System.out.println(" Word: '" + word.getText() + LOGGER.log(LogLevel.VERBOSE, () -> " Word: '" + word.getText() + "', Bounding polygon " + word.getBoundingPolygon() + ", Confidence " + String.format("%.4f", word.getConfidence())); } } } } catch (Exception e) { - e.printStackTrace(); + LOGGER.log(LogLevel.VERBOSE, () -> "Error printing analysis results", e); } } } diff --git a/sdk/webpubsub/azure-messaging-webpubsub-client/src/test/java/com/azure/messaging/webpubsub/client/GroupMessageTests.java b/sdk/webpubsub/azure-messaging-webpubsub-client/src/test/java/com/azure/messaging/webpubsub/client/GroupMessageTests.java index dd6fc1ad5aff..316e35d9a0db 100644 --- a/sdk/webpubsub/azure-messaging-webpubsub-client/src/test/java/com/azure/messaging/webpubsub/client/GroupMessageTests.java +++ b/sdk/webpubsub/azure-messaging-webpubsub-client/src/test/java/com/azure/messaging/webpubsub/client/GroupMessageTests.java @@ -5,6 +5,8 @@ import com.azure.core.test.annotation.DoNotRecord; import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.azure.messaging.webpubsub.client.models.SendMessageFailedException; import com.azure.messaging.webpubsub.client.models.SendToGroupOptions; import com.azure.messaging.webpubsub.client.models.WebPubSubDataFormat; @@ -18,6 +20,7 @@ import java.util.concurrent.TimeUnit; public class GroupMessageTests extends TestBase { + private static final ClientLogger LOGGER = new ClientLogger(GroupMessageTests.class); private static final String HELLO = "hello"; @@ -178,9 +181,10 @@ public void testSendMessagePerformance() throws InterruptedException { final long endNanoReceive = System.nanoTime(); // about 800 ms for 1k messages - System.out.println("send takes milliseconds: " + (endNanoSend - beginNano) / 1E6); + LOGGER.log(LogLevel.VERBOSE, () -> "send takes milliseconds: " + (endNanoSend - beginNano) / 1E6); // about 1 second for 1k messages - System.out.println("send and receive takes milliseconds: " + (endNanoReceive - beginNano) / 1E6); + LOGGER.log(LogLevel.VERBOSE, + () -> "send and receive takes milliseconds: " + (endNanoReceive - beginNano) / 1E6); } finally { client.stop(); } From c8de52fb580036f434d493c39dcdd607781687ee Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Thu, 9 May 2024 12:11:29 -0700 Subject: [PATCH 21/28] [Cosmos][VectorSearch] Non Streaming Order By Query (#40098) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial changes * Initial changes * Increment versions for core releases (#40003) Increment package versions for core releases * Ensure ServiceBus session idle timeout fall back to retry-options::try-timeout (#39994) * Added Alpha3 Java Media Streaming Events (#40002) * Added Alpha3 Java Media Streaming Events * updating readme to add the media streaming events to remove model --------- Co-authored-by: Vinothini Dharmaraj * Update version of github-event-processor to 1.0.0-dev.20240502.2 (#40012) Co-authored-by: James Suplizio * Prepare May 2024 Identity Release (#40006) * Prepare Identity Broker May 2024 Release (#40014) * Increment package versions for identity releases (#40015) * [JobRouter] SDK Review updates (#40011) * SDK Review updates * Update auto-generated models * Add customization * Fix customization * Update package * Update tests * Linting * FixFaultInjectionRuleFailedToApplyPerPartitionInGatewayMode (#40005) * fix fault injection rule failed to apply per partition in gateway mode --------- Co-authored-by: annie-mac * azure-cosmos-test_1.0.0.beta.7Release (#40021) * release azure-cosmos-test 1.0.0.beta.7 --------- Co-authored-by: annie-mac * Fixed existsById API in ReactiveCosmosTemplate (#40022) * Fixed existsById API in ReactiveCosmosTemplate * Added changelog * Initial changes * Initial changes * Skip Recorded test and delete Event record until test proxy to work with Event recordings (#40029) Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com> * Fix invalid CODEOWNERS (#40032) * Initial changes * ServiceBus: fix session tracing (#39962) * remove additional matrix * Fix session processing and disposition instrumentation * return matrix config * review suggestions * [Automation] Generate SDK based on TypeSpec 0.15.15 (#40048) * [CODEOWNERS] Updates for org changes (#40049) * [CODEOWNERS] Updates for org changes The focus of these changes is to remove an individual who no longer is responsible for the products which their GH account is associated to. * Move from using the docker image to java2docfx for docs validation (#39744) * Move from using the docker image to java2docfx for docs validation * Temporarily turn on docs processing for template libraries for testing * Actually install the rex validation tool * Fix the if not Test-Path statement * Update java2docfx version and add a couple of diagnostics output lines * Add missing close paren * Ensure that Sort-Object always returns an array even if there's only one item * add another piece of diagnostics output * trying one more thing * remove some diag, add other * Remove the additional diagnostics, add permanent output message * Invoke java -jar on java2docfx to show the help command to ensure the install is okay * fiddling with the java -jar command * Set the working directory to the java2docfx directory before executing the mvn dependency download * Actually create the directory before trying to set location...oops * Update rex validation to verify MAVEN_HOME is set * Updates for Java PR 39875 which had changes from this PR that were more immediate * Update java2docfx version * remove check for MAVEN_HOME which was only for testing * Update the version of java2docfx to test a fix * Update version of java2docfx to 1.0.4 * revert template's ci.yml changes that were only necessary to test java2docfx * owners (#39686) * Use ClientLogger in testing output (#40010) Use ClientLogger in testing output * Fix null pointer exception and context usage (#40053) * Rename AML to AzureMachineLearning (#40056) * Fixed the Key Vault `test-resources.json` file to properly configure a deployment script for certificate creation. (#40037) * Close response body in bearer policy (#40052) * Running Prepare-Release for azure-messaging-servicebus 7.17.0 (#40058) * mgmt, TypeSpec code generation pipeline (#39963) * typespec generation pipeline echo command PR_TITLE * generation typespec Update generation.yml for Azure Pipelines Update generation.yml for Azure Pipelines Update generation.yml for Azure Pipelines * remove typespec pipeline file * fix pr title * address comments * Add codeowner linter owners (#39997) * Update to ESRP task version that supports federated auth (#40059) * Increment package versions for cosmos releases (#40031) * Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#39627) * Add reduced embeddings sample to azure-search-documents (#40069) * Add reduced embeddings sample * Fix cspell * Fix link * Search May Preview Regen Updates (#40057) * Search May Preview Regeneration - Still need to add varargs convenience * Removing ovveride statements from `setFields` for `VectorizableImageUrlQuery` and `VectorizableImageBinaryQuery` * Removing ovveride statements from `setFields` for `VectorizableImageUrlQuery` and `VectorizableImageBinaryQuery` * adding varargs * Additional adjustments to FieldBuilder and Search Index Customizations * Updating cspell.json * Adjust `SearchScoreThreshold` customization Re-enable code generation in CI * Updates: - Updated Cspell - Rename `maxStoragePerIndex` property to `maxStoragePerIndexInBytes` in SearchServiceLimits - Set `hybridSearch` property to be type `HybridSearch` in SearchRequest - Add `hybridSearch` to SearchOptions and `SearchAsyncClient.createSearchRequest()` * Adding Support and testing byte[] and List within field builder * Fix linting --------- Co-authored-by: alzimmermsft <48699787+alzimmermsft@users.noreply.github.com> * Preparing Search May 2024 Beta Release (#40071) * Preparing Search May 2024 Beta Release * Preparing Search May 2024 Beta Release * Resolving comments * Fixing build issues * eng, update autorest.java, improve error output in sdk automation (#40073) * improve error output * autorest.java 4.1.29 * Merge to main after spring cloud azure 4.18.0 released (#40075) * Prepare for Spring Cloud Azure 4.18.0 release (#40063) * update version client * update version/changelog/readme * update changelog * Increment versions for spring releases (#40074) * Increment package versions for spring releases * Update version_client.txt * Update pom.xml --------- Co-authored-by: Muyao Feng <92105726+Netyyyy@users.noreply.github.com> --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> * Miscellaneous Core performance improvements (#39552) Miscellaneous Core performance improvements * Increment package versions for search releases (#40072) * Update io.fabric8:kubernetes-client (#40086) 5.12.3 -> 6.12.1 * Increment package versions for servicebus releases (#40094) * Emit stable auto-instrumented otel metrics (#39960) * Update otel metrics logic * add runtime metrics * adding a few metrics I forgot * small correction * Update * Fix * Update * Delete pre-stable metrics --------- Co-authored-by: Harsimar Kaur (from Dev Box) * Initial changes --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: Anu Thomas Chandy Co-authored-by: v-durgeshs <146056835+v-durgeshs@users.noreply.github.com> Co-authored-by: Vinothini Dharmaraj Co-authored-by: James Suplizio Co-authored-by: Bill Wert Co-authored-by: williamzhao87 Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac Co-authored-by: Kushagra Thapar Co-authored-by: minwoolee-msft <77083090+minwoolee-msft@users.noreply.github.com> Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com> Co-authored-by: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Co-authored-by: Liudmila Molkova Co-authored-by: Jesse Squire Co-authored-by: Harsimar Kaur Co-authored-by: vcolin7 Co-authored-by: Xiaofei Cao <92354331+XiaofeiCao@users.noreply.github.com> Co-authored-by: Wes Haggard Co-authored-by: Patrick Hallisey Co-authored-by: Jair Myree Co-authored-by: Weidong Xu Co-authored-by: Muyao Feng <92105726+Netyyyy@users.noreply.github.com> Co-authored-by: Helen <56097766+heyams@users.noreply.github.com> Co-authored-by: Harsimar Kaur (from Dev Box) --- .../cosmos/models/CosmosQueryRequestOptions.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java index 309fb87a8b22..f9d7d4a72531 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java @@ -265,6 +265,17 @@ public Integer getMaxItemSizeForVectorSearch() { return this.actualRequestOptions.getMaxItemSizeForVectorSearch(); } + /** + * Sets the maximum item size to fetch during non-streaming order by queries. + * + * @param maxItemSizeForVectorSearch the max number of items for vector search. + * @return the CosmosQueryRequestOptions. + */ + public CosmosQueryRequestOptions setMaxItemSizeForVectorSearch(Integer maxItemSizeForVectorSearch) { + this.actualRequestOptions.setMaxItemSizeForVectorSearch(maxItemSizeForVectorSearch); + return this; + } + /** * Gets the request continuation token. * From 55efb819c99e435d1cb413395c312703ce9dc448 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Fri, 10 May 2024 14:11:45 -0700 Subject: [PATCH 22/28] Resolving comments --- .../src/test/java/com/azure/cosmos/rx/VectorIndexTest.java | 2 +- sdk/cosmos/azure-cosmos/CHANGELOG.md | 3 +-- .../com/azure/cosmos/models/CosmosVectorEmbedding.java | 4 ++-- .../azure/cosmos/models/CosmosVectorEmbeddingPolicy.java | 7 +++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java index 74f13be9d4f4..d4f5b8cf6602 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java @@ -235,7 +235,7 @@ public void shouldFailOnWrongVectorEmbeddingPolicy() { embedding.setDistanceFunction(null); fail("Embedding creation failed because cosmosVectorDistanceFunction argument is empty"); } catch (NullPointerException ex) { - assertThat(ex.getMessage()).isEqualTo("cosmosVectorDistanceFunction cannot be empty"); + assertThat(ex.getMessage()).isEqualTo("cosmosVectorDistanceFunction cannot be null"); } try { diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 28c11dc76f12..799408de337b 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -3,6 +3,7 @@ ### 4.60.0-beta.1 (Unreleased) #### Features Added +* Added `cosmosVectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379) #### Breaking Changes @@ -11,9 +12,7 @@ #### Other Changes ### 4.59.0 (2024-04-27) - #### Features Added -* Added `cosmosVectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379) * Added public APIs `getCustomItemSerializer` and `setCustomItemSerializer` to allow customers to specify custom payload transformations or serialization settings. - See [PR 38997](https://github.com/Azure/azure-sdk-for-java/pull/38997) and [PR 39933](https://github.com/Azure/azure-sdk-for-java/pull/39933) #### Other Changes diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java index 94a519ef9d38..0f111d34e00a 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java @@ -47,7 +47,7 @@ public String getPath() { */ public CosmosVectorEmbedding setPath(String path) { if (StringUtils.isEmpty(path)) { - throw new NullPointerException("embedding path is empty"); + throw new NullPointerException("embedding path is either null or empty"); } if (path.charAt(0) != '/' || path.lastIndexOf('/') != 0) { @@ -121,7 +121,7 @@ public CosmosVectorDistanceFunction getDistanceFunction() { * @return CosmosVectorEmbedding */ public CosmosVectorEmbedding setDistanceFunction(CosmosVectorDistanceFunction distanceFunction) { - checkNotNull(distanceFunction, "cosmosVectorDistanceFunction cannot be empty"); + checkNotNull(distanceFunction, "cosmosVectorDistanceFunction cannot be null"); this.distanceFunction = distanceFunction.toString(); return this; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java index c54c843ebd96..86102cedb753 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java @@ -9,6 +9,8 @@ import java.util.List; +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + /** * Vector Embedding Policy */ @@ -44,12 +46,9 @@ public List getVectorEmbeddings() { */ public void setCosmosVectorEmbeddings(List cosmosVectorEmbeddings) { cosmosVectorEmbeddings.forEach(embedding -> { - if (embedding == null) { - throw new NullPointerException("Embedding cannot be null."); - } + checkNotNull(embedding, "Embedding cannot be null."); }); this.cosmosVectorEmbeddings = cosmosVectorEmbeddings; -// this.jsonSerializable.set(Constants.Properties.VECTOR_EMBEDDINGS, cosmosVectorEmbeddings); } } From 9a3b003b2014e50322a6834ce4cef6ba03f12ad0 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Fri, 10 May 2024 14:16:44 -0700 Subject: [PATCH 23/28] Resolving comments --- .../java/com/azure/cosmos/models/CosmosVectorDataType.java | 3 ++- .../azure/cosmos/models/CosmosVectorDistanceFunction.java | 3 ++- .../azure/cosmos/models/CosmosVectorEmbeddingPolicy.java | 2 +- .../java/com/azure/cosmos/models/CosmosVectorIndexSpec.java | 6 ++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java index 1a0d42af17a4..d8a4a63edbe2 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java @@ -53,6 +53,7 @@ public static CosmosVectorDataType fromString(String value) { return Arrays.stream(CosmosVectorDataType.values()) .filter(vectorDataType -> vectorDataType.toString().equalsIgnoreCase(value)) .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Invalid vector data type for the vector embedding policy.")); + .orElseThrow(() -> new IllegalArgumentException(String.format( + "Invalid vector data type with value {%s} for the vector embedding policy.", value))); } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java index 60efd432ad7f..57f74fab3dc9 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java @@ -48,6 +48,7 @@ public static CosmosVectorDistanceFunction fromString(String value) { return Arrays.stream(CosmosVectorDistanceFunction.values()) .filter(vectorDistanceFunction -> vectorDistanceFunction.toString().equalsIgnoreCase(value)) .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Invalid distance function for the vector embedding policy.")); + .orElseThrow(() -> new IllegalArgumentException(String.format( + "Invalid distance function with value {%s} for the vector embedding policy.", value ))); } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java index 86102cedb753..6abcc0028723 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java @@ -46,7 +46,7 @@ public List getVectorEmbeddings() { */ public void setCosmosVectorEmbeddings(List cosmosVectorEmbeddings) { cosmosVectorEmbeddings.forEach(embedding -> { - checkNotNull(embedding, "Embedding cannot be null."); + checkNotNull(embedding, "Null values are not allowed in cosmosVectorEmbeddings list."); }); this.cosmosVectorEmbeddings = cosmosVectorEmbeddings; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java index 13b1559810ca..4ea617eea041 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java @@ -14,13 +14,15 @@ */ public final class CosmosVectorIndexSpec { - private JsonSerializable jsonSerializable; + private final JsonSerializable jsonSerializable; private String type; /** * Constructor */ - public CosmosVectorIndexSpec() { this.jsonSerializable = new JsonSerializable(); } + public CosmosVectorIndexSpec() { + this.jsonSerializable = new JsonSerializable(); + } /** * Gets path. From 52917f935fdf16342d66da19fb831fa45fb16477 Mon Sep 17 00:00:00 2001 From: Aayush Kataria Date: Fri, 10 May 2024 14:27:51 -0700 Subject: [PATCH 24/28] [Cosmos][VectorSearch] Non Streaming Order By Query (#40115) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial changes * Initial changes * Increment versions for core releases (#40003) Increment package versions for core releases * Ensure ServiceBus session idle timeout fall back to retry-options::try-timeout (#39994) * Added Alpha3 Java Media Streaming Events (#40002) * Added Alpha3 Java Media Streaming Events * updating readme to add the media streaming events to remove model --------- Co-authored-by: Vinothini Dharmaraj * Update version of github-event-processor to 1.0.0-dev.20240502.2 (#40012) Co-authored-by: James Suplizio * Prepare May 2024 Identity Release (#40006) * Prepare Identity Broker May 2024 Release (#40014) * Increment package versions for identity releases (#40015) * [JobRouter] SDK Review updates (#40011) * SDK Review updates * Update auto-generated models * Add customization * Fix customization * Update package * Update tests * Linting * FixFaultInjectionRuleFailedToApplyPerPartitionInGatewayMode (#40005) * fix fault injection rule failed to apply per partition in gateway mode --------- Co-authored-by: annie-mac * azure-cosmos-test_1.0.0.beta.7Release (#40021) * release azure-cosmos-test 1.0.0.beta.7 --------- Co-authored-by: annie-mac * Fixed existsById API in ReactiveCosmosTemplate (#40022) * Fixed existsById API in ReactiveCosmosTemplate * Added changelog * Initial changes * Initial changes * Skip Recorded test and delete Event record until test proxy to work with Event recordings (#40029) Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com> * Fix invalid CODEOWNERS (#40032) * Initial changes * ServiceBus: fix session tracing (#39962) * remove additional matrix * Fix session processing and disposition instrumentation * return matrix config * review suggestions * [Automation] Generate SDK based on TypeSpec 0.15.15 (#40048) * [CODEOWNERS] Updates for org changes (#40049) * [CODEOWNERS] Updates for org changes The focus of these changes is to remove an individual who no longer is responsible for the products which their GH account is associated to. * Move from using the docker image to java2docfx for docs validation (#39744) * Move from using the docker image to java2docfx for docs validation * Temporarily turn on docs processing for template libraries for testing * Actually install the rex validation tool * Fix the if not Test-Path statement * Update java2docfx version and add a couple of diagnostics output lines * Add missing close paren * Ensure that Sort-Object always returns an array even if there's only one item * add another piece of diagnostics output * trying one more thing * remove some diag, add other * Remove the additional diagnostics, add permanent output message * Invoke java -jar on java2docfx to show the help command to ensure the install is okay * fiddling with the java -jar command * Set the working directory to the java2docfx directory before executing the mvn dependency download * Actually create the directory before trying to set location...oops * Update rex validation to verify MAVEN_HOME is set * Updates for Java PR 39875 which had changes from this PR that were more immediate * Update java2docfx version * remove check for MAVEN_HOME which was only for testing * Update the version of java2docfx to test a fix * Update version of java2docfx to 1.0.4 * revert template's ci.yml changes that were only necessary to test java2docfx * owners (#39686) * Use ClientLogger in testing output (#40010) Use ClientLogger in testing output * Fix null pointer exception and context usage (#40053) * Rename AML to AzureMachineLearning (#40056) * Fixed the Key Vault `test-resources.json` file to properly configure a deployment script for certificate creation. (#40037) * Close response body in bearer policy (#40052) * Running Prepare-Release for azure-messaging-servicebus 7.17.0 (#40058) * mgmt, TypeSpec code generation pipeline (#39963) * typespec generation pipeline echo command PR_TITLE * generation typespec Update generation.yml for Azure Pipelines Update generation.yml for Azure Pipelines Update generation.yml for Azure Pipelines * remove typespec pipeline file * fix pr title * address comments * Add codeowner linter owners (#39997) * Update to ESRP task version that supports federated auth (#40059) * Increment package versions for cosmos releases (#40031) * Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#39627) * Add reduced embeddings sample to azure-search-documents (#40069) * Add reduced embeddings sample * Fix cspell * Fix link * Search May Preview Regen Updates (#40057) * Search May Preview Regeneration - Still need to add varargs convenience * Removing ovveride statements from `setFields` for `VectorizableImageUrlQuery` and `VectorizableImageBinaryQuery` * Removing ovveride statements from `setFields` for `VectorizableImageUrlQuery` and `VectorizableImageBinaryQuery` * adding varargs * Additional adjustments to FieldBuilder and Search Index Customizations * Updating cspell.json * Adjust `SearchScoreThreshold` customization Re-enable code generation in CI * Updates: - Updated Cspell - Rename `maxStoragePerIndex` property to `maxStoragePerIndexInBytes` in SearchServiceLimits - Set `hybridSearch` property to be type `HybridSearch` in SearchRequest - Add `hybridSearch` to SearchOptions and `SearchAsyncClient.createSearchRequest()` * Adding Support and testing byte[] and List within field builder * Fix linting --------- Co-authored-by: alzimmermsft <48699787+alzimmermsft@users.noreply.github.com> * Preparing Search May 2024 Beta Release (#40071) * Preparing Search May 2024 Beta Release * Preparing Search May 2024 Beta Release * Resolving comments * Fixing build issues * eng, update autorest.java, improve error output in sdk automation (#40073) * improve error output * autorest.java 4.1.29 * Merge to main after spring cloud azure 4.18.0 released (#40075) * Prepare for Spring Cloud Azure 4.18.0 release (#40063) * update version client * update version/changelog/readme * update changelog * Increment versions for spring releases (#40074) * Increment package versions for spring releases * Update version_client.txt * Update pom.xml --------- Co-authored-by: Muyao Feng <92105726+Netyyyy@users.noreply.github.com> --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> * Miscellaneous Core performance improvements (#39552) Miscellaneous Core performance improvements * Increment package versions for search releases (#40072) * Update io.fabric8:kubernetes-client (#40086) 5.12.3 -> 6.12.1 * Increment package versions for servicebus releases (#40094) * Emit stable auto-instrumented otel metrics (#39960) * Update otel metrics logic * add runtime metrics * adding a few metrics I forgot * small correction * Update * Fix * Update * Delete pre-stable metrics --------- Co-authored-by: Harsimar Kaur (from Dev Box) * [Key Vault] Added support for `/prerestore` and `/prebackup` endpoints in Backup clients (#39878) * Updated `autorest.md` files in all swagger folders. * Re-generated implementation code. * Updated ServiceVersion expandable enums. * Added public APIs for the new /prebacukp and /prerestore endpoints. * Added tests. * Refactored Backup client tests. * Updated tests. * Updated test recordings. * Updated documentation and samples. * Addressed PR feedback. * Initial changes * Prepare to release beta.22 (#40097) * Fix template name (#40099) * Fix template name * Also install the rex validation tool * Update partner release to use WIF (#40101) * core mgmt, `SubResource` implements `JsonSerializable` to support azure-json (#40076) * test * implementation * fix lint * spotless:apply * Update spring-reference and sync changelog (#40105) * update spring-reference.yml * update CHANGELOG.md * Support per-call response timeout in all HttpClient implementations (#40017) Support per-call response timeout in all HttpClient implementations * Change how JavaType is resolved to support JsonSerializable better (#40112) * Initial changes * Fixes --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: Anu Thomas Chandy Co-authored-by: v-durgeshs <146056835+v-durgeshs@users.noreply.github.com> Co-authored-by: Vinothini Dharmaraj Co-authored-by: James Suplizio Co-authored-by: Bill Wert Co-authored-by: williamzhao87 Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac Co-authored-by: Kushagra Thapar Co-authored-by: minwoolee-msft <77083090+minwoolee-msft@users.noreply.github.com> Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com> Co-authored-by: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Co-authored-by: Liudmila Molkova Co-authored-by: Jesse Squire Co-authored-by: Harsimar Kaur Co-authored-by: vcolin7 Co-authored-by: Xiaofei Cao <92354331+XiaofeiCao@users.noreply.github.com> Co-authored-by: Wes Haggard Co-authored-by: Patrick Hallisey Co-authored-by: Jair Myree Co-authored-by: Weidong Xu Co-authored-by: Muyao Feng <92105726+Netyyyy@users.noreply.github.com> Co-authored-by: Helen <56097766+heyams@users.noreply.github.com> Co-authored-by: Harsimar Kaur (from Dev Box) --- eng/pipelines/docindex.yml | 4 +- eng/pipelines/partner-release.yml | 18 +- .../http/jdk/httpclient/JdkHttpClient.java | 11 +- .../jdk/httpclient/JdkHttpClientBuilder.java | 43 +- .../implementation/AzureJdkHttpRequest.java | 4 + .../JdkHttpClientLocalTestServer.java | 12 + .../jdk/httpclient/JdkHttpClientTests.java | 42 + .../core/http/netty/NettyAsyncHttpClient.java | 15 +- .../netty/NettyAsyncHttpClientBuilder.java | 57 +- .../NettyAsyncHttpClientBuilderTests.java | 3 +- .../http/netty/NettyAsyncHttpClientTests.java | 50 +- .../NettyHttpClientLocalTestServer.java | 11 + .../http/okhttp/OkHttpAsyncHttpClient.java | 110 ++- .../okhttp/OkHttpAsyncHttpClientBuilder.java | 90 +-- .../implementation/PerCallTimeoutCall.java | 92 +++ .../ResponseTimeoutListener.java | 220 ++++++ .../ResponseTimeoutListenerFactory.java | 26 + .../okhttp/OkHttpAsyncHttpClientTests.java | 48 ++ .../okhttp/OkHttpClientLocalTestServer.java | 11 + sdk/core/azure-core-http-vertx/pom.xml | 6 - .../spotbugs-exclude.xml | 8 + .../core/http/vertx/VertxAsyncHttpClient.java | 212 ++--- .../vertx/VertxAsyncHttpClientBuilder.java | 151 ++-- .../vertx/VertxAsyncHttpClientProvider.java | 6 +- .../VertxRequestWriteSubscriber.java | 29 +- ...xHttpClientBuilderJavaDocCodeSnippets.java | 27 +- .../VertxAsyncHttpClientBuilderTests.java | 24 +- .../VertxAsyncHttpClientProviderTests.java | 5 +- .../http/vertx/VertxAsyncHttpClientTests.java | 50 +- .../vertx/VertxHttpClientLocalTestServer.java | 11 + .../azure/core/management/SubResource.java | 40 +- .../azure/core/management/ResourceTests.java | 128 +++ .../implementation/ObjectMapperShim.java | 28 +- .../azure/core/test/http/HttpClientTests.java | 4 +- .../http/rest/RestProxyBase.java | 7 +- .../jackson/ObjectMapperShim.java | 26 +- .../core/implementation/util/HttpUtils.java | 130 ++++ .../azure/core/util/HttpClientOptions.java | 77 +- .../com/azure/cosmos/rx/VectorIndexTest.java | 345 -------- sdk/cosmos/azure-cosmos/CHANGELOG.md | 1 - .../cosmos/implementation/Constants.java | 9 - .../CosmosQueryRequestOptionsImpl.java | 2 +- .../implementation/DocumentCollection.java | 31 - ...gOrderByDocumentQueryExecutionContext.java | 10 +- .../query/NonStreamingOrderByUtils.java | 5 +- ...ipelinedDocumentQueryExecutionContext.java | 7 +- .../azure/cosmos/models/CompositePath.java | 2 +- .../models/CosmosContainerProperties.java | 22 - .../cosmos/models/CosmosVectorDataType.java | 58 -- .../models/CosmosVectorDistanceFunction.java | 53 -- .../cosmos/models/CosmosVectorEmbedding.java | 128 --- .../models/CosmosVectorEmbeddingPolicy.java | 55 -- .../cosmos/models/CosmosVectorIndexSpec.java | 77 -- .../cosmos/models/CosmosVectorIndexType.java | 36 - .../azure/cosmos/models/IndexingPolicy.java | 53 +- .../cosmos/models/ModelBridgeInternal.java | 4 - .../README.md | 126 ++- .../assets.json | 2 +- .../KeyVaultAdministrationServiceVersion.java | 9 +- .../KeyVaultBackupAsyncClient.java | 225 +++++- .../administration/KeyVaultBackupClient.java | 273 ++++++- .../KeyVaultBackupClientImpl.java | 330 +++++++- .../models/PreBackupOperationParameters.java | 144 ++++ .../models/PreFullBackupHeaders.java | 81 ++ .../PreFullRestoreOperationHeaders.java | 81 ++ .../models/PreRestoreOperationParameters.java | 113 +++ .../keyvault/administration/package-info.java | 95 ++- .../administration/ReadmeSamples.java | 124 ++- ...tBackupAsyncClientJavaDocCodeSnippets.java | 51 +- ...yVaultBackupClientJavaDocCodeSnippets.java | 83 +- .../KeyVaultAccessControlClientTestBase.java | 2 +- .../KeyVaultBackupAsyncClientTest.java | 143 ++-- .../KeyVaultBackupClientTest.java | 67 +- .../KeyVaultBackupClientTestBase.java | 8 +- .../swagger/autorest.md | 6 +- .../assets.json | 2 +- .../CertificateServiceVersion.java | 9 +- .../CertificateAsyncClientTest.java | 8 +- .../certificates/CertificateClientTest.java | 8 +- .../certificates/FakeCredentialsForTests.java | 107 +-- .../swagger/autorest.md | 2 +- .../azure-security-keyvault-keys/assets.json | 2 +- .../keyvault/keys/KeyServiceVersion.java | 9 +- .../CryptographyServiceVersion.java | 9 +- .../models/LifetimeActionsType.java | 6 +- .../keys/models/KeyRotationPolicyAction.java | 11 +- .../keyvault/keys/KeyAsyncClientTest.java | 15 +- .../security/keyvault/keys/KeyClientTest.java | 10 +- .../swagger/autorest.md | 2 +- .../assets.json | 2 +- .../secrets/SecretServiceVersion.java | 9 +- .../swagger/autorest.md | 2 +- .../CHANGELOG.md | 10 +- .../README.md | 2 +- sdk/spring/CHANGELOG.md | 13 + .../azure-spring-data-cosmos/CHANGELOG.md | 12 + sdk/spring/spring-reference.yml | 734 +++++++++--------- 97 files changed, 3653 insertions(+), 2028 deletions(-) create mode 100644 sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/PerCallTimeoutCall.java create mode 100644 sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/ResponseTimeoutListener.java create mode 100644 sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/ResponseTimeoutListenerFactory.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/HttpUtils.java delete mode 100644 sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java create mode 100644 sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreBackupOperationParameters.java create mode 100644 sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreFullBackupHeaders.java create mode 100644 sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreFullRestoreOperationHeaders.java create mode 100644 sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreRestoreOperationParameters.java diff --git a/eng/pipelines/docindex.yml b/eng/pipelines/docindex.yml index c128f858955d..21e623ada65c 100644 --- a/eng/pipelines/docindex.yml +++ b/eng/pipelines/docindex.yml @@ -90,7 +90,9 @@ jobs: parameters: DailyBranchVariableName: DailyDocsBranchName - - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml + + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - task: Powershell@2 inputs: diff --git a/eng/pipelines/partner-release.yml b/eng/pipelines/partner-release.yml index 8e6e5e544a6f..2a4052c95ac0 100644 --- a/eng/pipelines/partner-release.yml +++ b/eng/pipelines/partner-release.yml @@ -37,12 +37,20 @@ extends: - template: /eng/pipelines/templates/steps/download-credscan-suppressions.yml - - task: PowerShell@2 - displayName: 'Download packages from blob storage' + - task: AzurePowerShell@5 + displayName: 'Copy from azuresdkpartnerdrops' + condition: and(succeeded(), ne(variables['SkipCopyFromPartnerDrops'], 'true')) inputs: - targetType: filePath - filePath: '$(BuildToolScripts)/copy-from-azuresdkpartnerdrops.ps1' - arguments: '$(Artifacts) ${{ parameters.BlobPath }} $(azuresdkpartnerdrops-access-key)' + azureSubscription: 'azuresdkpartnerdrops - Storage Partner Drops' + ScriptType: 'InlineScript' + azurePowerShellVersion: LatestVersion + pwsh: true + Inline: | + azcopy copy 'https://azuresdkpartnerdrops.blob.core.windows.net/drops/${{ parameters.BlobPath }}/*' '$(Artifacts)' --recursive=true + echo "Copied files:" + dir '$(Artifacts)' -r | % { $_.FullName } + env: + AZCOPY_AUTO_LOGIN_TYPE: 'PSCRED' - template: tools/java-esrp-signing/java-esrp-signing.yml@azure-sdk-build-tools parameters: diff --git a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java index 8f8a45ef498c..f2fcd2dad7d1 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java +++ b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java @@ -12,6 +12,7 @@ import com.azure.core.http.jdk.httpclient.implementation.InputStreamTimeoutResponseSubscriber; import com.azure.core.http.jdk.httpclient.implementation.JdkHttpResponseAsync; import com.azure.core.http.jdk.httpclient.implementation.JdkHttpResponseSync; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; @@ -31,8 +32,6 @@ */ class JdkHttpClient implements HttpClient { private static final ClientLogger LOGGER = new ClientLogger(JdkHttpClient.class); - private static final String AZURE_EAGERLY_READ_RESPONSE = "azure-eagerly-read-response"; - private static final String AZURE_IGNORE_RESPONSE_BODY = "azure-ignore-response-body"; private final java.net.http.HttpClient jdkHttpClient; @@ -79,8 +78,8 @@ public Mono send(HttpRequest request) { @Override public Mono send(HttpRequest request, Context context) { - boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false); - boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false); + boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false); + boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false); Mono jdkRequestMono = Mono.fromCallable(() -> toJdkHttpRequest(request, context)); @@ -111,8 +110,8 @@ public Mono send(HttpRequest request, Context context) { @Override public HttpResponse sendSync(HttpRequest request, Context context) { - boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false); - boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false); + boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false); + boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false); java.net.http.HttpRequest jdkRequest = toJdkHttpRequest(request, context); try { diff --git a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClientBuilder.java b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClientBuilder.java index 79e2da860819..c20b141ecb1f 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClientBuilder.java +++ b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClientBuilder.java @@ -25,11 +25,11 @@ import java.util.Set; import java.util.concurrent.Executor; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_READ_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT; -import static com.azure.core.util.CoreUtils.getDefaultTimeoutFromEnvironment; +import static com.azure.core.implementation.util.HttpUtils.getDefaultConnectTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultReadTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultResponseTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultWriteTimeout; +import static com.azure.core.implementation.util.HttpUtils.getTimeout; /** * Builder to configure and build an instance of the azure-core {@link HttpClient} type using the JDK HttpClient APIs, @@ -38,12 +38,6 @@ public class JdkHttpClientBuilder { private static final ClientLogger LOGGER = new ClientLogger(JdkHttpClientBuilder.class); - private static final Duration MINIMUM_TIMEOUT = Duration.ofMillis(1); - private static final Duration DEFAULT_CONNECTION_TIMEOUT; - private static final Duration DEFAULT_WRITE_TIMEOUT; - private static final Duration DEFAULT_RESPONSE_TIMEOUT; - private static final Duration DEFAULT_READ_TIMEOUT; - private static final String JAVA_HOME = System.getProperty("java.home"); private static final String JDK_HTTPCLIENT_ALLOW_RESTRICTED_HEADERS = "jdk.httpclient.allowRestrictedHeaders"; @@ -57,17 +51,6 @@ public class JdkHttpClientBuilder { static final Set DEFAULT_RESTRICTED_HEADERS; static { - Configuration configuration = Configuration.getGlobalConfiguration(); - - DEFAULT_CONNECTION_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, - PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT, Duration.ofSeconds(10), LOGGER); - DEFAULT_WRITE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT, - Duration.ofSeconds(60), LOGGER); - DEFAULT_RESPONSE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, - PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT, Duration.ofSeconds(60), LOGGER); - DEFAULT_READ_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_READ_TIMEOUT, - Duration.ofSeconds(60), LOGGER); - DEFAULT_RESTRICTED_HEADERS = Set.of("connection", "content-length", "expect", "host", "upgrade"); } @@ -248,11 +231,11 @@ public HttpClient build() { // Azure JDK http client supports HTTP 1.1 by default. httpClientBuilder.version(java.net.http.HttpClient.Version.HTTP_1_1); - httpClientBuilder = httpClientBuilder.connectTimeout(getTimeout(connectionTimeout, DEFAULT_CONNECTION_TIMEOUT)); + httpClientBuilder = httpClientBuilder.connectTimeout(getTimeout(connectionTimeout, getDefaultConnectTimeout())); - Duration writeTimeout = getTimeout(this.writeTimeout, DEFAULT_WRITE_TIMEOUT); - Duration responseTimeout = getTimeout(this.responseTimeout, DEFAULT_RESPONSE_TIMEOUT); - Duration readTimeout = getTimeout(this.readTimeout, DEFAULT_READ_TIMEOUT); + Duration writeTimeout = getTimeout(this.writeTimeout, getDefaultWriteTimeout()); + Duration responseTimeout = getTimeout(this.responseTimeout, getDefaultResponseTimeout()); + Duration readTimeout = getTimeout(this.readTimeout, getDefaultReadTimeout()); Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; @@ -331,12 +314,4 @@ protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(this.userName, password.toCharArray()); } } - - private static Duration getTimeout(Duration configuredTimeout, Duration defaultTimeout) { - if (configuredTimeout == null) { - return defaultTimeout; - } - - return configuredTimeout.compareTo(MINIMUM_TIMEOUT) < 0 ? MINIMUM_TIMEOUT : configuredTimeout; - } } diff --git a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/implementation/AzureJdkHttpRequest.java b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/implementation/AzureJdkHttpRequest.java index 6cf58d3b4a36..4e833c2eec52 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/implementation/AzureJdkHttpRequest.java +++ b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/implementation/AzureJdkHttpRequest.java @@ -4,6 +4,7 @@ import com.azure.core.http.HttpMethod; import com.azure.core.implementation.util.HttpHeadersAccessHelper; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.util.Context; import com.azure.core.util.Contexts; import com.azure.core.util.ProgressReporter; @@ -51,6 +52,9 @@ public AzureJdkHttpRequest(com.azure.core.http.HttpRequest azureCoreRequest, Con Set restrictedHeaders, ClientLogger logger, Duration writeTimeout, Duration responseTimeout) { HttpMethod method = azureCoreRequest.getHttpMethod(); ProgressReporter progressReporter = Contexts.with(context).getHttpRequestProgressReporter(); + responseTimeout = (Duration) context.getData(HttpUtils.AZURE_RESPONSE_TIMEOUT) + .filter(timeoutDuration -> timeoutDuration instanceof Duration) + .orElse(responseTimeout); this.method = method.toString(); this.bodyPublisher = (method == HttpMethod.GET || method == HttpMethod.HEAD) diff --git a/sdk/core/azure-core-http-jdk-httpclient/src/test/java/com/azure/core/http/jdk/httpclient/JdkHttpClientLocalTestServer.java b/sdk/core/azure-core-http-jdk-httpclient/src/test/java/com/azure/core/http/jdk/httpclient/JdkHttpClientLocalTestServer.java index 48ce978de02a..4cac959b2dcf 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/src/test/java/com/azure/core/http/jdk/httpclient/JdkHttpClientLocalTestServer.java +++ b/sdk/core/azure-core-http-jdk-httpclient/src/test/java/com/azure/core/http/jdk/httpclient/JdkHttpClientLocalTestServer.java @@ -22,6 +22,8 @@ public final class JdkHttpClientLocalTestServer { private static volatile LocalTestServer proxyServer; private static final Semaphore PROXY_SERVER_SEMAPHORE = new Semaphore(1); + public static final String TIMEOUT = "/timeout"; + public static final byte[] SHORT_BODY = "hi there".getBytes(StandardCharsets.UTF_8); public static final byte[] LONG_BODY = createLongBody(); @@ -104,6 +106,16 @@ private static LocalTestServer initializeServer() { resp.getHttpOutput().write(SHORT_BODY, 5, 3); resp.getHttpOutput().flush(); resp.getHttpOutput().complete(Callback.NOOP); + } else if (get && TIMEOUT.equals(path)) { + try { + Thread.sleep(5000); + resp.setStatus(200); + resp.getHttpOutput().write(SHORT_BODY); + resp.getHttpOutput().flush(); + resp.getHttpOutput().complete(Callback.NOOP); + } catch (InterruptedException e) { + throw new ServletException(e); + } } else { throw new ServletException("Unexpected request: " + req.getMethod() + " " + path); } diff --git a/sdk/core/azure-core-http-jdk-httpclient/src/test/java/com/azure/core/http/jdk/httpclient/JdkHttpClientTests.java b/sdk/core/azure-core-http-jdk-httpclient/src/test/java/com/azure/core/http/jdk/httpclient/JdkHttpClientTests.java index 35503e58c998..88b0ef8dca21 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/src/test/java/com/azure/core/http/jdk/httpclient/JdkHttpClientTests.java +++ b/sdk/core/azure-core-http-jdk-httpclient/src/test/java/com/azure/core/http/jdk/httpclient/JdkHttpClientTests.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.Contexts; @@ -55,6 +56,7 @@ import static com.azure.core.http.jdk.httpclient.JdkHttpClientLocalTestServer.LONG_BODY; import static com.azure.core.http.jdk.httpclient.JdkHttpClientLocalTestServer.SHORT_BODY; +import static com.azure.core.http.jdk.httpclient.JdkHttpClientLocalTestServer.TIMEOUT; import static com.azure.core.test.utils.TestUtils.assertArraysEqual; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertInstanceOf; @@ -469,6 +471,46 @@ public void slowEagerReadingTimesOutAsync() { .verify(Duration.ofSeconds(5)); } + @Test + public void perCallTimeout() { + HttpClient client = new JdkHttpClientBuilder().responseTimeout(Duration.ofSeconds(10)).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT)); + + // Verify a smaller timeout sent through Context times out the request. + StepVerifier.create(client.send(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1)))) + .expectErrorMatches(e -> e instanceof HttpTimeoutException) + .verify(); + + // Then verify not setting a timeout through Context does not time out the request. + StepVerifier.create(client.send(request) + .flatMap(response -> Mono.zip(FluxUtil.collectBytesInByteBufferStream(response.getBody()), + Mono.just(response.getStatusCode())))) + .assertNext(tuple -> { + assertArraysEqual(SHORT_BODY, tuple.getT1()); + assertEquals(200, tuple.getT2()); + }) + .verifyComplete(); + } + + @Test + public void perCallTimeoutSync() { + HttpClient client = new JdkHttpClientBuilder().responseTimeout(Duration.ofSeconds(10)).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT)); + + // Verify a smaller timeout sent through Context times out the request. + RuntimeException ex = assertThrows(RuntimeException.class, + () -> client.sendSync(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1)))); + assertInstanceOf(HttpTimeoutException.class, ex.getCause()); + + // Then verify not setting a timeout through Context does not time out the request. + try (HttpResponse response = client.sendSync(request, Context.NONE)) { + assertEquals(200, response.getStatusCode()); + assertArraysEqual(SHORT_BODY, response.getBodyAsBinaryData().toBytes()); + } + } + private static Mono getResponse(String path) { HttpClient client = new JdkHttpClientBuilder().build(); return doRequest(client, path); diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java index 944b72081b40..e64b7b69fa1b 100644 --- a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java @@ -15,6 +15,7 @@ import com.azure.core.implementation.util.BinaryDataHelper; import com.azure.core.implementation.util.ByteArrayContent; import com.azure.core.implementation.util.FileContent; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.implementation.util.InputStreamContent; import com.azure.core.implementation.util.SerializableContent; import com.azure.core.implementation.util.StringContent; @@ -94,11 +95,6 @@ class NettyAsyncHttpClient implements HttpClient { private static final ClientLogger LOGGER = new ClientLogger(NettyAsyncHttpClient.class); private static final byte[] EMPTY_BYTES = new byte[0]; - private static final String AZURE_EAGERLY_READ_RESPONSE = "azure-eagerly-read-response"; - private static final String AZURE_IGNORE_RESPONSE_BODY = "azure-ignore-response-body"; - private static final String AZURE_RESPONSE_TIMEOUT = "azure-response-timeout"; - private static final String AZURE_EAGERLY_CONVERT_HEADERS = "azure-eagerly-convert-headers"; - final boolean disableBufferCopy; final boolean addProxyHandler; @@ -132,10 +128,11 @@ public Mono send(HttpRequest request, Context context) { Objects.requireNonNull(request.getUrl(), "'request.getUrl()' cannot be null."); Objects.requireNonNull(request.getUrl().getProtocol(), "'request.getUrl().getProtocol()' cannot be null."); - boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false); - boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false); - boolean headersEagerlyConverted = (boolean) context.getData(AZURE_EAGERLY_CONVERT_HEADERS).orElse(false); - Long responseTimeout = context.getData(AZURE_RESPONSE_TIMEOUT) + boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false); + boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false); + boolean headersEagerlyConverted + = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_CONVERT_HEADERS).orElse(false); + Long responseTimeout = context.getData(HttpUtils.AZURE_RESPONSE_TIMEOUT) .filter(timeoutDuration -> timeoutDuration instanceof Duration) .map(timeoutDuration -> ((Duration) timeoutDuration).toMillis()) .orElse(null); diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilder.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilder.java index 75083d268df5..ccdadbe4e2c8 100644 --- a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilder.java +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilder.java @@ -36,15 +36,14 @@ import java.nio.ByteBuffer; import java.time.Duration; import java.util.Objects; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_READ_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT; -import static com.azure.core.util.CoreUtils.getDefaultTimeoutFromEnvironment; +import static com.azure.core.implementation.util.HttpUtils.getDefaultConnectTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultReadTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultResponseTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultWriteTimeout; +import static com.azure.core.implementation.util.HttpUtils.getTimeout; /** *

@@ -112,27 +111,10 @@ * @see NettyAsyncHttpClient */ public class NettyAsyncHttpClientBuilder { - private static final long MINIMUM_TIMEOUT = TimeUnit.MILLISECONDS.toMillis(1); - private static final long DEFAULT_CONNECT_TIMEOUT; - private static final long DEFAULT_WRITE_TIMEOUT; - private static final long DEFAULT_RESPONSE_TIMEOUT; - private static final long DEFAULT_READ_TIMEOUT; - // NettyAsyncHttpClientBuilder may be instantiated many times, use a static logger. private static final ClientLogger LOGGER = new ClientLogger(NettyAsyncHttpClientBuilder.class); static { - Configuration configuration = Configuration.getGlobalConfiguration(); - - DEFAULT_CONNECT_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, - PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT, Duration.ofSeconds(10), LOGGER).toMillis(); - DEFAULT_WRITE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT, - Duration.ofSeconds(60), LOGGER).toMillis(); - DEFAULT_RESPONSE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, - PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT, Duration.ofSeconds(60), LOGGER).toMillis(); - DEFAULT_READ_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_READ_TIMEOUT, - Duration.ofSeconds(60), LOGGER).toMillis(); - Utility.validateNettyVersions(); } @@ -205,9 +187,9 @@ public com.azure.core.http.HttpClient build() { addressResolverWasSetByBuilder = true; } - long writeTimeout = getTimeoutMillis(this.writeTimeout, DEFAULT_WRITE_TIMEOUT); - long responseTimeout = getTimeoutMillis(this.responseTimeout, DEFAULT_RESPONSE_TIMEOUT); - long readTimeout = getTimeoutMillis(this.readTimeout, DEFAULT_READ_TIMEOUT); + long writeTimeout = getTimeout(this.writeTimeout, getDefaultWriteTimeout()).toMillis(); + long responseTimeout = getTimeout(this.responseTimeout, getDefaultResponseTimeout()).toMillis(); + long readTimeout = getTimeout(this.readTimeout, getDefaultReadTimeout()).toMillis(); // Get the initial HttpResponseDecoderSpec and update it. // .httpResponseDecoder passes a new HttpResponseDecoderSpec and any existing configuration should be updated @@ -215,7 +197,7 @@ public com.azure.core.http.HttpClient build() { HttpResponseDecoderSpec initialSpec = nettyHttpClient.configuration().decoder(); nettyHttpClient = nettyHttpClient.port(port) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, - (int) getTimeoutMillis(connectTimeout, DEFAULT_CONNECT_TIMEOUT)) + (int) getTimeout(connectTimeout, getDefaultConnectTimeout()).toMillis()) // TODO (alzimmer): What does validating HTTP response headers get us? .httpResponseDecoder(httpResponseDecoderSpec -> initialSpec.validateHeaders(false)) .doOnRequest( @@ -562,27 +544,6 @@ private static ProxyProvider.Proxy toReactorNettyProxyType(ProxyOptions.Type azu } } - /* - * Returns the timeout in milliseconds to use based on the passed Duration and default timeout. - * - * If the timeout is {@code null} the default timeout will be used. If the timeout is less than or equal to zero - * no timeout will be used. If the timeout is less than one millisecond a timeout of one millisecond will be used. - */ - static long getTimeoutMillis(Duration configuredTimeout, long defaultTimeout) { - // Timeout is null, use the default timeout. - if (configuredTimeout == null) { - return defaultTimeout; - } - - // Timeout is less than or equal to zero, return no timeout. - if (configuredTimeout.isZero() || configuredTimeout.isNegative()) { - return 0; - } - - // Return the maximum of the timeout period and the minimum allowed timeout period. - return Math.max(configuredTimeout.toMillis(), MINIMUM_TIMEOUT); - } - private static boolean shouldApplyProxy(SocketAddress socketAddress, Pattern nonProxyHostsPattern) { if (nonProxyHostsPattern == null) { return true; diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilderTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilderTests.java index 85abd25bf71e..44e3e9ed1cb2 100644 --- a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilderTests.java +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilderTests.java @@ -46,6 +46,7 @@ import static com.azure.core.http.netty.implementation.NettyHttpClientLocalTestServer.DEFAULT_PATH; import static com.azure.core.http.netty.implementation.NettyHttpClientLocalTestServer.PREBUILT_CLIENT_PATH; +import static com.azure.core.implementation.util.HttpUtils.getTimeout; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertInstanceOf; @@ -544,7 +545,7 @@ public void buildEventLoopClient() { @ParameterizedTest @MethodSource("getTimeoutMillisSupplier") public void getTimeoutMillis(Duration timeout, long expected) { - assertEquals(expected, NettyAsyncHttpClientBuilder.getTimeoutMillis(timeout, 60000)); + assertEquals(expected, getTimeout(timeout, Duration.ofMillis(60000)).toMillis()); } private static Stream getTimeoutMillisSupplier() { diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/NettyAsyncHttpClientTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/NettyAsyncHttpClientTests.java index 59e5a5dcd781..173061698aae 100644 --- a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/NettyAsyncHttpClientTests.java +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/NettyAsyncHttpClientTests.java @@ -18,7 +18,7 @@ import com.azure.core.http.netty.implementation.NettyHttpClientLocalTestServer; import com.azure.core.http.policy.FixedDelay; import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.test.utils.TestUtils; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.Contexts; @@ -70,6 +70,7 @@ import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -89,9 +90,12 @@ import static com.azure.core.http.netty.implementation.NettyHttpClientLocalTestServer.SHORT_POST_BODY_PATH; import static com.azure.core.http.netty.implementation.NettyHttpClientLocalTestServer.SHORT_POST_BODY_WITH_VALIDATION_PATH; import static com.azure.core.http.netty.implementation.NettyHttpClientLocalTestServer.TEST_HEADER; +import static com.azure.core.http.netty.implementation.NettyHttpClientLocalTestServer.TIMEOUT; +import static com.azure.core.test.utils.TestUtils.assertArraysEqual; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertLinesMatch; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -237,7 +241,7 @@ public void testConcurrentRequests() { .flatMap(response -> Mono.using(() -> response, HttpResponse::getBodyAsByteArray, HttpResponse::close)); StepVerifier.create(responses).thenConsumeWhile(response -> { - TestUtils.assertArraysEqual(LONG_BODY, response); + assertArraysEqual(LONG_BODY, response); return true; }).expectComplete().verify(Duration.ofSeconds(60)); } @@ -254,7 +258,7 @@ public void testConcurrentRequestsSync() throws InterruptedException { requests.add(() -> { try (HttpResponse response = doRequestSync(client, "/long")) { byte[] body = response.getBodyAsBinaryData().toBytes(); - TestUtils.assertArraysEqual(LONG_BODY, body); + assertArraysEqual(LONG_BODY, body); return null; } }); @@ -591,6 +595,46 @@ public void httpClientWithResolverUsesConfiguredResolverWithProxy() { } } + @Test + public void perCallTimeout() { + HttpClient client = new NettyAsyncHttpClientBuilder().responseTimeout(Duration.ofSeconds(10)).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT)); + + // Verify a smaller timeout sent through Context times out the request. + StepVerifier.create(client.send(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1)))) + .expectErrorMatches(e -> e instanceof TimeoutException) + .verify(); + + // Then verify not setting a timeout through Context does not time out the request. + StepVerifier.create(client.send(request) + .flatMap(response -> Mono.zip(FluxUtil.collectBytesInByteBufferStream(response.getBody()), + Mono.just(response.getStatusCode())))) + .assertNext(tuple -> { + assertArraysEqual(SHORT_BODY, tuple.getT1()); + assertEquals(200, tuple.getT2()); + }) + .verifyComplete(); + } + + @Test + public void perCallTimeoutSync() { + HttpClient client = new NettyAsyncHttpClientBuilder().responseTimeout(Duration.ofSeconds(10)).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT)); + + // Verify a smaller timeout sent through Context times out the request. + RuntimeException ex = assertThrows(RuntimeException.class, + () -> client.sendSync(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1)))); + assertInstanceOf(TimeoutException.class, ex.getCause()); + + // Then verify not setting a timeout through Context does not time out the request. + try (HttpResponse response = client.sendSync(request, Context.NONE)) { + assertArraysEqual(SHORT_BODY, response.getBodyAsBinaryData().toBytes()); + assertEquals(200, response.getStatusCode()); + } + } + private static Stream requestHeaderSupplier() { return Stream.of(Arguments.of(null, NULL_REPLACEMENT), Arguments.of("", ""), Arguments.of("aValue", "aValue")); } diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyHttpClientLocalTestServer.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyHttpClientLocalTestServer.java index 0f8c8c52ba0b..35df2c17338b 100644 --- a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyHttpClientLocalTestServer.java +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyHttpClientLocalTestServer.java @@ -36,6 +36,7 @@ public final class NettyHttpClientLocalTestServer { public static final String EXPECTED_HEADER = "userAgent"; public static final String RETURN_HEADERS_AS_IS_PATH = "/returnHeadersAsIs"; public static final String PROXY_TO_ADDRESS = "/proxyToAddress"; + public static final String TIMEOUT = "/timeout"; public static final byte[] SHORT_BODY = "hi there".getBytes(StandardCharsets.UTF_8); public static final byte[] LONG_BODY = createLongBody(); @@ -134,6 +135,16 @@ private static LocalTestServer initializeServer() { resp.getHttpOutput().write("I'm a teapot".getBytes(StandardCharsets.UTF_8)); resp.getHttpOutput().flush(); resp.getHttpOutput().complete(Callback.NOOP); + } else if (get && TIMEOUT.equals(path)) { + try { + Thread.sleep(5000); + resp.setStatus(200); + resp.getHttpOutput().write(SHORT_BODY); + resp.getHttpOutput().flush(); + resp.getHttpOutput().complete(Callback.NOOP); + } catch (InterruptedException e) { + throw new ServletException(e); + } } else { throw new ServletException("Unexpected request: " + req.getMethod() + " " + path); } diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClient.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClient.java index 0474465ff1ed..ed142df50ca4 100644 --- a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClient.java +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClient.java @@ -10,20 +10,25 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; +import com.azure.core.http.ProxyOptions; import com.azure.core.http.okhttp.implementation.BinaryDataRequestBody; import com.azure.core.http.okhttp.implementation.OkHttpAsyncBufferedResponse; import com.azure.core.http.okhttp.implementation.OkHttpAsyncResponse; import com.azure.core.http.okhttp.implementation.OkHttpFluxRequestBody; import com.azure.core.http.okhttp.implementation.OkHttpProgressReportingRequestBody; +import com.azure.core.http.okhttp.implementation.PerCallTimeoutCall; +import com.azure.core.http.okhttp.implementation.ResponseTimeoutListenerFactory; import com.azure.core.implementation.util.BinaryDataContent; import com.azure.core.implementation.util.BinaryDataHelper; import com.azure.core.implementation.util.FluxByteBufferContent; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.Contexts; import com.azure.core.util.ProgressReporter; import com.azure.core.util.logging.ClientLogger; import okhttp3.Call; +import okhttp3.EventListener; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -34,7 +39,9 @@ import reactor.core.publisher.MonoSink; import java.io.IOException; +import java.io.InterruptedIOException; import java.io.UncheckedIOException; +import java.time.Duration; /** * This class provides a OkHttp-based implementation for the {@link HttpClient} interface. Creating an instance of this @@ -70,14 +77,15 @@ class OkHttpAsyncHttpClient implements HttpClient { private static final byte[] EMPTY_BODY = new byte[0]; private static final RequestBody EMPTY_REQUEST_BODY = RequestBody.create(EMPTY_BODY); - private static final String AZURE_EAGERLY_READ_RESPONSE = "azure-eagerly-read-response"; - private static final String AZURE_IGNORE_RESPONSE_BODY = "azure-ignore-response-body"; - private static final String AZURE_EAGERLY_CONVERT_HEADERS = "azure-eagerly-convert-headers"; - final OkHttpClient httpClient; - OkHttpAsyncHttpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; + private final Duration responseTimeout; + + OkHttpAsyncHttpClient(OkHttpClient httpClient, Duration responseTimeout) { + EventListener.Factory factory = httpClient.eventListenerFactory(); + this.httpClient + = httpClient.newBuilder().eventListenerFactory(new ResponseTimeoutListenerFactory(factory)).build(); + this.responseTimeout = responseTimeout; } @Override @@ -87,9 +95,13 @@ public Mono send(HttpRequest request) { @Override public Mono send(HttpRequest request, Context context) { - boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false); - boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false); - boolean eagerlyConvertHeaders = (boolean) context.getData(AZURE_EAGERLY_CONVERT_HEADERS).orElse(false); + boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false); + boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false); + boolean eagerlyConvertHeaders + = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_CONVERT_HEADERS).orElse(false); + Duration perCallTimeout = (Duration) context.getData(HttpUtils.AZURE_RESPONSE_TIMEOUT) + .filter(timeoutDuration -> timeoutDuration instanceof Duration) + .orElse(responseTimeout); ProgressReporter progressReporter = Contexts.with(context).getHttpRequestProgressReporter(); @@ -106,47 +118,84 @@ public Mono send(HttpRequest request, Context context) { // 3. If Flux asynchronous then subscribe does not block caller thread // but block on the thread backing flux. This ignore any subscribeOn applied to send(r) // - Mono.fromCallable(() -> toOkHttpRequest(request, progressReporter)).subscribe(okHttpRequest -> { - try { - Call call = httpClient.newCall(okHttpRequest); - call.enqueue(new OkHttpCallback(sink, request, eagerlyReadResponse, ignoreResponseBody, - eagerlyConvertHeaders)); - sink.onCancel(call::cancel); - } catch (Exception ex) { - sink.error(ex); - } - }, sink::error); + Mono.fromCallable(() -> toOkHttpRequest(request, progressReporter, perCallTimeout)) + .subscribe(okHttpRequest -> { + try { + Call call = httpClient.newCall(okHttpRequest); + call.enqueue(new OkHttpCallback(sink, request, eagerlyReadResponse, ignoreResponseBody, + eagerlyConvertHeaders)); + sink.onCancel(call::cancel); + } catch (Exception ex) { + sink.error(ex); + } + }, sink::error); })); } @Override public HttpResponse sendSync(HttpRequest request, Context context) { - boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false); - boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false); - boolean eagerlyConvertHeaders = (boolean) context.getData(AZURE_EAGERLY_CONVERT_HEADERS).orElse(false); + boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false); + boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false); + boolean eagerlyConvertHeaders + = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_CONVERT_HEADERS).orElse(false); + Duration perCallTimeout = (Duration) context.getData(HttpUtils.AZURE_RESPONSE_TIMEOUT) + .filter(timeoutDuration -> timeoutDuration instanceof Duration) + .orElse(responseTimeout); ProgressReporter progressReporter = Contexts.with(context).getHttpRequestProgressReporter(); - Request okHttpRequest = toOkHttpRequest(request, progressReporter); + Request okHttpRequest = toOkHttpRequest(request, progressReporter, perCallTimeout); + Call call = null; try { - Response okHttpResponse = httpClient.newCall(okHttpRequest).execute(); + call = httpClient.newCall(okHttpRequest); + Response okHttpResponse = call.execute(); return toHttpResponse(request, okHttpResponse, eagerlyReadResponse, ignoreResponseBody, eagerlyConvertHeaders); } catch (IOException e) { - throw LOGGER.logExceptionAsError(new UncheckedIOException(e)); + throw LOGGER.logExceptionAsError(new UncheckedIOException(mapIOException(e, call))); } } + /** + * Current design for response timeout uses call cancellation which throws an IOException with message "canceled". + * This isn't what we want, we want an InterruptedIOException with message "timeout". Use information stored on the + * call to determine if the IOException should be mapped to an InterruptedIOException. + * + * @param e the IOException to map + * @param call the Call to associate with the new IOException + * @return the new IOException + */ + private static IOException mapIOException(IOException e, Call call) { + if (call == null) { + return e; + } + + PerCallTimeoutCall perCallTimeoutCall = call.request().tag(PerCallTimeoutCall.class); + if (perCallTimeoutCall != null && perCallTimeoutCall.isTimedOut()) { + InterruptedIOException i = new InterruptedIOException("timedout"); + i.addSuppressed(e); + return i; + } + + return e; + } + /** * Converts the given azure-core request to okhttp request. * * @param request the azure-core request * @param progressReporter the {@link ProgressReporter}. Can be null. + * @param perCallTimeout the per call timeout * @return the okhttp request */ - private okhttp3.Request toOkHttpRequest(HttpRequest request, ProgressReporter progressReporter) { + private okhttp3.Request toOkHttpRequest(HttpRequest request, ProgressReporter progressReporter, + Duration perCallTimeout) { Request.Builder requestBuilder = new Request.Builder().url(request.getUrl()); + if (perCallTimeout != null) { + requestBuilder.tag(PerCallTimeoutCall.class, new PerCallTimeoutCall(perCallTimeout.toMillis())); + } + if (request.getHeaders() != null) { for (HttpHeader hdr : request.getHeaders()) { // OkHttp allows for headers with multiple values, but it treats them as separate headers, @@ -263,9 +312,14 @@ public void onFailure(okhttp3.Call call, IOException e) { if (e.getSuppressed().length == 1) { // Propagate suppressed exception when there is one. // This happens when body emission fails in the middle. - sink.error(e.getSuppressed()[0]); + Throwable suppressed = e.getSuppressed()[0]; + if (suppressed instanceof IOException) { + sink.error(mapIOException((IOException) suppressed, call)); + } else { + sink.error(suppressed); + } } else { - sink.error(e); + sink.error(mapIOException(e, call)); } } diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilder.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilder.java index f34406773f5c..ada7f41fd95b 100644 --- a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilder.java +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilder.java @@ -4,10 +4,12 @@ package com.azure.core.http.okhttp; import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpRequest; import com.azure.core.http.ProxyOptions; import com.azure.core.http.okhttp.implementation.OkHttpProxySelector; import com.azure.core.http.okhttp.implementation.ProxyAuthenticator; import com.azure.core.util.Configuration; +import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import okhttp3.ConnectionPool; import okhttp3.Dispatcher; @@ -19,16 +21,17 @@ import java.util.List; import java.util.Objects; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_READ_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT; -import static com.azure.core.util.CoreUtils.getDefaultTimeoutFromEnvironment; +import static com.azure.core.implementation.util.HttpUtils.getDefaultConnectTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultReadTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultResponseTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultWriteTimeout; +import static com.azure.core.implementation.util.HttpUtils.getTimeout; /** * Builder class responsible for creating instances of {@link com.azure.core.http.HttpClient} backed by OkHttp. - * The client built from this builder can support sending requests synchronously and asynchronously. - * Use {@link com.azure.core.http.HttpClient#sendSync(HttpRequest, Context)} to send the provided request - * synchronously with contextual information. + * The client built from this builder can support sending requests synchronously and asynchronously. Use + * {@link HttpClient#sendSync(HttpRequest, Context)} to send the provided request synchronously with contextual + * information. * *

* Building a new HttpClient instance @@ -114,24 +117,9 @@ public class OkHttpAsyncHttpClientBuilder { private final okhttp3.OkHttpClient okHttpClient; - private static final Duration MINIMUM_TIMEOUT = Duration.ofMillis(1); - private static final Duration DEFAULT_CONNECT_TIMEOUT; - private static final Duration DEFAULT_WRITE_TIMEOUT; - private static final Duration DEFAULT_READ_TIMEOUT; - - static { - ClientLogger logger = new ClientLogger(OkHttpAsyncHttpClientBuilder.class); - Configuration configuration = Configuration.getGlobalConfiguration(); - DEFAULT_CONNECT_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, - PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT, Duration.ofSeconds(10), logger); - DEFAULT_WRITE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT, - Duration.ofSeconds(60), logger); - DEFAULT_READ_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_READ_TIMEOUT, - Duration.ofSeconds(60), logger); - } - private List networkInterceptors = new ArrayList<>(); private Duration readTimeout; + private Duration responseTimeout; private Duration writeTimeout; private Duration connectionTimeout; private Duration callTimeout; @@ -199,11 +187,31 @@ public OkHttpAsyncHttpClientBuilder networkInterceptors(List networ * @see OkHttpClient.Builder#readTimeout(Duration) */ public OkHttpAsyncHttpClientBuilder readTimeout(Duration readTimeout) { - // setReadTimeout can be null this.readTimeout = readTimeout; return this; } + /** + * Sets the response timeout duration used when waiting for a server to reply. + *

+ * The response timeout begins once the request write completes and finishes once the first response read is + * triggered when the server response is received. + *

+ * If {@code responseTimeout} is null either {@link Configuration#PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT} or a + * 60-second timeout will be used, if it is a {@link Duration} less than or equal to zero then no timeout will be + * applied to the response. When applying the timeout the greatest of one millisecond and the value of {@code + * responseTimeout} will be used. + *

+ * Given OkHttp doesn't have an equivalent timeout for just responses, this is handled manually. + * + * @param responseTimeout Response timeout duration. + * @return The updated OkHttpAsyncHttpClientBuilder object. + */ + public OkHttpAsyncHttpClientBuilder responseTimeout(Duration responseTimeout) { + this.responseTimeout = responseTimeout; + return this; + } + /** * Sets the writing timeout for a request to be sent. *

@@ -355,9 +363,9 @@ public HttpClient build() { } // Configure operation timeouts. - httpClientBuilder = httpClientBuilder.connectTimeout(getTimeout(connectionTimeout, DEFAULT_CONNECT_TIMEOUT)) - .writeTimeout(getTimeout(writeTimeout, DEFAULT_WRITE_TIMEOUT)) - .readTimeout(getTimeout(readTimeout, DEFAULT_READ_TIMEOUT)); + httpClientBuilder = httpClientBuilder.connectTimeout(getTimeout(connectionTimeout, getDefaultConnectTimeout())) + .writeTimeout(getTimeout(writeTimeout, getDefaultWriteTimeout())) + .readTimeout(getTimeout(readTimeout, getDefaultReadTimeout())); if (callTimeout != null) { // Call timeout is disabled by default. @@ -397,31 +405,7 @@ public HttpClient build() { // Set the followRedirects property. httpClientBuilder.followRedirects(this.followRedirects); - return new OkHttpAsyncHttpClient(httpClientBuilder.build()); - } - - /* - * Returns the timeout in milliseconds to use based on the passed Duration and default timeout. - * - * If the timeout is {@code null} the default timeout will be used. If the timeout is less than or equal to zero - * no timeout will be used. If the timeout is less than one millisecond a timeout of one millisecond will be used. - */ - static Duration getTimeout(Duration configuredTimeout, Duration defaultTimeout) { - // Timeout is null, use the default timeout. - if (configuredTimeout == null) { - return defaultTimeout; - } - - // Timeout is less than or equal to zero, return no timeout. - if (configuredTimeout.isZero() || configuredTimeout.isNegative()) { - return Duration.ZERO; - } - - // Return the maximum of the timeout period and the minimum allowed timeout period. - if (configuredTimeout.compareTo(MINIMUM_TIMEOUT) < 0) { - return MINIMUM_TIMEOUT; - } else { - return configuredTimeout; - } + return new OkHttpAsyncHttpClient(httpClientBuilder.build(), + getTimeout(responseTimeout, getDefaultResponseTimeout())); } } diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/PerCallTimeoutCall.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/PerCallTimeoutCall.java new file mode 100644 index 000000000000..c37173dc47cf --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/PerCallTimeoutCall.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.http.okhttp.implementation; + +import okhttp3.Call; + +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; + +/** + * Implementation of {@link Call} which applies a per-call response timeout to the call. + */ +public final class PerCallTimeoutCall { + // Singleton timer to schedule timeout tasks. + // TODO (alzimmer): Make sure one thread is sufficient for all timeout tasks. + private static final Timer TIMER = new Timer("azure-okhttp-response-timeout-tracker", true); + + private final long perCallTimeout; + + private volatile boolean timedOut; + + private static final AtomicReferenceFieldUpdater CURRENT_TIMEOUT_UPDATER + = AtomicReferenceFieldUpdater.newUpdater(PerCallTimeoutCall.class, TimerTask.class, "currentTimeout"); + private volatile TimerTask currentTimeout; + + /** + * Creates a new instance of PerCallTimeoutCall. + * + * @param perCallTimeout The per-call timeout to apply to the call. + */ + public PerCallTimeoutCall(long perCallTimeout) { + this.perCallTimeout = perCallTimeout; + } + + /** + * Starts the timer task to time out the call if it exceeds the per-call timeout. + *

+ * No timeout is applied if the per-call timeout is less than or equal to 0. + * + * @param call The call to apply the timeout to. + */ + public void beginPerCallTimeout(Call call) { + if (perCallTimeout > 0) { + TimerTask currentTimeout = new PerCallTimerTask(this, call); + + TIMER.schedule(currentTimeout, perCallTimeout); + TimerTask existing = CURRENT_TIMEOUT_UPDATER.getAndSet(this, currentTimeout); + if (existing != null) { + existing.cancel(); + } + } + } + + /** + * Cancels the per-call timeout task. + *

+ * Cancellations happen if the response returned before the timeout or if the call was cancelled externally. + */ + public void endPerCallTimeout() { + TimerTask currentTimeout = CURRENT_TIMEOUT_UPDATER.getAndSet(this, null); + if (currentTimeout != null) { + currentTimeout.cancel(); + } + } + + /** + * Returns whether the call timed out. + * + * @return Whether the call timed out. + */ + public boolean isTimedOut() { + return timedOut; + } + + private static final class PerCallTimerTask extends TimerTask { + private final PerCallTimeoutCall perCallTimeoutCall; + private final Call call; + + PerCallTimerTask(PerCallTimeoutCall perCallTimeoutCall, Call call) { + this.perCallTimeoutCall = perCallTimeoutCall; + this.call = call; + } + + @Override + public void run() { + // Set timeout first. + perCallTimeoutCall.timedOut = true; + call.cancel(); + } + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/ResponseTimeoutListener.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/ResponseTimeoutListener.java new file mode 100644 index 000000000000..fde446e419b7 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/ResponseTimeoutListener.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.http.okhttp.implementation; + +import okhttp3.Call; +import okhttp3.Connection; +import okhttp3.EventListener; +import okhttp3.Handshake; +import okhttp3.HttpUrl; +import okhttp3.Protocol; +import okhttp3.Request; +import okhttp3.Response; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.util.List; + +/** + * Implementation of {@link EventListener} that watches {@link #requestHeadersEnd(Call, Request)} and + * {@link #requestBodyEnd(Call, long)} to detect when a request has completed being sent and + * {@link #responseHeadersStart(Call)} and {@link #responseFailed(Call, IOException)} to detect when a response has + * started being received. This is used to determine a response timeout for the call. + *

+ * Both completing the request headers and the response body need to be watched as requests without a body will never + * trigger the request body events. + */ +public class ResponseTimeoutListener extends EventListener { + private final EventListener delegate; + + /** + * Creates a new instance of ResponseTimeoutListener. + * + * @param delegate The {@link EventListener} to delegate to. + */ + public ResponseTimeoutListener(EventListener delegate) { + this.delegate = delegate; + } + + @Override + public void requestHeadersEnd(Call call, Request request) { + PerCallTimeoutCall perCallTimeoutCall = request.tag(PerCallTimeoutCall.class); + if (perCallTimeoutCall != null) { + if (request.body() == null) { + // Start the per call timeout when the request headers have been sent if there isn't a body. + perCallTimeoutCall.beginPerCallTimeout(call); + } + } + + delegate.requestHeadersEnd(call, request); + } + + @Override + public void requestFailed(Call call, IOException ioe) { + PerCallTimeoutCall perCallTimeoutCall = call.request().tag(PerCallTimeoutCall.class); + if (perCallTimeoutCall != null) { + // End the per call timeout if the request fails. + perCallTimeoutCall.endPerCallTimeout(); + } + + delegate.requestFailed(call, ioe); + } + + @Override + public void requestBodyEnd(Call call, long byteCount) { + PerCallTimeoutCall perCallTimeoutCall = call.request().tag(PerCallTimeoutCall.class); + if (perCallTimeoutCall != null) { + // Start the per call timeout when the request body has been sent. + perCallTimeoutCall.beginPerCallTimeout(call); + } + delegate.requestBodyEnd(call, byteCount); + } + + @Override + public void responseHeadersStart(Call call) { + PerCallTimeoutCall perCallTimeoutCall = call.request().tag(PerCallTimeoutCall.class); + if (perCallTimeoutCall != null) { + // End the per call timeout when the response headers have started being received. + perCallTimeoutCall.endPerCallTimeout(); + } + delegate.responseHeadersStart(call); + } + + @Override + public void responseFailed(Call call, IOException ioe) { + PerCallTimeoutCall perCallTimeoutCall = call.request().tag(PerCallTimeoutCall.class); + if (perCallTimeoutCall != null) { + // End the per call timeout if the response fails. + perCallTimeoutCall.endPerCallTimeout(); + } + delegate.responseFailed(call, ioe); + } + + @Override + public void canceled(Call call) { + PerCallTimeoutCall perCallTimeoutCall = call.request().tag(PerCallTimeoutCall.class); + if (perCallTimeoutCall != null) { + // End the per call timeout if the call is cancelled. + perCallTimeoutCall.endPerCallTimeout(); + } + delegate.canceled(call); + } + + @Override + public void cacheConditionalHit(Call call, Response cachedResponse) { + delegate.cacheConditionalHit(call, cachedResponse); + } + + @Override + public void cacheHit(Call call, Response response) { + delegate.cacheHit(call, response); + } + + @Override + public void cacheMiss(Call call) { + delegate.cacheMiss(call); + } + + @Override + public void callEnd(Call call) { + delegate.callEnd(call); + } + + @Override + public void callFailed(Call call, IOException ioe) { + delegate.callFailed(call, ioe); + } + + @Override + public void callStart(Call call) { + delegate.callStart(call); + } + + @Override + public void connectEnd(Call call, InetSocketAddress inetSocketAddress, Proxy proxy, Protocol protocol) { + delegate.connectEnd(call, inetSocketAddress, proxy, protocol); + } + + @Override + public void connectFailed(Call call, InetSocketAddress inetSocketAddress, Proxy proxy, Protocol protocol, + IOException ioe) { + delegate.connectFailed(call, inetSocketAddress, proxy, protocol, ioe); + } + + @Override + public void connectStart(Call call, InetSocketAddress inetSocketAddress, Proxy proxy) { + delegate.connectStart(call, inetSocketAddress, proxy); + } + + @Override + public void connectionAcquired(Call call, Connection connection) { + delegate.connectionAcquired(call, connection); + } + + @Override + public void connectionReleased(Call call, Connection connection) { + delegate.connectionReleased(call, connection); + } + + @Override + public void dnsEnd(Call call, String domainName, List inetAddressList) { + delegate.dnsEnd(call, domainName, inetAddressList); + } + + @Override + public void dnsStart(Call call, String domainName) { + delegate.dnsStart(call, domainName); + } + + @Override + public void proxySelectEnd(Call call, HttpUrl url, List proxies) { + delegate.proxySelectEnd(call, url, proxies); + } + + @Override + public void proxySelectStart(Call call, HttpUrl url) { + delegate.proxySelectStart(call, url); + } + + @Override + public void requestHeadersStart(Call call) { + delegate.requestHeadersStart(call); + } + + @Override + public void requestBodyStart(Call call) { + delegate.requestBodyStart(call); + } + + @Override + public void responseBodyEnd(Call call, long byteCount) { + delegate.responseBodyEnd(call, byteCount); + } + + @Override + public void responseBodyStart(Call call) { + delegate.responseBodyStart(call); + } + + @Override + public void responseHeadersEnd(Call call, Response response) { + delegate.responseHeadersEnd(call, response); + } + + @Override + public void satisfactionFailure(Call call, Response response) { + delegate.satisfactionFailure(call, response); + } + + @Override + public void secureConnectEnd(Call call, Handshake handshake) { + delegate.secureConnectEnd(call, handshake); + } + + @Override + public void secureConnectStart(Call call) { + delegate.secureConnectStart(call); + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/ResponseTimeoutListenerFactory.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/ResponseTimeoutListenerFactory.java new file mode 100644 index 000000000000..c6b57b19933e --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/ResponseTimeoutListenerFactory.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.http.okhttp.implementation; + +import okhttp3.Call; +import okhttp3.EventListener; + +/** + * Implementation of {@link EventListener.Factory} that creates {@link ResponseTimeoutListener} instances. + */ +public final class ResponseTimeoutListenerFactory implements EventListener.Factory { + private final EventListener.Factory delegate; + + /** + * Creates a new instance of ResponseTimeoutListenerFactory. + * @param delegate The delegate factory to create the listener. + */ + public ResponseTimeoutListenerFactory(EventListener.Factory delegate) { + this.delegate = delegate; + } + + @Override + public EventListener create(Call call) { + return new ResponseTimeoutListener(delegate.create(call)); + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientTests.java b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientTests.java index 1c0783c436d6..3ff9611c8a28 100644 --- a/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientTests.java +++ b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientTests.java @@ -10,7 +10,9 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.parallel.Execution; @@ -23,6 +25,8 @@ import reactor.test.StepVerifierOptions; import java.io.IOException; +import java.io.InterruptedIOException; +import java.io.UncheckedIOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; @@ -40,10 +44,14 @@ import static com.azure.core.http.okhttp.OkHttpClientLocalTestServer.LONG_BODY; import static com.azure.core.http.okhttp.OkHttpClientLocalTestServer.RETURN_HEADERS_AS_IS_PATH; import static com.azure.core.http.okhttp.OkHttpClientLocalTestServer.SHORT_BODY; +import static com.azure.core.http.okhttp.OkHttpClientLocalTestServer.TIMEOUT; import static com.azure.core.http.okhttp.TestUtils.createQuietDispatcher; +import static com.azure.core.test.utils.TestUtils.assertArraysEqual; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertLinesMatch; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @Execution(ExecutionMode.SAME_THREAD) @@ -224,6 +232,46 @@ public void validateHeadersReturnAsIs() { .verify(Duration.ofSeconds(10)); } + @Test + public void perCallTimeout() { + HttpClient client = new OkHttpAsyncHttpClientBuilder().responseTimeout(Duration.ofSeconds(20)).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT)); + + // Verify a smaller timeout sent through Context times out the request. + StepVerifier.create(client.send(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1)))) + .expectErrorMatches(e -> e instanceof InterruptedIOException) + .verify(); + + // Then verify not setting a timeout through Context does not time out the request. + StepVerifier.create(client.send(request) + .flatMap(response -> Mono.zip(FluxUtil.collectBytesInByteBufferStream(response.getBody()), + Mono.just(response.getStatusCode())))) + .assertNext(tuple -> { + assertArraysEqual(SHORT_BODY, tuple.getT1()); + assertEquals(200, tuple.getT2()); + }) + .verifyComplete(); + } + + @Test + public void perCallTimeoutSync() { + HttpClient client = new OkHttpAsyncHttpClientBuilder().responseTimeout(Duration.ofSeconds(20)).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT)); + + // Verify a smaller timeout sent through Context times out the request. + UncheckedIOException ex = assertThrows(UncheckedIOException.class, + () -> client.sendSync(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1)))); + assertInstanceOf(InterruptedIOException.class, ex.getCause()); + + // Then verify not setting a timeout through Context does not time out the request. + try (HttpResponse response = client.sendSync(request, Context.NONE)) { + assertEquals(200, response.getStatusCode()); + assertArraysEqual(SHORT_BODY, response.getBodyAsBinaryData().toBytes()); + } + } + private static Mono getResponse(String path) { HttpClient client = new OkHttpAsyncHttpClientBuilder().build(); return getResponse(client, path); diff --git a/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpClientLocalTestServer.java b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpClientLocalTestServer.java index ad5a00e7ab52..cd1ec54f932a 100644 --- a/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpClientLocalTestServer.java +++ b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpClientLocalTestServer.java @@ -28,6 +28,7 @@ public final class OkHttpClientLocalTestServer { public static final String DISPATCHER_PATH = "/dispatcher"; public static final String REDIRECT_PATH = "/redirect"; public static final String LOCATION_PATH = "/location"; + public static final String TIMEOUT = "/timeout"; public static final byte[] SHORT_BODY = "hi there".getBytes(StandardCharsets.UTF_8); public static final byte[] LONG_BODY = createLongBody(); @@ -119,6 +120,16 @@ private static LocalTestServer initializeServer() { }); } else if (get && "/connectionClose".equals(path)) { resp.getHttpChannel().getConnection().close(); + } else if (get && TIMEOUT.equals(path)) { + try { + Thread.sleep(5000); + resp.setStatus(200); + resp.getHttpOutput().write(SHORT_BODY); + resp.getHttpOutput().flush(); + resp.getHttpOutput().complete(Callback.NOOP); + } catch (InterruptedException e) { + throw new ServletException(e); + } } else { throw new ServletException("Unexpected request: " + req.getMethod() + " " + path); } diff --git a/sdk/core/azure-core-http-vertx/pom.xml b/sdk/core/azure-core-http-vertx/pom.xml index b077001bce30..7e2283c0db87 100644 --- a/sdk/core/azure-core-http-vertx/pom.xml +++ b/sdk/core/azure-core-http-vertx/pom.xml @@ -96,12 +96,6 @@ 4.5.7 - - io.vertx - vertx-reactive-streams - 4.5.7 - - com.azure diff --git a/sdk/core/azure-core-http-vertx/spotbugs-exclude.xml b/sdk/core/azure-core-http-vertx/spotbugs-exclude.xml index 034d19a0d9fa..9e5076b8694f 100644 --- a/sdk/core/azure-core-http-vertx/spotbugs-exclude.xml +++ b/sdk/core/azure-core-http-vertx/spotbugs-exclude.xml @@ -16,4 +16,12 @@ + + + + + + + + diff --git a/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClient.java b/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClient.java index 7083892be4d2..2ea83eb4d1cd 100644 --- a/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClient.java +++ b/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClient.java @@ -11,51 +11,55 @@ import com.azure.core.http.vertx.implementation.BufferedVertxHttpResponse; import com.azure.core.http.vertx.implementation.VertxHttpAsyncResponse; import com.azure.core.http.vertx.implementation.VertxRequestWriteSubscriber; +import com.azure.core.http.vertx.implementation.VertxUtils; import com.azure.core.implementation.util.BinaryDataContent; import com.azure.core.implementation.util.BinaryDataHelper; import com.azure.core.implementation.util.ByteArrayContent; import com.azure.core.implementation.util.ByteBufferContent; -import com.azure.core.implementation.util.FileContent; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.implementation.util.SerializableContent; import com.azure.core.implementation.util.StringContent; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.Contexts; import com.azure.core.util.ProgressReporter; +import com.azure.core.util.logging.ClientLogger; import io.netty.buffer.Unpooled; -import io.vertx.core.Vertx; +import io.vertx.core.Future; +import io.vertx.core.Promise; import io.vertx.core.buffer.Buffer; -import io.vertx.core.file.AsyncFile; -import io.vertx.core.file.OpenOptions; import io.vertx.core.http.HttpClientRequest; import io.vertx.core.http.HttpClientResponse; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.RequestOptions; import reactor.core.publisher.Mono; -import reactor.core.publisher.MonoSink; +import reactor.util.context.ContextView; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.time.Duration; import java.util.Objects; - -import static com.azure.core.http.vertx.implementation.VertxUtils.wrapVertxException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; /** * {@link HttpClient} implementation for the Vert.x {@link io.vertx.core.http.HttpClient}. */ class VertxAsyncHttpClient implements HttpClient { - private static final String AZURE_EAGERLY_READ_RESPONSE = "azure-eagerly-read-response"; - private static final String AZURE_IGNORE_RESPONSE_BODY = "azure-ignore-response-body"; + private static final ClientLogger LOGGER = new ClientLogger(VertxAsyncHttpClient.class); - private final Vertx vertx; final io.vertx.core.http.HttpClient client; + private final Duration responseTimeout; /** * Constructs a {@link VertxAsyncHttpClient}. * * @param client The Vert.x {@link io.vertx.core.http.HttpClient} */ - VertxAsyncHttpClient(io.vertx.core.http.HttpClient client, Vertx vertx) { + VertxAsyncHttpClient(io.vertx.core.http.HttpClient client, Duration responseTimeout) { this.client = Objects.requireNonNull(client, "client cannot be null"); - this.vertx = Objects.requireNonNull(vertx, "vertx cannot be null"); + this.responseTimeout = responseTimeout; } @Override @@ -65,17 +69,57 @@ public Mono send(HttpRequest request) { @Override public Mono send(HttpRequest request, Context context) { - boolean eagerlyReadResponse = (boolean) context.getData(AZURE_EAGERLY_READ_RESPONSE).orElse(false); - boolean ignoreResponseBody = (boolean) context.getData(AZURE_IGNORE_RESPONSE_BODY).orElse(false); + return Mono.deferContextual(contextView -> Mono.fromFuture(sendInternal(request, context, contextView))) + .onErrorMap(VertxUtils::wrapVertxException); + } + + @Override + public HttpResponse sendSync(HttpRequest request, Context context) { + try { + return sendInternal(request, context, reactor.util.context.Context.empty()).get(); + } catch (Exception e) { + Throwable mapped = e; + if (e instanceof ExecutionException) { + mapped = e.getCause(); + } + + mapped = VertxUtils.wrapVertxException(mapped); + if (mapped instanceof Error) { + throw LOGGER.logThrowableAsError((Error) mapped); + } else if (mapped instanceof IOException) { + throw LOGGER.logExceptionAsError(new UncheckedIOException((IOException) mapped)); + } else if (mapped instanceof RuntimeException) { + throw LOGGER.logExceptionAsError((RuntimeException) mapped); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException(mapped)); + } + } + } + + private CompletableFuture sendInternal(HttpRequest request, Context context, + ContextView contextView) { + boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false); + boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false); + Duration perCallTimeout = (Duration) context.getData(HttpUtils.AZURE_RESPONSE_TIMEOUT) + .filter(timeoutDuration -> timeoutDuration instanceof Duration) + .orElse(responseTimeout); ProgressReporter progressReporter = Contexts.with(context).getHttpRequestProgressReporter(); RequestOptions options = new RequestOptions().setMethod(HttpMethod.valueOf(request.getHttpMethod().name())) .setAbsoluteURI(request.getUrl()); - return Mono.create(sink -> client.request(options, requestResult -> { + // This is the shared design for sending a request and receiving a response in Vert.x. The design relies on + // using a Vert.x Promise and the handler methods to control the flow of the request-response cycle. The Promise + // will be completed upon failure during the request-response cycle or upon completion of the response. This can + // be shared between sync and async as Reactor can use Mono.fromCompletionStage to convert the Promise to a Mono + // and the sync path can convert the Promise to a Future and block it. + + // Create the Promise that will be returned. Promise.promise() is an uncompleted Promise. + Promise promise = Promise.promise(); + client.request(options, requestResult -> { if (requestResult.failed()) { - sink.error(wrapVertxException(requestResult.cause())); + promise.fail(requestResult.cause()); return; } @@ -89,98 +133,70 @@ public Mono send(HttpRequest request, Context context) { vertxRequest.setChunked(true); } - vertxRequest.response(event -> { - if (event.succeeded()) { - HttpClientResponse vertxHttpResponse = event.result(); - vertxHttpResponse.exceptionHandler(exception -> sink.error(wrapVertxException(exception))); - - // TODO (alzimmer) - // For now Vertx will always use a buffered response until reliability issues when using streaming - // can be resolved. - if (eagerlyReadResponse || ignoreResponseBody) { - vertxHttpResponse.body(bodyEvent -> { - if (bodyEvent.succeeded()) { - sink.success( - new BufferedVertxHttpResponse(request, vertxHttpResponse, bodyEvent.result())); - } else { - sink.error(wrapVertxException(bodyEvent.cause())); - } - }); + Future responseFuture; + if (!perCallTimeout.isZero() && !perCallTimeout.isNegative()) { + responseFuture = vertxRequest.response().timeout(perCallTimeout.toMillis(), TimeUnit.MILLISECONDS); + } else { + responseFuture = vertxRequest.response(); + } + + responseFuture = responseFuture.onFailure(promise::fail); + + if (eagerlyReadResponse || ignoreResponseBody) { + responseFuture.andThen(responseResult -> { + if (responseResult.failed()) { + promise.fail(responseResult.cause()); + return; + } + + HttpClientResponse vertxHttpResponse = responseResult.result(); + vertxHttpResponse.body().andThen(bodyResult -> { + if (bodyResult.succeeded()) { + promise.complete( + new BufferedVertxHttpResponse(request, vertxHttpResponse, bodyResult.result())); + } else { + promise.fail(bodyResult.cause()); + } + }); + }); + } else { + responseFuture.andThen(responseResult -> { + if (responseResult.succeeded()) { + promise.complete(new VertxHttpAsyncResponse(request, responseResult.result())); } else { - sink.success(new VertxHttpAsyncResponse(request, vertxHttpResponse)); + promise.fail(responseResult.cause()); } - } else { - sink.error(wrapVertxException(event.cause())); - } - }); + }); + } - sendBody(sink, request, progressReporter, vertxRequest); - })); - } + sendBody(contextView, request, progressReporter, vertxRequest, promise); + }); - @Override - public HttpResponse sendSync(HttpRequest request, Context context) { - return send(request, context).block(); + return promise.future().toCompletionStage().toCompletableFuture(); } @SuppressWarnings("deprecation") - private void sendBody(MonoSink sink, HttpRequest azureRequest, ProgressReporter progressReporter, - HttpClientRequest vertxRequest) { + private void sendBody(ContextView contextView, HttpRequest azureRequest, ProgressReporter progressReporter, + HttpClientRequest vertxRequest, Promise promise) { BinaryData body = azureRequest.getBodyAsBinaryData(); - if (body == null) { - vertxRequest.send(result -> { - if (result.failed()) { - sink.error(wrapVertxException(result.cause())); - } - }); - return; - } - - BinaryDataContent bodyContent = BinaryDataHelper.getContent(body); - if (bodyContent instanceof ByteArrayContent - || bodyContent instanceof StringContent - || bodyContent instanceof SerializableContent) { - byte[] content = bodyContent.toBytes(); - vertxRequest.send(Buffer.buffer(Unpooled.wrappedBuffer(content)), result -> { - if (result.succeeded()) { - reportProgress(content.length, progressReporter); - } else { - sink.error(wrapVertxException(result.cause())); - } - }); - } else if (bodyContent instanceof ByteBufferContent) { - long contentLength = bodyContent.getLength(); - vertxRequest.send(Buffer.buffer(Unpooled.wrappedBuffer(bodyContent.toByteBuffer())), result -> { - if (result.succeeded()) { - reportProgress(contentLength, progressReporter); - } else { - sink.error(wrapVertxException(result.cause())); - } - }); - } else if (bodyContent instanceof FileContent) { - FileContent fileContent = (FileContent) bodyContent; - vertx.fileSystem().open(fileContent.getFile().toString(), new OpenOptions().setRead(true), event -> { - if (event.succeeded()) { - AsyncFile file = event.result(); - file.setReadPos(fileContent.getPosition()); - if (fileContent.getLength() != null) { - file.setReadLength(fileContent.getLength()); - } - vertxRequest.send(file, result -> { - if (result.succeeded()) { - reportProgress(fileContent.getLength(), progressReporter); - } else { - sink.error(wrapVertxException(result.cause())); - } - }); - } else { - sink.error(wrapVertxException(event.cause())); - } - }); + if (body == null) { + vertxRequest.send().onFailure(promise::fail); } else { - // Right now both Flux and InputStream bodies are being handled reactively. - azureRequest.getBody().subscribe(new VertxRequestWriteSubscriber(vertxRequest, sink, progressReporter)); + BinaryDataContent bodyContent = BinaryDataHelper.getContent(body); + if (bodyContent instanceof ByteArrayContent + || bodyContent instanceof ByteBufferContent + || bodyContent instanceof StringContent + || bodyContent instanceof SerializableContent) { + long contentLength = bodyContent.getLength(); + vertxRequest.send(Buffer.buffer(Unpooled.wrappedBuffer(bodyContent.toByteBuffer()))) + .onSuccess(ignored -> reportProgress(contentLength, progressReporter)) + .onFailure(promise::fail); + } else { + // Right now both Flux and InputStream bodies are being handled reactively. + azureRequest.getBody() + .subscribe(new VertxRequestWriteSubscriber(vertxRequest, promise, progressReporter, contextView)); + } } } diff --git a/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClientBuilder.java b/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClientBuilder.java index 270479074f73..ceca3b582e78 100644 --- a/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClientBuilder.java +++ b/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClientBuilder.java @@ -20,10 +20,11 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_READ_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT; -import static com.azure.core.util.CoreUtils.getDefaultTimeoutFromEnvironment; +import static com.azure.core.implementation.util.HttpUtils.getDefaultConnectTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultReadTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultResponseTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultWriteTimeout; +import static com.azure.core.implementation.util.HttpUtils.getTimeout; /** * Builds a {@link VertxAsyncHttpClient}. @@ -34,24 +35,11 @@ public class VertxAsyncHttpClientBuilder { private static final Pattern NON_PROXY_HOSTS_SPLIT = Pattern.compile("(? + * The connection timeout begins once the request attempts to connect to the remote host and finishes once the + * connection is resolved. + *

+ * If {@code connectTimeout} is null either {@link Configuration#PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT} or a + * 10-second timeout will be used, if it is a {@link Duration} less than or equal to zero then no timeout will be + * applied. When applying the timeout the greatest of one millisecond and the value of {@code connectTimeout} will + * be used. *

- * The default read idle timeout is 60 seconds. + * By default, the connection timeout is 10 seconds. * - * @param readIdleTimeout the read idle timeout - * @return the updated VertxAsyncHttpClientBuilder object + * @param connectTimeout Connect timeout duration. + * @return The updated OkHttpAsyncHttpClientBuilder object. */ - public VertxAsyncHttpClientBuilder readIdleTimeout(Duration readIdleTimeout) { - this.readIdleTimeout = readIdleTimeout; + public VertxAsyncHttpClientBuilder connectTimeout(Duration connectTimeout) { + // setConnectionTimeout can be null + this.connectTimeout = connectTimeout; return this; } /** - * Sets the write idle timeout. + * Sets the read timeout duration used when reading the server response. *

- * The default read idle timeout is 60 seconds. + * The read timeout begins once the first response read is triggered after the server response is received. This + * timeout triggers periodically but won't fire its operation if another read operation has completed between when + * the timeout is triggered and completes. + *

+ * If {@code readTimeout} is null or {@link Configuration#PROPERTY_AZURE_REQUEST_READ_TIMEOUT} or a 60-second + * timeout will be used, if it is a {@link Duration} less than or equal to zero then no timeout period will be + * applied to response read. When applying the timeout the greatest of one millisecond and the value of {@code + * readTimeout} will be used. * - * @param writeIdleTimeout the write idle timeout - * @return the updated VertxAsyncHttpClientBuilder object + * @param readTimeout Read timeout duration. + * @return The updated OkHttpAsyncHttpClientBuilder object. */ - public VertxAsyncHttpClientBuilder writeIdleTimeout(Duration writeIdleTimeout) { - this.writeIdleTimeout = writeIdleTimeout; + public VertxAsyncHttpClientBuilder readTimeout(Duration readTimeout) { + this.readTimeout = readTimeout; return this; } /** - * Sets the connect timeout. + * Sets the response timeout duration used when waiting for a server to reply. + *

+ * The response timeout begins once the request write completes and finishes once the first response read is + * triggered when the server response is received. + *

+ * If {@code responseTimeout} is null either {@link Configuration#PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT} or a + * 60-second timeout will be used, if it is a {@link Duration} less than or equal to zero then no timeout will be + * applied to the response. When applying the timeout the greatest of one millisecond and the value of {@code + * responseTimeout} will be used. *

- * The default connect timeout is 10 seconds. + * Given OkHttp doesn't have an equivalent timeout for just responses, this is handled manually. * - * @param connectTimeout the connection timeout - * @return the updated VertxAsyncHttpClientBuilder object + * @param responseTimeout Response timeout duration. + * @return The updated VertxAsyncHttpClientBuilder object. */ - public VertxAsyncHttpClientBuilder connectTimeout(Duration connectTimeout) { - this.connectTimeout = connectTimeout; + public VertxAsyncHttpClientBuilder responseTimeout(Duration responseTimeout) { + this.responseTimeout = responseTimeout; return this; } /** - * Sets the connection idle timeout. + * Sets the writing timeout for a request to be sent. + *

+ * The writing timeout does not apply to the entire request but to the request being sent over the wire. For example + * a request body which emits {@code 10} {@code 8KB} buffers will trigger {@code 10} write operations, the last + * write tracker will update when each operation completes and the outbound buffer will be periodically checked to + * determine if it is still draining. *

- * The default connect timeout is 60 seconds. + * If {@code writeTimeout} is null either {@link Configuration#PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT} or a 60-second + * timeout will be used, if it is a {@link Duration} less than or equal to zero then no write timeout will be + * applied. When applying the timeout the greatest of one millisecond and the value of {@code writeTimeout} will be + * used. * - * @param idleTimeout the connection idle timeout - * @return the updated VertxAsyncHttpClientBuilder object + * @param writeTimeout Write operation timeout duration. + * @return The updated VertxAsyncHttpClientBuilder object. */ - public VertxAsyncHttpClientBuilder idleTimeout(Duration idleTimeout) { - this.idleTimeout = idleTimeout; + public VertxAsyncHttpClientBuilder writeTimeout(Duration writeTimeout) { + this.writeTimeout = writeTimeout; return this; } @@ -178,35 +198,18 @@ public HttpClient build() { configuredVertx = getVertx(vertxProviders.iterator()); } - if (this.httpClientOptions == null) { - this.httpClientOptions = new HttpClientOptions(); - - if (this.connectTimeout != null) { - this.httpClientOptions.setConnectTimeout((int) this.connectTimeout.toMillis()); - } else { - this.httpClientOptions.setConnectTimeout((int) DEFAULT_CONNECT_TIMEOUT); - } - - if (this.readIdleTimeout != null) { - this.httpClientOptions.setReadIdleTimeout((int) this.readIdleTimeout.getSeconds()); - } else { - this.httpClientOptions.setReadIdleTimeout((int) DEFAULT_READ_TIMEOUT); - } - - if (this.writeIdleTimeout != null) { - this.httpClientOptions.setWriteIdleTimeout((int) this.writeIdleTimeout.getSeconds()); - } else { - this.httpClientOptions.setWriteIdleTimeout((int) DEFAULT_WRITE_TIMEOUT); - } - - this.httpClientOptions.setIdleTimeout((int) this.idleTimeout.getSeconds()); + HttpClientOptions buildOptions = this.httpClientOptions; + if (buildOptions == null) { + buildOptions = new HttpClientOptions().setIdleTimeoutUnit(TimeUnit.MILLISECONDS) + .setConnectTimeout((int) getTimeout(this.connectTimeout, getDefaultConnectTimeout()).toMillis()) + .setReadIdleTimeout((int) getTimeout(this.readTimeout, getDefaultReadTimeout()).toMillis()) + .setWriteIdleTimeout((int) getTimeout(this.writeTimeout, getDefaultWriteTimeout()).toMillis()); Configuration buildConfiguration - = (this.configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - ProxyOptions buildProxyOptions = (this.proxyOptions == null) - ? ProxyOptions.fromConfiguration(buildConfiguration, true) - : this.proxyOptions; + ProxyOptions buildProxyOptions + = (proxyOptions == null) ? ProxyOptions.fromConfiguration(buildConfiguration, true) : proxyOptions; if (buildProxyOptions != null) { io.vertx.core.net.ProxyOptions vertxProxyOptions = new io.vertx.core.net.ProxyOptions(); @@ -238,16 +241,16 @@ public HttpClient build() { String nonProxyHosts = buildProxyOptions.getNonProxyHosts(); if (!CoreUtils.isNullOrEmpty(nonProxyHosts)) { for (String nonProxyHost : desanitizedNonProxyHosts(nonProxyHosts)) { - this.httpClientOptions.addNonProxyHost(nonProxyHost); + buildOptions.addNonProxyHost(nonProxyHost); } } - this.httpClientOptions.setProxyOptions(vertxProxyOptions); + buildOptions.setProxyOptions(vertxProxyOptions); } } - io.vertx.core.http.HttpClient client = configuredVertx.createHttpClient(this.httpClientOptions); - return new VertxAsyncHttpClient(client, configuredVertx); + io.vertx.core.http.HttpClient client = configuredVertx.createHttpClient(buildOptions); + return new VertxAsyncHttpClient(client, getTimeout(this.responseTimeout, getDefaultResponseTimeout())); } static Vertx getVertx(Iterator iterator) { diff --git a/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClientProvider.java b/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClientProvider.java index 46c1a2476340..fba579502404 100644 --- a/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClientProvider.java +++ b/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxAsyncHttpClientProvider.java @@ -60,9 +60,9 @@ public HttpClient createInstance(HttpClientOptions clientOptions) { return new VertxAsyncHttpClientBuilder().proxy(clientOptions.getProxyOptions()) .configuration(clientOptions.getConfiguration()) .connectTimeout(clientOptions.getConnectTimeout()) - .idleTimeout(clientOptions.getConnectionIdleTimeout()) - .writeIdleTimeout(clientOptions.getWriteTimeout()) - .readIdleTimeout(clientOptions.getReadTimeout()) + .writeTimeout(clientOptions.getWriteTimeout()) + .responseTimeout(clientOptions.getResponseTimeout()) + .readTimeout(clientOptions.getReadTimeout()) .build(); } } diff --git a/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/implementation/VertxRequestWriteSubscriber.java b/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/implementation/VertxRequestWriteSubscriber.java index 7324a2bf38a0..2c9d12e16870 100644 --- a/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/implementation/VertxRequestWriteSubscriber.java +++ b/sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/implementation/VertxRequestWriteSubscriber.java @@ -5,7 +5,6 @@ import com.azure.core.http.HttpResponse; import com.azure.core.util.ProgressReporter; -import com.azure.core.util.logging.ClientLogger; import io.netty.buffer.Unpooled; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpClientRequest; @@ -14,21 +13,19 @@ import reactor.core.publisher.MonoSink; import reactor.core.publisher.Operators; import reactor.util.context.Context; +import reactor.util.context.ContextView; import java.nio.ByteBuffer; -import static com.azure.core.http.vertx.implementation.VertxUtils.wrapVertxException; - /** * Subscriber that writes a stream of {@link ByteBuffer ByteBuffers} to a {@link HttpClientRequest Vert.x request}. */ @SuppressWarnings("ReactiveStreamsSubscriberImplementation") public final class VertxRequestWriteSubscriber implements Subscriber { - private static final ClientLogger LOGGER = new ClientLogger(VertxRequestWriteSubscriber.class); - private final HttpClientRequest request; - private final MonoSink emitter; + private final io.vertx.core.Promise promise; private final ProgressReporter progressReporter; + private final ContextView contextView; // This subscriber is effectively synchronous so there is no need for these fields to be volatile. private volatile Subscription subscription; @@ -41,14 +38,16 @@ public final class VertxRequestWriteSubscriber implements Subscriber * {@link HttpClientRequest Vert.x request}. * * @param request The {@link HttpClientRequest Vert.x request} to write to. - * @param emitter The {@link MonoSink} to emit the {@link HttpResponse response} to. + * @param promise The {@link MonoSink} to emit the {@link HttpResponse response} to. * @param progressReporter The {@link ProgressReporter} to report progress to. + * @param contextView The {@link ContextView} to use when dropping errors. */ - public VertxRequestWriteSubscriber(HttpClientRequest request, MonoSink emitter, - ProgressReporter progressReporter) { + public VertxRequestWriteSubscriber(HttpClientRequest request, io.vertx.core.Promise promise, + ProgressReporter progressReporter, ContextView contextView) { this.request = request.exceptionHandler(this::onError).drainHandler(ignored -> requestNext()); - this.emitter = emitter; + this.promise = promise; this.progressReporter = progressReporter; + this.contextView = contextView; } @Override @@ -122,7 +121,7 @@ private void onErrorInternal(Throwable throwable) { State state = this.state; // code 2 and greater are completion states which means the error should be dropped as we already completed. if (state.code >= 2) { - Operators.onErrorDropped(throwable, Context.of(emitter.contextView())); + Operators.onErrorDropped(throwable, Context.of(contextView)); } this.state = State.ERROR; @@ -135,7 +134,7 @@ private void onErrorInternal(Throwable throwable) { private void resetRequest(Throwable throwable) { subscription.cancel(); - emitter.error(wrapVertxException(throwable)); + promise.fail(throwable); request.reset(0, throwable); } @@ -156,11 +155,7 @@ public void onComplete() { } private void endRequest() { - request.end(result -> { - if (result.failed()) { - emitter.error(wrapVertxException(result.cause())); - } - }); + request.end().onFailure(promise::fail); } private enum State { diff --git a/sdk/core/azure-core-http-vertx/src/samples/java/com/azure/core/http/vertx/VertxHttpClientBuilderJavaDocCodeSnippets.java b/sdk/core/azure-core-http-vertx/src/samples/java/com/azure/core/http/vertx/VertxHttpClientBuilderJavaDocCodeSnippets.java index 8a8da69d7664..6150813bb45d 100644 --- a/sdk/core/azure-core-http-vertx/src/samples/java/com/azure/core/http/vertx/VertxHttpClientBuilderJavaDocCodeSnippets.java +++ b/sdk/core/azure-core-http-vertx/src/samples/java/com/azure/core/http/vertx/VertxHttpClientBuilderJavaDocCodeSnippets.java @@ -12,6 +12,7 @@ /** * Code snippets for {@link VertxHttpClientBuilderJavaDocCodeSnippets} */ +@SuppressWarnings("unused") public class VertxHttpClientBuilderJavaDocCodeSnippets { /** @@ -55,25 +56,15 @@ public void proxyBasicAuthenticationSample() { } - public void connectionTimeoutSample() { - - // BEGIN: com.azure.core.http.vertx.vertxAsyncHttpClientBuilder#connextTimeout - final Duration connextTimeout = Duration.ofSeconds(250); // connection timeout of 250 seconds - HttpClient client = new VertxAsyncHttpClientBuilder() - .connectTimeout(connextTimeout) - .build(); - // END: com.azure.core.http.vertx.vertxAsyncHttpClientBuilder#connextTimeout - - } - - public void readTimeoutSample() { - - // BEGIN: com.azure.core.http.vertx.vertxAsyncHttpClientBuilder#readTimeout - final Duration readIdleTimeout = Duration.ofSeconds(100); // read timeout of 100 seconds + public void timeoutSample() { + // BEGIN: com.azure.core.http.vertx.VertxAsyncHttpClientBuilder#timeoutSample HttpClient client = new VertxAsyncHttpClientBuilder() - .readIdleTimeout(readIdleTimeout) - .build(); - // END: com.azure.core.http.vertx.vertxAsyncHttpClientBuilder#readTimeout + .connectTimeout(Duration.ofSeconds(10)) // Timeout of 10 seconds for establishing a connection + .writeTimeout(Duration.ofSeconds(100)) // Timeout of 100 seconds when network writing is idle + .responseTimeout(Duration.ofSeconds(30)) // Timeout of 30 seconds for the server to return a response + .readTimeout(Duration.ofSeconds(100)) // Timeout of 100 seconds when network reading is idle + .build(); + // END: com.azure.core.http.vertx.VertxAsyncHttpClientBuilder#timeoutSample } } diff --git a/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientBuilderTests.java b/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientBuilderTests.java index 56a9bade3cb1..6a642cbf9ee5 100644 --- a/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientBuilderTests.java +++ b/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientBuilderTests.java @@ -63,8 +63,7 @@ public void buildWithConfigurationNone() { @Test public void buildWithDefaultConnectionOptions() { - VertxAsyncHttpClientBuilder builder = new VertxAsyncHttpClientBuilder(); - HttpClient httpClient = builder.build(); + HttpClient httpClient = new VertxAsyncHttpClientBuilder().build(); io.vertx.core.http.HttpClient client = ((VertxAsyncHttpClient) httpClient).client; io.vertx.core.http.HttpClientOptions options = ((HttpClientImpl) client).options(); @@ -76,18 +75,16 @@ public void buildWithDefaultConnectionOptions() { .verifyComplete(); assertEquals(10000, options.getConnectTimeout()); - assertEquals(60, options.getIdleTimeout()); - assertEquals(60, options.getReadIdleTimeout()); - assertEquals(60, options.getWriteIdleTimeout()); + assertEquals(60000, options.getReadIdleTimeout()); + assertEquals(60000, options.getWriteIdleTimeout()); } @Test public void buildWithConnectionOptions() { VertxAsyncHttpClientBuilder builder = new VertxAsyncHttpClientBuilder(); VertxAsyncHttpClient httpClient = (VertxAsyncHttpClient) builder.connectTimeout(Duration.ofSeconds(10)) - .idleTimeout(Duration.ofSeconds(20)) - .readIdleTimeout(Duration.ofSeconds(30)) - .writeIdleTimeout(Duration.ofSeconds(40)) + .readTimeout(Duration.ofSeconds(30)) + .writeTimeout(Duration.ofSeconds(40)) .build(); io.vertx.core.http.HttpClientOptions options = ((HttpClientImpl) httpClient.client).options(); @@ -99,9 +96,8 @@ public void buildWithConnectionOptions() { .verifyComplete(); assertEquals(10000, options.getConnectTimeout()); - assertEquals(20, options.getIdleTimeout()); - assertEquals(30, options.getReadIdleTimeout()); - assertEquals(40, options.getWriteIdleTimeout()); + assertEquals(30000, options.getReadIdleTimeout()); + assertEquals(40000, options.getWriteIdleTimeout()); } @ParameterizedTest @@ -214,15 +210,13 @@ public void buildWithCustomHttpClientOptions() { options.setWriteIdleTimeout(70); HttpClient httpClient = new VertxAsyncHttpClientBuilder().connectTimeout(Duration.ofSeconds(10)) - .idleTimeout(Duration.ofSeconds(20)) - .readIdleTimeout(Duration.ofSeconds(30)) - .writeIdleTimeout(Duration.ofSeconds(40)) + .readTimeout(Duration.ofSeconds(30)) + .writeTimeout(Duration.ofSeconds(40)) .httpClientOptions(options) .build(); // Verify the original configuration was preserved and not overwritten assertEquals(30000, options.getConnectTimeout()); - assertEquals(50, options.getIdleTimeout()); assertEquals(60, options.getReadIdleTimeout()); assertEquals(70, options.getWriteIdleTimeout()); diff --git a/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientProviderTests.java b/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientProviderTests.java index e7e68f08c110..1714f4a0f566 100644 --- a/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientProviderTests.java +++ b/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientProviderTests.java @@ -107,9 +107,8 @@ public void optionsWithTimeouts() { io.vertx.core.http.HttpClientOptions options = ((HttpClientImpl) httpClient.client).options(); assertEquals(timeout.toMillis(), options.getConnectTimeout()); - assertEquals(timeout.getSeconds(), options.getIdleTimeout()); - assertEquals(timeout.getSeconds(), options.getReadIdleTimeout()); - assertEquals(timeout.getSeconds(), options.getWriteIdleTimeout()); + assertEquals(timeout.toMillis(), options.getReadIdleTimeout()); + assertEquals(timeout.toMillis(), options.getWriteIdleTimeout()); } @Test diff --git a/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientTests.java b/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientTests.java index 8e3e699f49f4..fa4742430177 100644 --- a/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientTests.java +++ b/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxAsyncHttpClientTests.java @@ -10,10 +10,10 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.parallel.Execution; -import org.junit.jupiter.api.parallel.ExecutionMode; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.publisher.ParallelFlux; @@ -36,16 +36,20 @@ import java.util.concurrent.Callable; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import static com.azure.core.http.vertx.VertxHttpClientLocalTestServer.LONG_BODY; import static com.azure.core.http.vertx.VertxHttpClientLocalTestServer.RETURN_HEADERS_AS_IS_PATH; import static com.azure.core.http.vertx.VertxHttpClientLocalTestServer.SHORT_BODY; +import static com.azure.core.http.vertx.VertxHttpClientLocalTestServer.TIMEOUT; +import static com.azure.core.test.utils.TestUtils.assertArraysEqual; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertLinesMatch; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -@Execution(ExecutionMode.SAME_THREAD) public class VertxAsyncHttpClientTests { private static final String SERVER_HTTP_URI = VertxHttpClientLocalTestServer.getServer().getHttpUri(); @@ -236,6 +240,46 @@ public void testEmptyBufferedResponse() { .verifyComplete(); } + @Test + public void perCallTimeout() { + HttpClient client = new VertxAsyncHttpClientBuilder().responseTimeout(Duration.ofSeconds(10)).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT)); + + // Verify a smaller timeout sent through Context times out the request. + StepVerifier.create(client.send(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1)))) + .expectErrorMatches(e -> e instanceof TimeoutException) + .verify(); + + // Then verify not setting a timeout through Context does not time out the request. + StepVerifier.create(client.send(request) + .flatMap(response -> Mono.zip(FluxUtil.collectBytesInByteBufferStream(response.getBody()), + Mono.just(response.getStatusCode())))) + .assertNext(tuple -> { + assertArraysEqual(SHORT_BODY, tuple.getT1()); + assertEquals(200, tuple.getT2()); + }) + .verifyComplete(); + } + + @Test + public void perCallTimeoutSync() { + HttpClient client = new VertxAsyncHttpClientBuilder().responseTimeout(Duration.ofSeconds(10)).build(); + + HttpRequest request = new HttpRequest(HttpMethod.GET, url(TIMEOUT)); + + // Verify a smaller timeout sent through Context times out the request. + RuntimeException ex = assertThrows(RuntimeException.class, + () -> client.sendSync(request, new Context(HttpUtils.AZURE_RESPONSE_TIMEOUT, Duration.ofSeconds(1)))); + assertInstanceOf(TimeoutException.class, ex.getCause()); + + // Then verify not setting a timeout through Context does not time out the request. + try (HttpResponse response = client.sendSync(request, Context.NONE)) { + assertEquals(200, response.getStatusCode()); + assertArraysEqual(SHORT_BODY, response.getBodyAsByteArray().block()); + } + } + private static Mono getResponse(String path) { HttpClient client = new VertxAsyncHttpClientBuilder().build(); return getResponse(client, path, Context.NONE); diff --git a/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxHttpClientLocalTestServer.java b/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxHttpClientLocalTestServer.java index 01c63e032632..1d533180191a 100644 --- a/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxHttpClientLocalTestServer.java +++ b/sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxHttpClientLocalTestServer.java @@ -30,6 +30,7 @@ public final class VertxHttpClientLocalTestServer { public static final byte[] SHORT_BODY = "hi there".getBytes(StandardCharsets.UTF_8); public static final byte[] LONG_BODY = createLongBody(); public static final String RETURN_HEADERS_AS_IS_PATH = "/returnHeadersAsIs"; + public static final String TIMEOUT = "/timeout"; public static final String PROXY_USERNAME = "foo"; public static final String PROXY_PASSWORD = "bar"; @@ -109,6 +110,16 @@ private static LocalTestServer initializeServer() { resp.setContentLength(0); } else if (get && "/connectionClose".equals(path)) { resp.getHttpChannel().getConnection().close(); + } else if (get && TIMEOUT.equals(path)) { + try { + Thread.sleep(5000); + resp.setStatus(200); + resp.getHttpOutput().write(SHORT_BODY); + resp.getHttpOutput().flush(); + resp.getHttpOutput().complete(Callback.NOOP); + } catch (InterruptedException e) { + throw new ServletException(e); + } } else { throw new ServletException("Unexpected request " + req.getMethod() + " " + path); } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/SubResource.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/SubResource.java index 5e73c158412b..f1bb6c775512 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/SubResource.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/SubResource.java @@ -3,10 +3,17 @@ package com.azure.core.management; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; + +import java.io.IOException; + /** * The SubResource model. */ -public class SubResource { +public class SubResource implements JsonSerializable { /** * Resource Id. */ @@ -37,4 +44,35 @@ public SubResource withId(String id) { this.id = id; return this; } + + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + return jsonWriter.writeStartObject().writeStringField("id", id).writeEndObject(); + } + + /** + * Reads a JSON stream into a {@link SubResource}. + * + * @param jsonReader The {@link JsonReader} being read. + * @return The {@link SubResource} that the JSON stream represented, may return null. + * @throws IOException If a {@link SubResource} fails to be read from the {@code jsonReader}. + */ + public static SubResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubResource subResource = new SubResource(); + + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + subResource.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return subResource; + }); + } } diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/ResourceTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/ResourceTests.java index 2235c58b5fcd..0cf0e543213a 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/ResourceTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/ResourceTests.java @@ -6,6 +6,7 @@ import com.azure.core.management.implementation.ProxyResourceAccessHelper; import com.azure.json.JsonProviders; import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.json.ReadValueCallback; @@ -14,6 +15,10 @@ import org.junit.jupiter.api.Test; import java.io.IOException; +import java.io.StringWriter; +import java.util.Collections; +import java.util.List; +import java.util.UUID; public class ResourceTests { @@ -127,6 +132,102 @@ public static ResourceWithSystemData fromJson(JsonReader jsonReader) throws IOEx } } + private static class SubResourceResource extends SubResource { + private SubResource subResource; + private List subResourceList; + private SubResourceResource subResourceResource; + private List subResourceResourceList; + + public SubResource subResource() { + return subResource; + } + + public SubResourceResource withSubResource(SubResource subResource) { + this.subResource = subResource; + return this; + } + + public List subResourceList() { + return subResourceList; + } + + public SubResourceResource withSubResourceList(List subResourceList) { + this.subResourceList = subResourceList; + return this; + } + + public SubResourceResource subResourceResource() { + return subResourceResource; + } + + public SubResourceResource withSubResourceResource(SubResourceResource subResourceResource) { + this.subResourceResource = subResourceResource; + return this; + } + + public List subResourceResourceList() { + return subResourceResourceList; + } + + public SubResourceResource withSubResourceResourceList(List subResourceResourceList) { + this.subResourceResourceList = subResourceResourceList; + return this; + } + + @Override + public SubResourceResource withId(String id) { + super.withId(id); + return this; + } + + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + return jsonWriter.writeStartObject() + .writeStringField("id", id()) + .writeJsonField("subResource", this.subResource) + .writeArrayField("subResourceList", this.subResourceList, JsonWriter::writeJson) + .writeJsonField("subResourceResource", this.subResourceResource) + .writeArrayField("subResourceResourceList", this.subResourceResourceList, JsonWriter::writeJson) + .writeEndObject(); + } + + /** + * Reads a JSON stream into a {@link SubResourceResource}. + * + * @param jsonReader The {@link JsonReader} being read. + * @return The {@link SubResourceResource} that the JSON stream represented, may return null. + * @throws IOException If a {@link SubResourceResource} fails to be read from the {@code jsonReader}. + */ + public static SubResourceResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubResourceResource subResource = new SubResourceResource(); + + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + subResource.withId(reader.getString()); + } else if ("subResource".equals(fieldName)) { + subResource.withSubResource(reader.readObject(reader1 -> SubResource.fromJson(reader1))); + } else if ("subResourceList".equals(fieldName)) { + subResource.withSubResourceList(reader.readArray(reader1 -> SubResource.fromJson(reader1))); + } else if ("subResourceResource".equals(fieldName)) { + subResource.withSubResourceResource( + reader.readObject(reader1 -> SubResourceResource.fromJson(reader1))); + } else if ("subResourceResourceList".equals(fieldName)) { + subResource.withSubResourceResourceList( + reader.readArray(reader1 -> SubResourceResource.fromJson(reader1))); + } else { + reader.skipChildren(); + } + } + + return subResource; + }); + } + } + @Test public void testSerialization() throws IOException { String cosmosAccountJson @@ -190,6 +291,33 @@ public void testSerialization() throws IOException { Assertions.assertEquals("Microsoft.KeyVault/vaults", vaultResource.type()); Assertions.assertEquals(0, vaultResource.tags().size()); Assertions.assertNull(vaultResource.systemData()); + + // test SubResource + SubResourceResource subResourceResourceRoot = new SubResourceResource(); + SubResource subResource = new SubResource().withId(UUID.randomUUID().toString()); + SubResourceResource subResourceResourceNest = new SubResourceResource().withId(UUID.randomUUID().toString()); + subResourceResourceRoot.withSubResource(subResource) + .withSubResourceList(Collections.singletonList(subResource)) + .withSubResourceResource(subResourceResourceNest) + .withSubResourceResourceList(Collections.singletonList(subResourceResourceNest)); + + String json = serializeToString(subResourceResourceRoot); + SubResourceResource subResourceResourceRootDeserialized = deserialize(json, SubResourceResource::fromJson); + Assertions.assertEquals(subResource.id(), subResourceResourceRootDeserialized.subResource().id()); + Assertions.assertEquals(subResource.id(), + subResourceResourceRootDeserialized.subResourceList().iterator().next().id()); + Assertions.assertEquals(subResourceResourceNest.id(), + subResourceResourceRootDeserialized.subResourceResource().id()); + Assertions.assertEquals(subResourceResourceNest.id(), + subResourceResourceRootDeserialized.subResourceResourceList().iterator().next().id()); + } + + private static > String serializeToString(T serializable) throws IOException { + StringWriter writer = new StringWriter(); + JsonWriter jsonWriter = JsonProviders.createWriter(writer); + serializable.toJson(jsonWriter); + jsonWriter.flush(); + return writer.toString(); } private static T deserialize(String json, ReadValueCallback reader) throws IOException { diff --git a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/ObjectMapperShim.java b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/ObjectMapperShim.java index 0ba4f95ca0a7..7b772355ec1c 100644 --- a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/ObjectMapperShim.java +++ b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/ObjectMapperShim.java @@ -6,10 +6,12 @@ import com.azure.core.annotation.HeaderCollection; import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; -import com.azure.core.implementation.ReflectiveInvoker; +import com.azure.core.implementation.ReflectionSerializable; import com.azure.core.implementation.ReflectionUtils; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.TypeUtil; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonSerializable; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -264,6 +266,7 @@ public JsonNode readTree(byte[] content) throws IOException { } } + @SuppressWarnings("unchecked") private JavaType createJavaType(Type type) { if (type == null) { return null; @@ -280,7 +283,28 @@ private JavaType createJavaType(Type type) { return getFromTypeCache(type, t -> mapper.getTypeFactory() .constructParametricType((Class) parameterizedType.getRawType(), javaTypeArguments)); } else { - return getFromTypeCache(type, t -> mapper.getTypeFactory().constructType(t)); + return getFromTypeCache(type, t -> { + JavaType javaType = mapper.constructType(t); + + // Need additional handling here so that the JavaType returned has the correct value handler for + // JsonSerializable types. + // While JsonSerializableDeserializer is registered with the ObjectMapper, and it mutates the + // JsonSerializer used by Jackson to handle as a JsonSerializable type, there have been cases where + // collection types (List, Map, etc) have not been handled correctly. So, additional handling is done + // here to ensure that the JavaType returned has the correct value handler. + + if (!(t instanceof Class)) { + // Not a Class, so can't be a JsonSerializable type. + return javaType; + } + + if (ReflectionSerializable.supportsJsonSerializable((Class) t)) { + // JsonSerializable type, so add the JsonSerializableDeserializer as the value handler. + return javaType.withValueHandler(new JsonSerializableDeserializer((Class>) t)); + } + + return javaType; + }); } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/HttpClientTests.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/HttpClientTests.java index cd1a10576a7d..ae9d33241b2e 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/HttpClientTests.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/HttpClientTests.java @@ -584,7 +584,7 @@ private static void canSendBinaryDataSync(URL requestUrl, BinaryData requestBody HttpRequest request = new HttpRequest(HttpMethod.PUT, requestUrl, new HttpHeaders(), requestBody); try (HttpResponse httpResponse = httpClient.sendSync(request, Context.NONE)) { - byte[] responseBytes = httpResponse.getBodyAsByteArray().block(); + byte[] responseBytes = httpResponse.getBodyAsBinaryData().toBytes(); assertArraysEqual(expectedResponseBody, responseBytes); } } @@ -615,7 +615,7 @@ private static void canSendBinaryDataSyncWithProgressReporter(URL requestUrl, Bi .getContext(); try (HttpResponse httpResponse = httpClient.sendSync(request, context)) { - byte[] responseBytes = httpResponse.getBodyAsByteArray().block(); + byte[] responseBytes = httpResponse.getBodyAsBinaryData().toBytes(); assertArraysEqual(expectedResponseBody, responseBytes); assertEquals(expectedResponseBody.length, progress.intValue()); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java index 67f4ea40662e..a33abec128a8 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java @@ -27,6 +27,7 @@ import com.azure.core.implementation.http.UnexpectedExceptionInformation; import com.azure.core.implementation.serializer.HttpResponseDecoder; import com.azure.core.implementation.serializer.MalformedValueException; +import com.azure.core.implementation.util.HttpUtils; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.UrlBuilder; @@ -109,15 +110,15 @@ public final Object invoke(Object proxy, Method method, RequestOptions options, // For the following Context options only set a value if it's true. This is to avoid adding a key to the // context with a value of false, which will increase all subsequent lookups of the context. if (methodParser.isResponseEagerlyRead()) { - context = context.addData("azure-eagerly-read-response", true); + context = context.addData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE, true); } if (methodParser.isResponseBodyIgnored()) { - context = context.addData("azure-ignore-response-body", true); + context = context.addData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY, true); } if (methodParser.isHeadersEagerlyConverted()) { - context = context.addData("azure-eagerly-convert-headers", true); + context = context.addData(HttpUtils.AZURE_EAGERLY_CONVERT_HEADERS, true); } return invoke(proxy, method, options, errorOptions, requestCallback, methodParser, request, context); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/ObjectMapperShim.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/ObjectMapperShim.java index b6a7af7a6372..4a2c2ac214cb 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/ObjectMapperShim.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/ObjectMapperShim.java @@ -6,12 +6,14 @@ import com.azure.core.annotation.HeaderCollection; import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; +import com.azure.core.implementation.ReflectionSerializable; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.TypeUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.logging.LogLevel; import com.azure.core.util.serializer.MemberNameConverter; +import com.azure.json.JsonSerializable; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -294,6 +296,7 @@ public JsonNode readTree(byte[] content) throws IOException { } } + @SuppressWarnings("unchecked") private JavaType createJavaType(Type type) { if (type == null) { return null; @@ -310,7 +313,28 @@ private JavaType createJavaType(Type type) { return getFromTypeCache(type, t -> mapper.getTypeFactory() .constructParametricType((Class) parameterizedType.getRawType(), javaTypeArguments)); } else { - return getFromTypeCache(type, t -> mapper.getTypeFactory().constructType(t)); + return getFromTypeCache(type, t -> { + JavaType javaType = mapper.constructType(t); + + // Need additional handling here so that the JavaType returned has the correct value handler for + // JsonSerializable types. + // While JsonSerializableDeserializer is registered with the ObjectMapper, and it mutates the + // JsonSerializer used by Jackson to handle as a JsonSerializable type, there have been cases where + // collection types (List, Map, etc) have not been handled correctly. So, additional handling is done + // here to ensure that the JavaType returned has the correct value handler. + + if (!(t instanceof Class)) { + // Not a Class, so can't be a JsonSerializable type. + return javaType; + } + + if (ReflectionSerializable.supportsJsonSerializable((Class) t)) { + // JsonSerializable type, so add the JsonSerializableDeserializer as the value handler. + return javaType.withValueHandler(new JsonSerializableDeserializer((Class>) t)); + } + + return javaType; + }); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/HttpUtils.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/HttpUtils.java new file mode 100644 index 000000000000..0fd02b8f9f3a --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/HttpUtils.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation.util; + +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; + +import java.time.Duration; + +import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT; +import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_READ_TIMEOUT; +import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT; +import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT; +import static com.azure.core.util.CoreUtils.getDefaultTimeoutFromEnvironment; + +/** + * Utilities shared with HttpClient implementations. + */ +public final class HttpUtils { + private static final ClientLogger LOGGER = new ClientLogger(HttpUtils.class); + + private static final Duration MINIMUM_TIMEOUT = Duration.ofMillis(1); + private static final Duration DEFAULT_CONNECT_TIMEOUT; + private static final Duration DEFAULT_WRITE_TIMEOUT; + private static final Duration DEFAULT_RESPONSE_TIMEOUT; + private static final Duration DEFAULT_READ_TIMEOUT; + + static { + Configuration configuration = Configuration.getGlobalConfiguration(); + DEFAULT_CONNECT_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, + PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT, Duration.ofSeconds(10), LOGGER); + DEFAULT_WRITE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT, + Duration.ofSeconds(60), LOGGER); + DEFAULT_RESPONSE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, + PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT, Duration.ofSeconds(60), LOGGER); + DEFAULT_READ_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_READ_TIMEOUT, + Duration.ofSeconds(60), LOGGER); + } + + /** + * Context key used to indicate to an HttpClient implementation if it should eagerly read the response from the + * network. + */ + public static final String AZURE_EAGERLY_READ_RESPONSE = "azure-eagerly-read-response"; + + /** + * Context key used to indicate to an HttpClient implementation if the response body should be ignored and eagerly + * drained from the network. + */ + public static final String AZURE_IGNORE_RESPONSE_BODY = "azure-ignore-response-body"; + + /** + * Context key used to indicate to an HttpClient a per-call response timeout. + */ + public static final String AZURE_RESPONSE_TIMEOUT = "azure-response-timeout"; + + /** + * Context key used to indicate to an HttpClient if the implementation specific HTTP headers should be converted to + * Azure Core HttpHeaders. + */ + public static final String AZURE_EAGERLY_CONVERT_HEADERS = "azure-eagerly-convert-headers"; + + /** + * Gets the default connect timeout. + * + * @return The default connect timeout. + */ + public static Duration getDefaultConnectTimeout() { + return DEFAULT_CONNECT_TIMEOUT; + } + + /** + * Gets the default write timeout. + * + * @return The default write timeout. + */ + public static Duration getDefaultWriteTimeout() { + return DEFAULT_WRITE_TIMEOUT; + } + + /** + * Gets the default response timeout. + * + * @return The default response timeout. + */ + public static Duration getDefaultResponseTimeout() { + return DEFAULT_RESPONSE_TIMEOUT; + } + + /** + * Gets the default read timeout. + * + * @return The default read timeout. + */ + public static Duration getDefaultReadTimeout() { + return DEFAULT_READ_TIMEOUT; + } + + /** + * Returns the timeout Duration to use based on the configured timeout and the default timeout. + *

+ * If the configured timeout is null the default timeout will be used. If the timeout is less than or equal to zero + * no timeout will be used. If the timeout is less than one millisecond a timeout of one millisecond will be used. + * + * @param configuredTimeout The configured timeout. + * @param defaultTimeout The default timeout. + * @return The timeout to use. + */ + public static Duration getTimeout(Duration configuredTimeout, Duration defaultTimeout) { + // Timeout is null, use the default timeout. + if (configuredTimeout == null) { + return defaultTimeout; + } + + // Timeout is less than or equal to zero, return no timeout. + if (configuredTimeout.isZero() || configuredTimeout.isNegative()) { + return Duration.ZERO; + } + + // Return the maximum of the timeout period and the minimum allowed timeout period. + if (configuredTimeout.compareTo(MINIMUM_TIMEOUT) < 0) { + return MINIMUM_TIMEOUT; + } else { + return configuredTimeout; + } + } + + private HttpUtils() { + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/HttpClientOptions.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/HttpClientOptions.java index 43808efe0eea..6d9a4e1bb2b6 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/HttpClientOptions.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/HttpClientOptions.java @@ -11,11 +11,11 @@ import java.time.Duration; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_READ_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT; -import static com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT; -import static com.azure.core.util.CoreUtils.getDefaultTimeoutFromEnvironment; +import static com.azure.core.implementation.util.HttpUtils.getDefaultConnectTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultReadTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultResponseTimeout; +import static com.azure.core.implementation.util.HttpUtils.getDefaultWriteTimeout; +import static com.azure.core.implementation.util.HttpUtils.getTimeout; /** * General configuration options for {@link HttpClient HttpClients}. @@ -24,29 +24,10 @@ */ @Fluent public final class HttpClientOptions extends ClientOptions { - private static final Duration MINIMUM_TIMEOUT = Duration.ofMillis(1); - private static final Duration DEFAULT_CONNECT_TIMEOUT; - private static final Duration DEFAULT_WRITE_TIMEOUT; - private static final Duration DEFAULT_RESPONSE_TIMEOUT; - private static final Duration DEFAULT_READ_TIMEOUT; private static final Duration DEFAULT_CONNECTION_IDLE_TIMEOUT = Duration.ofSeconds(60); - private static final Duration NO_TIMEOUT = Duration.ZERO; private static final ClientLogger LOGGER = new ClientLogger(HttpClientOptions.class); - static { - Configuration configuration = Configuration.getGlobalConfiguration(); - - DEFAULT_CONNECT_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, - PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT, Duration.ofSeconds(10), LOGGER); - DEFAULT_WRITE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT, - Duration.ofSeconds(60), LOGGER); - DEFAULT_RESPONSE_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, - PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT, Duration.ofSeconds(60), LOGGER); - DEFAULT_READ_TIMEOUT = getDefaultTimeoutFromEnvironment(configuration, PROPERTY_AZURE_REQUEST_READ_TIMEOUT, - Duration.ofSeconds(60), LOGGER); - } - private ProxyOptions proxyOptions; private Configuration configuration; private Duration connectTimeout; @@ -141,12 +122,20 @@ public HttpClientOptions setConnectTimeout(Duration connectTimeout) { /** * Gets the connection timeout for a request to be sent. *

+ * The connection timeout begins once the request attempts to connect to the remote host and finishes when the + * connection is resolved. + *

+ * If {@code connectTimeout} is null either {@link Configuration#PROPERTY_AZURE_REQUEST_CONNECT_TIMEOUT} or a + * 10-second timeout will be used, if it is a {@link Duration} less than or equal to zero then no timeout will be + * applied. When applying the timeout the greatest of one millisecond and the value of {@code connectTimeout} will + * be used. + *

* The default connection timeout is 10 seconds. * * @return The connection timeout of a request to be sent. */ public Duration getConnectTimeout() { - return getTimeout(connectTimeout, DEFAULT_CONNECT_TIMEOUT); + return getTimeout(connectTimeout, getDefaultConnectTimeout()); } /** @@ -174,12 +163,21 @@ public HttpClientOptions setWriteTimeout(Duration writeTimeout) { /** * Gets the writing timeout for a request to be sent. *

+ * The writing timeout does not apply to the entire request but to each emission being sent over the wire. For + * example a request body which emits {@code 10} {@code 8KB} buffers will trigger {@code 10} write operations, the + * outbound buffer will be periodically checked to determine if it is still draining. + *

+ * If {@code writeTimeout} is null either {@link Configuration#PROPERTY_AZURE_REQUEST_WRITE_TIMEOUT} or a 60-second + * timeout will be used, if it is a {@link Duration} less than or equal to zero then no write timeout will be + * applied. When applying the timeout the greatest of one millisecond and the value of {@code writeTimeout} will be + * used. + *

* The default writing timeout is 60 seconds. * * @return The writing timeout of a request to be sent. */ public Duration getWriteTimeout() { - return getTimeout(writeTimeout, DEFAULT_WRITE_TIMEOUT); + return getTimeout(writeTimeout, getDefaultWriteTimeout()); } /** @@ -227,12 +225,20 @@ public HttpClientOptions setResponseTimeout(Duration responseTimeout) { /** * Gets the response timeout duration used when waiting for a server to reply. *

+ * The response timeout begins once the request write completes and finishes once the first response read is + * triggered when the server response is received. + *

+ * If {@code responseTimeout} is null either {@link Configuration#PROPERTY_AZURE_REQUEST_RESPONSE_TIMEOUT} or a + * 60-second timeout will be used, if it is a {@link Duration} less than or equal to zero then no timeout will be + * applied to the response. When applying the timeout the greatest of one millisecond and the value of + * {@code responseTimeout} will be used. + *

* The default response timeout is 60 seconds. * * @return The response timeout duration. */ public Duration getResponseTimeout() { - return getTimeout(responseTimeout, DEFAULT_RESPONSE_TIMEOUT); + return getTimeout(responseTimeout, getDefaultResponseTimeout()); } /** @@ -287,7 +293,7 @@ public HttpClientOptions setReadTimeout(Duration readTimeout) { * @return The read timeout duration. */ public Duration getReadTimeout() { - return getTimeout(readTimeout, DEFAULT_READ_TIMEOUT); + return getTimeout(readTimeout, getDefaultReadTimeout()); } /** @@ -398,19 +404,4 @@ public HttpClientOptions setHttpClientProvider(Class getHttpClientProvider() { return httpClientProvider; } - - private static Duration getTimeout(Duration configuredTimeout, Duration defaultTimeout) { - // Timeout is null, use the default timeout. - if (configuredTimeout == null) { - return defaultTimeout; - } - - // Timeout is less than or equal to zero, return no timeout. - if (configuredTimeout.isZero() || configuredTimeout.isNegative()) { - return NO_TIMEOUT; - } - - // Return the maximum of the timeout period and the minimum allowed timeout period. - return configuredTimeout.compareTo(MINIMUM_TIMEOUT) > 0 ? configuredTimeout : MINIMUM_TIMEOUT; - } } diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java deleted file mode 100644 index 74f13be9d4f4..000000000000 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.cosmos.rx; - -import com.azure.cosmos.ConsistencyLevel; -import com.azure.cosmos.CosmosAsyncClient; -import com.azure.cosmos.CosmosAsyncContainer; -import com.azure.cosmos.CosmosAsyncDatabase; -import com.azure.cosmos.CosmosClientBuilder; -import com.azure.cosmos.CosmosDatabaseForTest; -import com.azure.cosmos.CosmosException; -import com.azure.cosmos.DirectConnectionConfig; -import com.azure.cosmos.implementation.TestConfigurations; -import com.azure.cosmos.implementation.Utils; -import com.azure.cosmos.implementation.guava25.collect.ImmutableList; -import com.azure.cosmos.models.CosmosContainerProperties; -import com.azure.cosmos.models.CosmosVectorDataType; -import com.azure.cosmos.models.CosmosVectorDistanceFunction; -import com.azure.cosmos.models.CosmosVectorEmbedding; -import com.azure.cosmos.models.CosmosVectorEmbeddingPolicy; -import com.azure.cosmos.models.ExcludedPath; -import com.azure.cosmos.models.IncludedPath; -import com.azure.cosmos.models.IndexingMode; -import com.azure.cosmos.models.IndexingPolicy; -import com.azure.cosmos.models.PartitionKeyDefinition; -import com.azure.cosmos.models.CosmosVectorIndexSpec; -import com.azure.cosmos.models.CosmosVectorIndexType; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Ignore; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -@Ignore("TODO: Ignore these test cases until the public emulator with vector indexes is released.") -public class VectorIndexTest extends TestSuiteBase { - protected static final int TIMEOUT = 30000; - protected static final int SETUP_TIMEOUT = 20000; - protected static final int SHUTDOWN_TIMEOUT = 20000; - - protected static Logger logger = LoggerFactory.getLogger(VectorIndexTest.class.getSimpleName()); - private final ObjectMapper simpleObjectMapper = Utils.getSimpleObjectMapper(); - private final String databaseId = CosmosDatabaseForTest.generateId(); - private CosmosAsyncClient client; - private CosmosAsyncDatabase database; - - @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) - public void before_VectorIndexTest() { - // set up the client - client = new CosmosClientBuilder() - .endpoint(TestConfigurations.HOST) - .key(TestConfigurations.MASTER_KEY) - .directMode(DirectConnectionConfig.getDefaultConfig()) - .consistencyLevel(ConsistencyLevel.SESSION) - .contentResponseOnWriteEnabled(true) - .buildAsyncClient(); - - database = createDatabase(client, databaseId); - } - - @AfterClass(groups = {"emulator"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(database); - safeClose(client); - } - - @Test(groups = {"emulator"}, timeOut = TIMEOUT*10000) - public void shouldCreateVectorEmbeddingPolicy() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath("/name/?"); - IncludedPath includedPath2 = new IncludedPath("/description/?"); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - indexingPolicy.setVectorIndexes(populateVectorIndexes()); - - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); - cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(populateEmbeddings()); - - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); - - database.createContainer(collectionDefinition).block(); - CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); - CosmosContainerProperties collectionProperties = createdCollection.read().block().getProperties(); - validateCollectionProperties(collectionDefinition, collectionProperties); - } - - @Test(groups = {"emulator"}, timeOut = TIMEOUT) - public void shouldFailOnEmptyVectorEmbeddingPolicy() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath("/name/?"); - IncludedPath includedPath2 = new IncludedPath("/description/?"); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec(); - cosmosVectorIndexSpec.setPath("/vector1"); - cosmosVectorIndexSpec.setType(CosmosVectorIndexType.FLAT.toString()); - indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); - - collectionDefinition.setIndexingPolicy(indexingPolicy); - - try { - database.createContainer(collectionDefinition).block(); - fail("Container creation will fail as no vector embedding policy is being passed"); - } catch (CosmosException ex) { - assertThat(ex.getStatusCode()).isEqualTo(400); - assertThat(ex.getMessage()).contains("vector1 not matching in Embedding's path"); - } - } - - @Test(groups = {"emulator"}, timeOut = TIMEOUT) - public void shouldFailOnWrongVectorIndex() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath("/name/?"); - IncludedPath includedPath2 = new IncludedPath("/description/?"); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - CosmosVectorIndexSpec cosmosVectorIndexSpec = new CosmosVectorIndexSpec(); - cosmosVectorIndexSpec.setPath("/vector1"); - cosmosVectorIndexSpec.setType("NonFlat"); - indexingPolicy.setVectorIndexes(ImmutableList.of(cosmosVectorIndexSpec)); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); - embedding.setPath("/vector1"); - embedding.setDataType(CosmosVectorDataType.FLOAT32); - embedding.setDimensions(3L); - embedding.setDistanceFunction(CosmosVectorDistanceFunction.COSINE); - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); - cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(ImmutableList.of(embedding)); - collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); - - try { - database.createContainer(collectionDefinition).block(); - fail("Container creation will fail as wrong vector index type is being passed"); - } catch (CosmosException ex) { - assertThat(ex.getStatusCode()).isEqualTo(400); - assertThat(ex.getMessage()).contains("NonFlat is invalid, Valid types are 'flat' or 'quantizedFlat'"); - } - } - - @Test(groups = {"emulator"}, timeOut = TIMEOUT) - public void shouldCreateVectorIndexSimilarPathDifferentVectorType() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - CosmosContainerProperties collectionDefinition = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath("/name/?"); - IncludedPath includedPath2 = new IncludedPath("/description/?"); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - List vectorIndexes = populateVectorIndexes(); - vectorIndexes.get(2).setPath("/vector2"); - indexingPolicy.setVectorIndexes(vectorIndexes); - - List embeddings = populateEmbeddings(); - embeddings.get(2).setPath("/vector2"); - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); - cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(embeddings); - - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy); - - database.createContainer(collectionDefinition).block(); - CosmosAsyncContainer createdCollection = database.getContainer(collectionDefinition.getId()); - CosmosContainerProperties collectionProperties = createdCollection.read().block().getProperties(); - validateCollectionProperties(collectionDefinition, collectionProperties); - } - - @Test(groups = {"unit"}, timeOut = TIMEOUT) - public void shouldFailOnWrongVectorEmbeddingPolicy() { - CosmosVectorEmbedding embedding = new CosmosVectorEmbedding(); - try { - - embedding.setDataType(null); - fail("Embedding creation failed because cosmosVectorDataType argument is empty"); - } catch (NullPointerException ex) { - assertThat(ex.getMessage()).isEqualTo("cosmosVectorDataType cannot be empty"); - } - - try { - embedding.setDistanceFunction(null); - fail("Embedding creation failed because cosmosVectorDistanceFunction argument is empty"); - } catch (NullPointerException ex) { - assertThat(ex.getMessage()).isEqualTo("cosmosVectorDistanceFunction cannot be empty"); - } - - try { - embedding.setDimensions(null); - fail("Embedding creation failed because dimensions argument is empty"); - } catch (NullPointerException ex) { - assertThat(ex.getMessage()).isEqualTo("dimensions cannot be empty"); - } - - try { - embedding.setDimensions(-1L); - fail("Vector Embedding policy creation will fail for negative dimensions being passed"); - } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage()).isEqualTo("Dimensions for the embedding has to be a long value greater than 1 for the vector embedding policy"); - } - } - - @Test(groups = {"unit"}, timeOut = TIMEOUT) - public void shouldValidateVectorEmbeddingPolicySerializationAndDeserialization() throws JsonProcessingException { - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setVectorIndexes(populateVectorIndexes()); - - CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy = new CosmosVectorEmbeddingPolicy(); - cosmosVectorEmbeddingPolicy.setCosmosVectorEmbeddings(populateEmbeddings()); - String vectorEmbeddingPolicyJson = getVectorEmbeddingPolicyAsString(); - String expectedVectorEmbeddingPolicyJson = simpleObjectMapper.writeValueAsString(cosmosVectorEmbeddingPolicy); - assertThat(vectorEmbeddingPolicyJson).isEqualTo(expectedVectorEmbeddingPolicyJson); - - CosmosVectorEmbeddingPolicy expectedCosmosVectorEmbeddingPolicy = simpleObjectMapper.readValue(expectedVectorEmbeddingPolicyJson, CosmosVectorEmbeddingPolicy.class); - validateVectorEmbeddingPolicy(cosmosVectorEmbeddingPolicy, expectedCosmosVectorEmbeddingPolicy); - } - - private void validateCollectionProperties(CosmosContainerProperties collectionDefinition, CosmosContainerProperties collectionProperties) { - assertThat(collectionProperties.getVectorEmbeddingPolicy()).isNotNull(); - assertThat(collectionProperties.getVectorEmbeddingPolicy().getVectorEmbeddings()).isNotNull(); - validateVectorEmbeddingPolicy(collectionProperties.getVectorEmbeddingPolicy(), - collectionDefinition.getVectorEmbeddingPolicy()); - - assertThat(collectionProperties.getIndexingPolicy().getVectorIndexes()).isNotNull(); - validateVectorIndexes(collectionDefinition.getIndexingPolicy().getVectorIndexes(), collectionProperties.getIndexingPolicy().getVectorIndexes()); - } - - private void validateVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy actual, CosmosVectorEmbeddingPolicy expected) { - List actualEmbeddings = actual.getVectorEmbeddings(); - List expectedEmbeddings = expected.getVectorEmbeddings(); - assertThat(expectedEmbeddings).hasSameSizeAs(actualEmbeddings); - for (int i = 0; i < expectedEmbeddings.size(); i++) { - assertThat(expectedEmbeddings.get(i).getPath()).isEqualTo(actualEmbeddings.get(i).getPath()); - assertThat(expectedEmbeddings.get(i).getDataType()).isEqualTo(actualEmbeddings.get(i).getDataType()); - assertThat(expectedEmbeddings.get(i).getDimensions()).isEqualTo(actualEmbeddings.get(i).getDimensions()); - assertThat(expectedEmbeddings.get(i).getDistanceFunction()).isEqualTo(actualEmbeddings.get(i).getDistanceFunction()); - } - } - - private void validateVectorIndexes(List actual, List expected) { - assertThat(expected).hasSameSizeAs(actual); - for (int i = 0; i < expected.size(); i++) { - assertThat(expected.get(i).getPath()).isEqualTo(actual.get(i).getPath()); - assertThat(expected.get(i).getType()).isEqualTo(actual.get(i).getType()); - } - } - - private List populateVectorIndexes() { - CosmosVectorIndexSpec cosmosVectorIndexSpec1 = new CosmosVectorIndexSpec(); - cosmosVectorIndexSpec1.setPath("/vector1"); - cosmosVectorIndexSpec1.setType(CosmosVectorIndexType.FLAT.toString()); - - CosmosVectorIndexSpec cosmosVectorIndexSpec2 = new CosmosVectorIndexSpec(); - cosmosVectorIndexSpec2.setPath("/vector2"); - cosmosVectorIndexSpec2.setType(CosmosVectorIndexType.QUANTIZED_FLAT.toString()); - - CosmosVectorIndexSpec cosmosVectorIndexSpec3 = new CosmosVectorIndexSpec(); - cosmosVectorIndexSpec3.setPath("/vector3"); - cosmosVectorIndexSpec3.setType(CosmosVectorIndexType.DISK_ANN.toString()); - - return Arrays.asList(cosmosVectorIndexSpec1, cosmosVectorIndexSpec2, cosmosVectorIndexSpec3); - } - - private List populateEmbeddings() { - CosmosVectorEmbedding embedding1 = new CosmosVectorEmbedding(); - embedding1.setPath("/vector1"); - embedding1.setDataType(CosmosVectorDataType.INT8); - embedding1.setDimensions(3L); - embedding1.setDistanceFunction(CosmosVectorDistanceFunction.COSINE); - - CosmosVectorEmbedding embedding2 = new CosmosVectorEmbedding(); - embedding2.setPath("/vector2"); - embedding2.setDataType(CosmosVectorDataType.FLOAT32); - embedding2.setDimensions(3L); - embedding2.setDistanceFunction(CosmosVectorDistanceFunction.DOT_PRODUCT); - - CosmosVectorEmbedding embedding3 = new CosmosVectorEmbedding(); - embedding3.setPath("/vector3"); - embedding3.setDataType(CosmosVectorDataType.UINT8); - embedding3.setDimensions(3L); - embedding3.setDistanceFunction(CosmosVectorDistanceFunction.EUCLIDEAN); - return Arrays.asList(embedding1, embedding2, embedding3); - } - - private String getVectorEmbeddingPolicyAsString() { - return "{\"vectorEmbeddings\":[" + - "{\"path\":\"/vector1\",\"dataType\":\"int8\",\"dimensions\":3,\"distanceFunction\":\"cosine\"}," + - "{\"path\":\"/vector2\",\"dataType\":\"float32\",\"dimensions\":3,\"distanceFunction\":\"dotproduct\"}," + - "{\"path\":\"/vector3\",\"dataType\":\"uint8\",\"dimensions\":3,\"distanceFunction\":\"euclidean\"}" + - "]}"; - } -} diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 686ee7b6b8e2..01db4f44daa2 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -15,7 +15,6 @@ ### 4.59.0 (2024-04-27) #### Features Added -* Added `cosmosVectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379) * Added public APIs `getCustomItemSerializer` and `setCustomItemSerializer` to allow customers to specify custom payload transformations or serialization settings. - See [PR 38997](https://github.com/Azure/azure-sdk-for-java/pull/38997) and [PR 39933](https://github.com/Azure/azure-sdk-for-java/pull/39933) #### Other Changes diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java index f789963783ed..8409d5b7ec23 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java @@ -120,15 +120,6 @@ public static final class Properties { public static final String SPATIAL_INDEXES = "spatialIndexes"; public static final String TYPES = "types"; - // Vector Embedding Policy - public static final String VECTOR_EMBEDDING_POLICY = "vectorEmbeddingPolicy"; - public static final String VECTOR_INDEXES = "vectorIndexes"; - public static final String VECTOR_EMBEDDINGS = "vectorEmbeddings"; - public static final String VECTOR_INDEX_TYPE = "type"; - public static final String VECTOR_DATA_TYPE = "dataType"; - public static final String VECTOR_DIMENSIONS = "dimensions"; - public static final String DISTANCE_FUNCTION = "distanceFunction"; - // Unique index. public static final String UNIQUE_KEY_POLICY = "uniqueKeyPolicy"; public static final String UNIQUE_KEYS = "uniqueKeys"; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java index c70ded3a906f..6d7b00068393 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java @@ -204,7 +204,7 @@ public CosmosQueryRequestOptionsImpl setMaxItemCount(Integer maxItemCount) { * @return the max number of items for vector search. */ public Integer getMaxItemSizeForVectorSearch() { - return maxItemSizeForVectorSearch; + return this.maxItemSizeForVectorSearch; } /** diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java index 1930f2275a61..b3d650157796 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java @@ -10,7 +10,6 @@ import com.azure.cosmos.models.ClientEncryptionPolicy; import com.azure.cosmos.models.ComputedProperty; import com.azure.cosmos.models.ConflictResolutionPolicy; -import com.azure.cosmos.models.CosmosVectorEmbeddingPolicy; import com.azure.cosmos.models.IndexingPolicy; import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.PartitionKeyDefinition; @@ -25,8 +24,6 @@ import java.util.Collection; import java.util.Collections; -import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; - /** * Represents a document collection in the Azure Cosmos DB database service. A collection is a named logical container * for documents. @@ -43,7 +40,6 @@ public final class DocumentCollection extends Resource { private UniqueKeyPolicy uniqueKeyPolicy; private PartitionKeyDefinition partitionKeyDefinition; private ClientEncryptionPolicy clientEncryptionPolicyInternal; - private CosmosVectorEmbeddingPolicy cosmosVectorEmbeddingPolicy; /** * Constructor. @@ -414,33 +410,6 @@ public void setClientEncryptionPolicy(ClientEncryptionPolicy value) { this.set(Constants.Properties.CLIENT_ENCRYPTION_POLICY, value, CosmosItemSerializer.DEFAULT_SERIALIZER); } - /** - * Gets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item - * used in performing vector search on the items in a collection in the Azure CosmosDB database service. - * - * @return the Vector Embedding Policy. - */ - public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() { - if (this.cosmosVectorEmbeddingPolicy == null) { - if (super.has(Constants.Properties.VECTOR_EMBEDDING_POLICY)) { - this.cosmosVectorEmbeddingPolicy = super.getObject(Constants.Properties.VECTOR_EMBEDDING_POLICY, - CosmosVectorEmbeddingPolicy.class); - } - } - return this.cosmosVectorEmbeddingPolicy; - } - - /** - * Sets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item - * used in performing vector search on the items in a collection in the Azure CosmosDB database service. - * - * @param value the Vector Embedding Policy. - */ - public void setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) { - checkNotNull(value, "cosmosVectorEmbeddingPolicy cannot be null"); - this.set(Constants.Properties.VECTOR_EMBEDDING_POLICY, value, CosmosItemSerializer.DEFAULT_SERIALIZER); - } - public void populatePropertyBag() { super.populatePropertyBag(); if (this.indexingPolicy == null) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java index 89a8a3065443..2f3abb36e9d1 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; @@ -125,10 +126,13 @@ private void initialize( // Since the continuation token will always be null, // we don't need to handle any initialization based on continuationToken. // We can directly initialize without any consideration for continuationToken. + Map partitionKeyRangeToContinuationToken = new HashMap<>(); + for (FeedRangeEpkImpl feedRangeEpk : feedRanges) { + partitionKeyRangeToContinuationToken.put(feedRangeEpk, + null); + } super.initialize(collection, - feedRanges.stream().collect(Collectors.toMap( - feedRangeEpk -> feedRangeEpk, - feedRangeEpk -> null)), + partitionKeyRangeToContinuationToken, initialPageSize, new SqlQuerySpec(querySpec.getQueryText().replace(FormatPlaceHolder, True), querySpec.getParameters())); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java index 1b4191e26413..b4ac33a1dbc2 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java @@ -74,7 +74,10 @@ private PageToItemTransformer(RequestChargeTracker tracker, Map> apply(Flux.DocumentProducerFeedResponse> source) { - PriorityBlockingQueue> priorityQueue = new PriorityBlockingQueue<>(initialPageSize, consumeComparer); + // the size of the priority queue is set to size+1, because when the pq reaches the max size we add that + // item and then remove the element. If we don't do this, then when adding this element the size of the pq + // will be increased automatically by 50% and then there would be inconsistent results for later pages. + PriorityBlockingQueue> priorityQueue = new PriorityBlockingQueue<>(initialPageSize + 1, consumeComparer); return source.flatMap(documentProducerFeedResponse -> { clientSideRequestStatistics.addAll( diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java index a6ea9fc2d5f6..82746ad412b5 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java @@ -5,6 +5,7 @@ import com.azure.cosmos.CosmosItemSerializer; import com.azure.cosmos.implementation.DiagnosticsClientContext; import com.azure.cosmos.implementation.DocumentCollection; +import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.Document; import com.azure.cosmos.implementation.ObjectNodeMap; @@ -56,7 +57,11 @@ private static BiFunction, Flux * For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", * then you need to make the order for "/age" "ascending" and the order for "/height" "descending". diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java index 0d357da0cc37..4fae5a797a70 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosContainerProperties.java @@ -347,28 +347,6 @@ public CosmosContainerProperties setClientEncryptionPolicy(ClientEncryptionPolic return this; } - /** - * Gets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item - * used in performing vector search on the items in a collection in the Azure CosmosDB database service. - * - * @return the Vector Embedding Policy. - */ - public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() { - return this.documentCollection.getVectorEmbeddingPolicy(); - } - - /** - * Sets the Vector Embedding Policy containing paths for embeddings along with path-specific settings for the item - * used in performing vector search on the items in a collection in the Azure CosmosDB database service. - * - * @param value the Vector Embedding Policy. - * @return the CosmosContainerProperties. - */ - public CosmosContainerProperties setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) { - this.documentCollection.setVectorEmbeddingPolicy(value); - return this; - } - Resource getResource() { return this.documentCollection; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java deleted file mode 100644 index 1a0d42af17a4..000000000000 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDataType.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.cosmos.models; - -import com.fasterxml.jackson.annotation.JsonValue; - -import java.util.Arrays; - -/** - * Data types for the embeddings in Cosmos DB database service. - */ -public enum CosmosVectorDataType { - /** - * Represents a int8 data type. - */ - INT8("int8"), - - /** - * Represents a uint8 data type. - */ - UINT8("uint8"), - - /** - * Represents a float16 data type. - */ - FLOAT16("float16"), - - /** - * Represents a float32 data type. - */ - FLOAT32("float32"); - - private final String overWireValue; - - CosmosVectorDataType(String overWireValue) { - this.overWireValue = overWireValue; - } - - @JsonValue - @Override - public String toString() { - return this.overWireValue; - } - - /** - * Method to retrieve the enum constant by its overWireValue. - * @param value the overWire value of the enum constant - * @return the matching CosmosVectorDataType - * @throws IllegalArgumentException if no matching enum constant is found - */ - public static CosmosVectorDataType fromString(String value) { - return Arrays.stream(CosmosVectorDataType.values()) - .filter(vectorDataType -> vectorDataType.toString().equalsIgnoreCase(value)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Invalid vector data type for the vector embedding policy.")); - } -} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java deleted file mode 100644 index 60efd432ad7f..000000000000 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorDistanceFunction.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.cosmos.models; - -import com.fasterxml.jackson.annotation.JsonValue; - -import java.util.Arrays; - -/** - * Distance Function for the embeddings in the Cosmos DB database service. - */ -public enum CosmosVectorDistanceFunction { - /** - * Represents the euclidean distance function. - */ - EUCLIDEAN("euclidean"), - - /** - * Represents the cosine distance function. - */ - COSINE("cosine"), - - /** - * Represents the dot product distance function. - */ - DOT_PRODUCT("dotproduct"); - - private final String overWireValue; - - CosmosVectorDistanceFunction(String overWireValue) { - this.overWireValue = overWireValue; - } - - @JsonValue - @Override - public String toString() { - return this.overWireValue; - } - - /** - * Method to retrieve the enum constant by its overWireValue. - * @param value the overWire value of the enum constant - * @return the matching CosmosVectorDataType - * @throws IllegalArgumentException if no matching enum constant is found - */ - public static CosmosVectorDistanceFunction fromString(String value) { - return Arrays.stream(CosmosVectorDistanceFunction.values()) - .filter(vectorDistanceFunction -> vectorDistanceFunction.toString().equalsIgnoreCase(value)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Invalid distance function for the vector embedding policy.")); - } -} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java deleted file mode 100644 index 94a519ef9d38..000000000000 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbedding.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.cosmos.models; - -import com.azure.cosmos.implementation.Constants; -import com.azure.cosmos.implementation.JsonSerializable; -import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; - -/** - * Embedding settings within {@link CosmosVectorEmbeddingPolicy} - */ -public final class CosmosVectorEmbedding { - @JsonProperty(Constants.Properties.PATH) - private String path; - @JsonProperty(Constants.Properties.VECTOR_DATA_TYPE) - private String dataType; - @JsonProperty(Constants.Properties.VECTOR_DIMENSIONS) - private Long dimensions; - @JsonProperty(Constants.Properties.DISTANCE_FUNCTION) - private String distanceFunction; - private JsonSerializable jsonSerializable; - - /** - * Constructor - */ - public CosmosVectorEmbedding() { - this.jsonSerializable = new JsonSerializable(); - } - - /** - * Gets the path for the cosmosVectorEmbedding. - * - * @return path - */ - public String getPath() { - return path; - } - - /** - * Sets the path for the cosmosVectorEmbedding. - * - * @param path the path for the cosmosVectorEmbedding - * @return CosmosVectorEmbedding - */ - public CosmosVectorEmbedding setPath(String path) { - if (StringUtils.isEmpty(path)) { - throw new NullPointerException("embedding path is empty"); - } - - if (path.charAt(0) != '/' || path.lastIndexOf('/') != 0) { - throw new IllegalArgumentException(""); - } - - this.path = path; - return this; - } - - /** - * Gets the data type for the cosmosVectorEmbedding. - * - * @return dataType - */ - public CosmosVectorDataType getDataType() { - return CosmosVectorDataType.fromString(dataType); - } - - /** - * Sets the data type for the cosmosVectorEmbedding. - * - * @param dataType the data type for the cosmosVectorEmbedding - * @return CosmosVectorEmbedding - */ - public CosmosVectorEmbedding setDataType(CosmosVectorDataType dataType) { - checkNotNull(dataType, "cosmosVectorDataType cannot be null"); - this.dataType = dataType.toString(); - return this; - } - - /** - * Gets the dimensions for the cosmosVectorEmbedding. - * - * @return dimensions - */ - public Long getDimensions() { - return dimensions; - } - - /** - * Sets the dimensions for the cosmosVectorEmbedding. - * - * @param dimensions the dimensions for the cosmosVectorEmbedding - * @return CosmosVectorEmbedding - */ - public CosmosVectorEmbedding setDimensions(Long dimensions) { - checkNotNull(dimensions, "dimensions cannot be null"); - if (dimensions < 1) { - throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 0 " + - "for the vector embedding policy"); - } - - this.dimensions = dimensions; - return this; - } - - /** - * Gets the distanceFunction for the cosmosVectorEmbedding. - * - * @return distanceFunction - */ - public CosmosVectorDistanceFunction getDistanceFunction() { - return CosmosVectorDistanceFunction.fromString(distanceFunction); - } - - /** - * Sets the distanceFunction for the cosmosVectorEmbedding. - * - * @param distanceFunction the distanceFunction for the cosmosVectorEmbedding - * @return CosmosVectorEmbedding - */ - public CosmosVectorEmbedding setDistanceFunction(CosmosVectorDistanceFunction distanceFunction) { - checkNotNull(distanceFunction, "cosmosVectorDistanceFunction cannot be empty"); - this.distanceFunction = distanceFunction.toString(); - return this; - } -} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java deleted file mode 100644 index c54c843ebd96..000000000000 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorEmbeddingPolicy.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.cosmos.models; - -import com.azure.cosmos.implementation.Constants; -import com.azure.cosmos.implementation.JsonSerializable; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -/** - * Vector Embedding Policy - */ -public final class CosmosVectorEmbeddingPolicy { - - private JsonSerializable jsonSerializable; - /** - * Paths for embeddings along with path-specific settings for the item. - */ - @JsonProperty(Constants.Properties.VECTOR_EMBEDDINGS) - private List cosmosVectorEmbeddings; - - /** - * Constructor - */ - public CosmosVectorEmbeddingPolicy() { - this.jsonSerializable = new JsonSerializable(); - } - - /** - * Gets the paths for embeddings along with path-specific settings for the item. - * - * @return the paths for embeddings along with path-specific settings for the item. - */ - public List getVectorEmbeddings() { - return this.cosmosVectorEmbeddings; - } - - /** - * Sets the paths for embeddings along with path-specific settings for the item. - * - * @param cosmosVectorEmbeddings paths for embeddings along with path-specific settings for the item. - */ - public void setCosmosVectorEmbeddings(List cosmosVectorEmbeddings) { - cosmosVectorEmbeddings.forEach(embedding -> { - if (embedding == null) { - throw new NullPointerException("Embedding cannot be null."); - } - }); - this.cosmosVectorEmbeddings = cosmosVectorEmbeddings; -// this.jsonSerializable.set(Constants.Properties.VECTOR_EMBEDDINGS, cosmosVectorEmbeddings); - } - -} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java deleted file mode 100644 index 13b1559810ca..000000000000 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.cosmos.models; - -import com.azure.cosmos.CosmosItemSerializer; -import com.azure.cosmos.implementation.Constants; -import com.azure.cosmos.implementation.JsonSerializable; - -import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; - -/** - * Vector Indexes spec for Azure CosmosDB service. - */ -public final class CosmosVectorIndexSpec { - - private JsonSerializable jsonSerializable; - private String type; - - /** - * Constructor - */ - public CosmosVectorIndexSpec() { this.jsonSerializable = new JsonSerializable(); } - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return this.jsonSerializable.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - * @return the SpatialSpec. - */ - public CosmosVectorIndexSpec setPath(String path) { - this.jsonSerializable.set(Constants.Properties.PATH, path, CosmosItemSerializer.DEFAULT_SERIALIZER); - return this; - } - - /** - * Gets the vector index type for the vector index - * - * @return the vector index type - */ - public String getType() { - if (this.type == null) { - this.type = this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE); - } - return this.type; - } - - /** - * Sets the vector index type for the vector index - * - * @param type the vector index type - * @return the VectorIndexSpec - */ - public CosmosVectorIndexSpec setType(String type) { - checkNotNull(type, "cosmosVectorIndexType cannot be null"); - this.type = type; - this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type, CosmosItemSerializer.DEFAULT_SERIALIZER); - return this; - } - - void populatePropertyBag() { - this.jsonSerializable.populatePropertyBag(); - } - - JsonSerializable getJsonSerializable() { - return this.jsonSerializable; - } -} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java deleted file mode 100644 index 679ea1f991c0..000000000000 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexType.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.cosmos.models; - -/** - * Defines the index type of vector index specification in the Azure Cosmos DB service. - */ -public enum CosmosVectorIndexType { - /** - * Represents a flat vector index type. - */ - FLAT("flat"), - - /** - * Represents a quantized flat vector index type. - */ - QUANTIZED_FLAT("quantizedFlat"), - - /** - * Represents a disk ANN vector index type. - */ - DISK_ANN("diskANN"); - - - private final String overWireValue; - - CosmosVectorIndexType(String overWireValue) { - this.overWireValue = overWireValue; - } - - @Override - public String toString() { - return this.overWireValue; - } -} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index 678cea56fcc4..939fc773c7e7 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -20,12 +20,11 @@ */ public final class IndexingPolicy { private static final String DEFAULT_PATH = "/*"; - private final JsonSerializable jsonSerializable; private List includedPaths; private List excludedPaths; private List> compositeIndexes; private List spatialIndexes; - private List vectorIndexes; + private final JsonSerializable jsonSerializable; /** * Constructor. @@ -53,7 +52,7 @@ public IndexingPolicy() { * * * @param defaultIndexOverrides comma separated set of indexes that serve as default index specifications for the - * root path. + * root path. * @throws IllegalArgumentException throws when defaultIndexOverrides is null */ IndexingPolicy(Index[] defaultIndexOverrides) { @@ -234,7 +233,7 @@ public IndexingPolicy setCompositeIndexes(List> compositeInd } /** - * Gets the spatial indexes for additional indexes. + * Sets the spatial indexes for additional indexes. * * @return the spatial indexes. */ @@ -265,55 +264,11 @@ public IndexingPolicy setSpatialIndexes(List spatialIndexes) { return this; } - /** - * Gets the vector indexes. - * - * @return the vector indexes - */ - public List getVectorIndexes() { - if (this.vectorIndexes == null) { - this.vectorIndexes = this.jsonSerializable.getList(Constants.Properties.VECTOR_INDEXES, CosmosVectorIndexSpec.class); - - if (this.vectorIndexes == null) { - this.vectorIndexes = new ArrayList(); - } - } - - return this.vectorIndexes; - } - - /** - * Sets the vector indexes. - * - * Example of the vectorIndexes: - * "vectorIndexes": [ - * { - * "path": "/vector1", - * "type": "diskANN" - * }, - * { - * "path": "/vector1", - * "type": "flat" - * }, - * { - * "path": "/vector2", - * "type": "quantizedFlat" - * }] - * - * @param vectorIndexes the vector indexes - * @return the Indexing Policy. - */ - public IndexingPolicy setVectorIndexes(List vectorIndexes) { - this.vectorIndexes = vectorIndexes; - this.jsonSerializable.set(Constants.Properties.VECTOR_INDEXES,this.vectorIndexes, CosmosItemSerializer.DEFAULT_SERIALIZER); - return this; - } - void populatePropertyBag() { this.jsonSerializable.populatePropertyBag(); // If indexing mode is not 'none' and not paths are set, set them to the defaults if (this.getIndexingMode() != IndexingMode.NONE && this.getIncludedPaths().size() == 0 - && this.getExcludedPaths().size() == 0) { + && this.getExcludedPaths().size() == 0) { IncludedPath includedPath = new IncludedPath(IndexingPolicy.DEFAULT_PATH); this.getIncludedPaths().add(includedPath); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java index e814cc16681b..cb9aba599c77 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java @@ -435,8 +435,6 @@ public static void populatePropertyBag(T t) { ((PartitionKeyDefinition) t).populatePropertyBag(); } else if (t instanceof SpatialSpec) { ((SpatialSpec) t).populatePropertyBag(); - } else if (t instanceof CosmosVectorIndexSpec) { - ((CosmosVectorIndexSpec) t).populatePropertyBag(); } else if (t instanceof SqlParameter) { ((SqlParameter) t).populatePropertyBag(); } else if (t instanceof SqlQuerySpec) { @@ -470,8 +468,6 @@ public static JsonSerializable getJsonSerializable(T t) { return ((PartitionKeyDefinition) t).getJsonSerializable(); } else if (t instanceof SpatialSpec) { return ((SpatialSpec) t).getJsonSerializable(); - } else if (t instanceof CosmosVectorIndexSpec) { - return ((CosmosVectorIndexSpec) t).getJsonSerializable(); } else if (t instanceof SqlParameter) { return ((SqlParameter) t).getJsonSerializable(); } else if (t instanceof SqlQuerySpec) { diff --git a/sdk/keyvault/azure-security-keyvault-administration/README.md b/sdk/keyvault/azure-security-keyvault-administration/README.md index f5293070284d..6cd8fad7cdeb 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/README.md +++ b/sdk/keyvault/azure-security-keyvault-administration/README.md @@ -111,9 +111,15 @@ The Key Vault Backup Client provides both synchronous and asynchronous operation > NOTE: The backing store for key backups is a blob storage container using Shared Access Signature authentication. For more details on creating a SAS token using the `BlobServiceClient`, see the [Azure Storage Blobs client README][storage_readme_sas_token]. Alternatively, it is possible to [generate a SAS token in Storage Explorer][portal_sas_token]. +### Pre-Backup Operation +A pre-backup operation represents a long-running operation that checks if it is possible to perform a full key backup. + ### Backup Operation A backup operation represents a long-running operation for a full key backup. +### Pre-Restore Operation +A pre-restore operation represents a long-running operation that checks if it is possible to perform a full key restore from a backup. + ### Restore Operation A restore operation represents a long-running operation for both a full key and selective key restore. @@ -340,20 +346,47 @@ keyVaultAccessControlAsyncClient.deleteRoleAssignment(KeyVaultRoleScope.GLOBAL, ### Examples #### Sync API The following sections provide several code snippets covering some of the most common Azure Key Vault Backup client tasks, including: +- [Pre-backup check for a Key Vault](#run-pre-backup-check-for-a-collection-of-keys) - [Backup a Key Vault](#backup-a-collection-of-keys) +- [Pre-restore check for a Key Vault](#run-pre-restore-check-for-a-collection-of-keys) - [Restore a Key Vault](#restore-a-collection-of-keys) - [Restore a key](#selectively-restore-a-key) +##### Run pre-backup check for a collection of keys +Check if an entire collection of keys can be backed up by using `beginPreBackup()`. + +```java readme-sample-beginPreBackup +String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer"; +String sasToken = ""; + +SyncPoller preBackupPoller = + keyVaultBackupClient.beginPreBackup(blobStorageUrl, sasToken); +PollResponse pollResponse = preBackupPoller.poll(); + +System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()); + +PollResponse finalPollResponse = preBackupPoller.waitForCompletion(); + +if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String folderUrl = preBackupPoller.getFinalResult(); + + System.out.printf("Pre-backup check completed successfully.%n"); +} else { + KeyVaultBackupOperation operation = preBackupPoller.poll().getValue(); + + System.out.printf("Pre-backup check failed with error: %s.%n", operation.getError().getMessage()); +} +``` + ##### Backup a collection of keys Back up an entire collection of keys using `beginBackup()`. ```java readme-sample-beginBackup String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer"; -String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D"; +String sasToken = ""; SyncPoller backupPoller = keyVaultBackupClient.beginBackup(blobStorageUrl, sasToken); - PollResponse pollResponse = backupPoller.poll(); System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()); @@ -371,26 +404,49 @@ if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COM } ``` +##### Run pre-restore check for a collection of keys +Check if an entire collection of keys can be restored from a backup by using `beginPreRestore()`. + +```java readme-sample-beginPreRestore +String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313"; +String sasToken = ""; + +SyncPoller preRestorePoller = + keyVaultBackupClient.beginPreRestore(folderUrl, sasToken); +PollResponse pollResponse = preRestorePoller.poll(); + +System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()); + +PollResponse finalPollResponse = preRestorePoller.waitForCompletion(); + +if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + System.out.printf("Pre-restore check completed successfully.%n"); +} else { + KeyVaultRestoreOperation operation = preRestorePoller.poll().getValue(); + + System.out.printf("Pre-restore check failed with error: %s.%n", operation.getError().getMessage()); +} +``` + ##### Restore a collection of keys Restore an entire collection of keys from a backup using `beginRestore()`. ```java readme-sample-beginRestore String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313"; -String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D"; +String sasToken = ""; -SyncPoller backupPoller = +SyncPoller restorePoller = keyVaultBackupClient.beginRestore(folderUrl, sasToken); - -PollResponse pollResponse = backupPoller.poll(); +PollResponse pollResponse = restorePoller.poll(); System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()); -PollResponse finalPollResponse = backupPoller.waitForCompletion(); +PollResponse finalPollResponse = restorePoller.waitForCompletion(); if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { System.out.printf("Backup restored successfully.%n"); } else { - KeyVaultRestoreOperation operation = backupPoller.poll().getValue(); + KeyVaultRestoreOperation operation = restorePoller.poll().getValue(); System.out.printf("Restore failed with error: %s.%n", operation.getError().getMessage()); } @@ -401,22 +457,21 @@ Restore a specific key from a backup using `beginSelectiveRestore()`. ```java readme-sample-beginSelectiveKeyRestore String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313"; -String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D"; +String sasToken = ""; String keyName = "myKey"; -SyncPoller backupPoller = +SyncPoller restorePoller = keyVaultBackupClient.beginSelectiveKeyRestore(folderUrl, sasToken, keyName); - -PollResponse pollResponse = backupPoller.poll(); +PollResponse pollResponse = restorePoller.poll(); System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()); -PollResponse finalPollResponse = backupPoller.waitForCompletion(); +PollResponse finalPollResponse = restorePoller.waitForCompletion(); if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { System.out.printf("Key restored successfully.%n"); } else { - KeyVaultSelectiveKeyRestoreOperation operation = backupPoller.poll().getValue(); + KeyVaultSelectiveKeyRestoreOperation operation = restorePoller.poll().getValue(); System.out.printf("Key restore failed with error: %s.%n", operation.getError().getMessage()); } @@ -424,18 +479,38 @@ if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COM #### Async API The following sections provide several code snippets covering some of the most common asynchronous Azure Key Vault Backup client tasks, including: +- [Run pre-backup check for a collection of keys asynchronously](#run-pre-backup-check-for-a-collection-of-keys-asynchronously) - [Backup a Key Vault asynchronously](#backup-a-collection-of-keys-asynchronously) +- [Run pre-restore check for a collection of keys asynchronously](#run-pre-restore-check-for-a-collection-of-keys-asynchronously) - [Restore a Key Vault asynchronously](#restore-a-collection-of-keys-asynchronously) - [Restore a key asynchronously](#selectively-restore-a-key-asynchronously) > Note : You should add `System.in.read()` or `Thread.sleep()` after the function calls in the main class/thread to allow async functions/operations to execute and finish before the main application/thread exits. +##### Run pre-backup check for a collection of keys asynchronously +Check if an entire collection of keys can be backed up by using `beginPreBackup()`. + +```java readme-sample-beginPreBackupAsync +String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer"; +String sasToken = ""; + +keyVaultBackupAsyncClient.beginPreBackup(blobStorageUrl, sasToken) + .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval. + .doOnError(e -> System.out.printf("Pre-backup check failed with error: %s.%n", e.getMessage())) + .doOnNext(pollResponse -> + System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus())) + .filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) + .flatMap(AsyncPollResponse::getFinalResult) + .subscribe(folderUrl -> + System.out.printf("Pre-backup check completed successfully.%n")); +``` + ##### Backup a collection of keys asynchronously Back up an entire collection of keys using `beginBackup()`. ```java readme-sample-beginBackupAsync String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer"; -String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D"; +String sasToken = ""; keyVaultBackupAsyncClient.beginBackup(blobStorageUrl, sasToken) .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval. @@ -448,12 +523,29 @@ keyVaultBackupAsyncClient.beginBackup(blobStorageUrl, sasToken) System.out.printf("Backup completed. The storage location of this backup is: %s.%n", folderUrl)); ``` +##### Run pre-restore check for a collection of keys asynchronously +Check if an entire collection of keys can be restored from a backup by using `beginPreRestore()`. + +```java readme-sample-beginPreRestoreAsync +String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313"; +String sasToken = ""; + +keyVaultBackupAsyncClient.beginPreRestore(folderUrl, sasToken) + .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval. + .doOnError(e -> System.out.printf("Pre-restore check failed with error: %s.%n", e.getMessage())) + .doOnNext(pollResponse -> + System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus())) + .filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) + .flatMap(AsyncPollResponse::getFinalResult) + .subscribe(unused -> System.out.printf("Pre-restore check completed successfully.%n")); +``` + ##### Restore a collection of keys asynchronously Restore an entire collection of keys from a backup using `beginRestore()`. ```java readme-sample-beginRestoreAsync String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313"; -String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D"; +String sasToken = ""; keyVaultBackupAsyncClient.beginRestore(folderUrl, sasToken) .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval. @@ -470,7 +562,7 @@ Restore an entire collection of keys from a backup using `beginSelectiveRestore( ```java readme-sample-beginSelectiveKeyRestoreAsync String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313"; -String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D"; +String sasToken = ""; String keyName = "myKey"; keyVaultBackupAsyncClient.beginSelectiveKeyRestore(folderUrl, sasToken, keyName) diff --git a/sdk/keyvault/azure-security-keyvault-administration/assets.json b/sdk/keyvault/azure-security-keyvault-administration/assets.json index 2edac6dd53d7..16819beda18c 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/assets.json +++ b/sdk/keyvault/azure-security-keyvault-administration/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/keyvault/azure-security-keyvault-administration", - "Tag": "java/keyvault/azure-security-keyvault-administration_95d2cbb133" + "Tag": "java/keyvault/azure-security-keyvault-administration_18fc6d4e27" } diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAdministrationServiceVersion.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAdministrationServiceVersion.java index 9da3c1ae7476..f816b886c8cb 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAdministrationServiceVersion.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAdministrationServiceVersion.java @@ -27,7 +27,12 @@ public enum KeyVaultAdministrationServiceVersion implements ServiceVersion { /** * Service version {@code 7.5}. */ - V7_5("7.5"); + V7_5("7.5"), + + /** + * Service version {@code 7.6-preview.1}. + */ + V7_6_PREVIEW_1("7.6-preview.1"); private final String version; @@ -46,6 +51,6 @@ public String getVersion() { * @return The latest {@link KeyVaultAdministrationServiceVersion}. */ public static KeyVaultAdministrationServiceVersion getLatest() { - return V7_5; + return V7_6_PREVIEW_1; } } diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java index d4ed2f1d1f92..e49ae353a98b 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java @@ -18,6 +18,8 @@ import com.azure.core.util.polling.PollingContext; import com.azure.security.keyvault.administration.implementation.KeyVaultBackupClientImpl; import com.azure.security.keyvault.administration.implementation.KeyVaultErrorCodeStrings; +import com.azure.security.keyvault.administration.implementation.models.PreBackupOperationParameters; +import com.azure.security.keyvault.administration.implementation.models.PreRestoreOperationParameters; import com.azure.security.keyvault.administration.implementation.models.RestoreOperation; import com.azure.security.keyvault.administration.implementation.models.RestoreOperationParameters; import com.azure.security.keyvault.administration.implementation.models.SASTokenParameter; @@ -89,8 +91,7 @@ * *

  * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
- * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
- *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+ * String sasToken = "<sas-token>";
  *
  * client.beginBackup(blobStorageUrl, sasToken)
  *     .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
@@ -120,8 +121,7 @@
  * 
  * 
  * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
- * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
- *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+ * String sasToken = "<sas-token>";
  *
  * client.beginRestore(folderUrl, sasToken)
  *     .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
@@ -150,8 +150,7 @@
  * 
  * 
  * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
- * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
- *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+ * String sasToken = "<sas-token>";
  * String keyName = "myKey";
  *
  * client.beginSelectiveKeyRestore(folderUrl, sasToken, keyName)
@@ -249,8 +248,7 @@ HttpPipeline getHttpPipeline() {
      * 
      * 
      * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
-     * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-     *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+     * String sasToken = "<sas-token>";
      *
      * client.beginBackup(blobStorageUrl, sasToken)
      *     .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
@@ -400,6 +398,101 @@ private static Mono> processBackupOperatio
             toLongRunningOperationStatus(operationStatus.toLowerCase(Locale.US)), response.getValue()));
     }
 
+    /**
+     * Initiates a pre-backup check on the Key Vault. This operation checks if it is possible to back up the entire
+     * collection of keys from a key vault.
+     *
+     * 

Code Samples

+ *

Starts a {@link KeyVaultBackupOperation pre-backup operation}, polls for its status and waits for it to + * complete. Prints out the details of the operation's final result in case of success or prints out details of an + * error in case the operation fails.

+ * + *
+     * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
+     * String sasToken = "<sas-token>";
+     *
+     * client.beginPreBackup(blobStorageUrl, sasToken)
+     *     .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
+     *     .doOnError(e -> System.out.printf("Pre-backup check failed with error: %s.%n", e.getMessage()))
+     *     .doOnNext(pollResponse ->
+     *         System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()))
+     *     .filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
+     *     .flatMap(AsyncPollResponse::getFinalResult)
+     *     .subscribe(unused -> System.out.printf("Pre-backup check completed successfully.%n"));
+     * 
+ * + * + * @param blobStorageUrl The URL for the Blob Storage resource where the backup will be located. + * @param sasToken Optional Shared Access Signature (SAS) token to authorize access to the blob. If {@code null}, + * Managed Identity will be used to authenticate instead. + * + * @return A {@link PollerFlux} polling on the {@link KeyVaultBackupOperation pre-backup operation} status. + * + * @throws KeyVaultAdministrationException If the given {@code blobStorageUrl} or {@code sasToken} are invalid. + * @throws NullPointerException If the {@code blobStorageUrl} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginPreBackup(String blobStorageUrl, String sasToken) { + if (blobStorageUrl == null) { + throw LOGGER.logExceptionAsError( + new NullPointerException( + String.format(KeyVaultErrorCodeStrings.PARAMETER_REQUIRED, "'blobStorageUrl'"))); + } + + return new PollerFlux<>(getDefaultPollingInterval(), + preBackupActivationOperation(blobStorageUrl, sasToken), + backupPollOperation(), + (pollingContext, firstResponse) -> + Mono.error(LOGGER.logExceptionAsError(new RuntimeException("Cancellation is not supported"))), + backupFetchOperation()); + } + + /** + * Initiates a pre-backup check on the Key Vault. This operation checks if it is possible to back up the entire + * collection of keys from a key vault. + * + * @param blobStorageUrl The URL for the Blob Storage resource where the backup will be located. + * @param sasToken Optional Shared Access Signature (SAS) token to authorize access to the blob. If {@code null}, + * Managed Identity will be used to authenticate instead. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return A {@link PollerFlux} polling on the {@link KeyVaultBackupOperation pre-backup operation} status. + * + * @throws KeyVaultAdministrationException If the given {@code blobStorageUrl} or {@code sasToken} are invalid. + */ + Mono> preBackupWithResponse(String blobStorageUrl, String sasToken, + Context context) { + PreBackupOperationParameters preBackupOperationParameters = new PreBackupOperationParameters() + .setStorageResourceUri(blobStorageUrl) + .setToken(sasToken) + .setUseManagedIdentity(sasToken == null); + + try { + return clientImpl.preFullBackupWithResponseAsync(vaultUrl, preBackupOperationParameters, context) + .doOnRequest(ignored -> LOGGER.verbose("Backing up at URL - {}", blobStorageUrl)) + .doOnSuccess(response -> LOGGER.verbose("Backed up at URL - {}", + response.getValue().getAzureStorageBlobContainerUri())) + .doOnError(error -> LOGGER.warning("Failed to backup at URL - {}", blobStorageUrl, error)) + .map(backupOperationResponse -> + new SimpleResponse<>(backupOperationResponse.getRequest(), backupOperationResponse.getStatusCode(), + backupOperationResponse.getHeaders(), + (KeyVaultBackupOperation) transformToLongRunningOperation(backupOperationResponse.getValue()))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); + } + } + + private Function, Mono> preBackupActivationOperation(String blobStorageUrl, String sasToken) { + return (pollingContext) -> { + try { + return withContext(context -> preBackupWithResponse(blobStorageUrl, sasToken, context)) + .flatMap(backupResponse -> Mono.just(backupResponse.getValue())); + } catch (RuntimeException e) { + return monoError(LOGGER, e); + } + }; + } + /** * Initiates a full restore of the Key Vault. * @@ -409,8 +502,7 @@ private static Mono> processBackupOperatio * *
      * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-     * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-     *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+     * String sasToken = "<sas-token>";
      *
      * client.beginRestore(folderUrl, sasToken)
      *     .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
@@ -554,6 +646,116 @@ static Mono> processRestoreOperationRespo
             toLongRunningOperationStatus(operationStatus.toLowerCase(Locale.US)), response.getValue()));
     }
 
+    /**
+     * Initiates a pre-restore check on the Key Vault. This operation checks if it is possible to restore an entire
+     * collection of keys from a backup.
+     *
+     * 

Code Samples

+ *

Starts a {@link KeyVaultRestoreOperation pre-restore operation}, polls for its status and waits for it to + * complete. Prints out error details in case the operation fails.

+ * + *
+     * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
+     * String sasToken = "<sas-token>";
+     *
+     * client.beginPreRestore(folderUrl, sasToken)
+     *     .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
+     *     .doOnError(e -> System.out.printf("Pre-restore check failed with error: %s.%n", e.getMessage()))
+     *     .doOnNext(pollResponse ->
+     *         System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()))
+     *     .filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
+     *     .flatMap(AsyncPollResponse::getFinalResult)
+     *     .subscribe(unused -> System.out.printf("Pre-restore check completed successfully.%n"));
+     * 
+ * + * + * @param folderUrl The URL for the Blob Storage resource where the backup is located, including the path to + * the blob container where the backup resides. This would be the exact value that is returned as the result of a + * backup operation. An example of such a URL may look like the following: + * {@code https://contoso.blob.core.windows.net/backup/mhsm-contoso-2020090117323313}. + * @param sasToken Optional Shared Access Signature (SAS) token to authorize access to the blob. If {@code null}, + * Managed Identity will be used to authenticate instead. + * + * @return A {@link PollerFlux} polling on the {@link KeyVaultRestoreOperation restore operation} status. + * + * @throws KeyVaultAdministrationException If the given {@code folderUrl} or {@code sasToken} are invalid. + * @throws NullPointerException If the {@code folderUrl} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginPreRestore(String folderUrl, + String sasToken) { + if (folderUrl == null) { + throw LOGGER.logExceptionAsError( + new NullPointerException(String.format(KeyVaultErrorCodeStrings.PARAMETER_REQUIRED, "'folderUrl'"))); + } + + return new PollerFlux<>(getDefaultPollingInterval(), + preRestoreActivationOperation(folderUrl, sasToken), + restorePollOperation(), + (pollingContext, firstResponse) -> + Mono.error(LOGGER.logExceptionAsError(new RuntimeException("Cancellation is not supported"))), + (pollingContext) -> Mono.just(new KeyVaultRestoreResult())); + } + + /** + * Initiates a pre-restore check on the Key Vault. This operation checks if it is possible to restore an entire + * collection of keys from a backup. + * + * @param folderUrl The URL for the Blob Storage resource where the backup is located, including the path to + * the blob container where the backup resides. This would be the exact value that is returned as the result of a + * backup operation. An example of such a URL may look like the following: + * {@code https://contoso.blob.core.windows.net/backup/mhsm-contoso-2020090117323313}. + * @param sasToken Optional Shared Access Signature (SAS) token to authorize access to the blob. If {@code null}, + * Managed Identity will be used to authenticate instead. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return A {@link PollerFlux} polling on the {@link KeyVaultRestoreOperation backup operation} status. + * + * @throws KeyVaultAdministrationException If the given {@code folderUrl} or {@code sasToken} are invalid. + */ + Mono> preRestoreWithResponse(String folderUrl, String sasToken, + Context context) { + String[] segments = folderUrl.split("/"); + String folderName = segments[segments.length - 1]; + String containerUrl = folderUrl.substring(0, folderUrl.length() - folderName.length()); + + SASTokenParameter sasTokenParameter = new SASTokenParameter(containerUrl) + .setToken(sasToken) + .setUseManagedIdentity(sasToken == null); + + PreRestoreOperationParameters preRestoreOperationParameters = + new PreRestoreOperationParameters() + .setFolderToRestore(folderName) + .setSasTokenParameters(sasTokenParameter); + + try { + return clientImpl.preFullRestoreOperationWithResponseAsync(vaultUrl, preRestoreOperationParameters, context) + .doOnRequest(ignored -> LOGGER.verbose("Restoring from location - {}", folderUrl)) + .doOnSuccess(response -> LOGGER.verbose("Restored from location - {}", folderUrl)) + .doOnError(error -> + LOGGER.warning("Failed to restore from location - {}", folderUrl, error)) + .map(restoreOperationResponse -> + new SimpleResponse<>(restoreOperationResponse.getRequest(), + restoreOperationResponse.getStatusCode(), + restoreOperationResponse.getHeaders(), + (KeyVaultRestoreOperation) transformToLongRunningOperation( + restoreOperationResponse.getValue()))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); + } + } + + private Function, Mono> preRestoreActivationOperation(String folderUrl, String sasToken) { + return (pollingContext) -> { + try { + return withContext(context -> preRestoreWithResponse(folderUrl, sasToken, context)) + .flatMap(restoreResponse -> Mono.just(restoreResponse.getValue())); + } catch (RuntimeException e) { + return monoError(LOGGER, e); + } + }; + } + /** * Restores all versions of a given key using the supplied SAS token pointing to a previously stored Azure Blob * storage backup folder. @@ -564,8 +766,7 @@ static Mono> processRestoreOperationRespo * *
      * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-     * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-     *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+     * String sasToken = "<sas-token>";
      * String keyName = "myKey";
      *
      * client.beginSelectiveKeyRestore(folderUrl, sasToken, keyName)
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClient.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClient.java
index 3dafe20bf84a..52bb3f35d5a8 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClient.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClient.java
@@ -22,6 +22,10 @@
 import com.azure.security.keyvault.administration.implementation.models.FullBackupHeaders;
 import com.azure.security.keyvault.administration.implementation.models.FullBackupOperation;
 import com.azure.security.keyvault.administration.implementation.models.FullRestoreOperationHeaders;
+import com.azure.security.keyvault.administration.implementation.models.PreBackupOperationParameters;
+import com.azure.security.keyvault.administration.implementation.models.PreFullBackupHeaders;
+import com.azure.security.keyvault.administration.implementation.models.PreFullRestoreOperationHeaders;
+import com.azure.security.keyvault.administration.implementation.models.PreRestoreOperationParameters;
 import com.azure.security.keyvault.administration.implementation.models.RestoreOperation;
 import com.azure.security.keyvault.administration.implementation.models.RestoreOperationParameters;
 import com.azure.security.keyvault.administration.implementation.models.SASTokenParameter;
@@ -92,11 +96,9 @@
  * 
  * 
  * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
- * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
- *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+ * String sasToken = "<sas-token>";
  *
  * SyncPoller<KeyVaultBackupOperation, String> backupPoller = client.beginBackup(blobStorageUrl, sasToken);
- *
  * PollResponse<KeyVaultBackupOperation> pollResponse = backupPoller.poll();
  *
  * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
@@ -131,22 +133,20 @@
  * 
  * 
  * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
- * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
- *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+ * String sasToken = "<sas-token>";
  *
- * SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> backupPoller =
+ * SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> restorePoller =
  *     client.beginRestore(folderUrl, sasToken);
- *
- * PollResponse<KeyVaultRestoreOperation> pollResponse = backupPoller.poll();
+ * PollResponse<KeyVaultRestoreOperation> pollResponse = restorePoller.poll();
  *
  * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
  *
- * PollResponse<KeyVaultRestoreOperation> finalPollResponse = backupPoller.waitForCompletion();
+ * PollResponse<KeyVaultRestoreOperation> finalPollResponse = restorePoller.waitForCompletion();
  *
  * if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
  *     System.out.printf("Backup restored successfully.%n");
  * } else {
- *     KeyVaultRestoreOperation operation = backupPoller.poll().getValue();
+ *     KeyVaultRestoreOperation operation = restorePoller.poll().getValue();
  *
  *     System.out.printf("Restore failed with error: %s.%n", operation.getError().getMessage());
  * }
@@ -169,23 +169,21 @@
  * 
  * 
  * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
- * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
- *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+ * String sasToken = "<sas-token>";
  * String keyName = "myKey";
  *
- * SyncPoller<KeyVaultSelectiveKeyRestoreOperation, KeyVaultSelectiveKeyRestoreResult> backupPoller =
+ * SyncPoller<KeyVaultSelectiveKeyRestoreOperation, KeyVaultSelectiveKeyRestoreResult> restorePoller =
  *     client.beginSelectiveKeyRestore(folderUrl, sasToken, keyName);
- *
- * PollResponse<KeyVaultSelectiveKeyRestoreOperation> pollResponse = backupPoller.poll();
+ * PollResponse<KeyVaultSelectiveKeyRestoreOperation> pollResponse = restorePoller.poll();
  *
  * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
  *
- * PollResponse<KeyVaultSelectiveKeyRestoreOperation> finalPollResponse = backupPoller.waitForCompletion();
+ * PollResponse<KeyVaultSelectiveKeyRestoreOperation> finalPollResponse = restorePoller.waitForCompletion();
  *
  * if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
  *     System.out.printf("Key restored successfully.%n");
  * } else {
- *     KeyVaultSelectiveKeyRestoreOperation operation = backupPoller.poll().getValue();
+ *     KeyVaultSelectiveKeyRestoreOperation operation = restorePoller.poll().getValue();
  *
  *     System.out.printf("Key restore failed with error: %s.%n", operation.getError().getMessage());
  * }
@@ -271,11 +269,9 @@ public String getVaultUrl() {
      * 
      * 
      * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
-     * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-     *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+     * String sasToken = "<sas-token>";
      *
      * SyncPoller<KeyVaultBackupOperation, String> backupPoller = client.beginBackup(blobStorageUrl, sasToken);
-     *
      * PollResponse<KeyVaultBackupOperation> pollResponse = backupPoller.poll();
      *
      * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
@@ -414,6 +410,112 @@ private static PollResponse processBackupOperationRespo
             toLongRunningOperationStatus(operationStatus.toLowerCase(Locale.US)), response.getValue());
     }
 
+    /**
+     * Initiates a pre-backup check on the Key Vault. This operation checks if it is possible to back up the entire
+     * collection of keys from a key vault.
+     *
+     * 

Code Samples

+ *

Starts a {@link KeyVaultBackupOperation pre-backup operation}, polls for its status and waits for it to + * complete. Prints out the details of the operation's final result in case of success or prints out error details + * in case the operation fails.

+ * + *
+     * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
+     * String sasToken = "<sas-token>";
+     *
+     * SyncPoller<KeyVaultBackupOperation, String> preBackupPoller = client.beginPreBackup(blobStorageUrl, sasToken);
+     * PollResponse<KeyVaultBackupOperation> pollResponse = preBackupPoller.poll();
+     *
+     * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
+     *
+     * PollResponse<KeyVaultBackupOperation> finalPollResponse = preBackupPoller.waitForCompletion();
+     *
+     * if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+     *     System.out.printf("Pre-backup check completed successfully.%n");
+     * } else {
+     *     KeyVaultBackupOperation operation = preBackupPoller.poll().getValue();
+     *
+     *     System.out.printf("Pre-backup check failed with error: %s.%n", operation.getError().getMessage());
+     * }
+     * 
+ * + * + * @param blobStorageUrl The URL for the Blob Storage resource where the backup will be located. + * @param sasToken Optional Shared Access Signature (SAS) token to authorize access to the blob. If {@code null}, + * Managed Identity will be used to authenticate instead. + * + * @return A {@link SyncPoller} polling on the {@link KeyVaultBackupOperation pre-backup operation} status. + * + * @throws KeyVaultAdministrationException If the given {@code blobStorageUrl} or {@code sasToken} are invalid. + * @throws NullPointerException If the {@code blobStorageUrl} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginPreBackup(String blobStorageUrl, String sasToken) { + if (blobStorageUrl == null) { + throw LOGGER.logExceptionAsError( + new NullPointerException( + String.format(KeyVaultErrorCodeStrings.PARAMETER_REQUIRED, "'blobStorageUrl'"))); + } + + Context context = Context.NONE; + + return SyncPoller.createPoller( + getDefaultPollingInterval(), + cxt -> + new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + preBackupActivationOperation(blobStorageUrl, sasToken, context) + .apply(cxt)), + backupPollOperation(context), + (pollingContext, firstResponse) -> { + throw LOGGER.logExceptionAsError(new RuntimeException("Cancellation is not supported")); + }, + backupFetchOperation()); + } + + private Function, KeyVaultBackupOperation> preBackupActivationOperation( + String blobStorageUrl, String sasToken, Context context) { + + return (pollingContext) -> { + try { + return preBackupWithResponse(blobStorageUrl, sasToken, context).getValue(); + } catch (RuntimeException e) { + throw LOGGER.logExceptionAsError(e); + } + }; + } + + /** + * Initiates a pre-backup check on the Key Vault. This operation checks if it is possible to back up the entire + * collection of keys from a key vault. + * + * @param blobStorageUrl The URL for the Blob Storage resource where the backup will be located. + * @param sasToken Optional Shared Access Signature (SAS) token to authorize access to the blob. If {@code null}, + * Managed Identity will be used to authenticate instead. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return A {@link Response} containing the {@link KeyVaultBackupOperation pre-backup operation} status. + * + * @throws KeyVaultAdministrationException If the given {@code blobStorageUrl} or {@code sasToken} are invalid. + */ + Response preBackupWithResponse(String blobStorageUrl, String sasToken, Context context) { + PreBackupOperationParameters preBackupOperationParameters = new PreBackupOperationParameters() + .setStorageResourceUri(blobStorageUrl) + .setToken(sasToken) + .setUseManagedIdentity(sasToken == null); + context = enableSyncRestProxy(context); + + try { + ResponseBase backupOperationResponse = + clientImpl.preFullBackupWithResponse(vaultUrl, preBackupOperationParameters, context); + + return new SimpleResponse<>(backupOperationResponse.getRequest(), backupOperationResponse.getStatusCode(), + backupOperationResponse.getHeaders(), + (KeyVaultBackupOperation) transformToLongRunningOperation(backupOperationResponse.getValue())); + } catch (RuntimeException e) { + throw LOGGER.logExceptionAsError(e); + } + } + /** * Initiates a full restore of the Key Vault. * @@ -423,11 +525,9 @@ private static PollResponse processBackupOperationRespo * *
      * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
-     * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-     *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+     * String sasToken = "<sas-token>";
      *
      * SyncPoller<KeyVaultBackupOperation, String> backupPoller = client.beginBackup(blobStorageUrl, sasToken);
-     *
      * PollResponse<KeyVaultBackupOperation> pollResponse = backupPoller.poll();
      *
      * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
@@ -569,6 +669,121 @@ private static PollResponse processRestoreOperationRes
             toLongRunningOperationStatus(operationStatus.toLowerCase(Locale.US)), response.getValue());
     }
 
+    /**
+     * Initiates a pre-restore check on the Key Vault. This operation checks if it is possible to restore an entire
+     * collection of keys from a backup.
+     *
+     * 

Code Samples

+ *

Starts a {@link KeyVaultRestoreOperation pre-restore operation}, polls for its status and waits for it to + * complete. Prints out error details in case the operation fails.

+ * + *
+     * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
+     * String sasToken = "<sas-token>";
+     *
+     * SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> preRestorePoller =
+     *     client.beginPreRestore(folderUrl, sasToken);
+     * PollResponse<KeyVaultRestoreOperation> pollResponse = preRestorePoller.poll();
+     *
+     * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
+     *
+     * PollResponse<KeyVaultRestoreOperation> finalPollResponse = preRestorePoller.waitForCompletion();
+     *
+     * if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+     *     System.out.printf("Pre-restore check completed successfully.%n");
+     * } else {
+     *     KeyVaultRestoreOperation operation = preRestorePoller.poll().getValue();
+     *
+     *     System.out.printf("Pre-restore check failed with error: %s.%n", operation.getError().getMessage());
+     * }
+     * 
+ * + * + * @param folderUrl The URL for the Blob Storage resource where the backup is located, including the path to + * the blob container where the backup resides. This would be the exact value that is returned as the result of a + * backup operation. An example of such a URL may look like the following: + * {@code https://contoso.blob.core.windows.net/backup/mhsm-contoso-2020090117323313}. + * @param sasToken Optional Shared Access Signature (SAS) token to authorize access to the blob. If {@code null}, + * Managed Identity will be used to authenticate instead. + * + * @return A {@link SyncPoller} to poll on the {@link KeyVaultRestoreOperation restore operation} status. + * + * @throws KeyVaultAdministrationException If the given {@code folderUrl} or {@code sasToken} are invalid. + * @throws NullPointerException If the {@code folderUrl} is {@code null}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginPreRestore(String folderUrl, String sasToken) { + if (folderUrl == null) { + throw LOGGER.logExceptionAsError( + new NullPointerException(String.format(KeyVaultErrorCodeStrings.PARAMETER_REQUIRED, "'folderUrl'"))); + } + + Context context = Context.NONE; + + return SyncPoller.createPoller(getDefaultPollingInterval(), + cxt -> + new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + preRestoreActivationOperation(folderUrl, sasToken, context) + .apply(cxt)), + restorePollOperation(context), + (pollingContext, firstResponse) -> { + throw LOGGER.logExceptionAsError(new RuntimeException("Cancellation is not supported")); + }, + (pollingContext) -> new KeyVaultRestoreResult()); + } + + /** + * Initiates a pre-restore check on the Key Vault. This operation checks if it is possible to restore an entire + * collection of keys from a backup. + * + * @param folderUrl The URL for the Blob Storage resource where the backup is located, including the path to + * the blob container where the backup resides. This would be the exact value that is returned as the result of a + * backup operation. An example of such a URL may look like the following: + * {@code https://contoso.blob.core.windows.net/backup/mhsm-contoso-2020090117323313}. + * @param sasToken Optional Shared Access Signature (SAS) token to authorize access to the blob. If {@code null}, + * Managed Identity will be used to authenticate instead. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return A {@link Response} containing the {@link KeyVaultRestoreOperation backup operation} status. + * + * @throws KeyVaultAdministrationException If the given {@code folderUrl} or {@code sasToken} are invalid. + */ + Response preRestoreWithResponse(String folderUrl, String sasToken, Context context) { + String[] segments = folderUrl.split("/"); + String folderName = segments[segments.length - 1]; + String containerUrl = folderUrl.substring(0, folderUrl.length() - folderName.length()); + + SASTokenParameter sasTokenParameter = new SASTokenParameter(containerUrl) + .setToken(sasToken) + .setUseManagedIdentity(sasToken == null); + PreRestoreOperationParameters restoreOperationParameters = + new PreRestoreOperationParameters() + .setFolderToRestore(folderName) + .setSasTokenParameters(sasTokenParameter); + context = enableSyncRestProxy(context); + + try { + ResponseBase restoreOperationResponse = + clientImpl.preFullRestoreOperationWithResponse(vaultUrl, restoreOperationParameters, context); + return new SimpleResponse<>(restoreOperationResponse.getRequest(), + restoreOperationResponse.getStatusCode(), + restoreOperationResponse.getHeaders(), + (KeyVaultRestoreOperation) transformToLongRunningOperation(restoreOperationResponse.getValue())); + } catch (RuntimeException e) { + throw LOGGER.logExceptionAsError(e); + } + } + + private Function, KeyVaultRestoreOperation> preRestoreActivationOperation(String folderUrl, String sasToken, Context context) { + return (pollingContext) -> { + try { + return preRestoreWithResponse(folderUrl, sasToken, context).getValue(); + } catch (RuntimeException e) { + throw LOGGER.logExceptionAsError(e); + } + }; + } + /** * Restores all versions of a given key using the supplied SAS token pointing to a previously stored Azure Blob * storage backup folder. @@ -579,23 +794,21 @@ private static PollResponse processRestoreOperationRes * *
      * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-     * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-     *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+     * String sasToken = "<sas-token>";
      * String keyName = "myKey";
      *
-     * SyncPoller<KeyVaultSelectiveKeyRestoreOperation, KeyVaultSelectiveKeyRestoreResult> backupPoller =
+     * SyncPoller<KeyVaultSelectiveKeyRestoreOperation, KeyVaultSelectiveKeyRestoreResult> restorePoller =
      *     client.beginSelectiveKeyRestore(folderUrl, sasToken, keyName);
-     *
-     * PollResponse<KeyVaultSelectiveKeyRestoreOperation> pollResponse = backupPoller.poll();
+     * PollResponse<KeyVaultSelectiveKeyRestoreOperation> pollResponse = restorePoller.poll();
      *
      * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
      *
-     * PollResponse<KeyVaultSelectiveKeyRestoreOperation> finalPollResponse = backupPoller.waitForCompletion();
+     * PollResponse<KeyVaultSelectiveKeyRestoreOperation> finalPollResponse = restorePoller.waitForCompletion();
      *
      * if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
      *     System.out.printf("Key restored successfully.%n");
      * } else {
-     *     KeyVaultSelectiveKeyRestoreOperation operation = backupPoller.poll().getValue();
+     *     KeyVaultSelectiveKeyRestoreOperation operation = restorePoller.poll().getValue();
      *
      *     System.out.printf("Key restore failed with error: %s.%n", operation.getError().getMessage());
      * }
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/KeyVaultBackupClientImpl.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/KeyVaultBackupClientImpl.java
index 4cf02ee63d5f..88a7c6f61f0d 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/KeyVaultBackupClientImpl.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/KeyVaultBackupClientImpl.java
@@ -33,6 +33,10 @@
 import com.azure.security.keyvault.administration.implementation.models.FullBackupOperation;
 import com.azure.security.keyvault.administration.implementation.models.FullRestoreOperationHeaders;
 import com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException;
+import com.azure.security.keyvault.administration.implementation.models.PreBackupOperationParameters;
+import com.azure.security.keyvault.administration.implementation.models.PreFullBackupHeaders;
+import com.azure.security.keyvault.administration.implementation.models.PreFullRestoreOperationHeaders;
+import com.azure.security.keyvault.administration.implementation.models.PreRestoreOperationParameters;
 import com.azure.security.keyvault.administration.implementation.models.RestoreOperation;
 import com.azure.security.keyvault.administration.implementation.models.RestoreOperationParameters;
 import com.azure.security.keyvault.administration.implementation.models.SASTokenParameter;
@@ -57,7 +61,7 @@ public final class KeyVaultBackupClientImpl {
 
     /**
      * Gets Api Version.
-     * 
+     *
      * @return the apiVersion value.
      */
     public String getApiVersion() {
@@ -71,7 +75,7 @@ public String getApiVersion() {
 
     /**
      * Gets The HTTP pipeline to send requests through.
-     * 
+     *
      * @return the httpPipeline value.
      */
     public HttpPipeline getHttpPipeline() {
@@ -85,7 +89,7 @@ public HttpPipeline getHttpPipeline() {
 
     /**
      * Gets The serializer to serialize an object into a string.
-     * 
+     *
      * @return the serializerAdapter value.
      */
     public SerializerAdapter getSerializerAdapter() {
@@ -94,7 +98,7 @@ public SerializerAdapter getSerializerAdapter() {
 
     /**
      * Initializes an instance of KeyVaultBackupClient client.
-     * 
+     *
      * @param apiVersion Api Version.
      */
     public KeyVaultBackupClientImpl(String apiVersion) {
@@ -104,7 +108,7 @@ public KeyVaultBackupClientImpl(String apiVersion) {
 
     /**
      * Initializes an instance of KeyVaultBackupClient client.
-     * 
+     *
      * @param httpPipeline The HTTP pipeline to send requests through.
      * @param apiVersion Api Version.
      */
@@ -114,7 +118,7 @@ public KeyVaultBackupClientImpl(HttpPipeline httpPipeline, String apiVersion) {
 
     /**
      * Initializes an instance of KeyVaultBackupClient client.
-     * 
+     *
      * @param httpPipeline The HTTP pipeline to send requests through.
      * @param serializerAdapter The serializer to serialize an object into a string.
      * @param apiVersion Api Version.
@@ -150,6 +154,22 @@ ResponseBase fullBackupSync(
             @BodyParam("application/json") SASTokenParameter azureStorageBlobContainerUri,
             @HeaderParam("Accept") String accept, Context context);
 
+        @Post("/prebackup")
+        @ExpectedResponses({ 202 })
+        @UnexpectedResponseExceptionType(KeyVaultErrorException.class)
+        Mono> preFullBackup(
+            @HostParam("vaultBaseUrl") String vaultBaseUrl, @QueryParam("api-version") String apiVersion,
+            @BodyParam("application/json") PreBackupOperationParameters preBackupOperationParameters,
+            @HeaderParam("Accept") String accept, Context context);
+
+        @Post("/prebackup")
+        @ExpectedResponses({ 202 })
+        @UnexpectedResponseExceptionType(KeyVaultErrorException.class)
+        ResponseBase preFullBackupSync(
+            @HostParam("vaultBaseUrl") String vaultBaseUrl, @QueryParam("api-version") String apiVersion,
+            @BodyParam("application/json") PreBackupOperationParameters preBackupOperationParameters,
+            @HeaderParam("Accept") String accept, Context context);
+
         @Get("/backup/{jobId}/pending")
         @ExpectedResponses({ 200 })
         @UnexpectedResponseExceptionType(KeyVaultErrorException.class)
@@ -164,6 +184,22 @@ Response fullBackupStatusSync(@HostParam("vaultBaseUrl") St
             @PathParam("jobId") String jobId, @QueryParam("api-version") String apiVersion,
             @HeaderParam("Accept") String accept, Context context);
 
+        @Put("/prerestore")
+        @ExpectedResponses({ 202 })
+        @UnexpectedResponseExceptionType(KeyVaultErrorException.class)
+        Mono> preFullRestoreOperation(
+            @HostParam("vaultBaseUrl") String vaultBaseUrl, @QueryParam("api-version") String apiVersion,
+            @BodyParam("application/json") PreRestoreOperationParameters preRestoreOperationParameters,
+            @HeaderParam("Accept") String accept, Context context);
+
+        @Put("/prerestore")
+        @ExpectedResponses({ 202 })
+        @UnexpectedResponseExceptionType(KeyVaultErrorException.class)
+        ResponseBase preFullRestoreOperationSync(
+            @HostParam("vaultBaseUrl") String vaultBaseUrl, @QueryParam("api-version") String apiVersion,
+            @BodyParam("application/json") PreRestoreOperationParameters preRestoreOperationParameters,
+            @HeaderParam("Accept") String accept, Context context);
+
         @Put("/restore")
         @ExpectedResponses({ 202 })
         @UnexpectedResponseExceptionType(KeyVaultErrorException.class)
@@ -215,7 +251,7 @@ Response restoreStatusSync(@HostParam("vaultBaseUrl") String v
 
     /**
      * Creates a full backup using a user-provided SAS token to an Azure blob storage container.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param azureStorageBlobContainerUri Azure blob shared access signature token pointing to a valid Azure blob
      * container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the
@@ -235,7 +271,7 @@ public Mono> fullBackupWith
 
     /**
      * Creates a full backup using a user-provided SAS token to an Azure blob storage container.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param azureStorageBlobContainerUri Azure blob shared access signature token pointing to a valid Azure blob
      * container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the
@@ -255,7 +291,7 @@ public Mono> fullBackupWith
 
     /**
      * Creates a full backup using a user-provided SAS token to an Azure blob storage container.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param azureStorageBlobContainerUri Azure blob shared access signature token pointing to a valid Azure blob
      * container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the
@@ -274,7 +310,7 @@ public Mono fullBackupAsync(String vaultBaseUrl,
 
     /**
      * Creates a full backup using a user-provided SAS token to an Azure blob storage container.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param azureStorageBlobContainerUri Azure blob shared access signature token pointing to a valid Azure blob
      * container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the
@@ -294,7 +330,7 @@ public Mono fullBackupAsync(String vaultBaseUrl,
 
     /**
      * Creates a full backup using a user-provided SAS token to an Azure blob storage container.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param azureStorageBlobContainerUri Azure blob shared access signature token pointing to a valid Azure blob
      * container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the
@@ -315,7 +351,7 @@ public ResponseBase fullBackupWithRespon
 
     /**
      * Creates a full backup using a user-provided SAS token to an Azure blob storage container.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param azureStorageBlobContainerUri Azure blob shared access signature token pointing to a valid Azure blob
      * container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the
@@ -330,9 +366,115 @@ public FullBackupOperation fullBackup(String vaultBaseUrl, SASTokenParameter azu
         return fullBackupWithResponse(vaultBaseUrl, azureStorageBlobContainerUri, Context.NONE).getValue();
     }
 
+    /**
+     * Pre-backup operation for checking whether the customer can perform a full backup operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preBackupOperationParameters Optional parameters to validate prior to performing a full backup operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return full backup operation along with {@link ResponseBase} on successful completion of {@link Mono}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono>
+        preFullBackupWithResponseAsync(String vaultBaseUrl, PreBackupOperationParameters preBackupOperationParameters) {
+        final String accept = "application/json";
+        return FluxUtil.withContext(context -> service.preFullBackup(vaultBaseUrl, this.getApiVersion(),
+            preBackupOperationParameters, accept, context));
+    }
+
+    /**
+     * Pre-backup operation for checking whether the customer can perform a full backup operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preBackupOperationParameters Optional parameters to validate prior to performing a full backup operation.
+     * @param context The context to associate with this operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return full backup operation along with {@link ResponseBase} on successful completion of {@link Mono}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono> preFullBackupWithResponseAsync(
+        String vaultBaseUrl, PreBackupOperationParameters preBackupOperationParameters, Context context) {
+        final String accept = "application/json";
+        return service.preFullBackup(vaultBaseUrl, this.getApiVersion(), preBackupOperationParameters, accept, context);
+    }
+
+    /**
+     * Pre-backup operation for checking whether the customer can perform a full backup operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preBackupOperationParameters Optional parameters to validate prior to performing a full backup operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return full backup operation on successful completion of {@link Mono}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono preFullBackupAsync(String vaultBaseUrl,
+        PreBackupOperationParameters preBackupOperationParameters) {
+        return preFullBackupWithResponseAsync(vaultBaseUrl, preBackupOperationParameters)
+            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+    }
+
+    /**
+     * Pre-backup operation for checking whether the customer can perform a full backup operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preBackupOperationParameters Optional parameters to validate prior to performing a full backup operation.
+     * @param context The context to associate with this operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return full backup operation on successful completion of {@link Mono}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono preFullBackupAsync(String vaultBaseUrl,
+        PreBackupOperationParameters preBackupOperationParameters, Context context) {
+        return preFullBackupWithResponseAsync(vaultBaseUrl, preBackupOperationParameters, context)
+            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+    }
+
+    /**
+     * Pre-backup operation for checking whether the customer can perform a full backup operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preBackupOperationParameters Optional parameters to validate prior to performing a full backup operation.
+     * @param context The context to associate with this operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return full backup operation along with {@link ResponseBase}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public ResponseBase preFullBackupWithResponse(String vaultBaseUrl,
+        PreBackupOperationParameters preBackupOperationParameters, Context context) {
+        final String accept = "application/json";
+        return service.preFullBackupSync(vaultBaseUrl, this.getApiVersion(), preBackupOperationParameters, accept,
+            context);
+    }
+
+    /**
+     * Pre-backup operation for checking whether the customer can perform a full backup operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preBackupOperationParameters Optional parameters to validate prior to performing a full backup operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return full backup operation.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public FullBackupOperation preFullBackup(String vaultBaseUrl,
+        PreBackupOperationParameters preBackupOperationParameters) {
+        return preFullBackupWithResponse(vaultBaseUrl, preBackupOperationParameters, Context.NONE).getValue();
+    }
+
     /**
      * Returns the status of full backup operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The id returned as part of the backup request.
      * @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -349,7 +491,7 @@ public Mono> fullBackupStatusWithResponseAsync(Str
 
     /**
      * Returns the status of full backup operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The id returned as part of the backup request.
      * @param context The context to associate with this operation.
@@ -367,7 +509,7 @@ public Mono> fullBackupStatusWithResponseAsync(Str
 
     /**
      * Returns the status of full backup operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The id returned as part of the backup request.
      * @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -382,7 +524,7 @@ public Mono fullBackupStatusAsync(String vaultBaseUrl, Stri
 
     /**
      * Returns the status of full backup operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The id returned as part of the backup request.
      * @param context The context to associate with this operation.
@@ -399,7 +541,7 @@ public Mono fullBackupStatusAsync(String vaultBaseUrl, Stri
 
     /**
      * Returns the status of full backup operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The id returned as part of the backup request.
      * @param context The context to associate with this operation.
@@ -417,7 +559,7 @@ public Response fullBackupStatusWithResponse(String vaultBa
 
     /**
      * Returns the status of full backup operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The id returned as part of the backup request.
      * @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -430,9 +572,125 @@ public FullBackupOperation fullBackupStatus(String vaultBaseUrl, String jobId) {
         return fullBackupStatusWithResponse(vaultBaseUrl, jobId, Context.NONE).getValue();
     }
 
+    /**
+     * Pre-restore operation for checking whether the customer can perform a full restore operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preRestoreOperationParameters Optional pre restore parameters to validate prior to performing a full
+     * restore operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return restore operation along with {@link ResponseBase} on successful completion of {@link Mono}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono>
+        preFullRestoreOperationWithResponseAsync(String vaultBaseUrl,
+            PreRestoreOperationParameters preRestoreOperationParameters) {
+        final String accept = "application/json";
+        return FluxUtil.withContext(context -> service.preFullRestoreOperation(vaultBaseUrl, this.getApiVersion(),
+            preRestoreOperationParameters, accept, context));
+    }
+
+    /**
+     * Pre-restore operation for checking whether the customer can perform a full restore operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preRestoreOperationParameters Optional pre restore parameters to validate prior to performing a full
+     * restore operation.
+     * @param context The context to associate with this operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return restore operation along with {@link ResponseBase} on successful completion of {@link Mono}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono>
+        preFullRestoreOperationWithResponseAsync(String vaultBaseUrl,
+            PreRestoreOperationParameters preRestoreOperationParameters, Context context) {
+        final String accept = "application/json";
+        return service.preFullRestoreOperation(vaultBaseUrl, this.getApiVersion(), preRestoreOperationParameters,
+            accept, context);
+    }
+
+    /**
+     * Pre-restore operation for checking whether the customer can perform a full restore operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preRestoreOperationParameters Optional pre restore parameters to validate prior to performing a full
+     * restore operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return restore operation on successful completion of {@link Mono}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono preFullRestoreOperationAsync(String vaultBaseUrl,
+        PreRestoreOperationParameters preRestoreOperationParameters) {
+        return preFullRestoreOperationWithResponseAsync(vaultBaseUrl, preRestoreOperationParameters)
+            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+    }
+
+    /**
+     * Pre-restore operation for checking whether the customer can perform a full restore operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preRestoreOperationParameters Optional pre restore parameters to validate prior to performing a full
+     * restore operation.
+     * @param context The context to associate with this operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return restore operation on successful completion of {@link Mono}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono preFullRestoreOperationAsync(String vaultBaseUrl,
+        PreRestoreOperationParameters preRestoreOperationParameters, Context context) {
+        return preFullRestoreOperationWithResponseAsync(vaultBaseUrl, preRestoreOperationParameters, context)
+            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+    }
+
+    /**
+     * Pre-restore operation for checking whether the customer can perform a full restore operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preRestoreOperationParameters Optional pre restore parameters to validate prior to performing a full
+     * restore operation.
+     * @param context The context to associate with this operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return restore operation along with {@link ResponseBase}.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public ResponseBase preFullRestoreOperationWithResponse(
+        String vaultBaseUrl, PreRestoreOperationParameters preRestoreOperationParameters, Context context) {
+        final String accept = "application/json";
+        return service.preFullRestoreOperationSync(vaultBaseUrl, this.getApiVersion(), preRestoreOperationParameters,
+            accept, context);
+    }
+
+    /**
+     * Pre-restore operation for checking whether the customer can perform a full restore operation.
+     *
+     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
+     * @param preRestoreOperationParameters Optional pre restore parameters to validate prior to performing a full
+     * restore operation.
+     * @throws IllegalArgumentException thrown if parameters fail the validation.
+     * @throws KeyVaultErrorException thrown if the request is rejected by server.
+     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+     * @return restore operation.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public RestoreOperation preFullRestoreOperation(String vaultBaseUrl,
+        PreRestoreOperationParameters preRestoreOperationParameters) {
+        return preFullRestoreOperationWithResponse(vaultBaseUrl, preRestoreOperationParameters, Context.NONE)
+            .getValue();
+    }
+
     /**
      * Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
      * was stored.
@@ -451,7 +709,7 @@ public FullBackupOperation fullBackupStatus(String vaultBaseUrl, String jobId) {
 
     /**
      * Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
      * was stored.
@@ -470,7 +728,7 @@ public Mono> fullRes
 
     /**
      * Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
      * was stored.
@@ -488,7 +746,7 @@ public Mono fullRestoreOperationAsync(String vaultBaseUrl,
 
     /**
      * Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
      * was stored.
@@ -507,7 +765,7 @@ public Mono fullRestoreOperationAsync(String vaultBaseUrl,
 
     /**
      * Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
      * was stored.
@@ -527,7 +785,7 @@ public ResponseBase fullRestoreOp
 
     /**
      * Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
      * was stored.
@@ -543,7 +801,7 @@ public RestoreOperation fullRestoreOperation(String vaultBaseUrl, RestoreOperati
 
     /**
      * Returns the status of restore operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The Job Id returned part of the restore operation.
      * @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -560,7 +818,7 @@ public Mono> restoreStatusWithResponseAsync(String va
 
     /**
      * Returns the status of restore operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The Job Id returned part of the restore operation.
      * @param context The context to associate with this operation.
@@ -578,7 +836,7 @@ public Mono> restoreStatusWithResponseAsync(String va
 
     /**
      * Returns the status of restore operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The Job Id returned part of the restore operation.
      * @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -593,7 +851,7 @@ public Mono restoreStatusAsync(String vaultBaseUrl, String job
 
     /**
      * Returns the status of restore operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The Job Id returned part of the restore operation.
      * @param context The context to associate with this operation.
@@ -610,7 +868,7 @@ public Mono restoreStatusAsync(String vaultBaseUrl, String job
 
     /**
      * Returns the status of restore operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The Job Id returned part of the restore operation.
      * @param context The context to associate with this operation.
@@ -627,7 +885,7 @@ public Response restoreStatusWithResponse(String vaultBaseUrl,
 
     /**
      * Returns the status of restore operation.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param jobId The Job Id returned part of the restore operation.
      * @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -643,7 +901,7 @@ public RestoreOperation restoreStatus(String vaultBaseUrl, String jobId) {
     /**
      * Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob
      * storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param keyName The name of the key to be restored from the user supplied backup.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
@@ -665,7 +923,7 @@ public RestoreOperation restoreStatus(String vaultBaseUrl, String jobId) {
     /**
      * Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob
      * storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param keyName The name of the key to be restored from the user supplied backup.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
@@ -688,7 +946,7 @@ public RestoreOperation restoreStatus(String vaultBaseUrl, String jobId) {
     /**
      * Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob
      * storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param keyName The name of the key to be restored from the user supplied backup.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
@@ -708,7 +966,7 @@ public Mono selectiveKeyRestoreOperationAsync(Stri
     /**
      * Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob
      * storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param keyName The name of the key to be restored from the user supplied backup.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
@@ -729,7 +987,7 @@ public Mono selectiveKeyRestoreOperationAsync(Stri
     /**
      * Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob
      * storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param keyName The name of the key to be restored from the user supplied backup.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
@@ -752,7 +1010,7 @@ public Mono selectiveKeyRestoreOperationAsync(Stri
     /**
      * Restores all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob
      * storage backup folder.
-     * 
+     *
      * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
      * @param keyName The name of the key to be restored from the user supplied backup.
      * @param restoreBlobDetails The Azure blob SAS token pointing to a folder where the previous successful full backup
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreBackupOperationParameters.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreBackupOperationParameters.java
new file mode 100644
index 000000000000..c8a6be3a6278
--- /dev/null
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreBackupOperationParameters.java
@@ -0,0 +1,144 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.security.keyvault.administration.implementation.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonSerializable;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
+
+/**
+ * The PreBackupOperationParameters model.
+ */
+@Fluent
+public final class PreBackupOperationParameters implements JsonSerializable {
+    /*
+     * Azure Blob storage container Uri
+     */
+    private String storageResourceUri;
+
+    /*
+     * The SAS token pointing to an Azure Blob storage container
+     */
+    private String token;
+
+    /*
+     * Indicates which authentication method should be used. If set to true, Managed HSM will use the configured
+     * user-assigned managed identity to authenticate with Azure Storage. Otherwise, a SAS token has to be specified.
+     */
+    private Boolean useManagedIdentity;
+
+    /**
+     * Creates an instance of PreBackupOperationParameters class.
+     */
+    public PreBackupOperationParameters() {
+    }
+
+    /**
+     * Get the storageResourceUri property: Azure Blob storage container Uri.
+     *
+     * @return the storageResourceUri value.
+     */
+    public String getStorageResourceUri() {
+        return this.storageResourceUri;
+    }
+
+    /**
+     * Set the storageResourceUri property: Azure Blob storage container Uri.
+     *
+     * @param storageResourceUri the storageResourceUri value to set.
+     * @return the PreBackupOperationParameters object itself.
+     */
+    public PreBackupOperationParameters setStorageResourceUri(String storageResourceUri) {
+        this.storageResourceUri = storageResourceUri;
+        return this;
+    }
+
+    /**
+     * Get the token property: The SAS token pointing to an Azure Blob storage container.
+     *
+     * @return the token value.
+     */
+    public String getToken() {
+        return this.token;
+    }
+
+    /**
+     * Set the token property: The SAS token pointing to an Azure Blob storage container.
+     *
+     * @param token the token value to set.
+     * @return the PreBackupOperationParameters object itself.
+     */
+    public PreBackupOperationParameters setToken(String token) {
+        this.token = token;
+        return this;
+    }
+
+    /**
+     * Get the useManagedIdentity property: Indicates which authentication method should be used. If set to true,
+     * Managed HSM will use the configured user-assigned managed identity to authenticate with Azure Storage.
+     * Otherwise, a SAS token has to be specified.
+     *
+     * @return the useManagedIdentity value.
+     */
+    public Boolean isUseManagedIdentity() {
+        return this.useManagedIdentity;
+    }
+
+    /**
+     * Set the useManagedIdentity property: Indicates which authentication method should be used. If set to true,
+     * Managed HSM will use the configured user-assigned managed identity to authenticate with Azure Storage.
+     * Otherwise, a SAS token has to be specified.
+     *
+     * @param useManagedIdentity the useManagedIdentity value to set.
+     * @return the PreBackupOperationParameters object itself.
+     */
+    public PreBackupOperationParameters setUseManagedIdentity(Boolean useManagedIdentity) {
+        this.useManagedIdentity = useManagedIdentity;
+        return this;
+    }
+
+    @Override
+    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+        jsonWriter.writeStartObject();
+        jsonWriter.writeStringField("storageResourceUri", this.storageResourceUri);
+        jsonWriter.writeStringField("token", this.token);
+        jsonWriter.writeBooleanField("useManagedIdentity", this.useManagedIdentity);
+        return jsonWriter.writeEndObject();
+    }
+
+    /**
+     * Reads an instance of PreBackupOperationParameters from the JsonReader.
+     *
+     * @param jsonReader The JsonReader being read.
+     * @return An instance of PreBackupOperationParameters if the JsonReader was pointing to an instance of it, or null
+     * if it was pointing to JSON null.
+     * @throws IOException If an error occurs while reading the PreBackupOperationParameters.
+     */
+    public static PreBackupOperationParameters fromJson(JsonReader jsonReader) throws IOException {
+        return jsonReader.readObject(reader -> {
+            PreBackupOperationParameters deserializedPreBackupOperationParameters = new PreBackupOperationParameters();
+            while (reader.nextToken() != JsonToken.END_OBJECT) {
+                String fieldName = reader.getFieldName();
+                reader.nextToken();
+
+                if ("storageResourceUri".equals(fieldName)) {
+                    deserializedPreBackupOperationParameters.storageResourceUri = reader.getString();
+                } else if ("token".equals(fieldName)) {
+                    deserializedPreBackupOperationParameters.token = reader.getString();
+                } else if ("useManagedIdentity".equals(fieldName)) {
+                    deserializedPreBackupOperationParameters.useManagedIdentity
+                        = reader.getNullable(JsonReader::getBoolean);
+                } else {
+                    reader.skipChildren();
+                }
+            }
+
+            return deserializedPreBackupOperationParameters;
+        });
+    }
+}
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreFullBackupHeaders.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreFullBackupHeaders.java
new file mode 100644
index 000000000000..9a2f0a0902ba
--- /dev/null
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreFullBackupHeaders.java
@@ -0,0 +1,81 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.security.keyvault.administration.implementation.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.core.http.HttpHeaderName;
+import com.azure.core.http.HttpHeaders;
+
+/**
+ * The PreFullBackupHeaders model.
+ */
+@Fluent
+public final class PreFullBackupHeaders {
+    /*
+     * The Retry-After property.
+     */
+    private Long retryAfter;
+
+    /*
+     * The Azure-AsyncOperation property.
+     */
+    private String azureAsyncOperation;
+
+    private static final HttpHeaderName AZURE_ASYNC_OPERATION = HttpHeaderName.fromString("Azure-AsyncOperation");
+
+    // HttpHeaders containing the raw property values.
+    /**
+     * Creates an instance of PreFullBackupHeaders class.
+     *
+     * @param rawHeaders The raw HttpHeaders that will be used to create the property values.
+     */
+    public PreFullBackupHeaders(HttpHeaders rawHeaders) {
+        String retryAfter = rawHeaders.getValue(HttpHeaderName.RETRY_AFTER);
+        if (retryAfter != null) {
+            this.retryAfter = Long.parseLong(retryAfter);
+        }
+        this.azureAsyncOperation = rawHeaders.getValue(AZURE_ASYNC_OPERATION);
+    }
+
+    /**
+     * Get the retryAfter property: The Retry-After property.
+     *
+     * @return the retryAfter value.
+     */
+    public Long getRetryAfter() {
+        return this.retryAfter;
+    }
+
+    /**
+     * Set the retryAfter property: The Retry-After property.
+     *
+     * @param retryAfter the retryAfter value to set.
+     * @return the PreFullBackupHeaders object itself.
+     */
+    public PreFullBackupHeaders setRetryAfter(Long retryAfter) {
+        this.retryAfter = retryAfter;
+        return this;
+    }
+
+    /**
+     * Get the azureAsyncOperation property: The Azure-AsyncOperation property.
+     *
+     * @return the azureAsyncOperation value.
+     */
+    public String getAzureAsyncOperation() {
+        return this.azureAsyncOperation;
+    }
+
+    /**
+     * Set the azureAsyncOperation property: The Azure-AsyncOperation property.
+     *
+     * @param azureAsyncOperation the azureAsyncOperation value to set.
+     * @return the PreFullBackupHeaders object itself.
+     */
+    public PreFullBackupHeaders setAzureAsyncOperation(String azureAsyncOperation) {
+        this.azureAsyncOperation = azureAsyncOperation;
+        return this;
+    }
+}
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreFullRestoreOperationHeaders.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreFullRestoreOperationHeaders.java
new file mode 100644
index 000000000000..4a44da9e1280
--- /dev/null
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreFullRestoreOperationHeaders.java
@@ -0,0 +1,81 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.security.keyvault.administration.implementation.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.core.http.HttpHeaderName;
+import com.azure.core.http.HttpHeaders;
+
+/**
+ * The PreFullRestoreOperationHeaders model.
+ */
+@Fluent
+public final class PreFullRestoreOperationHeaders {
+    /*
+     * The Retry-After property.
+     */
+    private Long retryAfter;
+
+    /*
+     * The Azure-AsyncOperation property.
+     */
+    private String azureAsyncOperation;
+
+    private static final HttpHeaderName AZURE_ASYNC_OPERATION = HttpHeaderName.fromString("Azure-AsyncOperation");
+
+    // HttpHeaders containing the raw property values.
+    /**
+     * Creates an instance of PreFullRestoreOperationHeaders class.
+     *
+     * @param rawHeaders The raw HttpHeaders that will be used to create the property values.
+     */
+    public PreFullRestoreOperationHeaders(HttpHeaders rawHeaders) {
+        String retryAfter = rawHeaders.getValue(HttpHeaderName.RETRY_AFTER);
+        if (retryAfter != null) {
+            this.retryAfter = Long.parseLong(retryAfter);
+        }
+        this.azureAsyncOperation = rawHeaders.getValue(AZURE_ASYNC_OPERATION);
+    }
+
+    /**
+     * Get the retryAfter property: The Retry-After property.
+     *
+     * @return the retryAfter value.
+     */
+    public Long getRetryAfter() {
+        return this.retryAfter;
+    }
+
+    /**
+     * Set the retryAfter property: The Retry-After property.
+     *
+     * @param retryAfter the retryAfter value to set.
+     * @return the PreFullRestoreOperationHeaders object itself.
+     */
+    public PreFullRestoreOperationHeaders setRetryAfter(Long retryAfter) {
+        this.retryAfter = retryAfter;
+        return this;
+    }
+
+    /**
+     * Get the azureAsyncOperation property: The Azure-AsyncOperation property.
+     *
+     * @return the azureAsyncOperation value.
+     */
+    public String getAzureAsyncOperation() {
+        return this.azureAsyncOperation;
+    }
+
+    /**
+     * Set the azureAsyncOperation property: The Azure-AsyncOperation property.
+     *
+     * @param azureAsyncOperation the azureAsyncOperation value to set.
+     * @return the PreFullRestoreOperationHeaders object itself.
+     */
+    public PreFullRestoreOperationHeaders setAzureAsyncOperation(String azureAsyncOperation) {
+        this.azureAsyncOperation = azureAsyncOperation;
+        return this;
+    }
+}
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreRestoreOperationParameters.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreRestoreOperationParameters.java
new file mode 100644
index 000000000000..a720ab06700d
--- /dev/null
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/implementation/models/PreRestoreOperationParameters.java
@@ -0,0 +1,113 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.security.keyvault.administration.implementation.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonSerializable;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
+
+/**
+ * The PreRestoreOperationParameters model.
+ */
+@Fluent
+public final class PreRestoreOperationParameters implements JsonSerializable {
+    /*
+     * The sasTokenParameters property.
+     */
+    private SASTokenParameter sasTokenParameters;
+
+    /*
+     * The Folder name of the blob where the previous successful full backup was stored
+     */
+    private String folderToRestore;
+
+    /**
+     * Creates an instance of PreRestoreOperationParameters class.
+     */
+    public PreRestoreOperationParameters() {
+    }
+
+    /**
+     * Get the sasTokenParameters property: The sasTokenParameters property.
+     *
+     * @return the sasTokenParameters value.
+     */
+    public SASTokenParameter getSasTokenParameters() {
+        return this.sasTokenParameters;
+    }
+
+    /**
+     * Set the sasTokenParameters property: The sasTokenParameters property.
+     *
+     * @param sasTokenParameters the sasTokenParameters value to set.
+     * @return the PreRestoreOperationParameters object itself.
+     */
+    public PreRestoreOperationParameters setSasTokenParameters(SASTokenParameter sasTokenParameters) {
+        this.sasTokenParameters = sasTokenParameters;
+        return this;
+    }
+
+    /**
+     * Get the folderToRestore property: The Folder name of the blob where the previous successful full backup was
+     * stored.
+     *
+     * @return the folderToRestore value.
+     */
+    public String getFolderToRestore() {
+        return this.folderToRestore;
+    }
+
+    /**
+     * Set the folderToRestore property: The Folder name of the blob where the previous successful full backup was
+     * stored.
+     *
+     * @param folderToRestore the folderToRestore value to set.
+     * @return the PreRestoreOperationParameters object itself.
+     */
+    public PreRestoreOperationParameters setFolderToRestore(String folderToRestore) {
+        this.folderToRestore = folderToRestore;
+        return this;
+    }
+
+    @Override
+    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+        jsonWriter.writeStartObject();
+        jsonWriter.writeJsonField("sasTokenParameters", this.sasTokenParameters);
+        jsonWriter.writeStringField("folderToRestore", this.folderToRestore);
+        return jsonWriter.writeEndObject();
+    }
+
+    /**
+     * Reads an instance of PreRestoreOperationParameters from the JsonReader.
+     *
+     * @param jsonReader The JsonReader being read.
+     * @return An instance of PreRestoreOperationParameters if the JsonReader was pointing to an instance of it, or null
+     * if it was pointing to JSON null.
+     * @throws IOException If an error occurs while reading the PreRestoreOperationParameters.
+     */
+    public static PreRestoreOperationParameters fromJson(JsonReader jsonReader) throws IOException {
+        return jsonReader.readObject(reader -> {
+            PreRestoreOperationParameters deserializedPreRestoreOperationParameters
+                = new PreRestoreOperationParameters();
+            while (reader.nextToken() != JsonToken.END_OBJECT) {
+                String fieldName = reader.getFieldName();
+                reader.nextToken();
+
+                if ("sasTokenParameters".equals(fieldName)) {
+                    deserializedPreRestoreOperationParameters.sasTokenParameters = SASTokenParameter.fromJson(reader);
+                } else if ("folderToRestore".equals(fieldName)) {
+                    deserializedPreRestoreOperationParameters.folderToRestore = reader.getString();
+                } else {
+                    reader.skipChildren();
+                }
+            }
+
+            return deserializedPreRestoreOperationParameters;
+        });
+    }
+}
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/package-info.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/package-info.java
index 1132a91286a5..b753f047dcb9 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/package-info.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/package-info.java
@@ -312,6 +312,45 @@
  * com.azure.security.keyvault.administration.KeyVaultAccessControlAsyncClient}. 
*
* + *

Run Pre-Backup Check for a Collection of Keys

+ * + * The {@link com.azure.security.keyvault.administration.KeyVaultBackupClient} can be used to check if it is possible to + * back up the entire collection of keys from a key vault. + * + *

+ * Code Sample: + * + *

+ * The following code sample demonstrates how to synchronously check if it is possible to back up an entire collection + * of keys, using the + * {@link com.azure.security.keyvault.administration.KeyVaultBackupClient#beginPreBackup(String, String)} API. + * + *

+ * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
+ * String sasToken = "<sas-token>";
+ *
+ * SyncPoller<KeyVaultBackupOperation, String> preBackupPoller = client.beginPreBackup(blobStorageUrl, sasToken);
+ * PollResponse<KeyVaultBackupOperation> pollResponse = preBackupPoller.poll();
+ *
+ * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
+ *
+ * PollResponse<KeyVaultBackupOperation> finalPollResponse = preBackupPoller.waitForCompletion();
+ *
+ * if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+ *     System.out.printf("Pre-backup check completed successfully.%n");
+ * } else {
+ *     KeyVaultBackupOperation operation = preBackupPoller.poll().getValue();
+ *
+ *     System.out.printf("Pre-backup check failed with error: %s.%n", operation.getError().getMessage());
+ * }
+ * 
+ * + * + *

+ * Note: For the asynchronous sample, refer to {@link + * com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient}.
+ *


+ * *

Back Up a Collection of Keys

* * The {@link com.azure.security.keyvault.administration.KeyVaultBackupClient} can be used to back up the entire @@ -326,11 +365,9 @@ * *
  * String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
- * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
- *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+ * String sasToken = "<sas-token>";
  *
  * SyncPoller<KeyVaultBackupOperation, String> backupPoller = client.beginBackup(blobStorageUrl, sasToken);
- *
  * PollResponse<KeyVaultBackupOperation> pollResponse = backupPoller.poll();
  *
  * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
@@ -354,6 +391,46 @@
  * com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient}. 
*
* + *

Run Pre-Restore Check for a Collection of Keys

+ * + * The {@link com.azure.security.keyvault.administration.KeyVaultBackupClient} can be used to check if it is possible to + * restore an entire collection of keys from a backup. + * + *

+ * Code Sample: + * + *

+ * The following code sample demonstrates how to synchronously check if it is possible to restore an entire collection + * of keys from a backup, using the + * {@link com.azure.security.keyvault.administration.KeyVaultBackupClient#beginPreRestore(String, String)} API. + * + *

+ * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
+ * String sasToken = "<sas-token>";
+ *
+ * SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> preRestorePoller =
+ *     client.beginPreRestore(folderUrl, sasToken);
+ * PollResponse<KeyVaultRestoreOperation> pollResponse = preRestorePoller.poll();
+ *
+ * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
+ *
+ * PollResponse<KeyVaultRestoreOperation> finalPollResponse = preRestorePoller.waitForCompletion();
+ *
+ * if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+ *     System.out.printf("Pre-restore check completed successfully.%n");
+ * } else {
+ *     KeyVaultRestoreOperation operation = preRestorePoller.poll().getValue();
+ *
+ *     System.out.printf("Pre-restore check failed with error: %s.%n", operation.getError().getMessage());
+ * }
+ * 
+ * + * + *

+ * Note: For the asynchronous sample, refer to {@link + * com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient}.
+ *


+ * *

Restore a Collection of Keys

* * The {@link com.azure.security.keyvault.administration.KeyVaultBackupClient} can be used to restore an entire @@ -368,22 +445,20 @@ * *
  * String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
- * String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
- *     + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+ * String sasToken = "<sas-token>";
  *
- * SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> backupPoller =
+ * SyncPoller<KeyVaultRestoreOperation, KeyVaultRestoreResult> restorePoller =
  *     client.beginRestore(folderUrl, sasToken);
- *
- * PollResponse<KeyVaultRestoreOperation> pollResponse = backupPoller.poll();
+ * PollResponse<KeyVaultRestoreOperation> pollResponse = restorePoller.poll();
  *
  * System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
  *
- * PollResponse<KeyVaultRestoreOperation> finalPollResponse = backupPoller.waitForCompletion();
+ * PollResponse<KeyVaultRestoreOperation> finalPollResponse = restorePoller.waitForCompletion();
  *
  * if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
  *     System.out.printf("Backup restored successfully.%n");
  * } else {
- *     KeyVaultRestoreOperation operation = backupPoller.poll().getValue();
+ *     KeyVaultRestoreOperation operation = restorePoller.poll().getValue();
  *
  *     System.out.printf("Restore failed with error: %s.%n", operation.getError().getMessage());
  * }
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/ReadmeSamples.java b/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/ReadmeSamples.java
index 7fa3c2c0dad7..f7d0108edc7a 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/ReadmeSamples.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/ReadmeSamples.java
@@ -293,17 +293,44 @@ public void createBackupClient() {
         // END: readme-sample-createBackupClient
     }
 
+    /**
+     * Code sample for starting a {@link KeyVaultBackupOperation pre-backup check}.
+     */
+    public void beginPreBackup() {
+        // BEGIN: readme-sample-beginPreBackup
+        String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
+        String sasToken = "";
+
+        SyncPoller preBackupPoller =
+            keyVaultBackupClient.beginPreBackup(blobStorageUrl, sasToken);
+        PollResponse pollResponse = preBackupPoller.poll();
+
+        System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
+
+        PollResponse finalPollResponse = preBackupPoller.waitForCompletion();
+
+        if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+            String folderUrl = preBackupPoller.getFinalResult();
+
+            System.out.printf("Pre-backup check completed successfully.%n");
+        } else {
+            KeyVaultBackupOperation operation = preBackupPoller.poll().getValue();
+
+            System.out.printf("Pre-backup check failed with error: %s.%n", operation.getError().getMessage());
+        }
+        // END: readme-sample-beginPreBackup
+    }
+
     /**
      * Code sample for starting a {@link KeyVaultBackupOperation backup operation}.
      */
     public void beginBackup() {
         // BEGIN: readme-sample-beginBackup
         String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
 
         SyncPoller backupPoller =
             keyVaultBackupClient.beginBackup(blobStorageUrl, sasToken);
-
         PollResponse pollResponse = backupPoller.poll();
 
         System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
@@ -322,27 +349,52 @@ public void beginBackup() {
         // END: readme-sample-beginBackup
     }
 
+    /**
+     * Code sample for starting a {@link KeyVaultRestoreOperation pre-restore check}.
+     */
+    public void beginPreRestore() {
+        // BEGIN: readme-sample-beginPreRestore
+        String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
+        String sasToken = "";
+
+        SyncPoller preRestorePoller =
+            keyVaultBackupClient.beginPreRestore(folderUrl, sasToken);
+        PollResponse pollResponse = preRestorePoller.poll();
+
+        System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
+
+        PollResponse finalPollResponse = preRestorePoller.waitForCompletion();
+
+        if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+            System.out.printf("Pre-restore check completed successfully.%n");
+        } else {
+            KeyVaultRestoreOperation operation = preRestorePoller.poll().getValue();
+
+            System.out.printf("Pre-restore check failed with error: %s.%n", operation.getError().getMessage());
+        }
+        // END: readme-sample-beginPreRestore
+    }
+
     /**
      * Code sample for starting a {@link KeyVaultRestoreOperation restore operation}.
      */
     public void beginRestore() {
         // BEGIN: readme-sample-beginRestore
         String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
 
-        SyncPoller backupPoller =
+        SyncPoller restorePoller =
             keyVaultBackupClient.beginRestore(folderUrl, sasToken);
-
-        PollResponse pollResponse = backupPoller.poll();
+        PollResponse pollResponse = restorePoller.poll();
 
         System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
 
-        PollResponse finalPollResponse = backupPoller.waitForCompletion();
+        PollResponse finalPollResponse = restorePoller.waitForCompletion();
 
         if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
             System.out.printf("Backup restored successfully.%n");
         } else {
-            KeyVaultRestoreOperation operation = backupPoller.poll().getValue();
+            KeyVaultRestoreOperation operation = restorePoller.poll().getValue();
 
             System.out.printf("Restore failed with error: %s.%n", operation.getError().getMessage());
         }
@@ -355,35 +407,54 @@ public void beginRestore() {
     public void beginSelectiveKeyRestore() {
         // BEGIN: readme-sample-beginSelectiveKeyRestore
         String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
         String keyName = "myKey";
 
-        SyncPoller backupPoller =
+        SyncPoller restorePoller =
             keyVaultBackupClient.beginSelectiveKeyRestore(folderUrl, sasToken, keyName);
-
-        PollResponse pollResponse = backupPoller.poll();
+        PollResponse pollResponse = restorePoller.poll();
 
         System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
 
-        PollResponse finalPollResponse = backupPoller.waitForCompletion();
+        PollResponse finalPollResponse = restorePoller.waitForCompletion();
 
         if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
             System.out.printf("Key restored successfully.%n");
         } else {
-            KeyVaultSelectiveKeyRestoreOperation operation = backupPoller.poll().getValue();
+            KeyVaultSelectiveKeyRestoreOperation operation = restorePoller.poll().getValue();
 
             System.out.printf("Key restore failed with error: %s.%n", operation.getError().getMessage());
         }
         // END: readme-sample-beginSelectiveKeyRestore
     }
 
+    /**
+     * Code sample for starting a {@link KeyVaultBackupOperation pre-backup check} asynchronously.
+     */
+    public void beginPreBackupAsync() {
+        // BEGIN: readme-sample-beginPreBackupAsync
+        String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
+        String sasToken = "";
+
+        keyVaultBackupAsyncClient.beginPreBackup(blobStorageUrl, sasToken)
+            .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
+            .doOnError(e -> System.out.printf("Pre-backup check failed with error: %s.%n", e.getMessage()))
+            .doOnNext(pollResponse ->
+                System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()))
+            .filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
+            .flatMap(AsyncPollResponse::getFinalResult)
+            .subscribe(folderUrl ->
+                System.out.printf("Pre-backup check completed successfully.%n"));
+        // END: readme-sample-beginPreBackupAsync
+    }
+
     /**
      * Code sample for starting a {@link KeyVaultBackupOperation backup operation} asynchronously.
      */
     public void beginBackupAsync() {
         // BEGIN: readme-sample-beginBackupAsync
         String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
 
         keyVaultBackupAsyncClient.beginBackup(blobStorageUrl, sasToken)
             .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
@@ -397,13 +468,32 @@ public void beginBackupAsync() {
         // END: readme-sample-beginBackupAsync
     }
 
+    /**
+     * Code sample for starting a {@link KeyVaultRestoreOperation pre-restore check} asynchronously.
+     */
+    public void beginPreRestoreAsync() {
+        // BEGIN: readme-sample-beginPreRestoreAsync
+        String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
+        String sasToken = "";
+
+        keyVaultBackupAsyncClient.beginPreRestore(folderUrl, sasToken)
+            .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
+            .doOnError(e -> System.out.printf("Pre-restore check failed with error: %s.%n", e.getMessage()))
+            .doOnNext(pollResponse ->
+                System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()))
+            .filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
+            .flatMap(AsyncPollResponse::getFinalResult)
+            .subscribe(unused -> System.out.printf("Pre-restore check completed successfully.%n"));
+        // END: readme-sample-beginPreRestoreAsync
+    }
+
     /**
      * Code sample for starting a {@link KeyVaultRestoreOperation restore operation} asynchronously.
      */
     public void beginRestoreAsync() {
         // BEGIN: readme-sample-beginRestoreAsync
         String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
 
         keyVaultBackupAsyncClient.beginRestore(folderUrl, sasToken)
             .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
@@ -423,7 +513,7 @@ public void beginRestoreAsync() {
     public void beginSelectiveKeyRestoreAsync() {
         // BEGIN: readme-sample-beginSelectiveKeyRestoreAsync
         String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
         String keyName = "myKey";
 
         keyVaultBackupAsyncClient.beginSelectiveKeyRestore(folderUrl, sasToken, keyName)
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/codesnippets/KeyVaultBackupAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/codesnippets/KeyVaultBackupAsyncClientJavaDocCodeSnippets.java
index 57e9b916a1c0..158569649064 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/codesnippets/KeyVaultBackupAsyncClientJavaDocCodeSnippets.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/codesnippets/KeyVaultBackupAsyncClientJavaDocCodeSnippets.java
@@ -50,6 +50,27 @@ public KeyVaultBackupAsyncClient createAsyncClientWithHttpClient() {
         return keyVaultBackupAsyncClient;
     }
 
+    /**
+     * Generates code samples for using {@link KeyVaultBackupAsyncClient#beginPreBackup(String, String)}.
+     */
+    public void beginPreBackup() {
+        KeyVaultBackupAsyncClient client = createAsyncClient();
+
+        // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient.beginPreBackup#String-String
+        String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
+        String sasToken = "";
+
+        client.beginPreBackup(blobStorageUrl, sasToken)
+            .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
+            .doOnError(e -> System.out.printf("Pre-backup check failed with error: %s.%n", e.getMessage()))
+            .doOnNext(pollResponse ->
+                System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()))
+            .filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
+            .flatMap(AsyncPollResponse::getFinalResult)
+            .subscribe(unused -> System.out.printf("Pre-backup check completed successfully.%n"));
+        // END: com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient.beginPreBackup#String-String
+    }
+
     /**
      * Generates code samples for using {@link KeyVaultBackupAsyncClient#beginBackup(String, String)}.
      */
@@ -58,8 +79,7 @@ public void beginBackup() {
 
         // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient.beginBackup#String-String
         String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-            + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
 
         client.beginBackup(blobStorageUrl, sasToken)
             .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
@@ -73,6 +93,27 @@ public void beginBackup() {
         // END: com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient.beginBackup#String-String
     }
 
+    /**
+     * Generates code samples for using {@link KeyVaultBackupAsyncClient#beginPreRestore(String, String)}.
+     */
+    public void beginPreRestore() {
+        KeyVaultBackupAsyncClient client = createAsyncClient();
+
+        // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient.beginPreRestore#String-String
+        String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
+        String sasToken = "";
+
+        client.beginPreRestore(folderUrl, sasToken)
+            .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
+            .doOnError(e -> System.out.printf("Pre-restore check failed with error: %s.%n", e.getMessage()))
+            .doOnNext(pollResponse ->
+                System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus()))
+            .filter(pollResponse -> pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
+            .flatMap(AsyncPollResponse::getFinalResult)
+            .subscribe(unused -> System.out.printf("Pre-restore check completed successfully.%n"));
+        // END: com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient.beginPreRestore#String-String
+    }
+
     /**
      * Generates code samples for using {@link KeyVaultBackupAsyncClient#beginRestore(String, String)}.
      */
@@ -81,8 +122,7 @@ public void beginRestore() {
 
         // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient.beginRestore#String-String
         String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-            + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
 
         client.beginRestore(folderUrl, sasToken)
             .setPollInterval(Duration.ofSeconds(1)) // You can set a custom polling interval.
@@ -104,8 +144,7 @@ public void beginSelectiveKeyRestore() {
 
         // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupAsyncClient.beginSelectiveKeyRestore#String-String-String
         String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-            + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
         String keyName = "myKey";
 
         client.beginSelectiveKeyRestore(folderUrl, sasToken, keyName)
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/codesnippets/KeyVaultBackupClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/codesnippets/KeyVaultBackupClientJavaDocCodeSnippets.java
index a0a0b8f1dab8..1c0788b0b3c2 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/codesnippets/KeyVaultBackupClientJavaDocCodeSnippets.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/samples/java/com/azure/security/keyvault/administration/codesnippets/KeyVaultBackupClientJavaDocCodeSnippets.java
@@ -34,6 +34,33 @@ public KeyVaultBackupClient createClient() {
         return keyVaultBackupClient;
     }
 
+    /**
+     * Generates code samples for using {@link KeyVaultBackupClient#beginPreBackup(String, String)}.
+     */
+    public void beginPreBackup() {
+        KeyVaultBackupClient client = createClient();
+
+        // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupClient.beginPreBackup#String-String
+        String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
+        String sasToken = "";
+
+        SyncPoller preBackupPoller = client.beginPreBackup(blobStorageUrl, sasToken);
+        PollResponse pollResponse = preBackupPoller.poll();
+
+        System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
+
+        PollResponse finalPollResponse = preBackupPoller.waitForCompletion();
+
+        if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+            System.out.printf("Pre-backup check completed successfully.%n");
+        } else {
+            KeyVaultBackupOperation operation = preBackupPoller.poll().getValue();
+
+            System.out.printf("Pre-backup check failed with error: %s.%n", operation.getError().getMessage());
+        }
+        // END: com.azure.security.keyvault.administration.KeyVaultBackupClient.beginPreBackup#String-String
+    }
+
     /**
      * Generates code samples for using {@link KeyVaultBackupClient#beginBackup(String, String)}.
      */
@@ -42,11 +69,9 @@ public void beginBackup() {
 
         // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupClient.beginBackup#String-String
         String blobStorageUrl = "https://myaccount.blob.core.windows.net/myContainer";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-            + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
 
         SyncPoller backupPoller = client.beginBackup(blobStorageUrl, sasToken);
-
         PollResponse pollResponse = backupPoller.poll();
 
         System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
@@ -65,6 +90,34 @@ public void beginBackup() {
         // END: com.azure.security.keyvault.administration.KeyVaultBackupClient.beginBackup#String-String
     }
 
+    /**
+     * Generates code samples for using {@link KeyVaultBackupClient#beginPreRestore(String, String)}.
+     */
+    public void beginPreRestore() {
+        KeyVaultBackupClient client = createClient();
+
+        // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupClient.beginPreRestore#String-String
+        String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
+        String sasToken = "";
+
+        SyncPoller preRestorePoller =
+            client.beginPreRestore(folderUrl, sasToken);
+        PollResponse pollResponse = preRestorePoller.poll();
+
+        System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
+
+        PollResponse finalPollResponse = preRestorePoller.waitForCompletion();
+
+        if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+            System.out.printf("Pre-restore check completed successfully.%n");
+        } else {
+            KeyVaultRestoreOperation operation = preRestorePoller.poll().getValue();
+
+            System.out.printf("Pre-restore check failed with error: %s.%n", operation.getError().getMessage());
+        }
+        // END: com.azure.security.keyvault.administration.KeyVaultBackupClient.beginPreRestore#String-String
+    }
+
     /**
      * Generates code samples for using {@link KeyVaultBackupClient#beginRestore(String, String)}.
      */
@@ -73,22 +126,20 @@ public void beginRestore() {
 
         // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupClient.beginRestore#String-String
         String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-            + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
 
-        SyncPoller backupPoller =
+        SyncPoller restorePoller =
             client.beginRestore(folderUrl, sasToken);
-
-        PollResponse pollResponse = backupPoller.poll();
+        PollResponse pollResponse = restorePoller.poll();
 
         System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
 
-        PollResponse finalPollResponse = backupPoller.waitForCompletion();
+        PollResponse finalPollResponse = restorePoller.waitForCompletion();
 
         if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
             System.out.printf("Backup restored successfully.%n");
         } else {
-            KeyVaultRestoreOperation operation = backupPoller.poll().getValue();
+            KeyVaultRestoreOperation operation = restorePoller.poll().getValue();
 
             System.out.printf("Restore failed with error: %s.%n", operation.getError().getMessage());
         }
@@ -103,23 +154,21 @@ public void beginSelectiveKeyRestore() {
 
         // BEGIN: com.azure.security.keyvault.administration.KeyVaultBackupClient.beginSelectiveKeyRestore#String-String-String
         String folderUrl = "https://myaccount.blob.core.windows.net/myContainer/mhsm-myaccount-2020090117323313";
-        String sasToken = "sv=2020-02-10&ss=b&srt=o&sp=rwdlactfx&se=2021-06-17T07:13:07Z&st=2021-06-16T23:13:07Z"
-            + "&spr=https&sig=n5V6fnlkViEF9b7ij%2FttTHNwO2BdFIHKHppRxGAyJdc%3D";
+        String sasToken = "";
         String keyName = "myKey";
 
-        SyncPoller backupPoller =
+        SyncPoller restorePoller =
             client.beginSelectiveKeyRestore(folderUrl, sasToken, keyName);
-
-        PollResponse pollResponse = backupPoller.poll();
+        PollResponse pollResponse = restorePoller.poll();
 
         System.out.printf("The current status of the operation is: %s.%n", pollResponse.getStatus());
 
-        PollResponse finalPollResponse = backupPoller.waitForCompletion();
+        PollResponse finalPollResponse = restorePoller.waitForCompletion();
 
         if (finalPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
             System.out.printf("Key restored successfully.%n");
         } else {
-            KeyVaultSelectiveKeyRestoreOperation operation = backupPoller.poll().getValue();
+            KeyVaultSelectiveKeyRestoreOperation operation = restorePoller.poll().getValue();
 
             System.out.printf("Key restore failed with error: %s.%n", operation.getError().getMessage());
         }
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientTestBase.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientTestBase.java
index 1912b0a0d083..bcddfaf61d1e 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientTestBase.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientTestBase.java
@@ -23,7 +23,7 @@ public abstract class KeyVaultAccessControlClientTestBase extends KeyVaultAdmini
     private static final ClientLogger LOGGER = new ClientLogger(KeyVaultAccessControlClientTestBase.class);
 
     protected final String servicePrincipalId =
-        Configuration.getGlobalConfiguration().get("CLIENT_OBJECTID", "3a107ba6-6cc0-40cf-9fed-22b612269c92");
+        Configuration.getGlobalConfiguration().get("CLIENT_OBJECTID", "f84ae8f9-c979-4750-a2fe-b350a00bebff");
 
     KeyVaultAccessControlClientBuilder getClientBuilder(HttpClient httpClient, boolean forCleanup) {
         return new KeyVaultAccessControlClientBuilder()
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClientTest.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClientTest.java
index 6c3be6ed35a8..1e8baaddd810 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClientTest.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClientTest.java
@@ -5,24 +5,20 @@
 import com.azure.core.http.HttpClient;
 import com.azure.core.test.http.AssertingHttpClientBuilder;
 import com.azure.core.util.polling.AsyncPollResponse;
-import com.azure.core.util.polling.LongRunningOperationStatus;
-import com.azure.security.keyvault.administration.models.KeyVaultBackupOperation;
-import com.azure.security.keyvault.administration.models.KeyVaultRestoreOperation;
-import com.azure.security.keyvault.administration.models.KeyVaultRestoreResult;
-import com.azure.security.keyvault.administration.models.KeyVaultSelectiveKeyRestoreOperation;
-import com.azure.security.keyvault.administration.models.KeyVaultSelectiveKeyRestoreResult;
-import com.azure.security.keyvault.keys.KeyAsyncClient;
+import com.azure.security.keyvault.keys.KeyClient;
 import com.azure.security.keyvault.keys.KeyClientBuilder;
-import com.azure.security.keyvault.keys.KeyServiceVersion;
 import com.azure.security.keyvault.keys.models.CreateRsaKeyOptions;
 import com.azure.security.keyvault.keys.models.KeyVaultKey;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
+import reactor.test.StepVerifier;
 
 import java.time.OffsetDateTime;
 import java.time.ZoneOffset;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class KeyVaultBackupAsyncClientTest extends KeyVaultBackupClientTestBase {
@@ -49,13 +45,34 @@ private HttpClient buildAsyncAssertingClient(HttpClient httpClient) {
     public void beginBackup(HttpClient httpClient) {
         getAsyncClient(httpClient, false);
 
-        AsyncPollResponse backupPollResponse =
-            setPlaybackPollerFluxPollInterval(asyncClient.beginBackup(blobStorageUrl, sasToken)).blockLast();
+        StepVerifier.create(setPlaybackPollerFluxPollInterval(asyncClient.beginBackup(blobStorageUrl, sasToken))
+                .last()
+                .flatMap(AsyncPollResponse::getFinalResult))
+            .assertNext(backupBlobUri -> {
+                assertNotNull(backupBlobUri);
+                assertTrue(backupBlobUri.startsWith(blobStorageUrl));
+            })
+            .verifyComplete();
+    }
+
+    /**
+     * Tests that a Key Vault or MHSM can be pre-backed up.
+     */
+    @SuppressWarnings("ConstantConditions")
+    @ParameterizedTest(name = DISPLAY_NAME)
+    @MethodSource("com.azure.security.keyvault.administration.KeyVaultAdministrationClientTestBase#createHttpClients")
+    public void beginPreBackup(HttpClient httpClient) {
+        getAsyncClient(httpClient, false);
 
-        String backupBlobUri = backupPollResponse.getFinalResult().block();
+        StepVerifier.create(setPlaybackPollerFluxPollInterval(asyncClient.beginPreBackup(blobStorageUrl, sasToken))
+                .last()
+                .flatMap(AsyncPollResponse::getFinalResult)
+                .mapNotNull(backupBlobUri -> {
+                    assertNull(backupBlobUri);
 
-        assertNotNull(backupBlobUri);
-        assertTrue(backupBlobUri.startsWith(blobStorageUrl));
+                    return backupBlobUri;
+                }))
+            .verifyComplete();
     }
 
     /**
@@ -67,26 +84,49 @@ public void beginBackup(HttpClient httpClient) {
     public void beginRestore(HttpClient httpClient) {
         getAsyncClient(httpClient, false);
 
-        // Create a backup
-        AsyncPollResponse backupPollResponse =
-            setPlaybackPollerFluxPollInterval(asyncClient.beginBackup(blobStorageUrl, sasToken))
-                .takeUntil(asyncPollResponse ->
-                    asyncPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
-                .blockLast();
+        StepVerifier.create(setPlaybackPollerFluxPollInterval(asyncClient.beginBackup(blobStorageUrl, sasToken))
+                .last()
+                .flatMap(AsyncPollResponse::getFinalResult)
+                .map(backupBlobUri -> {
+                    assertNotNull(backupBlobUri);
+                    assertTrue(backupBlobUri.startsWith(blobStorageUrl));
+
+                    return backupBlobUri;
+                })
+                .map(backupBlobUri -> asyncClient.beginRestore(backupBlobUri, sasToken)
+                    .last()
+                    .map(AsyncPollResponse::getValue)))
+            .assertNext(Assertions::assertNotNull)
+            .verifyComplete();
 
-        KeyVaultBackupOperation backupOperation = backupPollResponse.getValue();
-        assertNotNull(backupOperation);
+        // For some reason, the service might still think a restore operation is running even after returning a success
+        // signal. This gives it some time to "clear" the operation.
+        sleepIfRunningAgainstService(30000);
+    }
 
-        // Restore the backup
-        String backupFolderUrl = backupOperation.getAzureStorageBlobContainerUrl();
-        AsyncPollResponse restorePollResponse =
-            setPlaybackPollerFluxPollInterval(asyncClient.beginRestore(backupFolderUrl, sasToken))
-                .takeUntil(asyncPollResponse ->
-                    asyncPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
-                .blockLast();
+    /**
+     * Tests that a Key Vault can be pre-restored from a backup.
+     */
+    @SuppressWarnings("ConstantConditions")
+    @ParameterizedTest(name = DISPLAY_NAME)
+    @MethodSource("com.azure.security.keyvault.administration.KeyVaultAdministrationClientTestBase#createHttpClients")
+    public void beginPreRestore(HttpClient httpClient) {
+        getAsyncClient(httpClient, false);
 
-        KeyVaultRestoreOperation restoreOperation = restorePollResponse.getValue();
-        assertNotNull(restoreOperation);
+        StepVerifier.create(setPlaybackPollerFluxPollInterval(asyncClient.beginBackup(blobStorageUrl, sasToken))
+                .last()
+                .flatMap(AsyncPollResponse::getFinalResult)
+                .map(backupBlobUri -> {
+                    assertNotNull(backupBlobUri);
+                    assertTrue(backupBlobUri.startsWith(blobStorageUrl));
+
+                    return backupBlobUri;
+                })
+                .map(backupBlobUri -> asyncClient.beginPreRestore(backupBlobUri, sasToken)
+                    .last()
+                    .map(AsyncPollResponse::getValue)))
+            .assertNext(Assertions::assertNotNull)
+            .verifyComplete();
 
         // For some reason, the service might still think a restore operation is running even after returning a success
         // signal. This gives it some time to "clear" the operation.
@@ -100,42 +140,35 @@ public void beginRestore(HttpClient httpClient) {
     @ParameterizedTest(name = DISPLAY_NAME)
     @MethodSource("com.azure.security.keyvault.administration.KeyVaultAdministrationClientTestBase#createHttpClients")
     public void beginSelectiveKeyRestore(HttpClient httpClient) {
-        KeyAsyncClient keyClient = new KeyClientBuilder()
+        KeyClient keyClient = new KeyClientBuilder()
             .vaultUrl(getEndpoint())
-            .serviceVersion(KeyServiceVersion.V7_2)
             .pipeline(getPipeline(httpClient, false))
-            .buildAsyncClient();
+            .buildClient();
 
         String keyName = testResourceNamer.randomName("backupKey", 20);
         CreateRsaKeyOptions rsaKeyOptions = new CreateRsaKeyOptions(keyName)
             .setExpiresOn(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC))
             .setNotBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC));
 
-        KeyVaultKey createdKey = keyClient.createRsaKey(rsaKeyOptions).block();
+        KeyVaultKey createdKey = keyClient.createRsaKey(rsaKeyOptions);
 
         getAsyncClient(httpClient, false);
 
-        // Create a backup
-        AsyncPollResponse backupPollResponse =
-            setPlaybackPollerFluxPollInterval(asyncClient.beginBackup(blobStorageUrl, sasToken))
-                .takeUntil(asyncPollResponse ->
-                    asyncPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
-                .blockLast();
-
-        KeyVaultBackupOperation backupOperation = backupPollResponse.getValue();
-        assertNotNull(backupOperation);
-
-        // Restore the backup
-        String backupFolderUrl = backupOperation.getAzureStorageBlobContainerUrl();
-        AsyncPollResponse restorePollResponse =
-            setPlaybackPollerFluxPollInterval(asyncClient.beginSelectiveKeyRestore(createdKey.getName(),
-                backupFolderUrl, sasToken))
-                .takeUntil(asyncPollResponse ->
-                    asyncPollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED)
-                .blockLast();
-
-        KeyVaultSelectiveKeyRestoreOperation restoreOperation = restorePollResponse.getValue();
-        assertNotNull(restoreOperation);
+        StepVerifier.create(setPlaybackPollerFluxPollInterval(asyncClient.beginBackup(blobStorageUrl, sasToken))
+                .last()
+                .flatMap(AsyncPollResponse::getFinalResult)
+                .map(backupBlobUri -> {
+                    assertNotNull(backupBlobUri);
+                    assertTrue(backupBlobUri.startsWith(blobStorageUrl));
+
+                    return backupBlobUri;
+                })
+                .map(backupBlobUri ->
+                    asyncClient.beginSelectiveKeyRestore(createdKey.getName(), backupBlobUri, sasToken)
+                        .last()
+                        .map(AsyncPollResponse::getValue)))
+            .assertNext(Assertions::assertNotNull)
+            .verifyComplete();
 
         // For some reason, the service might still think a restore operation is running even after returning a success
         // signal. This gives it some time to "clear" the operation.
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTest.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTest.java
index 62b4d8e7cf2c..362e36ff1299 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTest.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTest.java
@@ -14,7 +14,6 @@
 import com.azure.security.keyvault.administration.models.KeyVaultSelectiveKeyRestoreResult;
 import com.azure.security.keyvault.keys.KeyClient;
 import com.azure.security.keyvault.keys.KeyClientBuilder;
-import com.azure.security.keyvault.keys.KeyServiceVersion;
 import com.azure.security.keyvault.keys.models.CreateRsaKeyOptions;
 import com.azure.security.keyvault.keys.models.KeyVaultKey;
 import org.junit.jupiter.params.ParameterizedTest;
@@ -25,6 +24,7 @@
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class KeyVaultBackupClientTest extends KeyVaultBackupClientTestBase {
@@ -52,8 +52,9 @@ public void beginBackup(HttpClient httpClient) {
 
         SyncPoller backupPoller =
             setPlaybackSyncPollerPollInterval(client.beginBackup(blobStorageUrl, sasToken));
+        PollResponse pollResponse = backupPoller.waitForCompletion();
 
-        backupPoller.waitForCompletion();
+        assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollResponse.getStatus());
 
         String backupBlobUri = backupPoller.getFinalResult();
 
@@ -61,6 +62,25 @@ public void beginBackup(HttpClient httpClient) {
         assertTrue(backupBlobUri.startsWith(blobStorageUrl));
     }
 
+    /**
+     * Tests that a Key Vault can be pre-backed up.
+     */
+    @ParameterizedTest(name = DISPLAY_NAME)
+    @MethodSource("com.azure.security.keyvault.administration.KeyVaultAdministrationClientTestBase#createHttpClients")
+    public void beginPreBackup(HttpClient httpClient) {
+        getClient(httpClient, false);
+
+        SyncPoller backupPoller =
+            setPlaybackSyncPollerPollInterval(client.beginPreBackup(blobStorageUrl, sasToken));
+        PollResponse pollResponse = backupPoller.waitForCompletion();
+
+        assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollResponse.getStatus());
+
+        String backupBlobUri = backupPoller.getFinalResult();
+
+        assertNull(backupBlobUri);
+    }
+
     /**
      * Tests that a Key Vault can be restored from a backup.
      */
@@ -72,8 +92,9 @@ public void beginRestore(HttpClient httpClient) {
         // Create a backup
         SyncPoller backupPoller =
             setPlaybackSyncPollerPollInterval(client.beginBackup(blobStorageUrl, sasToken));
+        PollResponse pollResponse = backupPoller.waitForCompletion();
 
-        backupPoller.waitForCompletion();
+        assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollResponse.getStatus());
 
         // Restore the backup
         String backupFolderUrl = backupPoller.getFinalResult();
@@ -91,6 +112,34 @@ public void beginRestore(HttpClient httpClient) {
         sleepIfRunningAgainstService(30000);
     }
 
+    /**
+     * Tests that a Key Vault can be pre-restored from a backup.
+     */
+    @ParameterizedTest(name = DISPLAY_NAME)
+    @MethodSource("com.azure.security.keyvault.administration.KeyVaultAdministrationClientTestBase#createHttpClients")
+    public void beginPreRestore(HttpClient httpClient) {
+        getClient(httpClient, false);
+
+        // Create a backup
+        SyncPoller backupPoller =
+            setPlaybackSyncPollerPollInterval(client.beginBackup(blobStorageUrl, sasToken));
+        PollResponse backupPollResponse = backupPoller.waitForCompletion();
+
+        assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, backupPollResponse.getStatus());
+
+        // Restore the backup
+        String backupFolderUrl = backupPoller.getFinalResult();
+        SyncPoller restorePoller =
+            setPlaybackSyncPollerPollInterval(client.beginPreRestore(backupFolderUrl, sasToken));
+        PollResponse restorePollResponse = restorePoller.waitForCompletion();
+
+        assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, restorePollResponse.getStatus());
+
+        // For some reason, the service might still think a restore operation is running even after returning a success
+        // signal. This gives it some time to "clear" the operation.
+        sleepIfRunningAgainstService(30000);
+    }
+
     /**
      * Tests that a key can be restored from a backup.
      */
@@ -99,7 +148,6 @@ public void beginRestore(HttpClient httpClient) {
     public void beginSelectiveKeyRestore(HttpClient httpClient) {
         KeyClient keyClient = new KeyClientBuilder()
             .vaultUrl(getEndpoint())
-            .serviceVersion(KeyServiceVersion.V7_2)
             .pipeline(getPipeline(httpClient, false))
             .buildClient();
 
@@ -115,20 +163,19 @@ public void beginSelectiveKeyRestore(HttpClient httpClient) {
         // Create a backup
         SyncPoller backupPoller =
             setPlaybackSyncPollerPollInterval(client.beginBackup(blobStorageUrl, sasToken));
+        PollResponse backupPollResponse = backupPoller.waitForCompletion();
 
-        backupPoller.waitForCompletion();
+        assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, backupPollResponse.getStatus());
 
         // Restore one key from said backup
         String backupFolderUrl = backupPoller.getFinalResult();
         SyncPoller selectiveKeyRestorePoller =
             setPlaybackSyncPollerPollInterval(client.beginSelectiveKeyRestore(createdKey.getName(), backupFolderUrl,
                 sasToken));
+        PollResponse restorePollResponse =
+            selectiveKeyRestorePoller.waitForCompletion();
 
-        selectiveKeyRestorePoller.waitForCompletion();
-
-        PollResponse response = selectiveKeyRestorePoller.poll();
-
-        assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, response.getStatus());
+        assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, restorePollResponse.getStatus());
 
         // For some reason, the service might still think a restore operation is running even after returning a success
         // signal. This gives it some time to "clear" the operation.
diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTestBase.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTestBase.java
index 0b5c5110844b..37adff2fc63a 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTestBase.java
+++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTestBase.java
@@ -19,7 +19,7 @@
 public abstract class KeyVaultBackupClientTestBase extends KeyVaultAdministrationClientTestBase {
     protected final String blobStorageUrl = IS_MANAGED_HSM_DEPLOYED
         ? getStorageEndpoint() + Configuration.getGlobalConfiguration().get("BLOB_CONTAINER_NAME")
-        : "https://ta70c2fe596f0a0dfprim.blob.core.windows.net/backup";
+        : "https://tb5d8675f0aa83a18prim.blob.core.windows.net/backup";
     protected final String sasToken = IS_MANAGED_HSM_DEPLOYED ? generateSasToken() : "REDACTED";
 
     KeyVaultBackupClientBuilder getClientBuilder(HttpClient httpClient, boolean forCleanup) {
@@ -31,9 +31,15 @@ KeyVaultBackupClientBuilder getClientBuilder(HttpClient httpClient, boolean forC
     @Test
     public abstract void beginBackup(HttpClient httpClient);
 
+    @Test
+    public abstract void beginPreBackup(HttpClient httpClient);
+
     @Test
     public abstract void beginRestore(HttpClient httpClient);
 
+    @Test
+    public abstract void beginPreRestore(HttpClient httpClient);
+
     @Test
     public abstract void beginSelectiveKeyRestore(HttpClient httpClient);
 
diff --git a/sdk/keyvault/azure-security-keyvault-administration/swagger/autorest.md b/sdk/keyvault/azure-security-keyvault-administration/swagger/autorest.md
index 39e47f91030e..7d1eeb09dfb6 100644
--- a/sdk/keyvault/azure-security-keyvault-administration/swagger/autorest.md
+++ b/sdk/keyvault/azure-security-keyvault-administration/swagger/autorest.md
@@ -65,7 +65,7 @@ partial-update: true
 These settings apply only when `--tag=rbac` is specified on the command line.
 
 ``` yaml $(tag) == 'rbac'
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a2f6f742d088dcc712e67cb2745d8271eaa370ff/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.5-preview.1/rbac.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/rbac.json
 title: KeyVaultAccessControlClient
 custom-types: KeyVaultDataAction,KeyVaultRoleDefinitionType,KeyVaultRoleScope,KeyVaultRoleType
 customization-class: src/main/java/RbacCustomizations.java
@@ -87,7 +87,7 @@ directive:
 These settings apply only when `--tag=backuprestore` is specified on the command line.
 
 ``` yaml $(tag) == 'backuprestore'
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a2f6f742d088dcc712e67cb2745d8271eaa370ff/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.5-preview.1/backuprestore.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/backuprestore.json
 title: KeyVaultBackupClient
 customization-class: src/main/java/BackupRestoreCustomizations.java
 ```
@@ -96,7 +96,7 @@ customization-class: src/main/java/BackupRestoreCustomizations.java
 These settings apply only when `--tag=settings` is specified on the command line.
 
 ``` yaml $(tag) == 'settings'
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a2f6f742d088dcc712e67cb2745d8271eaa370ff/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.5-preview.1/settings.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/settings.json
 title: KeyVaultSettingsClient
 custom-types: KeyVaultSettingType
 customization-class: src/main/java/SettingsCustomizations.java
diff --git a/sdk/keyvault/azure-security-keyvault-certificates/assets.json b/sdk/keyvault/azure-security-keyvault-certificates/assets.json
index 22243c30c53e..7235a61b39fc 100644
--- a/sdk/keyvault/azure-security-keyvault-certificates/assets.json
+++ b/sdk/keyvault/azure-security-keyvault-certificates/assets.json
@@ -2,5 +2,5 @@
   "AssetsRepo": "Azure/azure-sdk-assets",
   "AssetsRepoPrefixPath": "java",
   "TagPrefix": "java/keyvault/azure-security-keyvault-certificates",
-  "Tag": "java/keyvault/azure-security-keyvault-certificates_2816fc1705"
+  "Tag": "java/keyvault/azure-security-keyvault-certificates_e018897fab"
 }
diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateServiceVersion.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateServiceVersion.java
index 461be4837c41..c9be34b86aa7 100644
--- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateServiceVersion.java
+++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateServiceVersion.java
@@ -37,7 +37,12 @@ public enum CertificateServiceVersion implements ServiceVersion {
     /**
      * Service version {@code 7.5}.
      */
-    V7_5("7.5");
+    V7_5("7.5"),
+
+    /**
+     * Service version {@code 7.6-preview.1}.
+     */
+    V7_6_PREVIEW_1("7.6-preview.1");
 
     private final String version;
 
@@ -59,6 +64,6 @@ public String getVersion() {
      * @return the latest {@link CertificateServiceVersion}
      */
     public static CertificateServiceVersion getLatest() {
-        return V7_5;
+        return V7_6_PREVIEW_1;
     }
 }
diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateAsyncClientTest.java b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateAsyncClientTest.java
index 94612cd2c6bc..926609d0bbd9 100644
--- a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateAsyncClientTest.java
+++ b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateAsyncClientTest.java
@@ -873,7 +873,7 @@ public void importCertificate(HttpClient httpClient, CertificateServiceVersion s
         importCertificateRunner((importCertificateOptions) ->
             StepVerifier.create(certificateAsyncClient.importCertificate(importCertificateOptions))
                 .assertNext(importedCertificate -> {
-                    assertTrue("db1497bc2c82b365c5c7c73f611513ee117790a9"
+                    assertTrue("73b4319cdf38e0797084535d9c02fd04d4b2b2e6"
                         .equalsIgnoreCase(importedCertificate.getProperties().getX509ThumbprintAsString()));
                     assertEquals(importCertificateOptions.isEnabled(), importedCertificate.getProperties().isEnabled());
 
@@ -881,8 +881,10 @@ public void importCertificate(HttpClient httpClient, CertificateServiceVersion s
                     X509Certificate x509Certificate = assertDoesNotThrow(
                         () -> loadCerToX509Certificate(importedCertificate.getCer()));
 
-                    assertEquals("CN=KeyVaultTest", x509Certificate.getSubjectX500Principal().getName());
-                    assertEquals("CN=KeyVaultTest", x509Certificate.getIssuerX500Principal().getName());
+                    assertTrue(x509Certificate.getSubjectX500Principal().getName()
+                        .contains("CN=Test,OU=Test,O=Contoso,L=Redmond,ST=WA,C=US"));
+                    assertTrue(x509Certificate.getIssuerX500Principal().getName()
+                        .contains("CN=Test,OU=Test,O=Contoso,L=Redmond,ST=WA,C=US"));
                 })
                 .verifyComplete());
     }
diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java
index 393a22f5e03f..c727d4e7bbeb 100644
--- a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java
+++ b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java
@@ -865,7 +865,7 @@ public void importCertificate(HttpClient httpClient, CertificateServiceVersion s
             KeyVaultCertificateWithPolicy importedCertificate =
                 certificateClient.importCertificate(importCertificateOptions);
 
-            assertTrue("db1497bc2c82b365c5c7c73f611513ee117790a9"
+            assertTrue("73b4319cdf38e0797084535d9c02fd04d4b2b2e6"
                 .equalsIgnoreCase(importedCertificate.getProperties().getX509ThumbprintAsString()));
             assertEquals(importCertificateOptions.isEnabled(), importedCertificate.getProperties().isEnabled());
 
@@ -873,8 +873,10 @@ public void importCertificate(HttpClient httpClient, CertificateServiceVersion s
             X509Certificate x509Certificate = assertDoesNotThrow(
                 () -> loadCerToX509Certificate(importedCertificate.getCer()));
 
-            assertEquals("CN=KeyVaultTest", x509Certificate.getSubjectX500Principal().getName());
-            assertEquals("CN=KeyVaultTest", x509Certificate.getIssuerX500Principal().getName());
+            assertTrue(x509Certificate.getSubjectX500Principal().getName()
+                .contains("CN=Test,OU=Test,O=Contoso,L=Redmond,ST=WA,C=US"));
+            assertTrue(x509Certificate.getIssuerX500Principal().getName()
+                .contains("CN=Test,OU=Test,O=Contoso,L=Redmond,ST=WA,C=US"));
         });
     }
 
diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/FakeCredentialsForTests.java b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/FakeCredentialsForTests.java
index 67557bb45c07..d51e8d7c971e 100644
--- a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/FakeCredentialsForTests.java
+++ b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/FakeCredentialsForTests.java
@@ -11,56 +11,63 @@ public class FakeCredentialsForTests {
      * Fake certificate content
      */
     public static final String FAKE_CERTIFICATE =
-        "MIIJUQIBAzCCCRcGCSqGSIb3DQEHAaCCCQgEggkEMIIJADCCA7cGCSqGSIb3DQEH"
-        + "BqCCA6gwggOkAgEAMIIDnQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIONsr"
-        + "wr1FhuICAggAgIIDcBQWaArZgVr5K8+zccadOCGIC+WzlAx2V88HT6fQcujZItr3"
-        + "koiHi7+sdTe3mQncnxqZoNGgx4s6Xh+QIIFdHSAo4EL9uGoFKiprKMHAmiCj9Pcm"
-        + "M6stTFYMnzmlAiVLCNogPEobi2pfcQIVbDaVUHdm4EczlBGKyMTZSTkXmxI7Ax9V"
-        + "YXucniBpxJ3d0bTHchvHCjqHCLTDCnqyPXTqQH0JpHSYdcq9pxydtoNNgT7NDrKM"
-        + "0QtxIvI29+ZlSLZMxB3Mf4qOhn6bmyBakUypK1S8N0b2YPLTjp5+Zmb8W24+1bVm"
-        + "gV2p10SFjbt8CacDl3dmRUkwu6C8Cl3QIpgwbMoP8hnJppyaFvIqar9roNNS3seG"
-        + "8RDn/Q4DCYWJ6JhA6Z+gDL3BncwE2q9rekkOwo1MwERNhBEtINrXztKogdA/as1o"
-        + "O443ZbM/qm5pX9ZPh4Hv8Hzgl0aqlxubsUcEr8SIDNEJ3u91/gDdmHWgabnLZif8"
-        + "A7e2TMCqTiCM2nRr3soNUvOqnLHoexAKqsQAvi36VVmdAH1085Q+ISpVseCe3Piq"
-        + "PhLsqyfF2Yox+NkI/nOwtg0XhO+mdoAkes03ojctqFXB2ygo/iRH2ng16zGnWes0"
-        + "nSp3rcOaoqcE1c85+/QQZZrzVspdnnNhYWWr1IiwyiOctOAovpmU9oDacY+1u9dO"
-        + "pnVRr5ibwR1NSlIVl1KPNsYmQoP9hig8lULeVGLQTWEQc8qb55t/Y/RpgNFEs3pi"
-        + "Hmd12R9NZMBcrZp3bbSzdS51OicQ6PKRXKESHVMbbsLiR8M62Dxg9ysH0kVEdxjw"
-        + "LfdlqAPby/+/L2t62WKkoHq37GtqtVDYAELBsP9tq3AF+ucUB1Gj8vvwEAedJ2Zl"
-        + "Q2f9xVTHXr0Ah3JkYsMpAuK0HZzMTVc0ZKXrfocbtvwr4aVwc3zOP+pz1AhqZpkD"
-        + "fr23NVkAmV63aIBOr1TSNPCnn7PMlr4rfZ2vzwBKCrfnc+O44IsWNg1N4ZBAKjnh"
-        + "ZZjhgxRYC5en7PKVPHAla2R8299RJy7tuiR6qo58UZNdsIJXBbjhytLroZHvdF3r"
-        + "mSTxgYli5h9xKAw9c6eqmrmGNRD1dY9bmkgFNwF6C8Yi4RdCZ3C6LNFHhgxMwbXi"
-        + "Xl5Mfa7E4ZSOWIeH8I79knxDPDMm4sTRSncbyn8wggVBBgkqhkiG9w0BBwGgggUy"
-        + "BIIFLjCCBSowggUmBgsqhkiG9w0BDAoBAqCCBO4wggTqMBwGCiqGSIb3DQEMAQMw"
-        + "DgQI4fPTwJwGln0CAggABIIEyE1waejpdCUGBbzwCZhdul9adyBO8futpEZKKlcc"
-        + "RnP2iQ82N7P2CE7cXEch8OrC3+qyvyGfqVzNpjOWT1v+uMrqT67enK00/eU/OWxk"
-        + "2edizJXUr+usLjojPh1Yu822Ffax3qiZ87Svm9staSNebek6q/2W24KnaDNvqPPT"
-        + "vGA4prwpwdn98NHGQou5WQiSsh+VkT49duZxO6/+TWK8I27FnoyCgiKEjr6vvY6a"
-        + "x4E3ect4Kz0MZsLKNYd6/BqBRw2UnrKg0yoIYHvP/j/DT8q++cafs9ZSS2eO4ZlC"
-        + "5DAshQdXUD6O7fJF+rI5Ao36keWlkz8DKi0kWL32Rzvk56vVbVGIkrGveZ19E5WR"
-        + "3kqkFNddO+zZs6tJJeO8Rghylp43mgyivpkzPQ6By9aekn+VgQ5Oqze7gUX74CD0"
-        + "onjf5Q5eaOl6ZGdcVlKOXbf/r8libAq7GvGICm1Rfa79/Q1IqvvKFmxd/WZfa1iJ"
-        + "OwZwaV53ALhlDejdTU1YS7ZHorFTJGfn4LtHoVkRpZsMnA+ygMZ0+vTTgnGS1GZz"
-        + "g7OACuXWla1Dh2yv/UYKpdnhgyAGgCcIIguiRSD/JWxZxiT9sb/t+bN7NLRYpXak"
-        + "rYTOi1lHoqCGfZTlzMyZPmo/DfZTdhGXVUYA6puvi+Qv22ub9N01riv2TN9noOkB"
-        + "RH67I48dXRrzJi7m2CYG6v8pQmvW4Tg3feIrOF99hHU/YJfOWvQgjiQoyJFlyq8L"
-        + "1wwhG4eXQH4bP97ilJHFDWjTzKzbYrhKZadd7SJ2hT6R3NPH9AYyMdsoPaWu9RIE"
-        + "g2niz0niFXwUnNQib/deL7PDyFwndsRtp3P405oF4tzMU1Q4mD2IwObM7g4+syFW"
-        + "c+2Cy29o0buJrb4jIsIjjUYNB/mzoU7iKXwQ0qhPTHyUbP4XM5jaiEuS48u4hRbh"
-        + "k9C5Ti6fvrbeVqN/rcXPvS0h+HCf4Gc8LCXTBME0a1SSnQR10q66GRnuQa2hM+/b"
-        + "AxQUTXNYs/p4Np8aGIR6EkXXR0cbcoMHp3+d6h9B8tqlmvTYAFYvlkImeyJaNOpH"
-        + "J9E+AbNEugEm1s+GgfQT5XKCThmpg0uNyKFAkjvkXjoS5K4dJwQPtYfM2SYyLjTO"
-        + "dEmsjPKR7NcBIR3hx35PIpyHxdqAnb25GakB7GHX1/HJsZCf+NLuUsWkyP6pNy6w"
-        + "o9l9BOSSDnUPEV5D/J1h/GZ/hOHcf9WDv06KefKAy77UpnTKSSlHr/PzkfNbtjFf"
-        + "6xKPQRWA1WVd3FW2BETdABteX0QcYSZjVRjirWZUOxu2VKv9I4G0PGMjmo6UxCMG"
-        + "xFV1qulKn+kPAInoNbgbY2ZaF5q1FAoMQ4nAPG6W79J0xgEkuCiH6F7F7TEHldCO"
-        + "ulHWfJja7K27zW2T4ZnQbcpKmHpCns7bAt0198CrYyHfNP4Yyx0uiXBI+Z9hlHvO"
-        + "kcs0l5RDV1EWR3jOih7zLr43MPwJ12sXwEMCOjUHYxs0jTZcgmti+wBPs8xuWayh"
-        + "J/9pD1DfFxf6lFOCi1op5zPc7U3NNMbU3gXgSolsrMjm0dJH0rfu4+C0cym62EBo"
-        + "IGdvyABqS9N96YUu1OreBcCYiTP5Qajn87J8i9zj3aa5lFGJYCS6s8EBeDElMCMG"
-        + "CSqGSIb3DQEJFTEWBBTbFJe8LIKzZcXHxz9hFRPuEXeQqTAxMCEwCQYFKw4DAhoF"
-        + "AAQUI7HzgLxeU0ExCw7mUkJyWmnUlckECNF1gKFeLQMGAgIIAA==";
+        "MIIKjwIBAzCCCkUGCSqGSIb3DQEHAaCCCjYEggoyMIIKLjCCBJoGCSqGSIb3DQEH"
+        + "BqCCBIswggSHAgEAMIIEgAYJKoZIhvcNAQcBMF8GCSqGSIb3DQEFDTBSMDEGCSqG"
+        + "SIb3DQEFDDAkBBD6J7VlngzbeYpxVxb5zbUjAgIIADAMBggqhkiG9w0CCQUAMB0G"
+        + "CWCGSAFlAwQBKgQQFq79Veolktn9WBVZ2b+yn4CCBBDmBdB0C7F9Lac/Kv5pjH4b"
+        + "RFX1HEygcQVBJQpCKq5WuR2ahBZolTfo6mlhWrB0Y/pdNe5QBERrw5PX9hghny19"
+        + "S0m9jmwYb2VwTigIGJAqR6Ruik3MJ1Ya57dYNXgpr3smhgYNe66Jk8sHbFiwlSU7"
+        + "Hsq69+1EZwwKBHerGfpMux4vWAWAIHorJgZxrXAuce+mSxDxkASe+Ud/bqq0no3q"
+        + "qsad60l2SgTElwpBCrMkac8bUHwOg6jOJltPRSfWjfSiqVt/14OIS5HQwUaA6ZyP"
+        + "sD3poTAaDu35d3Xou7f7oZlN5AeCNnoD/uQlA5d/nXEyCC/UXbXj9O+vDXKfaS7Y"
+        + "naUqKSOcqxCj9NRsLAJWuE06oOFxrZJu+UbcANZAUqLW6GD8D7kTgoZmakE6QxT0"
+        + "Q1tOtEV2/pxhAHKj3V8IiWQ2NdodigO52UcGIt8Q4awbydy6RPFMppsi8WBTXDtP"
+        + "bui8V4AJvtrm5jRGdW7mzJvkqeUVR/IeQ/7L5hpcr1hg1EVs43ax29VF6VmMiVKa"
+        + "Y3Itiqs49fet6Qburgf11AyrP9RuipJD5hQd1YmlIvpySLkxc2/PMGEsdgC4BTIz"
+        + "I0MszHaQPvsgKxGTdf6keV4yZSWUyEOAyFCmuynfOCwSya6Cbm74YAXXj4IdA1dY"
+        + "6kOgNgfTM8Tr3KmaBSNbenwAXXPVHIJacqIMRTUIQ/+be0dwsgJ5FJi0/5poYrDj"
+        + "XLyXT25OOTFZVAzGwVcm5hlFNQUULV7bAaJOH2ZtK3uoTHuH83FCfRSRqeOqEhZJ"
+        + "Z0DF2yEG2yuEHOT2OqcIYuRnl1HbGdYFgbwoa9UTMOYG8HkEgzKFTXoqmKOC38zu"
+        + "W+1pKLn+uiTkeyCOjAq99Mwve2fFDdQHXcSmv24ZFsiHSctzDQe9xJUBtRtm38+d"
+        + "GkniMuusmxBIhgMqPeG1g7tqS7OrX+r9wZieBqL3aaabXAXQbuQZ3tFyZDzWfA5w"
+        + "lWY0mc7rmqau70XTV90eGxUtT4IYeLuTbjVsPBYahsupEbujrkeo4kS8cp6AyIhl"
+        + "WLzcXYzwAnIcbQJkw6nb/JyCrz9/mASpQmKpX4syj+4wcFATwDDt4KjblAendcJw"
+        + "bguM4isaPCxP48hg4Tj0CLLSRNtMfXIjKltJWkhjXzQLEzcCTeWLAUzzm9mNyDOZ"
+        + "EVso2Y1jN6Xqdm6D1bRuHp0TsKlHdkyBwBCkFPph+fCgKrASmbgSzX8bilqzOU/r"
+        + "8Ql+ot6br42IPIm6Cwn6sCwdiS0chx0mr52n3Fef7Aurluu6x/xnNT+wLoURXHNe"
+        + "FqN0nKZBgKWRQIUKAkpK+02tN0TFtUWbHjJ0EAsNwAaSoTwqXNgEmb8JPR1BRCod"
+        + "kYfAnHlnvBy83IMiXMz0lDCCBYwGCSqGSIb3DQEHAaCCBX0EggV5MIIFdTCCBXEG"
+        + "CyqGSIb3DQEMCgECoIIFOTCCBTUwXwYJKoZIhvcNAQUNMFIwMQYJKoZIhvcNAQUM"
+        + "MCQEEEaqp++BjdYKmeKmJMqBDE0CAggAMAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUD"
+        + "BAEqBBB8PJ1Qo62GUuy2gDROrqH8BIIE0Byd3Rzee8m9fS7xEV6Z5QM86PEOyziF"
+        + "nzWe8WRrbTN62u9JPAfYvXeeCRdr8QKkvw8mJXUUNHYmwo56ExR/JSJu/vQIl7FN"
+        + "jtGzwQHQtUTNcZuAsiFrZvYq4vAI0wnwmtW/ApQCylbERyZp8DRx3fT90QTAGz9s"
+        + "T9RreOeN8qUj0UY6/8eD3vZJ2sG+QpHK5cv1H++ZhbfgZgR8aaupu6xXKQdTHg7P"
+        + "ors42O7Q40Sk/LvWVHfA2tYPr5QfeB1tyjhSnwx1wExlWb01XvRq1IkP8K4SD4Ss"
+        + "7Smo7SmWprzjIFcpTWXI0MS2sFIzJICxih3eUoWvRYWZk0J8H1qVq4yDke0q9ah7"
+        + "FdCOt2Ah7JPscb+ahGjQjNNWsfC3INSNLABxB3b3RlJLCY9D/hG5a2auDaF/0tXX"
+        + "UhrRfUZhW70Cc345I4hdrX9xze4kSdF5h9Uzzv2OzzFcojM/7CYG3ya2pyMn1CQH"
+        + "B/SY2XqweINrqVRWiBEhD1r/SJ1Sq2uvMp6WmctKKOh6JNErFabxd/GybrcYlhZO"
+        + "a6SnH23xpMonPzAzW43p8C41GDIizUMFvbxvkPFWBbsSJuUUoGvR6sHvKGOLs72Z"
+        + "D0ruInfTeZxD15NX8zd+pZDEyFWVH0sxZjOXouJr3RM28UvLu9uuIoz7+1/p3rns"
+        + "NX7tBV7zDspe5Tsb3t49vtO5wxdGAIAEK+5MrbvuP1w2T6aQYwF5DSzckDeZREGn"
+        + "GjEyTnzFRn/1FTKgfPkBUa8AIl1CbYYNebusVZSoB19+gDCH3oyzF4+Qr5mKpkEF"
+        + "LFbV4Sxvbk8vxNthubcuMXP+QGJA5o6jNfpvM8mGcZR8tO8J7Kq+pKv8AdtkRHuj"
+        + "HVuenB5sdgKR5hJB7cOqQBush+6i+yA4dFWbt1vblABGCueJYw7/czhQx4iO6JEx"
+        + "P2TZaFq7+SuvIdEOB7uMwnPIQFv1ukBcx8eiWspK0qsKeIpqDVwaypJLgqKEOL9U"
+        + "0YRXxeH1XjxBWGipvRhmo4C8NYt9Lwt1FUh9nEwjmXSapaA0zUO2pLpzy3rdIGW9"
+        + "gdRfKvNie0w8jwuvgzMY9t3u04MHyKQ2h1NIOXrOfZk/dOrgpUpRqG1bPhS/El1s"
+        + "cwZglmVX6PU4fItXFkQpR+WxQpVncOlS/e4ac3RYXAq/ch84vQ+vXRaWruNB9nSy"
+        + "y1d/bwJWtF1I0ZWE+nExyWdlUBp89dIrYSFw/cfwark615ROE1akA7wU68Y5K7HO"
+        + "99t4V9NwleGhfQ2mf94QjkfVyszYsrCBqSWhrGYTQ6JoTKquR0Xz6vZnMmUvaUK1"
+        + "Ddv96lmfWBSIJ/urWMSRL75jIH5bYNnx5gAyorXqEKJAtt1yGftZYUXaOOfHvXJc"
+        + "FOlXIGAF9EtmaPnefC9HSTmnrNSJEB9u+hiaXBzVkI2oJG/GM6aLOTdYyMDC8fXw"
+        + "30h0j+cp4IhoYythftmQZ1rz9oVZOZgIQJjViYwPHY2gOE/BZ+bBKjtdZ4cDYOHS"
+        + "9g3DrtexeLpjmWSqITa+x/KV8KWmE0FMcsDauKNVILFs607F9hqd+4azfqhtpT8Q"
+        + "0u84RgoVrmFIajhaNl5+06KVGCRAkmwQkxYHiY8SkuPTo4dh0/9AycqMODL5Zjh6"
+        + "a6MHpGSGG+WXMSUwIwYJKoZIhvcNAQkVMRYEFHO0MZzfOOB5cIRTXZwC/QTUsrLm"
+        + "MEEwMTANBglghkgBZQMEAgEFAAQguefMRfuN/2S1v8baZNWXyR/9lVxdKylJSNnO"
+        + "ULN2mZ4ECN9bsOpidibOAgIIAA==";
 
     public static final String FAKE_PEM_CERTIFICATE =
         "-----BEGIN CERTIFICATE-----\n"
diff --git a/sdk/keyvault/azure-security-keyvault-certificates/swagger/autorest.md b/sdk/keyvault/azure-security-keyvault-certificates/swagger/autorest.md
index 535eb0f0d9fd..077bab94790b 100644
--- a/sdk/keyvault/azure-security-keyvault-certificates/swagger/autorest.md
+++ b/sdk/keyvault/azure-security-keyvault-certificates/swagger/autorest.md
@@ -34,7 +34,7 @@ autorest
 use: '@autorest/java@4.1.22'
 output-folder: ../
 java: true
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a2f6f742d088dcc712e67cb2745d8271eaa370ff/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.5-preview.1/certificates.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/certificates.json
 title: CertificateClient
 namespace: com.azure.security.keyvault.certificates
 models-subpackage: implementation.models
diff --git a/sdk/keyvault/azure-security-keyvault-keys/assets.json b/sdk/keyvault/azure-security-keyvault-keys/assets.json
index f14b27d364ed..31f6f88f48d3 100644
--- a/sdk/keyvault/azure-security-keyvault-keys/assets.json
+++ b/sdk/keyvault/azure-security-keyvault-keys/assets.json
@@ -2,5 +2,5 @@
   "AssetsRepo": "Azure/azure-sdk-assets",
   "AssetsRepoPrefixPath": "java",
   "TagPrefix": "java/keyvault/azure-security-keyvault-keys",
-  "Tag": "java/keyvault/azure-security-keyvault-keys_72fb58ae91"
+  "Tag": "java/keyvault/azure-security-keyvault-keys_d9bef0f806"
 }
diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyServiceVersion.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyServiceVersion.java
index 500375096e3a..c335fdc6e383 100644
--- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyServiceVersion.java
+++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyServiceVersion.java
@@ -37,7 +37,12 @@ public enum KeyServiceVersion implements ServiceVersion {
     /**
      * Service version {@code 7.5}.
      */
-    V7_5("7.5");
+    V7_5("7.5"),
+
+    /**
+     * Service version {@code 7.6-preview.1}.
+     */
+    V7_6_PREVIEW_1("7.6-preview.1");
 
     private final String version;
 
@@ -59,6 +64,6 @@ public String getVersion() {
      * @return the latest {@link KeyServiceVersion}
      */
     public static KeyServiceVersion getLatest() {
-        return V7_5;
+        return V7_6_PREVIEW_1;
     }
 }
diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceVersion.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceVersion.java
index c3694a542c5a..728b1b316463 100644
--- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceVersion.java
+++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceVersion.java
@@ -37,7 +37,12 @@ public enum CryptographyServiceVersion implements ServiceVersion {
     /**
      * Service version {@code 7.5}.
      */
-    V7_5("7.5");
+    V7_5("7.5"),
+
+    /**
+     * Service version {@code 7.6-preview.1}.
+     */
+    V7_6_PREVIEW_1("7.6-preview.1");
 
     private final String version;
 
@@ -59,6 +64,6 @@ public String getVersion() {
      * @return the latest {@link CryptographyServiceVersion}
      */
     public static CryptographyServiceVersion getLatest() {
-        return V7_5;
+        return V7_6_PREVIEW_1;
     }
 }
diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/models/LifetimeActionsType.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/models/LifetimeActionsType.java
index e7465db72a32..da0e6509c80e 100644
--- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/models/LifetimeActionsType.java
+++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/models/LifetimeActionsType.java
@@ -17,7 +17,7 @@
 @Fluent
 public final class LifetimeActionsType implements JsonSerializable {
     /*
-     * The type of the action.
+     * The type of the action. The value should be compared case-insensitively.
      */
     private KeyRotationPolicyAction type;
 
@@ -25,7 +25,7 @@ public final class LifetimeActionsType implements JsonSerializable {
                     assertKeyEquals(keyToCreate, createdKey);
-                    assertEquals("0", createdKey.getProperties().getHsmPlatform());
+
+                    if (!isHsmEnabled) {
+                        assertEquals("0", createdKey.getProperties().getHsmPlatform());
+                    }
                 })
                 .verifyComplete());
     }
@@ -213,14 +216,20 @@ public void getKey(HttpClient httpClient, KeyServiceVersion serviceVersion) {
             StepVerifier.create(keyAsyncClient.createKey(keyToSetAndGet))
                 .assertNext(createdKey -> {
                     assertKeyEquals(keyToSetAndGet, createdKey);
-                    assertEquals("0", createdKey.getProperties().getHsmPlatform());
+
+                    if (!isHsmEnabled) {
+                        assertEquals("0", createdKey.getProperties().getHsmPlatform());
+                    }
                 })
                 .verifyComplete();
 
             StepVerifier.create(keyAsyncClient.getKey(keyToSetAndGet.getName()))
                 .assertNext(retrievedKey -> {
                     assertKeyEquals(keyToSetAndGet, retrievedKey);
-                    assertEquals("0", retrievedKey.getProperties().getHsmPlatform());
+
+                    if (!isHsmEnabled) {
+                        assertEquals("0", retrievedKey.getProperties().getHsmPlatform());
+                    }
                 })
                 .verifyComplete();
         });
diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java
index ae77209705b3..fb8b4c69e83e 100644
--- a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java
+++ b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java
@@ -74,7 +74,10 @@ public void createKey(HttpClient httpClient, KeyServiceVersion serviceVersion) {
             KeyVaultKey createdKey = keyClient.createKey(keyToCreate);
 
             assertKeyEquals(keyToCreate, createdKey);
-            assertEquals("0", createdKey.getProperties().getHsmPlatform());
+
+            if (!isHsmEnabled) {
+                assertEquals("0", createdKey.getProperties().getHsmPlatform());
+            }
         });
     }
 
@@ -196,7 +199,10 @@ public void getKey(HttpClient httpClient, KeyServiceVersion serviceVersion) {
             KeyVaultKey retrievedKey = keyClient.getKey(keyToSetAndGet.getName());
 
             assertKeyEquals(keyToSetAndGet, retrievedKey);
-            assertEquals("0", retrievedKey.getProperties().getHsmPlatform());
+
+            if (!isHsmEnabled) {
+                assertEquals("0", retrievedKey.getProperties().getHsmPlatform());
+            }
         });
     }
 
diff --git a/sdk/keyvault/azure-security-keyvault-keys/swagger/autorest.md b/sdk/keyvault/azure-security-keyvault-keys/swagger/autorest.md
index 14e6cfb2b298..798832d19a67 100644
--- a/sdk/keyvault/azure-security-keyvault-keys/swagger/autorest.md
+++ b/sdk/keyvault/azure-security-keyvault-keys/swagger/autorest.md
@@ -33,7 +33,7 @@ autorest
 use: '@autorest/java@4.1.22'
 output-folder: ../
 java: true
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/551275acb80e1f8b39036b79dfc35a8f63b601a7/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.4/keys.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/keys.json
 title: KeyClient
 namespace: com.azure.security.keyvault.keys
 models-subpackage: implementation.models
diff --git a/sdk/keyvault/azure-security-keyvault-secrets/assets.json b/sdk/keyvault/azure-security-keyvault-secrets/assets.json
index 7acd1df9cf28..2363851274cf 100644
--- a/sdk/keyvault/azure-security-keyvault-secrets/assets.json
+++ b/sdk/keyvault/azure-security-keyvault-secrets/assets.json
@@ -2,5 +2,5 @@
   "AssetsRepo": "Azure/azure-sdk-assets",
   "AssetsRepoPrefixPath": "java",
   "TagPrefix": "java/keyvault/azure-security-keyvault-secrets",
-  "Tag": "java/keyvault/azure-security-keyvault-secrets_28e407b475"
+  "Tag": "java/keyvault/azure-security-keyvault-secrets_5c7c80d234"
 }
diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretServiceVersion.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretServiceVersion.java
index 15f47b6b8e98..8ddee9cb149b 100644
--- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretServiceVersion.java
+++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretServiceVersion.java
@@ -37,7 +37,12 @@ public enum SecretServiceVersion implements ServiceVersion {
     /**
      * Service version {@code 7.5}.
      */
-    V7_5("7.5");
+    V7_5("7.5"),
+
+    /**
+     * Service version {@code 7.6-preview.1}.
+     */
+    V7_6_PREVIEW_1("7.6-preview.1");
 
     private final String version;
 
@@ -59,6 +64,6 @@ public String getVersion() {
      * @return the latest {@link SecretServiceVersion}
      */
     public static SecretServiceVersion getLatest() {
-        return V7_5;
+        return V7_6_PREVIEW_1;
     }
 }
diff --git a/sdk/keyvault/azure-security-keyvault-secrets/swagger/autorest.md b/sdk/keyvault/azure-security-keyvault-secrets/swagger/autorest.md
index 9a355aa4e714..8f4eefa758dc 100644
--- a/sdk/keyvault/azure-security-keyvault-secrets/swagger/autorest.md
+++ b/sdk/keyvault/azure-security-keyvault-secrets/swagger/autorest.md
@@ -33,7 +33,7 @@ autorest
 use: '@autorest/java@4.1.22'
 output-folder: ../
 java: true
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a2f6f742d088dcc712e67cb2745d8271eaa370ff/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.5-preview.1/secrets.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/secrets.json
 title: SecretClient
 namespace: com.azure.security.keyvault.secrets
 models-subpackage: implementation.models
diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md
index c5f9897de936..c83669324abc 100644
--- a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md
+++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md
@@ -1,14 +1,14 @@
 # Release History
 
-## 1.0.0-beta.22 (Unreleased)
-
-### Features Added
-
-### Breaking Changes
+## 1.0.0-beta.22 (2024-05-09)
 
 ### Bugs Fixed
+- [Fix _OTELRESOURCE_ custom metrics with default resources](https://github.com/Azure/azure-sdk-for-java/pull/39380)
 
 ### Other Changes
+- [Update OpenTelemetry to 2.3.0](https://github.com/Azure/azure-sdk-for-java/pull/39843)
+- [Add attach type to sdkVersion](https://github.com/Azure/azure-sdk-for-java/pull/39883)
+- [Emit stable HTTP OTel metrics](https://github.com/Azure/azure-sdk-for-java/pull/39960)
 
 ## 1.0.0-beta.21 (2024-03-11)
 
diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md
index 810e2a5455a2..c3e14134d5dc 100644
--- a/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md
+++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md
@@ -23,7 +23,7 @@ For more information, please read [introduction to Application Insights][applica
 
   com.azure
   azure-monitor-opentelemetry-exporter
-  1.0.0-beta.21/version>
+  1.0.0-beta.22/version>
 
 ```
 [//]: # ({x-version-update-end})
diff --git a/sdk/spring/CHANGELOG.md b/sdk/spring/CHANGELOG.md
index e9cff45da533..8fcdaf273a34 100644
--- a/sdk/spring/CHANGELOG.md
+++ b/sdk/spring/CHANGELOG.md
@@ -1,5 +1,18 @@
 # Release History
 
+## 5.12.0 (2024-05-09)
+- This release is compatible with Spring Boot 3.0.0-3.0.13, 3.1.0-3.1.8, 3.2.0-3.2.5. (Note: 3.0.x (x>13), 3.1.y (y>8) and 3.2.z (z>5) should be supported, but they aren't tested with this release.)
+- This release is compatible with Spring Cloud 2022.0.0-2022.0.5, 2023.0.0-2023.0.1. (Note: 2022.0.x (x>5) and 2023.0.y (y>1) should be supported, but they aren't tested with this release.)
+
+### Spring Cloud Azure Dependencies (BOM)
+
+#### Dependency Updates
+- Upgrade `azure-sdk-bom` to 1.2.23.
+
+### Azure Spring Data Cosmos
+This section includes changes in `azure-spring-data-cosmos` module.
+Please refer to [azure-spring-data-cosmos/CHANGELOG.md](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md#5120-2024-05-09) for more details.
+
 ## 4.18.0 (2024-05-07)
 - This release is compatible with Spring Boot 2.5.0-2.5.15, 2.6.0-2.6.15, 2.7.0-2.7.18. (Note: 2.5.x (x>15), 2.6.y (y>15) and 2.7.z (z>18) should be supported, but they aren't tested with this release.)
 - This release is compatible with Spring Cloud 2020.0.3-2020.0.6, 2021.0.0-2021.0.9. (Note: 2020.0.x (x>6) and 2021.0.y (y>9) should be supported, but they aren't tested with this release.)
diff --git a/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md b/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md
index ee1ac98b5886..f9cf51ba3a31 100644
--- a/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md
+++ b/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md
@@ -10,6 +10,18 @@
 
 #### Other Changes
 
+### 5.12.0 (2024-05-09)
+
+#### Features Added
+* Exposing the `indexQueryMetrics` to the `CosmosConfig` via the `application.properties` configuration file - See [PR 39623](https://github.com/Azure/azure-sdk-for-java/pull/39623).
+
+#### Bugs Fixed
+* Fixed all saveAll/insertAll bulk functionality to populated audit data - See [PR 39811](https://github.com/Azure/azure-sdk-for-java/pull/39811).
+* Fixed `existsById` API in `ReactiveCosmosTemplate` to return `Mono` containing `False` in case the item does not exist - See [PR 40050](https://github.com/Azure/azure-sdk-for-java/pull/40050).
+
+#### Other Changes
+* Updated `azure-cosmos` to version `4.58.0`.
+
 ### 3.45.0 (2024-05-07)
 
 #### Features Added
diff --git a/sdk/spring/spring-reference.yml b/sdk/spring/spring-reference.yml
index 43094715ba6a..f7d3d64cb201 100644
--- a/sdk/spring/spring-reference.yml
+++ b/sdk/spring/spring-reference.yml
@@ -8,12 +8,12 @@
       artifacts:
         - artifactId: spring-cloud-azure-dependencies
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: Bill of Materials (BOM) for Spring Cloud Azure support.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/boms/spring-cloud-azure-dependencies
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/boms/spring-cloud-azure-dependencies
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#bill-of-material-bom
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-dependencies
           dependencyPattern:
@@ -37,32 +37,32 @@
                 
           springProperties:
             starter: false
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-dependencies
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-dependencies
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-dependencies
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-dependencies
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-dependencies
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-dependencies
-                version: 5.11.0
+                version: 5.12.0
 - name: Active Directory
   content:
     - name: Active Directory
@@ -73,8 +73,8 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-active-directory
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter provides the most optimal way to connect your Web
             application to an Azure Active Directory (AAD for short) tenant and protect resource
@@ -82,39 +82,39 @@
             servers.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-active-directory
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-active-directory
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-active-directory
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-active-directory
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/aad/spring-cloud-azure-starter-active-directory/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/aad/spring-cloud-azure-starter-active-directory/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory
-                version: 5.11.0
+                version: 5.12.0
 - name: Active Directory B2C
   content:
     - name: Active Directory B2C
@@ -126,43 +126,43 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-active-directory-b2c
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-active-directory-b2c
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-active-directory-b2c
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-active-directory-b2c-oidc
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-active-directory-b2c
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/aad/spring-cloud-azure-starter-active-directory-b2c/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/aad/spring-cloud-azure-starter-active-directory-b2c/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory-b2c
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory-b2c
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory-b2c
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory-b2c
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory-b2c
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-active-directory-b2c
-                version: 5.11.0
+                version: 5.12.0
 - name: App Configuration
   content:
     - name: App Configuration
@@ -177,86 +177,86 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-appconfiguration
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure App Configuration.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-appconfiguration
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-appconfiguration
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#auto-configure-azure-sdk-clients
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-appconfiguration
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/appconfiguration/spring-cloud-azure-starter-appconfiguration/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/appconfiguration/spring-cloud-azure-starter-appconfiguration/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-cloud-azure-starter-appconfiguration-config
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: Microsoft's Spring Boot Starter helps developers to load properties
             and manage features from Azure App Configuration service for Spring Application.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-appconfiguration-config
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-appconfiguration-config
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-appconfiguration-config
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/appconfiguration/spring-cloud-azure-starter-appconfiguration-config/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/appconfiguration/spring-cloud-azure-starter-appconfiguration-config/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration-config
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration-config
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration-config
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration-config
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration-config
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-appconfiguration-config
-                version: 5.11.0
+                version: 5.12.0
 - name: Cosmos DB
   content:
     - name: Spring Data Cosmos
@@ -272,47 +272,47 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-data-cosmos
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Spring Data Azure Cosmos DB, which enables developers to easily integrate with Azure Cosmos
             DB SQL API using Spring Data.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-data-cosmos
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-data-cosmos
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-cosmos-db
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-data-cosmos
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/cosmos/spring-cloud-azure-starter-data-cosmos/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/cosmos/spring-cloud-azure-starter-data-cosmos/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-data-cosmos
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-data-cosmos
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-data-cosmos
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-data-cosmos
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-data-cosmos
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-data-cosmos
-                version: 5.11.0
+                version: 5.12.0
     - name: Cosmos DB
       description: |-
         Azure Cosmos DB is a fully managed NoSQL database for modern app development.
@@ -323,46 +323,46 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-cosmos
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Cosmos DB, which enables developers to easily integrate with Azure Cosmos DB SQL API.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-cosmos
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-cosmos
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#auto-configure-azure-sdk-clients
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-cosmos
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/cosmos/spring-cloud-azure-starter-cosmos/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/cosmos/spring-cloud-azure-starter-cosmos/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-cosmos
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-cosmos
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-cosmos
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-cosmos
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-cosmos
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-cosmos
-                version: 5.11.0
+                version: 5.12.0
 - name: Key Vault
   content:
     - name: Key Vault
@@ -372,46 +372,46 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-keyvault
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Key Vault.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-keyvault
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-keyvault
             msdocs: https://learn.microsoft.com/azure/key-vault/
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-keyvault
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/keyvault/spring-cloud-azure-starter-keyvault/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/keyvault/spring-cloud-azure-starter-keyvault/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault
-                version: 5.11.0
+                version: 5.12.0
     - name: Key Vault - Certificates
       description: |-
         Azure Key Vault enables Microsoft Azure applications and users to store and use certificates, which are
@@ -423,45 +423,45 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-keyvault-certificates
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Key Vault Certificates.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-keyvault-certificates
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-keyvault-certificates
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-key-vault-certificates
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-keyvault-certificates
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-certificates
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-certificates
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-certificates
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-certificates
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-certificates
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-certificates
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: azure-security-keyvault-jca
           groupId: com.azure
           versionGA: 2.8.0
@@ -485,8 +485,8 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-keyvault-secrets
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Key Vault Secrets, and adds Azure Key Vault as one of Spring PropertySource.
@@ -494,39 +494,39 @@
             externalized configuration property.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-keyvault-secrets
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-keyvault-secrets
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-key-vault
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-keyvault-secrets
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/keyvault/spring-cloud-azure-starter-keyvault-secrets/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/keyvault/spring-cloud-azure-starter-keyvault-secrets/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-secrets
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-secrets
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-secrets
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-secrets
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-secrets
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-keyvault-secrets
-                version: 5.11.0
+                version: 5.12.0
 - name: Storage
   content:
     - name: Storage
@@ -535,47 +535,47 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-storage
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Storage, and implements Spring Resource abstraction for Azure Storage
             service which allows you to interact with Storage Account using Spring programming model.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-storage
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-storage
             msdocs: https://docs.microsoft.com/azure/storage/
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-storage
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/storage/spring-cloud-azure-starter-storage/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/storage/spring-cloud-azure-starter-storage/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage
-                version: 5.11.0
+                version: 5.12.0
     - name: Storage - Blobs
       description: |-
         Azure Blob Storage is Microsoft's object storage solution for the cloud. Blob Storage
@@ -589,47 +589,47 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-storage-blob
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Storage Blob, and implements Spring Resource abstraction for Azure Storage
             service which allows you to interact with Storage Blob using Spring programming model.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-storage-blob
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-storage-blob
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-storage
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-storage-blob
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/storage/spring-cloud-azure-starter-storage-blob/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/storage/spring-cloud-azure-starter-storage-blob/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-blob
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-blob
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-blob
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-blob
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-blob
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-blob
-                version: 5.11.0
+                version: 5.12.0
     - name: Storage - Files Shares
       description: |-
         Azure File Share storage offers fully managed file shares in the cloud that are
@@ -644,47 +644,47 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-storage-file-share
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Storage File Share, and implements Spring Resource abstraction for Azure Storage
             service which allows you to interact with Storage File Share using Spring programming model.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-storage-file-share
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-storage-file-share
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#resource-handling
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-storage-file-share
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/storage/spring-cloud-azure-starter-storage-file-share/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/storage/spring-cloud-azure-starter-storage-file-share/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-file-share
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-file-share
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-file-share
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-file-share
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-file-share
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-file-share
-                version: 5.11.0
+                version: 5.12.0
     - name: Storage - Queues
       description: |-
         Azure Queue Storage is a service for storing large numbers of messages. You access
@@ -699,131 +699,131 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-storage-queue
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Storage Queue.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-storage-queue
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-storage-queue
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#auto-configure-azure-sdk-clients
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-storage-queue
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/storage/spring-cloud-azure-starter-storage-queue/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/storage/spring-cloud-azure-starter-storage-queue/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-queue
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-queue
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-storage-queue
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-cloud-azure-starter-integration-storage-queue
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Spring Integration Azure Storage Queue.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-integration-storage-queue
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-integration-storage-queue
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-integration-storage-queue
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/storage/spring-cloud-azure-starter-integration-storage-queue/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/storage/spring-cloud-azure-starter-integration-storage-queue/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-storage-queue
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-storage-queue
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-storage-queue
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-integration-azure-storage-queue
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Integration extension for Azure Storage Queue. Spring Integration extends
             the Spring programming modoel to support well-known Enterprise Integration Patterns.
           type: spring
           links:
-            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-integration-azure-storage-queue/4.17.0/index.html
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-integration-azure-storage-queue
+            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-integration-azure-storage-queue/4.18.0/index.html
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-integration-azure-storage-queue
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#spring-integration-support
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-integration-azure-storage-queue
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/storage/spring-integration-azure-storage-queue/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/storage/spring-integration-azure-storage-queue/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-storage-queue
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-storage-queue
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-storage-queue
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-storage-queue
-                version: 5.11.0
+                version: 5.12.0
 - name: Service Bus
   content:
     - name: Service Bus
@@ -839,175 +839,175 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-servicebus
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Service Bus.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-servicebus
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-servicebus
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#auto-configure-azure-sdk-clients
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-servicebus
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/servicebus/spring-cloud-azure-starter-servicebus/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/servicebus/spring-cloud-azure-starter-servicebus/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-cloud-azure-starter-integration-servicebus
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Spring Integration Azure Service Bus.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-integration-servicebus
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-integration-servicebus
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-integration-servicebus
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/servicebus/spring-cloud-azure-starter-integration-servicebus/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/servicebus/spring-cloud-azure-starter-integration-servicebus/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-servicebus
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-servicebus
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-servicebus
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-integration-azure-servicebus
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Integration extension for Azure Service Bus. Spring Integration extends
             the Spring programming modoel to support well-known Enterprise Integration Patterns.
           type: spring
           links:
-            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-integration-azure-servicebus/4.17.0/index.html
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-integration-azure-servicebus
+            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-integration-azure-servicebus/4.18.0/index.html
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-integration-azure-servicebus
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#spring-integration-support
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-integration-azure-servicebus
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/servicebus/spring-integration-azure-servicebus/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/servicebus/spring-integration-azure-servicebus/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-servicebus
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-servicebus
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-servicebus
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-cloud-azure-stream-binder-servicebus
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Cloud Stream Binder provides Spring Cloud Stream Binder for Azure
             Service Bus which allows you to build message-driven microservice using Spring Cloud
             Stream based on Azure Service Bus.
           type: spring
           links:
-            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-cloud-azure-stream-binder-servicebus/4.17.0/index.html
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-stream-binder-servicebus
+            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-cloud-azure-stream-binder-servicebus/4.18.0/index.html
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-stream-binder-servicebus
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-cloud-stream-binder-java-app-with-service-bus
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-stream-binder-servicebus
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/servicebus/spring-cloud-azure-stream-binder-servicebus/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/servicebus/spring-cloud-azure-stream-binder-servicebus/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-servicebus
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-servicebus
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-servicebus
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-servicebus
-                version: 5.11.0
+                version: 5.12.0
     - name: Service Bus JMS
       description: |-
         Microsoft Azure Service Bus is a fully managed enterprise integration message broker.
@@ -1018,46 +1018,46 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-servicebus-jms
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Spring JMS with Azure Service Bus Queue and Topic.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-servicebus-jms
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-servicebus-jms
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-servicebus-jms
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/servicebus/spring-cloud-azure-starter-servicebus-jms/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/servicebus/spring-cloud-azure-starter-servicebus-jms/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus-jms
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus-jms
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus-jms
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus-jms
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus-jms
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-servicebus-jms
-                version: 5.11.0
+                version: 5.12.0
 - name: Event Grid
   content:
     - name: Event Grid
@@ -1079,46 +1079,46 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-eventgrid
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Event Grid.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-eventgrid
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-eventgrid
             msdocs: https://learn.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-initializer-java-app-with-event-grid
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-eventgrid
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/eventgrid/spring-cloud-azure-starter-eventgrid/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/eventgrid/spring-cloud-azure-starter-eventgrid/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventgrid
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventgrid
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventgrid
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventgrid
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventgrid
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventgrid
-                version: 5.11.0
+                version: 5.12.0
 - name: Event Hubs
   content:
     - name: Event Hubs
@@ -1134,175 +1134,175 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-eventhubs
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Event Hubs.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-eventhubs
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-eventhubs
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#auto-configure-azure-sdk-clients
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-eventhubs
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/eventhubs/spring-cloud-azure-starter-eventhubs/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/eventhubs/spring-cloud-azure-starter-eventhubs/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventhubs
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventhubs
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-eventhubs
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-cloud-azure-starter-integration-eventhubs
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Spring Integration Azure Event Hubs.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-integration-eventhubs
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-integration-eventhubs
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-integration-eventhubs
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/eventhubs/spring-cloud-azure-starter-integration-eventhubs/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/eventhubs/spring-cloud-azure-starter-integration-eventhubs/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-eventhubs
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-eventhubs
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-integration-eventhubs
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-integration-azure-eventhubs
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Integration extension for Azure Event Hubs. Spring Integration extends
             the Spring programming modoel to support well-known Enterprise Integration Patterns.
           type: spring
           links:
-            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-integration-azure-eventhubs/4.17.0/index.html
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-integration-azure-eventhubs
+            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-integration-azure-eventhubs/4.18.0/index.html
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-integration-azure-eventhubs
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#spring-integration-support
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-integration-azure-eventhubs
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/eventhubs/spring-integration-azure-eventhubs/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/eventhubs/spring-integration-azure-eventhubs/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-eventhubs
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-eventhubs
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-integration-azure-eventhubs
-                version: 5.11.0
+                version: 5.12.0
         - artifactId: spring-cloud-azure-stream-binder-eventhubs
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Cloud Stream Binder provides Spring Cloud Stream Binder for Azure
             Event Hubs which allows you to build message-driven microservice using Spring Cloud
             Stream based on Azure Event Hubs.
           type: spring
           links:
-            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-cloud-azure-stream-binder-eventhubs/4.17.0/index.html
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-stream-binder-eventhubs
+            javadoc: https://azuresdkdocs.blob.core.windows.net/$web/java/spring-cloud-azure-stream-binder-eventhubs/4.18.0/index.html
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-stream-binder-eventhubs
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#spring-cloud-stream-binder-for-azure-event-hubs
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-stream-binder-eventhubs
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/eventhubs/spring-cloud-azure-stream-binder-eventhubs/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/eventhubs/spring-cloud-azure-stream-binder-eventhubs/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-eventhubs
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-eventhubs
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-eventhubs
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-stream-binder-eventhubs
-                version: 5.11.0
+                version: 5.12.0
 - name: MySQL
   content:
     - name: Database for MySQL
@@ -1314,46 +1314,46 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-jdbc-mysql
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Database for MySQL.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-jdbc-mysql
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-jdbc-mysql
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#auto-configure-azure-sdk-clients
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-jdbc-mysql
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/mysql/spring-cloud-azure-starter-jdbc-mysql/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/mysql/spring-cloud-azure-starter-jdbc-mysql/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-mysql
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-mysql
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-mysql
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-mysql
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-mysql
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-mysql
-                version: 5.11.0
+                version: 5.12.0
 - name: PostgreSQL
   content:
     - name: Database for PostgreSQL
@@ -1365,43 +1365,43 @@
       artifacts:
         - artifactId: spring-cloud-azure-starter-jdbc-postgresql
           groupId: com.azure.spring
-          versionGA: 4.17.0
-          versionPreview: 5.11.0
+          versionGA: 4.18.0
+          versionPreview: 5.12.0
           description: |-
             Microsoft's Spring Boot Starter helps developers to finish the auto-configuration of
             Azure Database for PostgreSQL.
           type: spring
           links:
-            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.17.0/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql
+            github: https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure_4.18.0/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql
             msdocs: https://docs.microsoft.com/azure/developer/java/spring-framework/spring-cloud-azure#auto-configure-azure-sdk-clients
             repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-jdbc-postgresql
-            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.17.0/postgresql/spring-cloud-azure-starter-jdbc-postgresql/
+            sample: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_4.18.0/postgresql/spring-cloud-azure-starter-jdbc-postgresql/
           springProperties:
             starter: true
             bom: spring-cloud-azure-dependencies
-            compatibilityRange: "[2.5.0,3.2.4]"
+            compatibilityRange: "[2.5.0,3.2.5]"
             mappings:
               - compatibilityRange: "[2.5.0,2.5.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-postgresql
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.6.0,2.6.15]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-postgresql
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[2.7.0,2.7.18]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-postgresql
-                version: 4.17.0
+                version: 4.18.0
               - compatibilityRange: "[3.0.0,3.0.13]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-postgresql
-                version: 5.11.0
-              - compatibilityRange: "[3.1.0,3.1.10]"
+                version: 5.12.0
+              - compatibilityRange: "[3.1.0,3.1.11]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-postgresql
-                version: 5.11.0
-              - compatibilityRange: "[3.2.0,3.2.4]"
+                version: 5.12.0
+              - compatibilityRange: "[3.2.0,3.2.5]"
                 groupId: com.azure.spring
                 artifactId: spring-cloud-azure-starter-jdbc-postgresql
-                version: 5.11.0
+                version: 5.12.0

From 4055fe8ab61d8e46d0526d16e06857e287f45df4 Mon Sep 17 00:00:00 2001
From: Aayush Kataria 
Date: Tue, 14 May 2024 14:30:56 -0700
Subject: [PATCH 25/28] Fixing merge issues

---
 .../azure/cosmos/implementation/Configs.java  |  15 -
 .../CosmosQueryRequestOptionsImpl.java        |  22 --
 .../DocumentQueryExecutionContextFactory.java |  34 +--
 ...onStreamingOrderByBadRequestException.java |  20 --
 .../NonStreamingOrderByDocumentProducer.java  |  43 ---
 ...gOrderByDocumentQueryExecutionContext.java | 268 ------------------
 .../query/NonStreamingOrderByUtils.java       | 114 --------
 ...ParallelDocumentQueryExecutionContext.java |   3 +-
 ...ipelinedDocumentQueryExecutionContext.java |  21 +-
 .../PipelinedQueryExecutionContextBase.java   |   3 +-
 .../implementation/query/QueryFeature.java    |   3 +-
 .../implementation/query/QueryInfo.java       |   6 -
 .../query/QueryPlanRetriever.java             |   3 +-
 .../models/CosmosQueryRequestOptions.java     |  20 --
 .../cosmos/models/ModelBridgeInternal.java    |   7 +-
 .../azure-messaging-servicebus/CHANGELOG.md   |   3 -
 16 files changed, 12 insertions(+), 573 deletions(-)
 delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByBadRequestException.java
 delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentProducer.java
 delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java
 delete mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java

diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java
index c643379b2fe6..da368de5360d 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java
@@ -166,13 +166,6 @@ public class Configs {
     public static final String MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED = "COSMOS.MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED";
     private static final int DEFAULT_MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED = 1;
 
-    private static final String MAX_ITEM_SIZE_FOR_VECTOR_SEARCH = "COSMOS.MAX_ITEM_SIZE_FOR_VECTOR_SEARCH";
-    private static final int DEFAULT_MAX_ITEM_SIZE_FOR_VECTOR_SEARCH = 50000;
-
-    private static final String MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED = "COSMOS.MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED";
-
-    private static final boolean DEFAULT_MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED = true;
-
     public static final int MIN_MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED = 1;
 
     public static final String TCP_CONNECTION_ACQUISITION_TIMEOUT_IN_MS = "COSMOS.TCP_CONNECTION_ACQUISITION_TIMEOUT_IN_MS";
@@ -491,14 +484,6 @@ public static int getMaxRetriesInLocalRegionWhenRemoteRegionPreferred() {
                 MIN_MAX_RETRIES_IN_LOCAL_REGION_WHEN_REMOTE_REGION_PREFERRED);
     }
 
-    public static int getMaxItemSizeForVectorSearch() {
-        return getJVMConfigAsInt(MAX_ITEM_SIZE_FOR_VECTOR_SEARCH, DEFAULT_MAX_ITEM_SIZE_FOR_VECTOR_SEARCH);
-    }
-
-    public static boolean getMaxItemSizeForVectorSearchEnabled() {
-        return getJVMConfigAsBoolean(MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED, DEFAULT_MAX_ITEM_SIZE_FOR_VECTOR_SEARCH_ENABLED);
-    }
-
     public static Duration getMinRetryTimeInLocalRegionWhenRemoteRegionPreferred() {
         return
             Duration.ofMillis(Math.max(
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java
index 6d7b00068393..4dc62089acc5 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsImpl.java
@@ -25,7 +25,6 @@ public final class CosmosQueryRequestOptionsImpl extends CosmosQueryRequestOptio
     private boolean queryPlanRetrievalDisallowed;
     private boolean emptyPageDiagnosticsEnabled;
     private String queryName;
-    private Integer maxItemSizeForVectorSearch;
     private List cancelledRequestDiagnosticsTracker = new ArrayList<>();
 
     /**
@@ -63,7 +62,6 @@ public CosmosQueryRequestOptionsImpl(CosmosQueryRequestOptionsImpl options) {
         this.queryName = options.queryName;
         this.feedRange = options.feedRange;
         this.cancelledRequestDiagnosticsTracker = options.cancelledRequestDiagnosticsTracker;
-        this.maxItemSizeForVectorSearch = options.maxItemSizeForVectorSearch;
     }
 
     /**
@@ -198,26 +196,6 @@ public CosmosQueryRequestOptionsImpl setMaxItemCount(Integer maxItemCount) {
         return this;
     }
 
-    /**
-     * Gets the maximum item size to fetch during non-streaming order by queries.
-     *
-     * @return the max number of items for vector search.
-     */
-    public Integer getMaxItemSizeForVectorSearch() {
-        return this.maxItemSizeForVectorSearch;
-    }
-
-    /**
-     * Sets the maximum item size to fetch during non-streaming order by queries.
-     *
-     * @param maxItemSizeForVectorSearch the max number of items for vector search.
-     * return the CosmosQueryRequestOptions.
-     */
-    public CosmosQueryRequestOptionsImpl setMaxItemSizeForVectorSearch(Integer maxItemSizeForVectorSearch) {
-        this.maxItemSizeForVectorSearch = maxItemSizeForVectorSearch;
-        return this;
-    }
-
     /**
      * Gets the request continuation token.
      *
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java
index 7a530816856b..c9f1c19cb126 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java
@@ -241,8 +241,7 @@ private static boolean canCacheQuery(QueryInfo queryInfo) {
                    && !queryInfo.hasTop()
                    && !queryInfo.hasOffset()
                    && !queryInfo.hasDCount()
-                   && !queryInfo.hasOrderBy()
-                   && !queryInfo.hasNonStreamingOrderBy();
+                   && !queryInfo.hasOrderBy();
     }
 
     private static boolean isScopedToSinglePartition(CosmosQueryRequestOptions cosmosQueryRequestOptions) {
@@ -361,37 +360,6 @@ public static  Flux> createSpecia
 
         boolean getLazyFeedResponse = queryInfo.hasTop();
 
-        // We need to compute the optimal initial age size for non-streaming order-by queries
-        if (queryInfo.hasNonStreamingOrderBy() && Configs.getMaxItemSizeForVectorSearchEnabled()) {
-            // Validate the TOP or LIMIT for non-streaming order-by queries
-            if (!queryInfo.hasTop() && !queryInfo.hasLimit() && queryInfo.getTop() < 0 && queryInfo.getLimit() < 0) {
-                throw new NonStreamingOrderByBadRequestException(HttpConstants.StatusCodes.BADREQUEST,
-                    "Executing a vector search query without TOP or LIMIT can consume a large number of RUs" +
-                        "very fast and have long runtimes. Please ensure you are using one of the above two filters" +
-                        "with you vector search query.");
-            }
-            // Validate the size of TOP or LIMIT against MaxItemSizeForVectorSearch
-            int maxLimit = Math.max(queryInfo.hasTop() ? queryInfo.getTop() : 0,
-                queryInfo.hasLimit() ? queryInfo.getLimit() : 0);
-            int maxItemSizeForVectorSearch = Math.max(Configs.getMaxItemSizeForVectorSearch(),
-                ModelBridgeInternal.getMaxItemSizeForVectorSearchFromQueryRequestOptions(cosmosQueryRequestOptions));
-            if (maxLimit > maxItemSizeForVectorSearch) {
-                throw new NonStreamingOrderByBadRequestException(HttpConstants.StatusCodes.BADREQUEST,
-                    "Executing a vector search query with TOP or LIMIT larger than the maxItemSizeForVectorSearch " +
-                        "is not allowed");
-            }
-            // Set initialPageSize based on the smallest of TOP or LIMIT
-            if (queryInfo.hasTop() || queryInfo.hasLimit()) {
-                int pageSizeWithTopOrLimit = Math.min(queryInfo.hasTop() ? queryInfo.getTop() : Integer.MAX_VALUE,
-                                           queryInfo.hasLimit() ? queryInfo.getLimit() : Integer.MAX_VALUE);
-                if (initialPageSize > 0) {
-                    initialPageSize = Math.min(pageSizeWithTopOrLimit, initialPageSize);
-                } else {
-                    initialPageSize = pageSizeWithTopOrLimit;
-                }
-            }
-        }
-
         // We need to compute the optimal initial page size for order-by queries
         if (queryInfo.hasOrderBy()) {
             int top;
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByBadRequestException.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByBadRequestException.java
deleted file mode 100644
index 4b3b41fbc675..000000000000
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByBadRequestException.java
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-package com.azure.cosmos.implementation.query;
-
-import com.azure.cosmos.CosmosException;
-
-public class NonStreamingOrderByBadRequestException extends CosmosException {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Creates a new instance of the NonStreamingOrderByBadRequestException class.
-     *
-     * @param statusCode the http status code of the response.
-     * @param errorMessage the error message.
-     */
-    public NonStreamingOrderByBadRequestException(int statusCode, String errorMessage) {
-        super(statusCode, errorMessage);
-    }
-}
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentProducer.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentProducer.java
deleted file mode 100644
index c64ef5d1fbda..000000000000
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentProducer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-package com.azure.cosmos.implementation.query;
-
-import com.azure.cosmos.implementation.Document;
-import com.azure.cosmos.implementation.DocumentClientRetryPolicy;
-import com.azure.cosmos.implementation.RxDocumentServiceRequest;
-import com.azure.cosmos.implementation.feedranges.FeedRangeEpkImpl;
-import com.azure.cosmos.implementation.query.orderbyquery.OrderbyRowComparer;
-import com.azure.cosmos.models.CosmosQueryRequestOptions;
-import com.azure.cosmos.models.FeedResponse;
-import reactor.core.publisher.Mono;
-
-import java.util.UUID;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-public class NonStreamingOrderByDocumentProducer extends DocumentProducer {
-    private final OrderbyRowComparer consumeComparer;
-
-    NonStreamingOrderByDocumentProducer(
-        OrderbyRowComparer consumeComparer,
-        IDocumentQueryClient client,
-        String collectionResourceId,
-        CosmosQueryRequestOptions cosmosQueryRequestOptions,
-        TriFunction createRequestFunc,
-        Function>> executeRequestFunc,
-        FeedRangeEpkImpl feedRange,
-        String collectionLink,
-        Supplier createRetryPolicyFunc,
-        Class resourceType,
-        UUID correlatedActivityId,
-        int initialPageSize,
-        String initialContinuationToken,
-        int top,
-        Supplier operationContextTextProvider) {
-        super(client, collectionResourceId, cosmosQueryRequestOptions, createRequestFunc, executeRequestFunc,
-            collectionLink, createRetryPolicyFunc, resourceType, correlatedActivityId, initialPageSize,
-            initialContinuationToken, top, feedRange, operationContextTextProvider);
-        this.consumeComparer = consumeComparer;
-    }
-}
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java
deleted file mode 100644
index 2f3abb36e9d1..000000000000
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByDocumentQueryExecutionContext.java
+++ /dev/null
@@ -1,268 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-package com.azure.cosmos.implementation.query;
-
-import com.azure.cosmos.BridgeInternal;
-import com.azure.cosmos.CosmosException;
-import com.azure.cosmos.implementation.ClientSideRequestStatistics;
-import com.azure.cosmos.implementation.DiagnosticsClientContext;
-import com.azure.cosmos.implementation.Document;
-import com.azure.cosmos.implementation.DocumentClientRetryPolicy;
-import com.azure.cosmos.implementation.DocumentCollection;
-import com.azure.cosmos.implementation.HttpConstants;
-import com.azure.cosmos.implementation.ImplementationBridgeHelpers;
-import com.azure.cosmos.implementation.QueryMetrics;
-import com.azure.cosmos.implementation.RequestChargeTracker;
-import com.azure.cosmos.implementation.ResourceType;
-import com.azure.cosmos.implementation.RxDocumentServiceRequest;
-import com.azure.cosmos.implementation.Utils;
-import com.azure.cosmos.implementation.feedranges.FeedRangeEpkImpl;
-import com.azure.cosmos.implementation.query.orderbyquery.OrderByRowResult;
-import com.azure.cosmos.implementation.query.orderbyquery.OrderbyRowComparer;
-import com.azure.cosmos.models.CosmosQueryRequestOptions;
-import com.azure.cosmos.models.FeedResponse;
-import com.azure.cosmos.models.ModelBridgeInternal;
-import com.azure.cosmos.models.SqlQuerySpec;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Function;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-
-public class NonStreamingOrderByDocumentQueryExecutionContext
-    extends ParallelDocumentQueryExecutionContextBase {
-
-    private final static
-    ImplementationBridgeHelpers.CosmosDiagnosticsHelper.CosmosDiagnosticsAccessor diagnosticsAccessor =
-        ImplementationBridgeHelpers.CosmosDiagnosticsHelper.getCosmosDiagnosticsAccessor();
-
-    private static final ImplementationBridgeHelpers.FeedResponseHelper.FeedResponseAccessor feedResponseAccessor =
-        ImplementationBridgeHelpers.FeedResponseHelper.getFeedResponseAccessor();
-
-    private final static String FormatPlaceHolder = "{documentdb-formattableorderbyquery-filter}";
-    private final static String True = "true";
-
-    private final OrderbyRowComparer consumeComparer;
-    private final RequestChargeTracker tracker;
-    private final ConcurrentMap queryMetricMap;
-    private final Collection clientSideRequestStatistics;
-    private Flux> orderByObservable;
-
-    private int maxPageSizePerPartition;
-
-    public NonStreamingOrderByDocumentQueryExecutionContext(
-        DiagnosticsClientContext diagnosticsClientContext,
-        IDocumentQueryClient client,
-        ResourceType resourceTypeEnum,
-        SqlQuerySpec query,
-        CosmosQueryRequestOptions cosmosQueryRequestOptions,
-        String resourceLink,
-        String rewrittenQuery,
-        OrderbyRowComparer consumeComparer,
-        UUID correlatedActivityId,
-        boolean hasSelectValue,
-        final AtomicBoolean isQueryCancelledOnTimeout) {
-        super(diagnosticsClientContext, client, resourceTypeEnum, Document.class, query, cosmosQueryRequestOptions,
-            resourceLink, rewrittenQuery, correlatedActivityId, hasSelectValue, isQueryCancelledOnTimeout);
-        this.consumeComparer = consumeComparer;
-        this.tracker = new RequestChargeTracker();
-        this.queryMetricMap = new ConcurrentHashMap<>();
-        this.clientSideRequestStatistics = ConcurrentHashMap.newKeySet();
-    }
-
-    public static Flux> createAsync(
-        DiagnosticsClientContext diagnosticsClientContext,
-        IDocumentQueryClient client,
-        PipelinedDocumentQueryParams initParams,
-        DocumentCollection collection) {
-
-        QueryInfo queryInfo = initParams.getQueryInfo();
-
-        NonStreamingOrderByDocumentQueryExecutionContext context = new NonStreamingOrderByDocumentQueryExecutionContext(
-            diagnosticsClientContext,
-            client,
-            initParams.getResourceTypeEnum(),
-            initParams.getQuery(),
-            initParams.getCosmosQueryRequestOptions(),
-            initParams.getResourceLink(),
-            initParams.getQueryInfo().getRewrittenQuery(),
-            new OrderbyRowComparer<>(queryInfo.getOrderBy()),
-            initParams.getCorrelatedActivityId(),
-            queryInfo.hasSelectValue(),
-            initParams.isQueryCancelledOnTimeout());
-
-        context.setTop(initParams.getTop());
-
-        try {
-            context.initialize(
-                initParams.getFeedRanges(),
-                initParams.getQueryInfo().getOrderBy(),
-                initParams.getQueryInfo().getOrderByExpressions(),
-                initParams.getInitialPageSize(),
-                collection);
-
-            return Flux.just(context);
-        } catch (CosmosException dce) {
-            return Flux.error(dce);
-        }
-    }
-
-    private void initialize(
-        List feedRanges, List sortOrders,
-        Collection orderByExpressions,
-        int initialPageSize,
-        DocumentCollection collection) throws CosmosException {
-        // Since the continuation token will always be null,
-        // we don't need to handle any initialization based on continuationToken.
-        // We can directly initialize without any consideration for continuationToken.
-        Map partitionKeyRangeToContinuationToken = new HashMap<>();
-        for (FeedRangeEpkImpl feedRangeEpk : feedRanges) {
-            partitionKeyRangeToContinuationToken.put(feedRangeEpk,
-                null);
-        }
-        super.initialize(collection,
-            partitionKeyRangeToContinuationToken,
-            initialPageSize,
-            new SqlQuerySpec(querySpec.getQueryText().replace(FormatPlaceHolder, True),
-                querySpec.getParameters()));
-
-        orderByObservable = NonStreamingOrderByUtils.nonStreamingOrderedMerge(
-            consumeComparer,
-            tracker,
-            documentProducers,
-            initialPageSize,
-            queryMetricMap,
-            clientSideRequestStatistics);
-    }
-
-    @Override
-    protected NonStreamingOrderByDocumentProducer createDocumentProducer(
-        String collectionRid,
-        String continuationToken,
-        int initialPageSize,
-        CosmosQueryRequestOptions cosmosQueryRequestOptions,
-        SqlQuerySpec querySpecForInit,
-        Map commonRequestHeaders,
-        TriFunction createRequestFunc,
-        Function>> executeFunc,
-        Supplier createRetryPolicyFunc,
-        FeedRangeEpkImpl feedRange) {
-        return new NonStreamingOrderByDocumentProducer(
-            consumeComparer,
-            client,
-            collectionRid,
-            cosmosQueryRequestOptions,
-            createRequestFunc,
-            executeFunc,
-            feedRange,
-            collectionRid,
-            createRetryPolicyFunc,
-            Document.class,
-            correlatedActivityId,
-            maxPageSizePerPartition,
-            continuationToken,
-            top,
-            this.getOperationContextTextProvider());
-    }
-
-    @Override
-    public Flux> drainAsync(int maxPageSize) {
-        return this.orderByObservable.transformDeferred(new ItemToPageTransformer(tracker,
-            maxPageSize,
-            this.queryMetricMap,
-            this.clientSideRequestStatistics));
-    }
-
-    @Override
-    public Flux> executeAsync() {
-        return drainAsync(ModelBridgeInternal.getMaxItemCountFromQueryRequestOptions(cosmosQueryRequestOptions));
-    }
-
-    private static class ItemToPageTransformer implements
-        Function>, Flux>> {
-        private final static int DEFAULT_PAGE_SIZE = 100;
-        private final RequestChargeTracker tracker;
-        private final int maxPageSize;
-        private final ConcurrentMap queryMetricMap;
-        private final Collection clientSideRequestStatistics;
-
-        public ItemToPageTransformer(RequestChargeTracker tracker,
-                                     int maxPageSize,
-                                     ConcurrentMap queryMetricsMap,
-                                     Collection clientSideRequestStatistics) {
-            this.tracker = tracker;
-            this.maxPageSize = maxPageSize > 0 ? maxPageSize : DEFAULT_PAGE_SIZE;
-            this.queryMetricMap = queryMetricsMap;
-            this.clientSideRequestStatistics = clientSideRequestStatistics;
-        }
-
-        private static Map headerResponse(double requestCharge) {
-            return Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, String.valueOf(requestCharge));
-        }
-
-        @Override
-        public Flux> apply(Flux> source) {
-            return source
-                .window(maxPageSize).map(Flux::collectList)
-                .flatMap(resultListObs -> resultListObs, 1)
-                .map(orderByRowResults -> {
-                    // construct a page from result with request charge
-                    FeedResponse> feedResponse = feedResponseAccessor.createFeedResponse(
-                        orderByRowResults,
-                        headerResponse(tracker.getAndResetCharge()),
-                        null);
-                    if (!queryMetricMap.isEmpty()) {
-                        for (Map.Entry entry : queryMetricMap.entrySet()) {
-                            BridgeInternal.putQueryMetricsIntoMap(feedResponse,
-                                entry.getKey(),
-                                entry.getValue());
-                        }
-                    }
-                    return feedResponse;
-                })
-                .concatWith(Flux.defer(() -> {
-                    return Flux.just(feedResponseAccessor.createFeedResponse(Utils.immutableListOf(),
-                        null, null));
-                }))
-                .map(feedOfOrderByRowResults -> {
-                    List unwrappedResults = new ArrayList<>();
-                    for (OrderByRowResult orderByRowResult : feedOfOrderByRowResults.getResults()) {
-                        unwrappedResults.add(orderByRowResult.getPayload());
-                    }
-                    FeedResponse feedResponse = BridgeInternal.createFeedResponseWithQueryMetrics(unwrappedResults,
-                        feedOfOrderByRowResults.getResponseHeaders(),
-                        BridgeInternal.queryMetricsFromFeedResponse(feedOfOrderByRowResults),
-                        ModelBridgeInternal.getQueryPlanDiagnosticsContext(feedOfOrderByRowResults),
-                        false,
-                        false, feedOfOrderByRowResults.getCosmosDiagnostics());
-                    diagnosticsAccessor.addClientSideDiagnosticsToFeed(
-                        feedResponse.getCosmosDiagnostics(), clientSideRequestStatistics);
-                    return feedResponse;
-                }).switchIfEmpty(Flux.defer(() -> {
-                    // create an empty page if there is no result
-                    FeedResponse frp = BridgeInternal.createFeedResponseWithQueryMetrics(Utils.immutableListOf(),
-                        headerResponse(
-                            tracker.getAndResetCharge()),
-                        queryMetricMap,
-                        null,
-                        false,
-                        false,
-                        null);
-                    diagnosticsAccessor.addClientSideDiagnosticsToFeed(
-                        frp.getCosmosDiagnostics(), clientSideRequestStatistics);
-                    return Flux.just(frp);
-                }));
-        }
-    }
-}
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java
deleted file mode 100644
index b4ac33a1dbc2..000000000000
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/NonStreamingOrderByUtils.java
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-package com.azure.cosmos.implementation.query;
-
-import com.azure.cosmos.BridgeInternal;
-import com.azure.cosmos.implementation.ClientSideRequestStatistics;
-import com.azure.cosmos.implementation.Configs;
-import com.azure.cosmos.implementation.Document;
-import com.azure.cosmos.implementation.ImplementationBridgeHelpers;
-import com.azure.cosmos.implementation.QueryMetrics;
-import com.azure.cosmos.implementation.RequestChargeTracker;
-import com.azure.cosmos.implementation.Resource;
-import com.azure.cosmos.implementation.query.orderbyquery.OrderByRowResult;
-import com.azure.cosmos.implementation.query.orderbyquery.OrderbyRowComparer;
-import reactor.core.publisher.Flux;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.PriorityBlockingQueue;
-import java.util.function.Function;
-
-public class NonStreamingOrderByUtils {
-    private final static
-    ImplementationBridgeHelpers.CosmosDiagnosticsHelper.CosmosDiagnosticsAccessor diagnosticsAccessor =
-        ImplementationBridgeHelpers.CosmosDiagnosticsHelper.getCosmosDiagnosticsAccessor();
-
-    public static  Flux> nonStreamingOrderedMerge(OrderbyRowComparer consumeComparer,
-                                                                                                 RequestChargeTracker tracker,
-                                                                                                 List> documentProducers,
-                                                                                                 int initialPageSize,
-                                                                                                 Map queryMetricsMap,
-                                                                                                 Collection clientSideRequestStatistics) {
-        @SuppressWarnings("unchecked")
-        Flux>[] fluxes = documentProducers
-            .subList(0, documentProducers.size())
-            .stream()
-            .map(producer ->
-                toNonStreamingOrderByQueryResultObservable(producer, tracker, queryMetricsMap, initialPageSize,
-                    consumeComparer, clientSideRequestStatistics))
-            .toArray(Flux[]::new);
-        return Flux.mergeComparingDelayError(1,consumeComparer, fluxes);
-    }
-
-    private static Flux> toNonStreamingOrderByQueryResultObservable(DocumentProducer producer,
-                                                                                               RequestChargeTracker tracker,
-                                                                                               Map queryMetricsMap,
-                                                                                               int initialPageSize,
-                                                                                               OrderbyRowComparer consumeComparer,
-                                                                                               Collection clientSideRequestStatisticsList) {
-        return producer
-            .produceAsync()
-            .transformDeferred(new NonStreamingOrderByUtils.PageToItemTransformer(tracker, queryMetricsMap, initialPageSize,
-                consumeComparer, clientSideRequestStatisticsList));
-    }
-
-    private static class PageToItemTransformer implements
-        Function.DocumentProducerFeedResponse>, Flux>> {
-        private final RequestChargeTracker tracker;
-        private final Map queryMetricsMap;
-        private final Integer initialPageSize;
-        private final OrderbyRowComparer consumeComparer;
-        private final Collection clientSideRequestStatistics;
-
-        private PageToItemTransformer(RequestChargeTracker tracker, Map queryMetricsMap,
-                                      Integer initialPageSize, OrderbyRowComparer consumeComparer,
-                                      Collection clientSideRequestStatistics) {
-            this.tracker = tracker;
-            this.queryMetricsMap = queryMetricsMap;
-            this.initialPageSize = initialPageSize;
-            this.consumeComparer = consumeComparer;
-            this.clientSideRequestStatistics = clientSideRequestStatistics;
-        }
-
-        @Override
-        public Flux> apply(Flux.DocumentProducerFeedResponse> source) {
-            // the size of the priority queue is set to size+1, because when the pq reaches the max size we add that
-            // item and then remove the element. If we don't do this, then when adding this element the size of the pq
-            // will be increased automatically by 50% and then there would be inconsistent results for later pages.
-            PriorityBlockingQueue> priorityQueue = new PriorityBlockingQueue<>(initialPageSize + 1, consumeComparer);
-
-            return source.flatMap(documentProducerFeedResponse -> {
-                    clientSideRequestStatistics.addAll(
-                        diagnosticsAccessor.getClientSideRequestStatisticsForQueryPipelineAggregations(documentProducerFeedResponse
-                            .pageResult.getCosmosDiagnostics()));
-
-                    QueryMetrics.mergeQueryMetricsMap(queryMetricsMap,
-                        BridgeInternal.queryMetricsFromFeedResponse(documentProducerFeedResponse.pageResult));
-                    List results = documentProducerFeedResponse.pageResult.getResults();
-                    results.forEach(r -> {
-                        OrderByRowResult orderByRowResult = new OrderByRowResult(
-                            r.toJson(),
-                            documentProducerFeedResponse.sourceFeedRange,
-                            null);
-                        if (Configs.getMaxItemSizeForVectorSearchEnabled()) {
-                            if (priorityQueue.size() < initialPageSize) {
-                                priorityQueue.add(orderByRowResult);
-                            } else {
-                                priorityQueue.add(orderByRowResult);
-                                priorityQueue.poll();
-                            }
-                        } else {
-                            priorityQueue.add(orderByRowResult);
-                        }
-
-                    });
-                    tracker.addCharge(documentProducerFeedResponse.pageResult.getRequestCharge());
-                    // Returning an empty Flux since we are only processing and managing state here
-                    return Flux.empty();
-                }, 1)
-                .thenMany(Flux.defer(() -> Flux.fromIterable(priorityQueue)));
-        }
-    }
-}
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java
index 6ed30d3a7fbe..020b8633d2be 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java
@@ -106,8 +106,7 @@ public static  Flux> createAsync(
                         || queryInfo.hasAggregates()
                         || queryInfo.hasGroupBy()
                         || queryInfo.hasDCount()
-                        || queryInfo.hasDistinct()
-                        || queryInfo.hasNonStreamingOrderBy()),
+                        || queryInfo.hasDistinct()),
                 initParams.isQueryCancelledOnTimeout());
         context.setTop(initParams.getTop());
 
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
index 82746ad412b5..3f3e1795ac6b 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
@@ -56,21 +56,12 @@ private static BiFunction, Flux {
                 CosmosQueryRequestOptions orderByCosmosQueryRequestOptions =
                     qryOptAccessor.clone(requestOptions);
-                if (queryInfo.hasNonStreamingOrderBy()) {
-                    if (continuationToken != null) {
-                        throw new NonStreamingOrderByBadRequestException(
-                            HttpConstants.StatusCodes.BADREQUEST,
-                            "Can not use a continuation token for a vector search query");
-                    }
-                    qryOptAccessor.getImpl(orderByCosmosQueryRequestOptions).setCustomItemSerializer(null);
-                    documentQueryParams.setCosmosQueryRequestOptions(orderByCosmosQueryRequestOptions);
-                    return NonStreamingOrderByDocumentQueryExecutionContext.createAsync(diagnosticsClientContext, client, documentQueryParams, collection);
-                } else {
-                    ModelBridgeInternal.setQueryRequestOptionsContinuationToken(orderByCosmosQueryRequestOptions, continuationToken);
-                    qryOptAccessor.getImpl(orderByCosmosQueryRequestOptions).setCustomItemSerializer(null);
-                    documentQueryParams.setCosmosQueryRequestOptions(orderByCosmosQueryRequestOptions);
-                    return OrderByDocumentQueryExecutionContext.createAsync(diagnosticsClientContext, client, documentQueryParams, collection);
-                }
+                ModelBridgeInternal.setQueryRequestOptionsContinuationToken(orderByCosmosQueryRequestOptions, continuationToken);
+                qryOptAccessor.getImpl(orderByCosmosQueryRequestOptions).setCustomItemSerializer(null);
+
+                documentQueryParams.setCosmosQueryRequestOptions(orderByCosmosQueryRequestOptions);
+
+                return OrderByDocumentQueryExecutionContext.createAsync(diagnosticsClientContext, client, documentQueryParams, collection);
             };
         } else {
 
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContextBase.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContextBase.java
index 39c6c27efad8..232f942b8590 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContextBase.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContextBase.java
@@ -63,8 +63,7 @@ public static  Flux> createAsync(
             || queryInfo.hasAggregates()
             || queryInfo.hasGroupBy()
             || queryInfo.hasDCount()
-            || queryInfo.hasDistinct()
-            || queryInfo.hasNonStreamingOrderBy()) {
+            || queryInfo.hasDistinct()) {
 
             return PipelinedDocumentQueryExecutionContext.createAsyncCore(
                 diagnosticsClientContext,
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryFeature.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryFeature.java
index 1dd3e5928b92..ce2b4865767c 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryFeature.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryFeature.java
@@ -14,6 +14,5 @@ public enum QueryFeature {
     OrderBy,
     Top,
     NonValueAggregate,
-    DCount,
-    NonStreamingOrderBy
+    DCount
 }
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryInfo.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryInfo.java
index 48870a5ae52d..65efb92c3325 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryInfo.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryInfo.java
@@ -36,7 +36,6 @@ public final class QueryInfo extends JsonSerializable {
     private DistinctQueryType distinctQueryType;
     private QueryPlanDiagnosticsContext queryPlanDiagnosticsContext;
     private DCountInfo dCountInfo;
-    private boolean nonStreamingOrderBy;
 
     public QueryInfo() {
     }
@@ -161,11 +160,6 @@ public boolean hasGroupBy() {
         return groupByExpressions != null && !groupByExpressions.isEmpty();
     }
 
-    public boolean hasNonStreamingOrderBy() {
-        this.nonStreamingOrderBy = Boolean.TRUE.equals(super.getBoolean("hasNonStreamingOrderBy"));
-        return this.nonStreamingOrderBy;
-    }
-
     public Map getGroupByAliasToAggregateType(){
             Map  groupByAliasToAggregateMap;
             groupByAliasToAggregateMap = super.getMap("groupByAliasToAggregateType");
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java
index 83f82dbde363..ce91ff2029e9 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java
@@ -43,8 +43,7 @@ class QueryPlanRetriever {
                                                                QueryFeature.GroupBy.name() + ", " +
                                                                QueryFeature.Top.name() + ", " +
                                                                QueryFeature.DCount.name() + ", " +
-                                                               QueryFeature.NonValueAggregate.name() + ", " +
-                                                               QueryFeature.NonStreamingOrderBy.name();
+                                                               QueryFeature.NonValueAggregate.name();
 
     static Mono getQueryPlanThroughGatewayAsync(DiagnosticsClientContext diagnosticsClientContext,
                                                                                IDocumentQueryClient queryClient,
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java
index f9d7d4a72531..c9bf3909fd5d 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java
@@ -256,26 +256,6 @@ CosmosQueryRequestOptions setMaxItemCount(Integer maxItemCount) {
         return this;
     }
 
-    /**
-     * Gets the maximum item size to fetch during non-streaming order by queries.
-     *
-     * @return the max number of items for vector search.
-     */
-    public Integer getMaxItemSizeForVectorSearch() {
-        return this.actualRequestOptions.getMaxItemSizeForVectorSearch();
-    }
-
-    /**
-     * Sets the maximum item size to fetch during non-streaming order by queries.
-     *
-     * @param maxItemSizeForVectorSearch the max number of items for vector search.
-     * @return the CosmosQueryRequestOptions.
-     */
-    public CosmosQueryRequestOptions setMaxItemSizeForVectorSearch(Integer maxItemSizeForVectorSearch) {
-        this.actualRequestOptions.setMaxItemSizeForVectorSearch(maxItemSizeForVectorSearch);
-        return this;
-    }
-
     /**
      * Gets the request continuation token.
      *
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java
index e814cc16681b..80efe93d1682 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java
@@ -543,12 +543,7 @@ public static boolean getNoChangesFromFeedResponse(FeedResponse response) {
     public static Integer getMaxItemCountFromQueryRequestOptions(CosmosQueryRequestOptions options) {
         return options.getMaxItemCount();
     }
-
-    @Warning(value = INTERNAL_USE_ONLY_WARNING)
-    public static Integer getMaxItemSizeForVectorSearchFromQueryRequestOptions(CosmosQueryRequestOptions options) {
-        return options.getMaxItemSizeForVectorSearch();
-    }
-
+    
     @Warning(value = INTERNAL_USE_ONLY_WARNING)
     public static String getRequestContinuationFromQueryRequestOptions(CosmosQueryRequestOptions options) {
         return options.getRequestContinuation();
diff --git a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md
index 486ca9852bc7..6d699b6e17bd 100644
--- a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md
+++ b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md
@@ -8,9 +8,6 @@
 
 ### Bugs Fixed
 
-- Fixes the session message disposition to use management node as fall back. ([#39913](https://github.com/Azure/azure-sdk-for-java/issues/ 39913))
-- Fixes the session processor idle timeout to fall back to RetryOptions::tryTimeout. ([#39993](https://github.com/Azure/azure-sdk-for-java/issues/39993))
-
 ### Other Changes
 
 ## 7.17.0 (2024-05-06)

From 62931db6f21e7581c3b40a6bcfaf4de7311e114e Mon Sep 17 00:00:00 2001
From: Aayush Kataria 
Date: Tue, 14 May 2024 14:33:51 -0700
Subject: [PATCH 26/28] Fixing merge issues

---
 sdk/cosmos/azure-cosmos-test/CHANGELOG.md                   | 6 +-----
 .../java/com/azure/cosmos/models/ModelBridgeInternal.java   | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/sdk/cosmos/azure-cosmos-test/CHANGELOG.md b/sdk/cosmos/azure-cosmos-test/CHANGELOG.md
index e7cdc6f02af1..8bfe27c5aa13 100644
--- a/sdk/cosmos/azure-cosmos-test/CHANGELOG.md
+++ b/sdk/cosmos/azure-cosmos-test/CHANGELOG.md
@@ -7,12 +7,8 @@
 #### Breaking Changes
 
 #### Bugs Fixed
-* Fixed an issue where `FaultInjectionRule` can not apply on partition level when using `Gateway` Mode and non-session consistency - See [40005](https://github.com/Azure/azure-sdk-for-java/pull/40005)
-
-### 1.0.0-beta.7 (2024-05-03)
 
-#### Bugs Fixed
-* Fixed an issue where `FaultInjectionRule` can not apply on partition level when using `Gateway` Mode and non-session consistency - See [40005](https://github.com/Azure/azure-sdk-for-java/pull/40005)
+#### Other Changes
 
 ### 1.0.0-beta.7 (2024-05-03)
 
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java
index 80efe93d1682..4931c9b3b1b0 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java
@@ -543,7 +543,7 @@ public static boolean getNoChangesFromFeedResponse(FeedResponse response) {
     public static Integer getMaxItemCountFromQueryRequestOptions(CosmosQueryRequestOptions options) {
         return options.getMaxItemCount();
     }
-    
+
     @Warning(value = INTERNAL_USE_ONLY_WARNING)
     public static String getRequestContinuationFromQueryRequestOptions(CosmosQueryRequestOptions options) {
         return options.getRequestContinuation();

From f7f7d0868d302e91cb6f5ed4238df5e3e5e09523 Mon Sep 17 00:00:00 2001
From: Aayush Kataria 
Date: Wed, 15 May 2024 08:18:01 -0700
Subject: [PATCH 27/28] Fixing build

---
 .../query/DocumentQueryExecutionContextFactory.java             | 2 --
 .../query/PipelinedDocumentQueryExecutionContext.java           | 2 --
 .../implementation/query/PipelinedQueryExecutionContext.java    | 2 +-
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java
index c9f1c19cb126..a13cfc65348d 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java
@@ -4,11 +4,9 @@
 
 import com.azure.cosmos.BridgeInternal;
 import com.azure.cosmos.implementation.BadRequestException;
-import com.azure.cosmos.implementation.Configs;
 import com.azure.cosmos.implementation.Constants;
 import com.azure.cosmos.implementation.DiagnosticsClientContext;
 import com.azure.cosmos.implementation.DocumentCollection;
-import com.azure.cosmos.implementation.HttpConstants;
 import com.azure.cosmos.implementation.ImplementationBridgeHelpers;
 import com.azure.cosmos.implementation.OperationType;
 import com.azure.cosmos.implementation.PartitionKeyRange;
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
index 3f3e1795ac6b..771659d722b4 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
@@ -5,7 +5,6 @@
 import com.azure.cosmos.CosmosItemSerializer;
 import com.azure.cosmos.implementation.DiagnosticsClientContext;
 import com.azure.cosmos.implementation.DocumentCollection;
-import com.azure.cosmos.implementation.HttpConstants;
 import com.azure.cosmos.implementation.ImplementationBridgeHelpers;
 import com.azure.cosmos.implementation.Document;
 import com.azure.cosmos.implementation.ObjectNodeMap;
@@ -16,7 +15,6 @@
 
 import java.util.function.BiFunction;
 
-import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull;
 
 /**
  * While this class is public, but it is not part of our published public APIs.
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java
index 6c3fa2827216..c7f67711fabd 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java
@@ -137,7 +137,7 @@ public Flux> executeAsync() {
     }
 
     private static QueryInfo validateQueryInfo(QueryInfo queryInfo) {
-        if (queryInfo.hasOrderBy() || queryInfo.hasAggregates() || queryInfo.hasGroupBy() || queryInfo.hasNonStreamingOrderBy()) {
+        if (queryInfo.hasOrderBy() || queryInfo.hasAggregates() || queryInfo.hasGroupBy()) {
             // Any query with order by, aggregates or group by needs to go through the Document query pipeline
             throw new IllegalStateException("This query must not use the simple query pipeline.");
         }

From bce71deea34dee0dd12f15f7649ead6b666a3f16 Mon Sep 17 00:00:00 2001
From: Aayush Kataria 
Date: Wed, 15 May 2024 08:21:15 -0700
Subject: [PATCH 28/28] Fixing build

---
 .../query/PipelinedDocumentQueryExecutionContext.java            | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
index 771659d722b4..7b6104271762 100644
--- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
+++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java
@@ -15,7 +15,6 @@
 
 import java.util.function.BiFunction;
 
-
 /**
  * While this class is public, but it is not part of our published public APIs.
  * This is meant to be internally used only by our sdk.