forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regular expressions tests (Azure#41)
* Adding test: canSearchWithRegex() * Adding test: canSearchWithRegex() * Fix search() implementations * Adding Test searchThrowsWhenSpecialCharInRegexIsUnescaped() * remove unneeded implementations * remove unused import * fix playback file
- Loading branch information
Showing
6 changed files
with
261 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...arch-data/src/test/resources/session-records/canSearchWithEscapedSpecialCharsInRegex.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"networkCallRecords": [ | ||
{ | ||
"Method": "POST", | ||
"Uri": "https://azs-sdk86b96718fcdb.search.windows.net/indexes('hotels')/docs/search.index?api-version=2019-05-06", | ||
"Headers": { | ||
"Content-Type": "application/json; charset=utf-8" | ||
}, | ||
"Response": { | ||
"Pragma": "no-cache", | ||
"retry-after": "0", | ||
"request-id": "75e8fa58-53b3-476f-894d-0bb1c7022c61", | ||
"StatusCode": "200", | ||
"Date": "Thu, 22 Aug 2019 12:14:57 GMT", | ||
"Strict-Transport-Security": "max-age=15724800; includeSubDomains", | ||
"Cache-Control": "no-cache", | ||
"elapsed-time": "206", | ||
"OData-Version": "4.0", | ||
"Expires": "-1", | ||
"Content-Length": "795", | ||
"Body": "{\"@odata.context\":\"https://azs-sdk86b96718fcdb.search.windows.net/indexes('hotels')/$metadata#Collection(Microsoft.Azure.Search.V2019_05_06.IndexResult)\",\"value\":[{\"key\":\"1\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"2\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"3\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"4\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"5\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"6\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"7\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"8\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"9\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"10\",\"status\":true,\"errorMessage\":null,\"statusCode\":201}]}", | ||
"Preference-Applied": "odata.include-annotations=\"*\"", | ||
"Content-Type": "application/json; odata.metadata=minimal" | ||
} | ||
}, | ||
{ | ||
"Method": "POST", | ||
"Uri": "https://azs-sdk86b96718fcdb.search.windows.net/indexes('hotels')/docs/search.post.search?api-version=2019-05-06", | ||
"Headers": { | ||
"Content-Type": "application/json; charset=utf-8" | ||
}, | ||
"Response": { | ||
"Pragma": "no-cache", | ||
"retry-after": "0", | ||
"request-id": "f67dbb8c-90c0-42df-9249-6e42437891e5", | ||
"StatusCode": "200", | ||
"Date": "Thu, 22 Aug 2019 12:14:59 GMT", | ||
"Strict-Transport-Security": "max-age=15724800; includeSubDomains", | ||
"Cache-Control": "no-cache", | ||
"elapsed-time": "34", | ||
"OData-Version": "4.0", | ||
"Expires": "-1", | ||
"Content-Length": "114", | ||
"Body": "{\"@odata.context\":\"https://azs-sdk86b96718fcdb.search.windows.net/indexes('hotels')/$metadata#docs(*)\",\"value\":[]}", | ||
"Preference-Applied": "odata.include-annotations=\"*\"", | ||
"Content-Type": "application/json; odata.metadata=minimal" | ||
} | ||
} | ||
], | ||
"variables": [] | ||
} |
51 changes: 51 additions & 0 deletions
51
sdk/search/azure-search-data/src/test/resources/session-records/canSearchWithRegex.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"networkCallRecords": [ | ||
{ | ||
"Method": "POST", | ||
"Uri": "https://azs-sdk41d21851476d.search.windows.net/indexes('hotels')/docs/search.index?api-version=2019-05-06", | ||
"Headers": { | ||
"Content-Type": "application/json; charset=utf-8" | ||
}, | ||
"Response": { | ||
"Pragma": "no-cache", | ||
"retry-after": "0", | ||
"request-id": "9c4a4854-ab49-482e-98ae-6784ffdce506", | ||
"StatusCode": "200", | ||
"Date": "Thu, 22 Aug 2019 11:31:06 GMT", | ||
"Strict-Transport-Security": "max-age=15724800; includeSubDomains", | ||
"Cache-Control": "no-cache", | ||
"elapsed-time": "325", | ||
"OData-Version": "4.0", | ||
"Expires": "-1", | ||
"Content-Length": "795", | ||
"Body": "{\"@odata.context\":\"https://azs-sdk41d21851476d.search.windows.net/indexes('hotels')/$metadata#Collection(Microsoft.Azure.Search.V2019_05_06.IndexResult)\",\"value\":[{\"key\":\"1\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"2\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"3\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"4\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"5\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"6\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"7\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"8\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"9\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"10\",\"status\":true,\"errorMessage\":null,\"statusCode\":201}]}", | ||
"Preference-Applied": "odata.include-annotations=\"*\"", | ||
"Content-Type": "application/json; odata.metadata=minimal" | ||
} | ||
}, | ||
{ | ||
"Method": "POST", | ||
"Uri": "https://azs-sdk41d21851476d.search.windows.net/indexes('hotels')/docs/search.post.search?api-version=2019-05-06", | ||
"Headers": { | ||
"Content-Type": "application/json; charset=utf-8" | ||
}, | ||
"Response": { | ||
"Pragma": "no-cache", | ||
"retry-after": "0", | ||
"request-id": "a7d4e71b-b702-4f8e-b482-0312884c6b1e", | ||
"StatusCode": "200", | ||
"Date": "Thu, 22 Aug 2019 11:31:08 GMT", | ||
"Strict-Transport-Security": "max-age=15724800; includeSubDomains", | ||
"Cache-Control": "no-cache", | ||
"elapsed-time": "193", | ||
"OData-Version": "4.0", | ||
"Expires": "-1", | ||
"Content-Length": "172", | ||
"Body": "{\"@odata.context\":\"https://azs-sdk41d21851476d.search.windows.net/indexes('hotels')/$metadata#docs(*)\",\"value\":[{\"@search.score\":1.0,\"HotelName\":\"Roach Motel\",\"Rating\":1}]}", | ||
"Preference-Applied": "odata.include-annotations=\"*\"", | ||
"Content-Type": "application/json; odata.metadata=minimal" | ||
} | ||
} | ||
], | ||
"variables": [] | ||
} |
52 changes: 52 additions & 0 deletions
52
...ata/src/test/resources/session-records/searchThrowsWhenSpecialCharInRegexIsUnescaped.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"networkCallRecords": [ | ||
{ | ||
"Method": "POST", | ||
"Uri": "https://azs-sdk19d56030fd09.search.windows.net/indexes('hotels')/docs/search.index?api-version=2019-05-06", | ||
"Headers": { | ||
"Content-Type": "application/json; charset=utf-8" | ||
}, | ||
"Response": { | ||
"Pragma": "no-cache", | ||
"retry-after": "0", | ||
"request-id": "e7fba5c4-9d5c-4b4b-b1fe-1857949ca77e", | ||
"StatusCode": "200", | ||
"Date": "Thu, 22 Aug 2019 16:00:35 GMT", | ||
"Strict-Transport-Security": "max-age=15724800; includeSubDomains", | ||
"Cache-Control": "no-cache", | ||
"elapsed-time": "167", | ||
"OData-Version": "4.0", | ||
"Expires": "-1", | ||
"Content-Length": "795", | ||
"Body": "{\"@odata.context\":\"https://azs-sdk19d56030fd09.search.windows.net/indexes('hotels')/$metadata#Collection(Microsoft.Azure.Search.V2019_05_06.IndexResult)\",\"value\":[{\"key\":\"1\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"2\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"3\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"4\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"5\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"6\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"7\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"8\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"9\",\"status\":true,\"errorMessage\":null,\"statusCode\":201},{\"key\":\"10\",\"status\":true,\"errorMessage\":null,\"statusCode\":201}]}", | ||
"Preference-Applied": "odata.include-annotations=\"*\"", | ||
"Content-Type": "application/json; odata.metadata=minimal" | ||
} | ||
}, | ||
{ | ||
"Method": "POST", | ||
"Uri": "https://azs-sdk19d56030fd09.search.windows.net/indexes('hotels')/docs/search.post.search?api-version=2019-05-06", | ||
"Headers": { | ||
"Content-Type": "application/json; charset=utf-8" | ||
}, | ||
"Response": { | ||
"Pragma": "no-cache", | ||
"retry-after": "0", | ||
"request-id": "0efd19ae-b539-4c9c-8218-943f2859de4b", | ||
"StatusCode": "400", | ||
"Date": "Thu, 22 Aug 2019 16:00:37 GMT", | ||
"Strict-Transport-Security": "max-age=15724800; includeSubDomains", | ||
"Cache-Control": "no-cache", | ||
"elapsed-time": "79", | ||
"OData-Version": "4.0", | ||
"Expires": "-1", | ||
"Content-Length": "148", | ||
"Body": "{\"error\":{\"code\":\"\",\"message\":\"Failed to parse query string at line 1, column 8. See https://aka.ms/azure-search-full-query for supported syntax.\"}}", | ||
"Preference-Applied": "odata.include-annotations=\"*\"", | ||
"Content-Language": "en", | ||
"Content-Type": "application/json; odata.metadata=minimal" | ||
} | ||
} | ||
], | ||
"variables": [] | ||
} |