Skip to content

Commit

Permalink
Change searchServiceVersion to serviceVersion (#8683)
Browse files Browse the repository at this point in the history
* Change searchServiceVersion to serviceVersion
  • Loading branch information
sima-zhu authored Mar 3, 2020
1 parent 2087e89 commit 9c376ec
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public final class SearchIndexAsyncClient {
/**
* Search REST API Version
*/
private final SearchServiceVersion searchServiceVersion;
private final SearchServiceVersion serviceVersion;

/**
* The endpoint for the Azure Cognitive Search service.
Expand Down Expand Up @@ -92,20 +92,20 @@ public final class SearchIndexAsyncClient {
/**
* Package private constructor to be used by {@link SearchIndexClientBuilder}
*/
SearchIndexAsyncClient(String endpoint, String indexName, SearchServiceVersion searchServiceVersion,
SearchIndexAsyncClient(String endpoint, String indexName, SearchServiceVersion serviceVersion,
HttpPipeline httpPipeline) {

SearchServiceUrlParts parts = SearchServiceUrlParser.parseServiceUrlParts(endpoint);
this.endpoint = endpoint;
this.indexName = indexName;
this.searchServiceVersion = searchServiceVersion;
this.serviceVersion = serviceVersion;
this.httpPipeline = httpPipeline;

restClient = new SearchIndexRestClientBuilder()
.searchServiceName(parts.serviceName)
.indexName(indexName)
.searchDnsSuffix(parts.dnsSuffix)
.apiVersion(searchServiceVersion.getVersion())
.apiVersion(serviceVersion.getVersion())
.pipeline(httpPipeline)
.serializer(SERIALIZER)
.build();
Expand Down Expand Up @@ -333,7 +333,7 @@ Mono<Response<IndexDocumentsResult>> deleteDocumentsWithResponse(Iterable<?> doc
* @return The version of the Search service the client is using.
*/
public SearchServiceVersion getServiceVersion() {
return this.searchServiceVersion;
return this.serviceVersion;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public final class SearchIndexClientBuilder {
private final String clientVersion;

private SearchApiKeyCredential searchApiKeyCredential;
private SearchServiceVersion searchServiceVersion;
private SearchServiceVersion serviceVersion;
private String endpoint;
private HttpClient httpClient;
private HttpPipeline httpPipeline;
Expand Down Expand Up @@ -118,9 +118,9 @@ public SearchIndexAsyncClient buildAsyncClient() {
Objects.requireNonNull(indexName, "'indexName' cannot be null.");
Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");

SearchServiceVersion buildVersion = (searchServiceVersion == null)
SearchServiceVersion buildVersion = (serviceVersion == null)
? SearchServiceVersion.getLatest()
: searchServiceVersion;
: serviceVersion;

if (httpPipeline != null) {
return new SearchIndexAsyncClient(endpoint, indexName, buildVersion, httpPipeline);
Expand Down Expand Up @@ -300,11 +300,11 @@ public SearchIndexClientBuilder retryPolicy(RetryPolicy retryPolicy) {
* If a service version is not provided, {@link SearchServiceVersion#getLatest()} will be used as a default. When
* this default is used updating to a newer client library may result in a newer version of the service being used.
*
* @param searchServiceVersion The version of the service to be used when making requests.
* @param serviceVersion The version of the service to be used when making requests.
* @return The updated SearchIndexClientBuilder object.
*/
public SearchIndexClientBuilder searchServiceVersion(SearchServiceVersion searchServiceVersion) {
this.searchServiceVersion = searchServiceVersion;
public SearchIndexClientBuilder serviceVersion(SearchServiceVersion serviceVersion) {
this.serviceVersion = serviceVersion;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public final class SearchServiceAsyncClient {
/**
* Search REST API Version
*/
private final SearchServiceVersion searchServiceVersion;
private final SearchServiceVersion serviceVersion;

/**
* The endpoint for the Azure Cognitive Search service.
Expand All @@ -65,16 +65,16 @@ public final class SearchServiceAsyncClient {
*/
private final HttpPipeline httpPipeline;

SearchServiceAsyncClient(String endpoint, SearchServiceVersion searchServiceVersion, HttpPipeline httpPipeline) {
SearchServiceAsyncClient(String endpoint, SearchServiceVersion serviceVersion, HttpPipeline httpPipeline) {
SearchServiceUrlParts parts = SearchServiceUrlParser.parseServiceUrlParts(endpoint);
this.endpoint = endpoint;
this.searchServiceVersion = searchServiceVersion;
this.serviceVersion = serviceVersion;
this.httpPipeline = httpPipeline;

this.restClient = new SearchServiceRestClientBuilder()
.searchServiceName(parts.serviceName)
.searchDnsSuffix(parts.dnsSuffix)
.apiVersion(searchServiceVersion.getVersion())
.apiVersion(serviceVersion.getVersion())
.pipeline(httpPipeline)
.build();
}
Expand All @@ -96,7 +96,7 @@ HttpPipeline getHttpPipeline() {
* @return a {@link SearchIndexAsyncClient} created from the service client configuration
*/
public SearchIndexAsyncClient getIndexClient(String indexName) {
return new SearchIndexAsyncClient(endpoint, indexName, searchServiceVersion, httpPipeline);
return new SearchIndexAsyncClient(endpoint, indexName, serviceVersion, httpPipeline);
}

/**
Expand All @@ -105,7 +105,7 @@ public SearchIndexAsyncClient getIndexClient(String indexName) {
* @return the search service version value.
*/
public SearchServiceVersion getServiceVersion() {
return this.searchServiceVersion;
return this.serviceVersion;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public final class SearchServiceClientBuilder {
private final String clientVersion;

private SearchApiKeyCredential searchApiKeyCredential;
private SearchServiceVersion searchServiceVersion;
private SearchServiceVersion serviceVersion;
private String endpoint;
private HttpClient httpClient;
private HttpPipeline httpPipeline;
Expand Down Expand Up @@ -112,9 +112,9 @@ public SearchServiceClient buildClient() {
public SearchServiceAsyncClient buildAsyncClient() {
Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");

SearchServiceVersion buildVersion = (searchServiceVersion == null)
SearchServiceVersion buildVersion = (serviceVersion == null)
? SearchServiceVersion.getLatest()
: searchServiceVersion;
: serviceVersion;

if (httpPipeline != null) {
return new SearchServiceAsyncClient(endpoint, buildVersion, httpPipeline);
Expand Down Expand Up @@ -279,11 +279,11 @@ public SearchServiceClientBuilder retryPolicy(RetryPolicy retryPolicy) {
* If a service version is not provided, {@link SearchServiceVersion#getLatest()} will be used as a default. When
* this default is used updating to a newer client library may result in a newer version of the service being used.
*
* @param searchServiceVersion The version of the service to be used when making requests.
* @param serviceVersion The version of the service to be used when making requests.
* @return The updated SearchServiceClientBuilder object.
*/
public SearchServiceClientBuilder searchServiceVersion(SearchServiceVersion searchServiceVersion) {
this.searchServiceVersion = searchServiceVersion;
public SearchServiceClientBuilder serviceVersion(SearchServiceVersion serviceVersion) {
this.serviceVersion = serviceVersion;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private static SearchIndexAsyncClient createAdvancedClient() {
.endpoint(ENDPOINT)
.credential(new SearchApiKeyCredential(API_KEY))
.indexName("hotels")
.searchServiceVersion(SearchServiceVersion.V2019_05_06)
.serviceVersion(SearchServiceVersion.V2019_05_06)
.addPolicy(new RetryPolicy())
.httpClient(
new NettyAsyncHttpClientBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void buildSyncClientTest() {
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.searchServiceVersion(apiVersion)
.serviceVersion(apiVersion)
.buildClient();

assertNotNull(client);
Expand All @@ -46,7 +46,7 @@ public void buildAsyncClientTest() {
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.searchServiceVersion(apiVersion)
.serviceVersion(apiVersion)
.buildAsyncClient();

assertNotNull(client);
Expand All @@ -73,7 +73,7 @@ public void whenApiVersionSpecifiedThenSpecifiedValueExists() {
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.searchServiceVersion(expectedVersion)
.serviceVersion(expectedVersion)
.buildClient();

assertEquals(expectedVersion, searchIndexClient.getServiceVersion());
Expand All @@ -82,7 +82,7 @@ public void whenApiVersionSpecifiedThenSpecifiedValueExists() {
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.searchServiceVersion(expectedVersion)
.serviceVersion(expectedVersion)
.buildAsyncClient();
assertEquals(expectedVersion, asyncClient.getServiceVersion());
}
Expand Down Expand Up @@ -161,7 +161,7 @@ public void nullApiVersionUsesLatest() {
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.searchServiceVersion(null);
.serviceVersion(null);

assertEquals(SearchServiceVersion.getLatest(), builder.buildAsyncClient().getServiceVersion());
assertEquals(SearchServiceVersion.getLatest(), builder.buildClient().getServiceVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void buildSyncClientTest() {
SearchServiceClient client = new SearchServiceClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.searchServiceVersion(apiVersion)
.serviceVersion(apiVersion)
.buildClient();

assertNotNull(client);
Expand All @@ -41,7 +41,7 @@ public void buildAsyncClientTest() {
SearchServiceAsyncClient client = new SearchServiceClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.searchServiceVersion(apiVersion)
.serviceVersion(apiVersion)
.buildAsyncClient();

assertNotNull(client);
Expand All @@ -66,15 +66,15 @@ public void whenApiVersionSpecifiedThenSpecifiedValueExists() {
SearchServiceClient client = new SearchServiceClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.searchServiceVersion(expectedApiVersion)
.serviceVersion(expectedApiVersion)
.buildClient();

assertEquals(expectedApiVersion.getVersion(), client.getServiceVersion().getVersion());

SearchServiceAsyncClient asyncClient = new SearchServiceClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.searchServiceVersion(expectedApiVersion)
.serviceVersion(expectedApiVersion)
.buildAsyncClient();
assertEquals(expectedApiVersion.getVersion(), asyncClient.getServiceVersion().getVersion());
}
Expand All @@ -92,7 +92,7 @@ public void whenBuildClientAndVerifyPropertiesThenSuccess() {
SearchServiceAsyncClient asyncClient = new SearchServiceClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.searchServiceVersion(apiVersion)
.serviceVersion(apiVersion)
.buildAsyncClient();

assertEquals(searchEndpoint, asyncClient.getEndpoint());
Expand Down Expand Up @@ -120,7 +120,7 @@ void nullApiVersionSetsLatest() {
SearchServiceClientBuilder builder = new SearchServiceClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.searchServiceVersion(null);
.serviceVersion(null);

assertEquals(SearchServiceVersion.getLatest(), builder.buildAsyncClient().getServiceVersion());
assertEquals(SearchServiceVersion.getLatest(), builder.buildClient().getServiceVersion());
Expand Down

0 comments on commit 9c376ec

Please sign in to comment.