From 4a75bb81d977442cf5eaac5736beae1ddf800d22 Mon Sep 17 00:00:00 2001 From: Connie Date: Wed, 10 Nov 2021 16:29:37 -0800 Subject: [PATCH 1/8] Fix user agent string. --- .../azure/data/schemaregistry/SchemaRegistryClientBuilder.java | 2 +- .../src/main/resources/azure-data-schemaregistry.properties | 2 ++ sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/main/resources/azure-data-schemaregistry.properties diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClientBuilder.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClientBuilder.java index 18078200d565..8bb45de82dec 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClientBuilder.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClientBuilder.java @@ -58,7 +58,7 @@ public class SchemaRegistryClientBuilder { private final ClientLogger logger = new ClientLogger(SchemaRegistryClientBuilder.class); private static final String DEFAULT_SCOPE = "https://eventhubs.azure.net/.default"; - private static final String CLIENT_PROPERTIES = "azure-data-schemaregistry-client.properties"; + private static final String CLIENT_PROPERTIES = "azure-data-schemaregistry.properties"; private static final String NAME = "name"; private static final String VERSION = "version"; private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms", ChronoUnit.MILLIS); diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/resources/azure-data-schemaregistry.properties b/sdk/schemaregistry/azure-data-schemaregistry/src/main/resources/azure-data-schemaregistry.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/resources/azure-data-schemaregistry.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md b/sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md index e0f1860198bf..90ea5ec6afab 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md +++ b/sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md @@ -16,7 +16,7 @@ autorest --java --use:@autorest/java@4.0.x ### Code generation settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/2f33c13f9d5964781f4b8954bf3909b5039fe129/specification/schemaregistry/data-plane/Microsoft.EventHub/stable/2021-10/schemaregistry.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/77ace2a6387b5a210f6b822262bc68cffa55499d/specification/schemaregistry/data-plane/Microsoft.EventHub/stable/2021-10/schemaregistry.json java: true output-folder: ../ namespace: com.azure.data.schemaregistry From 46ea5dd92c3f966767b38f32cb8f01181531b7bd Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 11 Nov 2021 09:21:12 -0800 Subject: [PATCH 2/8] Adding new record playback files. --- ...syncClientTests.getSchemaDoesNotExist.json | 8 +-- ...ncClientTests.getSchemaIdDoesNotExist.json | 10 +-- ...AsyncClientTests.registerAndGetSchema.json | 42 ++++++------- ...yncClientTests.registerAndGetSchemaId.json | 42 ++++++------- ...dGetSchemaPropertiesWithInvalidFormat.json | 47 ++++++++++++++ ...ClientTests.registerAndGetSchemaTwice.json | 62 +++++++++---------- ...ryAsyncClientTests.registerBadRequest.json | 12 ++-- ...ientTests.registerSchemaInvalidFormat.json | 23 +++++++ ...stryClientTests.getSchemaDoesNotExist.json | 8 +-- ...ryClientTests.getSchemaIdDoesNotExist.json | 10 +-- ...istryClientTests.registerAndGetSchema.json | 42 ++++++------- ...tryClientTests.registerAndGetSchemaId.json | 42 ++++++------- ...ClientTests.registerAndGetSchemaTwice.json | 62 +++++++++---------- ...egistryClientTests.registerBadRequest.json | 12 ++-- ...ientTests.registerSchemaInvalidFormat.json | 23 +++++++ 15 files changed, 269 insertions(+), 176 deletions(-) create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaPropertiesWithInvalidFormat.json create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerSchemaInvalidFormat.json create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerSchemaInvalidFormat.json diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaDoesNotExist.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaDoesNotExist.json index 09bec33e2461..e186aee9840f 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaDoesNotExist.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaDoesNotExist.json @@ -3,8 +3,8 @@ "Method" : "GET", "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/59f112cf-ff02-40e6-aca9-0d30ed7f7f94?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "67364f5a-7a2d-4edf-8ec5-4ee3c53a7e6b" + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "2c32253c-ef1f-47ba-a7f6-04721ff502b9" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -12,8 +12,8 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "404", - "Body" : "{\"Code\":404,\"Detail\":\"Schema id 59f112cf-ff02-40e6-aca9-0d30ed7f7f94 does not exist. TrackingId:897a19b1-d44e-4d5c-b909-1d7a31270b67_G2, SystemTracker:hmlam-sr-test-01.servicebus.windows.net:$schemaGroups\\/$schemas\\/59f112cf-ff02-40e6-aca9-0d30ed7f7f94, Timestamp:2021-11-02T21:05:09\"}", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Body" : "{\"Code\":404,\"Detail\":\"Schema id 59f112cf-ff02-40e6-aca9-0d30ed7f7f94 does not exist. TrackingId:0be5b411-cfc7-40f3-aebf-f48ffe71d265_G30, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/$schemas\\/59f112cf-ff02-40e6-aca9-0d30ed7f7f94, Timestamp:2021-11-11T02:50:13\"}", + "Date" : "Thu, 11 Nov 2021 02:50:13 GMT", "Content-Type" : "application/json" }, "Exception" : null diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaIdDoesNotExist.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaIdDoesNotExist.json index 8622411c0fbb..97b79f54e697 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaIdDoesNotExist.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaIdDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/bar:get-id?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/bar:get-id?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "123feeb5-d531-4700-aaef-ccbd14ae6f98", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "024136f2-787f-480e-b328-878d296277bf", "Content-Type" : "application/json; serialization=avro" }, "Response" : { @@ -13,8 +13,8 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "404", - "Body" : "{\"Code\":404,\"Detail\":\"Schema at\\/bar does not exist. TrackingId:e8389b8e-10f9-4c23-87ea-b0fb2b06fe6a_G14, SystemTracker:hmlam-sr-test-01.servicebus.windows.net:$schemaGroups\\/at\\/schemas\\/bar:get-id, Timestamp:2021-11-02T21:08:21\"}", - "Date" : "Tue, 02 Nov 2021 21:08:21 GMT", + "Body" : "{\"Code\":404,\"Detail\":\"Schema mygroup\\/bar does not exist. TrackingId:ba7b3a34-fd4f-4813-81fe-671c2bf39dfd_G29, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/testgroup001\\/schemas\\/bar:get-id, Timestamp:2021-11-11T02:50:09\"}", + "Date" : "Thu, 11 Nov 2021 02:50:09 GMT", "Content-Type" : "application/json" }, "Exception" : null diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchema.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchema.json index 428760af6dee..d8e6b0d7e6ef 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchema.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchema.json @@ -1,53 +1,53 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch8712108a5?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch17568204e?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "760e2c5a-8e0a-45c6-9c5e-b0b37421959b", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "dd6f9450-a9a5-40a9-8c9f-951515e6b0b0", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch8712108a5", + "Schema-Name" : "sch17568204e", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/1ffa614d2d864d0ea336ee8dcfcbb3e6?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/e5691f79e3964309ac712ec52abcccca?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:12 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "1ffa614d2d864d0ea336ee8dcfcbb3e6", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch8712108a5/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch8712108a5/versions?api-version=2021-10" + "Schema-Id" : "e5691f79e3964309ac712ec52abcccca", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch17568204e/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch17568204e/versions?api-version=2021-10" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/1ffa614d2d864d0ea336ee8dcfcbb3e6?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/e5691f79e3964309ac712ec52abcccca?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "a17c684d-cf6e-4ce0-b40e-c358f4bdcb2b" + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "f68333f6-8f87-4b80-9cda-ac2ec096fa25" }, "Response" : { "Transfer-Encoding" : "chunked", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch8712108a5", + "Schema-Name" : "sch17568204e", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/1ffa614d2d864d0ea336ee8dcfcbb3e6?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/e5691f79e3964309ac712ec52abcccca?api-version=2021-10", "StatusCode" : "200", - "Date" : "Tue, 02 Nov 2021 21:05:09 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:18 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "1ffa614d2d864d0ea336ee8dcfcbb3e6", - "Schema-Group-Name" : "testgroup001", + "Schema-Id" : "e5691f79e3964309ac712ec52abcccca", + "Schema-Group-Name" : "mygroup", "Body" : "\"{\\\"type\\\" : \\\"record\\\",\\\"namespace\\\" : \\\"TestSchema\\\",\\\"name\\\" : \\\"Employee\\\",\\\"fields\\\" : [{ \\\"name\\\" : \\\"Name\\\" , \\\"type\\\" : \\\"string\\\" },{ \\\"name\\\" : \\\"Age\\\", \\\"type\\\" : \\\"int\\\" }]}\"", "Content-Type" : "application/json;serialization=Avro", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch8712108a5/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch8712108a5/versions?api-version=2021-10" + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch17568204e/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch17568204e/versions?api-version=2021-10" }, "Exception" : null } ], - "variables" : [ "sch8712108a5" ] + "variables" : [ "sch17568204e" ] } \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaId.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaId.json index c7f6ab403fcb..ca047bfda408 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaId.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaId.json @@ -1,52 +1,52 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch46532ddaa?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch82478e451?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "d7452615-19de-4999-a39a-c2204a58656b", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "a3251442-0ce8-447d-8a7a-dc04d0ea2179", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch46532ddaa", + "Schema-Name" : "sch82478e451", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/809a85c4862e4bffaf9efc1602e472ad?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/af123d3b28cb4316be10487b3d799bf2?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:09 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:09 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "809a85c4862e4bffaf9efc1602e472ad", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch46532ddaa/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch46532ddaa/versions?api-version=2021-10" + "Schema-Id" : "af123d3b28cb4316be10487b3d799bf2", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch82478e451/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch82478e451/versions?api-version=2021-10" }, "Exception" : null }, { "Method" : "POST", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch46532ddaa:get-id?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch82478e451:get-id?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "78a01d12-6afa-49b7-bef8-157fe620063b", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "5ed32c7b-6671-4c21-982f-b1bff593a5b2", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch46532ddaa", + "Schema-Name" : "sch82478e451", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/809a85c4862e4bffaf9efc1602e472ad?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/af123d3b28cb4316be10487b3d799bf2?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:09 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:14 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "809a85c4862e4bffaf9efc1602e472ad", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch46532ddaa/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch46532ddaa/versions?api-version=2021-10" + "Schema-Id" : "af123d3b28cb4316be10487b3d799bf2", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch82478e451/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch82478e451/versions?api-version=2021-10" }, "Exception" : null } ], - "variables" : [ "sch46532ddaa" ] + "variables" : [ "sch82478e451" ] } \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaPropertiesWithInvalidFormat.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaPropertiesWithInvalidFormat.json new file mode 100644 index 000000000000..82f6371d9db1 --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaPropertiesWithInvalidFormat.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch75672f4a1?api-version=2021-10", + "Headers" : { + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "a9c4204b-05fd-4430-a453-b1453d5aea8a", + "Content-Type" : "application/json; serialization=avro" + }, + "Response" : { + "content-length" : "0", + "Schema-Version" : "1", + "Server" : "Microsoft-HTTPAPI/2.0", + "Schema-Name" : "sch75672f4a1", + "retry-after" : "0", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/1bfb1947c46f415a838f7365bfdea46c?api-version=2021-10", + "StatusCode" : "204", + "Date" : "Thu, 11 Nov 2021 02:50:18 GMT", + "Strict-Transport-Security" : "max-age=31536000", + "Schema-Id" : "1bfb1947c46f415a838f7365bfdea46c", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch75672f4a1/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch75672f4a1/versions?api-version=2021-10" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch75672f4a1:get-id?api-version=2021-10", + "Headers" : { + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "ffbeb8d7-6048-4379-b77a-73208282caf8", + "Content-Type" : "application/json; serialization=protobuf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "415", + "Body" : "{\"Code\":415,\"Detail\":\"Invalid schema type for POST request. 'protobuf' is not supported. TrackingId:3afd1daa-d918-4f87-b145-803b15684e05_G19, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/mygroup\\/schemas\\/sch75672f4a1:get-id, Timestamp:2021-11-11T02:50:21\"}", + "Date" : "Thu, 11 Nov 2021 02:50:20 GMT", + "Content-Type" : "application/json" + }, + "Exception" : null + } ], + "variables" : [ "sch75672f4a1" ] +} \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaTwice.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaTwice.json index 1f1a461dace3..76c52d4f91d0 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaTwice.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerAndGetSchemaTwice.json @@ -1,77 +1,77 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch654909c8c?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch73838b757?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "9917613a-58ed-4c96-9ffc-2b1ea9daa59c", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "60a49dfb-3270-42af-83c6-d1d7af843f9d", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch654909c8c", + "Schema-Name" : "sch73838b757", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/c03098b4691944c9be9d446f8fa31aa2?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/a7390c7eabce4e26aa4d3d803011729c?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:09 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "c03098b4691944c9be9d446f8fa31aa2", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch654909c8c/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch654909c8c/versions?api-version=2021-10" + "Schema-Id" : "a7390c7eabce4e26aa4d3d803011729c", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch73838b757/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch73838b757/versions?api-version=2021-10" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch654909c8c?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch73838b757?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "84f9f83e-2ce5-48f9-9c70-d37dd1102251", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "d1aac4d4-6801-47f5-9b86-5bb909d84006", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "2", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch654909c8c", + "Schema-Name" : "sch73838b757", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/4ea8acced95440b98534529aa6b41a01?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/5f9d507d289d469bb11f03f7d5d3a7d3?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:10 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "4ea8acced95440b98534529aa6b41a01", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch654909c8c/versions/2?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch654909c8c/versions?api-version=2021-10" + "Schema-Id" : "5f9d507d289d469bb11f03f7d5d3a7d3", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch73838b757/versions/2?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch73838b757/versions?api-version=2021-10" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/4ea8acced95440b98534529aa6b41a01?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/5f9d507d289d469bb11f03f7d5d3a7d3?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "baaac2d7-3384-4c37-b049-0d096a51ecfb" + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "8cc14426-593e-4c70-9c2f-22485068789b" }, "Response" : { "Transfer-Encoding" : "chunked", "Schema-Version" : "2", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch654909c8c", + "Schema-Name" : "sch73838b757", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/4ea8acced95440b98534529aa6b41a01?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/5f9d507d289d469bb11f03f7d5d3a7d3?api-version=2021-10", "StatusCode" : "200", - "Date" : "Tue, 02 Nov 2021 21:05:09 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:17 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "4ea8acced95440b98534529aa6b41a01", - "Schema-Group-Name" : "testgroup001", + "Schema-Id" : "5f9d507d289d469bb11f03f7d5d3a7d3", + "Schema-Group-Name" : "mygroup", "Body" : "\"{\\\"type\\\" : \\\"record\\\",\\\"namespace\\\" : \\\"TestSchema\\\",\\\"name\\\" : \\\"Employee\\\",\\\"fields\\\" : [{ \\\"name\\\" : \\\"Name\\\" , \\\"type\\\" : \\\"string\\\" },{ \\\"name\\\" : \\\"Age\\\", \\\"type\\\" : \\\"int\\\" },{ \\\"name\\\" : \\\"Sign\\\", \\\"type\\\" : \\\"string\\\" }]}\"", "Content-Type" : "application/json;serialization=Avro", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch654909c8c/versions/2?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch654909c8c/versions?api-version=2021-10" + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch73838b757/versions/2?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch73838b757/versions?api-version=2021-10" }, "Exception" : null } ], - "variables" : [ "sch654909c8c" ] + "variables" : [ "sch73838b757" ] } \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerBadRequest.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerBadRequest.json index 66020777af64..4210cbd2c314 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerBadRequest.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerBadRequest.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch199059275?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch7670427d1?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "24c84f98-8394-4ce9-95c3-f86eab07f775", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "ac8c16d5-8001-4a49-beb0-7c883cbe29e2", "Content-Type" : "application/json; serialization=avro" }, "Response" : { @@ -13,11 +13,11 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "400", - "Body" : "{\"Code\":400,\"Detail\":\"Schema validation failed: Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 3. TrackingId:850dbc5e-b67f-401b-b58e-38fcf37eaffa_G25, SystemTracker:hmlam-sr-test-01.servicebus.windows.net:$schemaGroups\\/testgroup001\\/schemas\\/sch199059275, Timestamp:2021-11-02T21:05:09\"}", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Body" : "{\"Code\":400,\"Detail\":\"Schema validation failed: Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 3. TrackingId:e58eab9a-680e-4b8d-ad3e-0272b6f6dcc2_G29, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/mygroup\\/schemas\\/sch7670427d1, Timestamp:2021-11-11T02:50:18\"}", + "Date" : "Thu, 11 Nov 2021 02:50:18 GMT", "Content-Type" : "application/json" }, "Exception" : null } ], - "variables" : [ "sch199059275" ] + "variables" : [ "sch7670427d1" ] } \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerSchemaInvalidFormat.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerSchemaInvalidFormat.json new file mode 100644 index 000000000000..cbe5924c3c32 --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.registerSchemaInvalidFormat.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch678727847?api-version=2021-10", + "Headers" : { + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "70c9c243-db6b-4c77-b5d7-069859e23680", + "Content-Type" : "application/json; serialization=protobuf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "415", + "Body" : "{\"Code\":415,\"Detail\":\"Invalid schema type for PUT request. 'protobuf' is not supported. TrackingId:6fb03f01-5bc5-4156-8473-e89aac11dc30_G13, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/mygroup\\/schemas\\/sch678727847, Timestamp:2021-11-11T02:50:18\"}", + "Date" : "Thu, 11 Nov 2021 02:50:18 GMT", + "Content-Type" : "application/json" + }, + "Exception" : null + } ], + "variables" : [ "sch678727847" ] +} \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaDoesNotExist.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaDoesNotExist.json index 485c8ef63904..080c48746208 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaDoesNotExist.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaDoesNotExist.json @@ -3,8 +3,8 @@ "Method" : "GET", "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/59f112cf-ff02-40e6-aca9-0d30ed7f7f94?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "d1d39486-04aa-480d-a041-17d01e1e2f11" + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "01994c9e-6a94-41fc-ad39-e60b31d9f87f" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -12,8 +12,8 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "404", - "Body" : "{\"Code\":404,\"Detail\":\"Schema id 59f112cf-ff02-40e6-aca9-0d30ed7f7f94 does not exist. TrackingId:3236595c-2184-4a42-935a-4a45ae9a36be_G2, SystemTracker:hmlam-sr-test-01.servicebus.windows.net:$schemaGroups\\/$schemas\\/59f112cf-ff02-40e6-aca9-0d30ed7f7f94, Timestamp:2021-11-02T21:05:08\"}", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Body" : "{\"Code\":404,\"Detail\":\"Schema id 59f112cf-ff02-40e6-aca9-0d30ed7f7f94 does not exist. TrackingId:dc9bda8b-c340-4fee-9a59-89c13be11dab_G18, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/$schemas\\/59f112cf-ff02-40e6-aca9-0d30ed7f7f94, Timestamp:2021-11-11T02:50:13\"}", + "Date" : "Thu, 11 Nov 2021 02:50:12 GMT", "Content-Type" : "application/json" }, "Exception" : null diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaIdDoesNotExist.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaIdDoesNotExist.json index a840407d056a..b5840dd80a56 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaIdDoesNotExist.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaIdDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/bar:get-id?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/bar:get-id?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "e11379fc-241d-481e-af69-aa701c1c11b9", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "45899e02-e2d0-422f-b210-e1170164ff07", "Content-Type" : "application/json; serialization=avro" }, "Response" : { @@ -13,8 +13,8 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "404", - "Body" : "{\"Code\":404,\"Detail\":\"Schema at\\/bar does not exist. TrackingId:8303524c-652a-4a10-b961-a0e08e01b36d_G23, SystemTracker:hmlam-sr-test-01.servicebus.windows.net:$schemaGroups\\/at\\/schemas\\/bar:get-id, Timestamp:2021-11-02T21:08:21\"}", - "Date" : "Tue, 02 Nov 2021 21:08:21 GMT", + "Body" : "{\"Code\":404,\"Detail\":\"Schema mygroup\\/bar does not exist. TrackingId:b116fdf6-d077-468f-8f74-eaa40dc7ed1d_G13, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/testgroup001\\/schemas\\/bar:get-id, Timestamp:2021-11-11T02:50:09\"}", + "Date" : "Thu, 11 Nov 2021 02:50:09 GMT", "Content-Type" : "application/json" }, "Exception" : null diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchema.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchema.json index e2e21598d548..e46a7896df42 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchema.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchema.json @@ -1,53 +1,53 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch1938067ba?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch447611714?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "308e76ff-2ab3-4974-a31d-eb442fc0bb5f", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "39ab1f36-d2d9-49c7-8b6c-763d18d21a12", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch1938067ba", + "Schema-Name" : "sch447611714", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/8d175cc8f9d6413e9cbdefcce654c823?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/e1b0a5be968d44ba81d43d7cdf3fffe6?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:09 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:09 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "8d175cc8f9d6413e9cbdefcce654c823", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch1938067ba/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch1938067ba/versions?api-version=2021-10" + "Schema-Id" : "e1b0a5be968d44ba81d43d7cdf3fffe6", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch447611714/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch447611714/versions?api-version=2021-10" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/8d175cc8f9d6413e9cbdefcce654c823?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/e1b0a5be968d44ba81d43d7cdf3fffe6?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "8d0250f1-7908-4fd2-a311-7ab2f1ecc7f6" + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "24bb2c6b-0aa6-4f70-b6e8-02c2429870a8" }, "Response" : { "Transfer-Encoding" : "chunked", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch1938067ba", + "Schema-Name" : "sch447611714", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/8d175cc8f9d6413e9cbdefcce654c823?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/e1b0a5be968d44ba81d43d7cdf3fffe6?api-version=2021-10", "StatusCode" : "200", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:14 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "8d175cc8f9d6413e9cbdefcce654c823", - "Schema-Group-Name" : "testgroup001", + "Schema-Id" : "e1b0a5be968d44ba81d43d7cdf3fffe6", + "Schema-Group-Name" : "mygroup", "Body" : "\"{\\\"type\\\" : \\\"record\\\",\\\"namespace\\\" : \\\"TestSchema\\\",\\\"name\\\" : \\\"Employee\\\",\\\"fields\\\" : [{ \\\"name\\\" : \\\"Name\\\" , \\\"type\\\" : \\\"string\\\" },{ \\\"name\\\" : \\\"Age\\\", \\\"type\\\" : \\\"int\\\" }]}\"", "Content-Type" : "application/json;serialization=Avro", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch1938067ba/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch1938067ba/versions?api-version=2021-10" + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch447611714/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch447611714/versions?api-version=2021-10" }, "Exception" : null } ], - "variables" : [ "sch1938067ba" ] + "variables" : [ "sch447611714" ] } \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchemaId.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchemaId.json index bd5ad3a4c485..fa8404da7239 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchemaId.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchemaId.json @@ -1,52 +1,52 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch734563397?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch610042013?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "c109742a-a63b-47dd-80b2-077f6554f57d", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "9754de3a-2149-4353-b409-d6720ed52dd6", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch734563397", + "Schema-Name" : "sch610042013", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/6a31d9c9f7f64f1e8be15987a829b015?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/86847abb67a74871ae7b913e23924964?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:09 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "6a31d9c9f7f64f1e8be15987a829b015", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch734563397/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch734563397/versions?api-version=2021-10" + "Schema-Id" : "86847abb67a74871ae7b913e23924964", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch610042013/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch610042013/versions?api-version=2021-10" }, "Exception" : null }, { "Method" : "POST", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch734563397:get-id?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch610042013:get-id?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "406ba2b7-047b-4fa2-afc7-b99c20b0a244", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "2d16af18-bf8e-431c-a609-c5ef5fc1b95b", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch734563397", + "Schema-Name" : "sch610042013", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/6a31d9c9f7f64f1e8be15987a829b015?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/86847abb67a74871ae7b913e23924964?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:13 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "6a31d9c9f7f64f1e8be15987a829b015", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch734563397/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch734563397/versions?api-version=2021-10" + "Schema-Id" : "86847abb67a74871ae7b913e23924964", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch610042013/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch610042013/versions?api-version=2021-10" }, "Exception" : null } ], - "variables" : [ "sch734563397" ] + "variables" : [ "sch610042013" ] } \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchemaTwice.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchemaTwice.json index b351342229b4..93abb264808b 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchemaTwice.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerAndGetSchemaTwice.json @@ -1,77 +1,77 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch72257142f?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch0179638bc?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "2c6a8e9a-aedb-4750-ad69-6392f8c99ff2", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "d05d9438-59fb-4889-adfd-479f60ff58c9", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "1", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch72257142f", + "Schema-Name" : "sch0179638bc", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/26c76062d09c47a48f9a648f961ee39c?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/3a085c070092446ba95db83196aa71c1?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:09 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "26c76062d09c47a48f9a648f961ee39c", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch72257142f/versions/1?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch72257142f/versions?api-version=2021-10" + "Schema-Id" : "3a085c070092446ba95db83196aa71c1", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch0179638bc/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch0179638bc/versions?api-version=2021-10" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch72257142f?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch0179638bc?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "c9ed69d7-aa0e-4613-89e0-3065effe39f5", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "0fabadd2-1c6f-4f4c-b652-8dea83c03938", "Content-Type" : "application/json; serialization=avro" }, "Response" : { "content-length" : "0", "Schema-Version" : "2", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch72257142f", + "Schema-Name" : "sch0179638bc", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/b492271ef5454df7bdfb9465ea6fa2e0?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/d1d3a156039443399ee30295e4316220?api-version=2021-10", "StatusCode" : "204", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:10 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "b492271ef5454df7bdfb9465ea6fa2e0", - "Schema-Group-Name" : "testgroup001", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch72257142f/versions/2?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch72257142f/versions?api-version=2021-10" + "Schema-Id" : "d1d3a156039443399ee30295e4316220", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch0179638bc/versions/2?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch0179638bc/versions?api-version=2021-10" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/b492271ef5454df7bdfb9465ea6fa2e0?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/$schemas/d1d3a156039443399ee30295e4316220?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "58f7a81b-6177-4c65-a471-792d7c03c5ca" + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "28d3ebd8-d81a-42dd-8732-a66f9b1f004c" }, "Response" : { "Transfer-Encoding" : "chunked", "Schema-Version" : "2", "Server" : "Microsoft-HTTPAPI/2.0", - "Schema-Name" : "sch72257142f", + "Schema-Name" : "sch0179638bc", "retry-after" : "0", - "Schema-Id-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/$schemas/b492271ef5454df7bdfb9465ea6fa2e0?api-version=2021-10", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/d1d3a156039443399ee30295e4316220?api-version=2021-10", "StatusCode" : "200", - "Date" : "Tue, 02 Nov 2021 21:05:10 GMT", + "Date" : "Thu, 11 Nov 2021 02:50:17 GMT", "Strict-Transport-Security" : "max-age=31536000", - "Schema-Id" : "b492271ef5454df7bdfb9465ea6fa2e0", - "Schema-Group-Name" : "testgroup001", + "Schema-Id" : "d1d3a156039443399ee30295e4316220", + "Schema-Group-Name" : "mygroup", "Body" : "\"{\\\"type\\\" : \\\"record\\\",\\\"namespace\\\" : \\\"TestSchema\\\",\\\"name\\\" : \\\"Employee\\\",\\\"fields\\\" : [{ \\\"name\\\" : \\\"Name\\\" , \\\"type\\\" : \\\"string\\\" },{ \\\"name\\\" : \\\"Age\\\", \\\"type\\\" : \\\"int\\\" },{ \\\"name\\\" : \\\"Sign\\\", \\\"type\\\" : \\\"string\\\" }]}\"", "Content-Type" : "application/json;serialization=Avro", - "Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch72257142f/versions/2?api-version=2021-10", - "Schema-Versions-Location" : "https://hmlam-sr-test-01.servicebus.windows.net:443/$schemagroups/testgroup001/schemas/sch72257142f/versions?api-version=2021-10" + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch0179638bc/versions/2?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch0179638bc/versions?api-version=2021-10" }, "Exception" : null } ], - "variables" : [ "sch72257142f" ] + "variables" : [ "sch0179638bc" ] } \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerBadRequest.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerBadRequest.json index 331747ca3fca..8c68a23e079f 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerBadRequest.json +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerBadRequest.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/testgroup001/schemas/sch026641bb1?api-version=2021-10", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch167984d39?api-version=2021-10", "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.5; Windows 10; 10.0)", - "x-ms-client-request-id" : "e020d5bf-30c5-4d5e-8621-8e2c220fb3e2", + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "7dfefecf-281b-42ca-b4d9-61c973ae7abf", "Content-Type" : "application/json; serialization=avro" }, "Response" : { @@ -13,11 +13,11 @@ "Server" : "Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "400", - "Body" : "{\"Code\":400,\"Detail\":\"Schema validation failed: Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 3. TrackingId:fa677ffd-2908-497a-9b2e-b8578cb72bdf_G4, SystemTracker:hmlam-sr-test-01.servicebus.windows.net:$schemaGroups\\/testgroup001\\/schemas\\/sch026641bb1, Timestamp:2021-11-02T21:05:08\"}", - "Date" : "Tue, 02 Nov 2021 21:05:08 GMT", + "Body" : "{\"Code\":400,\"Detail\":\"Schema validation failed: Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 3. TrackingId:712d66d0-2bb7-4704-a706-5ab6d6ec884c_G5, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/mygroup\\/schemas\\/sch167984d39, Timestamp:2021-11-11T02:50:13\"}", + "Date" : "Thu, 11 Nov 2021 02:50:13 GMT", "Content-Type" : "application/json" }, "Exception" : null } ], - "variables" : [ "sch026641bb1" ] + "variables" : [ "sch167984d39" ] } \ No newline at end of file diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerSchemaInvalidFormat.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerSchemaInvalidFormat.json new file mode 100644 index 000000000000..8a3862364c5d --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.registerSchemaInvalidFormat.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch979172d92?api-version=2021-10", + "Headers" : { + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.0.0-beta.7 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "9eb549f6-0e4d-4854-85a2-b2cb6e95b084", + "Content-Type" : "application/json; serialization=protobuf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Strict-Transport-Security" : "max-age=31536000", + "Server" : "Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "415", + "Body" : "{\"Code\":415,\"Detail\":\"Invalid schema type for PUT request. 'protobuf' is not supported. TrackingId:2825ebdf-332a-4ef1-a1e3-84384da1bbb3_G22, SystemTracker:conniey.servicebus.windows.net:$schemaGroups\\/mygroup\\/schemas\\/sch979172d92, Timestamp:2021-11-11T02:50:18\"}", + "Date" : "Thu, 11 Nov 2021 02:50:17 GMT", + "Content-Type" : "application/json" + }, + "Exception" : null + } ], + "variables" : [ "sch979172d92" ] +} \ No newline at end of file From b9c2f08fc8f553768d0e1e67d18aa870dd718739 Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 11 Nov 2021 09:22:08 -0800 Subject: [PATCH 3/8] Adding regenerated classes. --- .../implementation/SchemasImpl.java | 29 ++++++++++---- .../implementation/models/SchemaId.java | 38 +++++++++++++++++++ 2 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaId.java diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java index 61df7ffa2df1..a7727d8c27d6 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java @@ -54,7 +54,7 @@ public final class SchemasImpl { @ServiceInterface(name = "AzureSchemaRegistryS") private interface SchemasService { @Get("/$schemaGroups/$schemas/{id}") - @ExpectedResponses({200, 200}) + @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorException.class) Mono getById( @HostParam("endpoint") String endpoint, @@ -75,26 +75,34 @@ Mono> getVersions( Context context); @Post("/$schemaGroups/{groupName}/schemas/{schemaName}:get-id") - @ExpectedResponses({204, 415}) + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ErrorException.class, + code = {415}) @UnexpectedResponseExceptionType(ErrorException.class) Mono queryIdByContent( @HostParam("endpoint") String endpoint, @PathParam("groupName") String groupName, @PathParam("schemaName") String schemaName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json; serialization=avro") String schemaContent, + @BodyParam("application/json; serialization=Avro") String schemaContent, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, Context context); @Put("/$schemaGroups/{groupName}/schemas/{schemaName}") - @ExpectedResponses({204, 415}) + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ErrorException.class, + code = {415}) @UnexpectedResponseExceptionType(ErrorException.class) Mono register( @HostParam("endpoint") String endpoint, @PathParam("groupName") String groupName, @PathParam("schemaName") String schemaName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json; serialization=avro") String schemaContent, + @BodyParam("application/json; serialization=Avro") String schemaContent, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, Context context); } @@ -112,7 +120,7 @@ Mono register( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getByIdWithResponseAsync(String id, Context context) { - final String accept = "text/plain, application/json, application/json;serialization=avro"; + final String accept = "application/json; serialization=Avro"; return service.getById(this.client.getEndpoint(), id, this.client.getApiVersion(), accept, context); } @@ -144,16 +152,18 @@ public Mono> getVersionsWithResponseAsync( * serialization type specified in the request. * @param schemaName Name of requested schema. * @param schemaContent String representation (UTF-8) of the registered schema. + * @param contentType The contentType parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. + * @throws ErrorException thrown if the request is rejected by server on status code 415. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the ID referencing an existing schema within the specified schema group, as matched by schema content * comparison. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono queryIdByContentWithResponseAsync( - String groupName, String schemaName, String schemaContent, Context context) { + String groupName, String schemaName, String schemaContent, String contentType, Context context) { final String accept = "application/json"; return service.queryIdByContent( this.client.getEndpoint(), @@ -161,6 +171,7 @@ public Mono queryIdByContentWithResponseAsync( schemaName, this.client.getApiVersion(), schemaContent, + contentType, accept, context); } @@ -176,12 +187,13 @@ public Mono queryIdByContentWithResponseAsync( * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. + * @throws ErrorException thrown if the request is rejected by server on status code 415. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono registerWithResponseAsync( - String groupName, String schemaName, String schemaContent, Context context) { + String groupName, String schemaName, String schemaContent, String contentType, Context context) { final String accept = "application/json"; return service.register( this.client.getEndpoint(), @@ -189,6 +201,7 @@ public Mono registerWithResponseAsync( schemaName, this.client.getApiVersion(), schemaContent, + contentType, accept, context); } diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaId.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaId.java new file mode 100644 index 000000000000..95c6a509358f --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaId.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.data.schemaregistry.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Object received from the registry containing schema identifiers. */ +@Fluent +public final class SchemaId { + /* + * Schema ID that uniquely identifies a schema in the registry namespace. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Schema ID that uniquely identifies a schema in the registry namespace. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: Schema ID that uniquely identifies a schema in the registry namespace. + * + * @param id the id value to set. + * @return the SchemaId object itself. + */ + public SchemaId setId(String id) { + this.id = id; + return this; + } +} From 5ca3843aa8060fc13560baddc2b3e8525d6487b5 Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 11 Nov 2021 09:22:43 -0800 Subject: [PATCH 4/8] Adding additional tests. --- .../SchemaRegistryAsyncClientTests.java | 57 ++++++++++++++++++- .../SchemaRegistryClientTests.java | 25 +++++++- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java index 36acd1ad935c..9522a045140c 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java @@ -8,7 +8,10 @@ import com.azure.core.credential.TokenRequestContext; import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.RetryStrategy; import com.azure.core.test.TestBase; import com.azure.data.schemaregistry.models.SchemaFormat; import com.azure.data.schemaregistry.models.SchemaProperties; @@ -19,6 +22,7 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.time.Duration; import java.time.OffsetDateTime; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; @@ -43,7 +47,7 @@ public class SchemaRegistryAsyncClientTests extends TestBase { static final String SCHEMA_CONTENT_NO_WHITESPACE = WHITESPACE_PATTERN.matcher(SCHEMA_CONTENT).replaceAll(""); // When we regenerate recordings, make sure that the schema group matches what we are persisting. - static final String PLAYBACK_TEST_GROUP = "testgroup001"; + static final String PLAYBACK_TEST_GROUP = "mygroup"; private String schemaGroup; private SchemaRegistryClientBuilder builder; @@ -82,6 +86,7 @@ protected void beforeTest() { builder.httpClient(interceptorManager.getPlaybackClient()); } else { builder.addPolicy(new RetryPolicy()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .addPolicy(interceptorManager.getRecordPolicy()); } } @@ -201,6 +206,53 @@ public void registerAndGetSchemaId() { .verifyComplete(); } + /** + * Verifies that a 415 is returned if we use an invalid schema format. + */ + @Test + public void registerSchemaInvalidFormat() { + // Arrange + final String schemaName = testResourceNamer.randomName("sch", RESOURCE_LENGTH); + final SchemaRegistryAsyncClient client = builder.buildAsyncClient(); + final SchemaFormat unknownSchemaFormat = SchemaFormat.fromString("protobuf"); + + // Act & Assert + StepVerifier.create(client.registerSchemaWithResponse(schemaGroup, schemaName, SCHEMA_CONTENT, unknownSchemaFormat)) + .expectErrorSatisfies(error -> { + assertTrue(error instanceof HttpResponseException); + + final HttpResponseException responseException = ((HttpResponseException) error); + assertEquals(415, responseException.getResponse().getStatusCode()); + }) + .verify(); + } + + /** + * Verifies that if we register a schema and try to fetch it using an invalid schema format, an error is returned. + */ + @Test + public void registerAndGetSchemaPropertiesWithInvalidFormat() { + // Arrange + final String schemaName = testResourceNamer.randomName("sch", RESOURCE_LENGTH); + final SchemaRegistryAsyncClient client1 = builder.buildAsyncClient(); + final SchemaRegistryAsyncClient client2 = builder.buildAsyncClient(); + final SchemaFormat invalidFormat = SchemaFormat.fromString("protobuf"); + + final SchemaProperties schemaProperties = client1.registerSchema(schemaGroup, schemaName, SCHEMA_CONTENT, + SchemaFormat.AVRO).block(Duration.ofSeconds(10)); + + assertNotNull(schemaProperties); + + // Act & Assert + StepVerifier.create(client2.getSchemaProperties(schemaGroup, schemaName, SCHEMA_CONTENT, invalidFormat)) + .expectErrorSatisfies(error -> { + assertTrue(error instanceof HttpResponseException); + + final HttpResponseException responseException = ((HttpResponseException) error); + assertEquals(415, responseException.getResponse().getStatusCode()); + }).verify(); + } + /** * Verifies that we can register a schema and then get it by its schemaId. */ @@ -248,7 +300,7 @@ public void getSchemaIdDoesNotExist() { final SchemaRegistryAsyncClient client1 = builder.buildAsyncClient(); // Act & Assert - StepVerifier.create(client1.getSchemaProperties(PLAYBACK_TEST_GROUP, "bar", SCHEMA_CONTENT, SchemaFormat.AVRO)) + StepVerifier.create(client1.getSchemaProperties(schemaGroup, "bar", SCHEMA_CONTENT, SchemaFormat.AVRO)) .expectErrorSatisfies(error -> { assertTrue(error instanceof ResourceNotFoundException); assertEquals(404, ((ResourceNotFoundException) error).getResponse().getStatusCode()); @@ -256,6 +308,7 @@ public void getSchemaIdDoesNotExist() { .verify(); } + static void assertSchemaRegistrySchema(SchemaRegistrySchema actual, String expectedSchemaId, SchemaFormat format, String expectedContents) { diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryClientTests.java b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryClientTests.java index c4e40b24188d..cd711b6489cd 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryClientTests.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryClientTests.java @@ -17,6 +17,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; import java.time.OffsetDateTime; @@ -31,6 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; 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 static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -193,6 +195,27 @@ public void registerBadRequest() { assertEquals(400, exception.getResponse().getStatusCode()); } + /** + * Verifies that a 415 is returned if we use an invalid schema format. + */ + @Test + public void registerSchemaInvalidFormat() { + // Arrange + final String schemaName = testResourceNamer.randomName("sch", RESOURCE_LENGTH); + final SchemaRegistryAsyncClient client = builder.buildAsyncClient(); + final SchemaFormat unknownSchemaFormat = SchemaFormat.fromString("protobuf"); + + // Act & Assert + StepVerifier.create(client.registerSchemaWithResponse(schemaGroup, schemaName, SCHEMA_CONTENT, unknownSchemaFormat)) + .expectErrorSatisfies(error -> { + assertTrue(error instanceof HttpResponseException); + + final HttpResponseException responseException = ((HttpResponseException) error); + assertEquals(415, responseException.getResponse().getStatusCode()); + }) + .verify(); + } + /** * Verifies that we get 404 when non-existent schema returned. */ @@ -219,7 +242,7 @@ public void getSchemaIdDoesNotExist() { // Act & Assert final ResourceNotFoundException error = assertThrows(ResourceNotFoundException.class, - () -> client1.getSchemaProperties(PLAYBACK_TEST_GROUP, "bar", SCHEMA_CONTENT, SchemaFormat.AVRO)); + () -> client1.getSchemaProperties(schemaGroup, "bar", SCHEMA_CONTENT, SchemaFormat.AVRO)); assertEquals(404, error.getResponse().getStatusCode()); } From 1d49a00d11d3b553a7dc70bfb4893b9d79c96032 Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 11 Nov 2021 09:23:05 -0800 Subject: [PATCH 5/8] Adding content headers depending on SchemaFormat type. --- .../schemaregistry/SchemaRegistryAsyncClient.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java index 019ce3d5b86e..e09e4dfdfa94 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java @@ -121,7 +121,9 @@ Mono> registerSchemaWithResponse(String groupName, St logger.verbose("Registering schema. Group: '{}', name: '{}', serialization type: '{}', payload: '{}'", groupName, name, format, schemaDefinition); - return restService.getSchemas().registerWithResponseAsync(groupName, name, schemaDefinition, context) + final String contentType = getContentType(format); + + return restService.getSchemas().registerWithResponseAsync(groupName, name, schemaDefinition, contentType, context) .map(response -> { final SchemasRegisterHeaders deserializedHeaders = response.getDeserializedHeaders(); final SchemaProperties registered = new SchemaProperties(deserializedHeaders.getSchemaId(), format); @@ -262,8 +264,10 @@ Mono> getSchemaPropertiesWithResponse(String groupNam context = Context.NONE; } + final String contentType = getContentType(format); + return restService.getSchemas() - .queryIdByContentWithResponseAsync(groupName, name, schemaDefinition, context) + .queryIdByContentWithResponseAsync(groupName, name, schemaDefinition, contentType, context) .onErrorMap(ErrorException.class, SchemaRegistryAsyncClient::remapError) .map(response -> { final SchemasQueryIdByContentHeaders deserializedHeaders = response.getDeserializedHeaders(); @@ -296,4 +300,8 @@ private static Throwable remapError(ErrorException error) { return error; } + + private static String getContentType(SchemaFormat schemaFormat) { + return "application/json; serialization=" + schemaFormat; + } } From 69b87b7ec57af81667d04851f7cd76f84de2634f Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 11 Nov 2021 10:14:41 -0800 Subject: [PATCH 6/8] Adding CHANGELOG.md --- sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md b/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md index 8c4b1e2dac83..a417ddf28db8 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md +++ b/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md @@ -11,9 +11,13 @@ ### Bugs Fixed +- Added correct User Agent string for client. + ### Other Changes - Regenerated REST API based off 2021-10 swagger. +- An HttpResponseException with status code 415 is returned if an invalid SchemaFormat is passed for registerSchema or + getSchemaById calls. ## 1.0.0-beta.6 (2021-10-08) From 06c8da3062b9a694276f60db10039ab784b13a7c Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Thu, 11 Nov 2021 12:22:28 -0800 Subject: [PATCH 7/8] Update sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md Co-authored-by: Liudmila Molkova --- sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md b/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md index a417ddf28db8..208f8cbd9f4b 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md +++ b/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md @@ -16,8 +16,7 @@ ### Other Changes - Regenerated REST API based off 2021-10 swagger. -- An HttpResponseException with status code 415 is returned if an invalid SchemaFormat is passed for registerSchema or - getSchemaById calls. +- An `HttpResponseException` with status code 415 is returned if an invalid `SchemaFormat` is passed for `registerSchema` or `getSchemaById` calls. ## 1.0.0-beta.6 (2021-10-08) From 2dd8df7d803a86066a6fedc9d918b087ceab9ec2 Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 11 Nov 2021 13:11:02 -0800 Subject: [PATCH 8/8] Fixing unused import. Reverting casing. --- .../azure/data/schemaregistry/implementation/SchemasImpl.java | 2 +- .../data/schemaregistry/SchemaRegistryAsyncClientTests.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java index a7727d8c27d6..3c634e7bdc64 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java @@ -120,7 +120,7 @@ Mono register( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getByIdWithResponseAsync(String id, Context context) { - final String accept = "application/json; serialization=Avro"; + final String accept = "application/json; serialization=avro"; return service.getById(this.client.getEndpoint(), id, this.client.getApiVersion(), accept, context); } diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java index 9522a045140c..57e771f32e4a 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java @@ -11,7 +11,6 @@ import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.RetryStrategy; import com.azure.core.test.TestBase; import com.azure.data.schemaregistry.models.SchemaFormat; import com.azure.data.schemaregistry.models.SchemaProperties;