diff --git a/search/data-plane/data/client.yml b/search/data-plane/data/azure-pipelines.yml
similarity index 85%
rename from search/data-plane/data/client.yml
rename to search/data-plane/data/azure-pipelines.yml
index 924c6bc9c854..10aa7a682122 100644
--- a/search/data-plane/data/client.yml
+++ b/search/data-plane/data/azure-pipelines.yml
@@ -1,11 +1,8 @@
-# External variables Settable at queue time:
-# "pomFile" : "pom.client.xml". This is the project object model file for Maven.
-
variables:
LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=warn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
jobs:
-- job: 'Compile'
+- job: 'Package'
pool:
vmImage: 'ubuntu-16.04'
@@ -31,7 +28,7 @@ jobs:
- task: Maven@3
displayName: 'Install Azure Core'
inputs:
- mavenPomFile: './sdk/core/azure-core/pom.xml'
+ mavenPomFile: './sdk/core/pom.xml'
goals: 'install'
options: '-Dmaven.test.skip=true -Dgpg.skip'
publishJUnitResults: false
@@ -41,7 +38,7 @@ jobs:
mavenVersionOption: 'Default'
- task: Maven@3
- displayName: 'Compile'
+ displayName: 'Package'
inputs:
mavenPomFile: ./search/data-plane/data/pom.xml
goals: 'package'
diff --git a/search/data-plane/data/pom.xml b/search/data-plane/data/pom.xml
index 72163ebb1688..d65d59a357aa 100644
--- a/search/data-plane/data/pom.xml
+++ b/search/data-plane/data/pom.xml
@@ -7,7 +7,7 @@
com.azure
azure-client-sdk-parent
- 1.0.0
+ 1.1.0
../../../pom.client.xml
@@ -16,6 +16,59 @@
1.0-SNAPSHOT
jar
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+ com.azure
+ sdk-build-tools
+ ${sdk-build-tools.version}
+
+
+ com.puppycrawl.tools
+ checkstyle
+ ${checkstyle.version}
+
+
+
+ checkstyle/checkstyle.xml
+ checkstyle/checkstyle-suppressions.xml
+ checkstyle/java.header
+ samedir=
+ UTF-8
+ true
+ true
+ true
+ true
+ true
+ **/generated/**/*
+
+
+
+ package
+
+ check
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+ true
+ true
+
+
+
+
+
com.microsoft.azure
diff --git a/search/data-plane/data/src/test/java/com/azure/search/data/env/AzureSearchResources.java b/search/data-plane/data/src/test/java/com/azure/search/data/env/AzureSearchResources.java
index 18e7555fff85..7dca6a81dcfa 100644
--- a/search/data-plane/data/src/test/java/com/azure/search/data/env/AzureSearchResources.java
+++ b/search/data-plane/data/src/test/java/com/azure/search/data/env/AzureSearchResources.java
@@ -1,3 +1,6 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
package com.azure.search.data.env;
import com.microsoft.azure.credentials.AzureTokenCredentials;
@@ -26,14 +29,26 @@ public class AzureSearchResources {
private ResourceGroup resourceGroup = null;
private SearchService searchService = null;
+ /**
+ *
+ * @return The created Resource Group name
+ */
public String getResourceGroupName() {
return resourceGroupName;
}
+ /**
+ *
+ * @return The created Search service name
+ */
public String getSearchServiceName() {
return searchServiceName;
}
+ /**
+ *
+ * @return The Search service admin key
+ */
public String getSearchAdminKey() {
return searchAdminKey;
}
@@ -41,9 +56,10 @@ public String getSearchAdminKey() {
/**
* Creates an instance of AzureTokenCredentials to be used in creating a Resource Group and Search service
* in Azure to be used for tests.
+ *
* @param azureTokenCredentials includes credentials to connect to Azure.
- * @param subscriptionId Azure subscription id.
- * @param location location of the resources to be created in.
+ * @param subscriptionId Azure subscription id.
+ * @param location location of the resources to be created in.
*/
public AzureSearchResources(
AzureTokenCredentials azureTokenCredentials, String subscriptionId,
@@ -91,7 +107,7 @@ public void initialize() {
private void validate() {
Objects.requireNonNull(this.azureTokenCredentials, "azureTokenCredentials cannot be null");
Objects.requireNonNull(this.location, "location cannot be null");
- if(StringUtils.isBlank(this.subscriptionId)){
+ if (StringUtils.isBlank(this.subscriptionId)) {
throw new IllegalArgumentException("subscriptionId cannot be blank");
}
}
diff --git a/search/data-plane/data/src/test/java/com/azure/search/data/env/SearchIndexDocs.java b/search/data-plane/data/src/test/java/com/azure/search/data/env/SearchIndexDocs.java
new file mode 100644
index 000000000000..ad5fe474517a
--- /dev/null
+++ b/search/data-plane/data/src/test/java/com/azure/search/data/env/SearchIndexDocs.java
@@ -0,0 +1,100 @@
+package com.azure.search.data.env;
+
+import com.azure.search.data.SearchIndexASyncClient;
+import com.azure.search.data.common.SearchPipelinePolicy;
+import com.azure.search.data.customization.SearchIndexClientBuilderImpl;
+import com.azure.search.data.generated.models.DocumentIndexResult;
+import com.azure.search.data.generated.models.IndexAction;
+import com.azure.search.data.generated.models.IndexActionType;
+import com.azure.search.data.generated.models.IndexBatch;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class SearchIndexDocs {
+
+ private static final String HOTELS_DATA_JSON = "HotelsDataArray.json";
+
+ private String searchServiceName;
+ private String apiAdminKey;
+ private String indexName;
+ private String dnsSuffix;
+ private String apiVersion;
+
+ private SearchIndexASyncClient searchIndexASyncClient;
+
+ /**
+ * Creates an instance of SearchIndexASyncClient to be used in uploading documents to a certain index,
+ * to be used in tests.
+ *
+ * @param searchServiceName The name of the Search service
+ * @param apiAdminKey The Admin key of the Search service
+ * @param indexName The name of the index
+ * @param dnsSuffix DNS suffix of the Search service
+ * @param apiVersion used API version
+ */
+ public SearchIndexDocs(
+ String searchServiceName, String apiAdminKey, String indexName,
+ String dnsSuffix, String apiVersion) {
+ this.searchServiceName = searchServiceName;
+ this.apiAdminKey = apiAdminKey;
+ this.indexName = indexName;
+ this.dnsSuffix = dnsSuffix;
+ this.apiVersion = apiVersion;
+ }
+
+ /**
+ * Created new documents in the index. The new documents are retrieved from HotelsDataArray.json
+ * @throws IOException If the file in HOTELS_DATA_JSON is not existing or invalid.
+ */
+ public void initialize() throws IOException {
+ if (searchIndexASyncClient == null) {
+ searchIndexASyncClient = new SearchIndexClientBuilderImpl()
+ .serviceName(searchServiceName)
+ .searchDnsSuffix(dnsSuffix)
+ .indexName(indexName)
+ .apiVersion(apiVersion)
+ .policy(new SearchPipelinePolicy(apiAdminKey))
+ .buildAsyncClient();
+ }
+ addDocsData();
+ }
+
+ private void addDocsData() throws IOException {
+ Reader docsData = new InputStreamReader(
+ getClass().getClassLoader().getResourceAsStream(HOTELS_DATA_JSON));
+ List